2023-08-22 19:08:45 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
2024-09-30 12:21:25 +08:00
|
|
|
|
using System.Linq;
|
2024-10-28 13:27:21 +08:00
|
|
|
|
using cfg.CharacterCfg;
|
2024-11-20 15:18:21 +08:00
|
|
|
|
using cfg.FightCfg;
|
|
|
|
|
|
using cfg.MonsterCfg;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
using cfg.VehicleCfg;
|
|
|
|
|
|
using Cysharp.Threading.Tasks;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using Framework;
|
|
|
|
|
|
using Gameplay;
|
2023-12-18 16:14:18 +08:00
|
|
|
|
using Gameplay.Area;
|
|
|
|
|
|
using Gameplay.Area.Ready;
|
2023-12-14 16:14:30 +08:00
|
|
|
|
using Gameplay.Character;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
using Gameplay.Level;
|
2024-11-20 15:18:21 +08:00
|
|
|
|
using Gameplay.Level.Data;
|
2023-12-13 16:20:41 +08:00
|
|
|
|
using Gameplay.Unit;
|
|
|
|
|
|
using Gameplay.Unit.Data;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
using PhxhSDK;
|
|
|
|
|
|
using Constants = Framework.Constants;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
using EventManager = Framework.EventManager;
|
|
|
|
|
|
|
|
|
|
|
|
//队伍管理器
|
2024-03-20 19:58:18 +08:00
|
|
|
|
public partial class TeamManager
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
private static TeamManager m_instance;
|
|
|
|
|
|
private TeamManager()
|
|
|
|
|
|
{
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-30 12:21:25 +08:00
|
|
|
|
public int TotalLimit
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return 7;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
private const int FIGHT_LIMIT = 5;
|
2024-09-30 12:21:25 +08:00
|
|
|
|
private const int VEHICLE_FIGHT_LIMIT = 3;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
private const int WAIT_LIMIT = 7;
|
2024-05-24 12:10:41 +08:00
|
|
|
|
public const int TOTAL_LIMIT = 6;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
2023-12-07 16:16:28 +08:00
|
|
|
|
//指挥官技能
|
|
|
|
|
|
private CommandSkillManager _commonSkillMgr;
|
|
|
|
|
|
public CommandSkillManager CommonSkillMgr => _commonSkillMgr;
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2024-11-20 15:18:21 +08:00
|
|
|
|
private bool _isFightStory = true;
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
//进入时初始队列,队伍信息池
|
2024-11-14 15:43:20 +08:00
|
|
|
|
private Dictionary<uint, TeamUnitInfo> m_allCharactersMap;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
private List<uint> m_allIDList;
|
|
|
|
|
|
//上阵角色ID队列
|
|
|
|
|
|
private List<uint> m_onFightIDList;
|
|
|
|
|
|
//下阵角色ID队列
|
|
|
|
|
|
private List<uint> m_waitFightIDList;
|
|
|
|
|
|
//死亡角色ID队列
|
|
|
|
|
|
private List<uint> m_deadIDList;
|
|
|
|
|
|
//敌方NPCID列表
|
|
|
|
|
|
private List<uint> m_enemyIDList;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
//载具上的成员
|
|
|
|
|
|
private List<uint> _inVehicleIDList;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2023-12-14 14:47:14 +08:00
|
|
|
|
private int _lastVehicleCellIdx = Constants.INVALID_ID;
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
//当前选择ID
|
2023-12-18 16:14:18 +08:00
|
|
|
|
private uint m_selectID = Constants.INVALID_UINT_ID;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
//战斗进行时间,战斗开始时开始计时
|
|
|
|
|
|
private float m_fightPastTimeCount = 0;
|
|
|
|
|
|
|
|
|
|
|
|
private bool _isChanging = false;
|
|
|
|
|
|
|
2024-01-10 15:21:05 +08:00
|
|
|
|
private static bool _isHideAllUI = false;
|
|
|
|
|
|
|
|
|
|
|
|
public static bool IsHideAllUI
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
return _isHideAllUI;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set
|
|
|
|
|
|
{
|
|
|
|
|
|
_isHideAllUI = value;
|
|
|
|
|
|
if (_isHideAllUI)
|
|
|
|
|
|
{
|
2024-11-26 19:28:33 +08:00
|
|
|
|
UIManager.Instance.HideAllUI(UINameConst.UIFightScene, UINameConst.UI_Guide, UINameConst.UI_GuideTip, UINameConst.UISkillPut);
|
2024-01-10 15:21:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
UIManager.Instance.ShowAllUI();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public uint SelectID
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return m_selectID; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static TeamManager Instance
|
|
|
|
|
|
{
|
2023-12-18 16:14:18 +08:00
|
|
|
|
get
|
|
|
|
|
|
{
|
2023-08-22 19:08:45 +08:00
|
|
|
|
if (m_instance == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_instance = new TeamManager();
|
|
|
|
|
|
}
|
|
|
|
|
|
return m_instance;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-14 15:43:20 +08:00
|
|
|
|
#region Init
|
|
|
|
|
|
|
2023-12-14 16:10:28 +08:00
|
|
|
|
public async void Init()
|
|
|
|
|
|
{
|
|
|
|
|
|
await _Init();
|
|
|
|
|
|
}
|
|
|
|
|
|
private async UniTask _Init()
|
|
|
|
|
|
{
|
2024-11-20 15:18:21 +08:00
|
|
|
|
_isFightStory = false;
|
2024-10-15 16:30:20 +08:00
|
|
|
|
Team team = TeamEditManager.Instance.GetSelectTeam();
|
2024-09-30 12:21:25 +08:00
|
|
|
|
if (SROptions.Current.UseTestTeam)
|
|
|
|
|
|
{
|
2024-10-15 16:30:20 +08:00
|
|
|
|
team = TeamEditManager.Instance.GetTestTeam();
|
2024-09-30 12:21:25 +08:00
|
|
|
|
}
|
2024-07-04 18:41:23 +08:00
|
|
|
|
if (null == team)
|
|
|
|
|
|
_commonSkillMgr = new CommandSkillManager();
|
|
|
|
|
|
else
|
|
|
|
|
|
_commonSkillMgr = new CommandSkillManager(team.GetPlayerSkillIDs());
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2024-11-20 15:18:21 +08:00
|
|
|
|
var curLevel = LevelManager.Instance.CurrentLevel;
|
|
|
|
|
|
if (curLevel != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (curLevel.GetLevelInfo().fightStoryData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_isFightStory = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
var selectList = await GetSelectList(_isFightStory);
|
|
|
|
|
|
|
2023-12-14 16:10:28 +08:00
|
|
|
|
m_allIDList = new List<uint>();
|
|
|
|
|
|
m_waitFightIDList = new List<uint>();
|
2024-11-14 15:43:20 +08:00
|
|
|
|
m_allCharactersMap = new Dictionary<uint, TeamUnitInfo>();
|
2023-12-14 16:10:28 +08:00
|
|
|
|
m_onFightIDList = new List<uint>();
|
|
|
|
|
|
m_deadIDList = new List<uint>();
|
|
|
|
|
|
m_enemyIDList = new List<uint>();
|
|
|
|
|
|
_inVehicleIDList = new List<uint>();
|
2024-11-20 15:18:21 +08:00
|
|
|
|
|
|
|
|
|
|
if (_isFightStory)
|
2023-12-14 16:10:28 +08:00
|
|
|
|
{
|
2024-11-20 15:18:21 +08:00
|
|
|
|
for (int i = 0; i < selectList.Count; i++)
|
2023-12-14 16:10:28 +08:00
|
|
|
|
{
|
2024-11-20 15:18:21 +08:00
|
|
|
|
uint uid = selectList[i].Uid;
|
|
|
|
|
|
m_allIDList.Add(uid);
|
|
|
|
|
|
m_allCharactersMap.Add(uid, selectList[i]);
|
|
|
|
|
|
if (selectList[i].IsVehicle())
|
|
|
|
|
|
{
|
|
|
|
|
|
m_onFightIDList.Insert(0, uid);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
m_onFightIDList.Add(uid);
|
|
|
|
|
|
}
|
2023-12-14 16:10:28 +08:00
|
|
|
|
}
|
2024-11-20 15:18:21 +08:00
|
|
|
|
|
|
|
|
|
|
m_onFightIDList.Reverse();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
for (int i = 0; i < selectList.Count; i++)
|
2023-12-14 16:10:28 +08:00
|
|
|
|
{
|
2024-11-20 15:18:21 +08:00
|
|
|
|
uint uid = selectList[i].Uid;
|
|
|
|
|
|
m_allIDList.Add(uid);
|
|
|
|
|
|
m_allCharactersMap.Add(uid, selectList[i]);
|
|
|
|
|
|
if (selectList[i].IsVehicle())
|
|
|
|
|
|
{
|
|
|
|
|
|
m_waitFightIDList.Insert(0, uid);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
m_waitFightIDList.Add(uid);
|
|
|
|
|
|
}
|
2023-12-14 16:10:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-11-20 15:18:21 +08:00
|
|
|
|
|
2023-12-14 16:10:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-20 15:18:21 +08:00
|
|
|
|
private async UniTask<List<TeamUnitInfo>> GetSelectList(bool isFightStory = false)
|
2023-12-14 16:10:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
//测试数据
|
|
|
|
|
|
//AllCharacterInfo allChaInfo = AllCharacterInfo.Instance;
|
|
|
|
|
|
|
|
|
|
|
|
var useFullCharacters = SROptions.Current.UseFullCharacters;
|
2024-09-30 12:21:25 +08:00
|
|
|
|
var useTestTeam = SROptions.Current.UseTestTeam;
|
2023-12-14 16:10:28 +08:00
|
|
|
|
|
|
|
|
|
|
if (useFullCharacters)
|
|
|
|
|
|
{
|
|
|
|
|
|
CharacterDataInfoManager.Instance.AddAllCfgCharacter();
|
2024-01-11 14:12:39 +08:00
|
|
|
|
VehicleCultivateDataManager.Instance.AddAllCfgVehicles();
|
2023-12-14 16:10:28 +08:00
|
|
|
|
}
|
2024-10-15 16:30:20 +08:00
|
|
|
|
Team defaultTeam = TeamEditManager.Instance.GetSelectTeam();
|
2024-09-30 12:21:25 +08:00
|
|
|
|
|
2024-10-11 15:22:03 +08:00
|
|
|
|
var cIDs = defaultTeam.GetAllCharacters();
|
2023-12-14 16:10:28 +08:00
|
|
|
|
if (useFullCharacters)
|
|
|
|
|
|
{
|
2024-10-11 15:22:03 +08:00
|
|
|
|
cIDs = CharacterDataInfoManager.Instance.DataList.ConvertAll((info) => info.ID);
|
2023-12-14 16:10:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var vInfos = new List<VehicleCultivateData>();
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2024-01-11 14:12:39 +08:00
|
|
|
|
if (useFullCharacters)
|
|
|
|
|
|
{
|
|
|
|
|
|
var dataList = VehicleCultivateDataManager.Instance.DataList;
|
|
|
|
|
|
vInfos.AddRange(dataList);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
2023-12-14 16:16:39 +08:00
|
|
|
|
{
|
2024-10-11 15:22:03 +08:00
|
|
|
|
foreach (var vehicleID in defaultTeam.GetVehicleIDs())
|
2024-01-11 14:12:39 +08:00
|
|
|
|
{
|
2024-11-14 19:58:45 +08:00
|
|
|
|
if (ValueValidator.IsIdValid(vehicleID))
|
2024-10-11 15:22:03 +08:00
|
|
|
|
{
|
2024-11-14 19:58:45 +08:00
|
|
|
|
var vInfo = VehicleCultivateDataManager.Instance.DataDic[vehicleID];
|
2024-10-11 15:22:03 +08:00
|
|
|
|
vInfos.Add(vInfo);
|
|
|
|
|
|
}
|
2024-01-11 14:12:39 +08:00
|
|
|
|
}
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
2023-12-14 16:16:39 +08:00
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2024-09-30 12:21:25 +08:00
|
|
|
|
if (useTestTeam)
|
|
|
|
|
|
{
|
2024-10-15 16:30:20 +08:00
|
|
|
|
var team = TeamEditManager.Instance.GetTestTeam();
|
2024-10-11 15:22:03 +08:00
|
|
|
|
cIDs = team.GetAllCharacters();
|
2024-09-30 12:21:25 +08:00
|
|
|
|
var vIDs = team.GetVehicleIDs();
|
|
|
|
|
|
vInfos = new List<VehicleCultivateData>(VehicleCultivateDataManager.Instance.DataList.Where(
|
|
|
|
|
|
data => vIDs.Contains(data.nID)));
|
|
|
|
|
|
}
|
2024-01-11 14:12:39 +08:00
|
|
|
|
|
2024-11-14 15:43:20 +08:00
|
|
|
|
List<TeamUnitInfo> selectList = new List<TeamUnitInfo>();
|
2024-11-20 15:18:21 +08:00
|
|
|
|
if (isFightStory)
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
|
|
_SetTeamUnitListFightStory(selectList);
|
|
|
|
|
|
return selectList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-11 15:22:03 +08:00
|
|
|
|
int allCount = cIDs.Count + vInfos.Count;
|
2023-12-14 16:10:28 +08:00
|
|
|
|
var count = allCount > WAIT_LIMIT ? WAIT_LIMIT : allCount;
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2024-10-09 13:23:07 +08:00
|
|
|
|
var workUIIndex = 1;
|
2023-12-14 16:10:28 +08:00
|
|
|
|
//Test
|
2024-10-11 15:22:03 +08:00
|
|
|
|
for (int i = 0; i < cIDs.Count; i++)
|
2023-12-14 16:10:28 +08:00
|
|
|
|
{
|
2024-10-11 15:22:03 +08:00
|
|
|
|
if (i < cIDs.Count)
|
2023-12-14 16:10:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
var id = cIDs[i];
|
|
|
|
|
|
if (id > 0)
|
|
|
|
|
|
{
|
2024-11-14 15:43:20 +08:00
|
|
|
|
TeamUnitInfo info;
|
2023-12-14 16:10:28 +08:00
|
|
|
|
var charInfo = CharacterDataInfoManager.Instance.DataDic[id];
|
|
|
|
|
|
var unit = await GameUnitManager.instance.PrepareCharacter(charInfo, ETroopsId.Self);
|
2024-01-03 13:04:36 +08:00
|
|
|
|
if (unit == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("创建角色失败!!!");
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2024-11-14 15:43:20 +08:00
|
|
|
|
info = new TeamUnitInfo(CharacterDataInfoManager.Instance.DataDic[id], unit.GetID());
|
2024-10-16 19:08:00 +08:00
|
|
|
|
unit.unitUIData.uiIndex = defaultTeam.GetCharacterIdxInAllUnits(id);
|
2024-11-20 15:18:21 +08:00
|
|
|
|
unit.unitUIData.isNPC = false;
|
2024-10-09 13:19:06 +08:00
|
|
|
|
workUIIndex++;
|
2024-11-14 15:43:20 +08:00
|
|
|
|
selectList.Add(info);
|
2023-12-14 16:10:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2024-01-11 14:12:39 +08:00
|
|
|
|
for (int i = 0; i < vInfos.Count; i++)
|
2023-12-14 16:10:28 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (i < vInfos.Count)
|
|
|
|
|
|
{
|
2024-11-14 15:43:20 +08:00
|
|
|
|
TeamUnitInfo info;
|
2023-12-14 16:10:28 +08:00
|
|
|
|
var unit = await GameUnitManager.instance.PrepareVehicle(vInfos[i], ETroopsId.Self);
|
2024-11-14 15:43:20 +08:00
|
|
|
|
info = new TeamUnitInfo(unit.GetID(), vInfos[i]);
|
2024-10-16 19:08:00 +08:00
|
|
|
|
unit.unitUIData.uiIndex = defaultTeam.GetVehicleIdxInAllUnits(vInfos[i].nID);
|
2024-11-20 15:18:21 +08:00
|
|
|
|
unit.unitUIData.isNPC = false;
|
2024-10-09 13:19:06 +08:00
|
|
|
|
workUIIndex++;
|
2024-11-14 15:43:20 +08:00
|
|
|
|
selectList.Add(info);
|
2023-12-14 16:10:28 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return selectList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
private void InitData()
|
|
|
|
|
|
{
|
|
|
|
|
|
Release();
|
|
|
|
|
|
}
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
2024-11-20 15:18:21 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 剧情战斗关卡设置队伍
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="selectList"></param>
|
|
|
|
|
|
private void _SetTeamUnitListFightStory(List<TeamUnitInfo> selectList)
|
|
|
|
|
|
{
|
|
|
|
|
|
selectList.Clear();
|
|
|
|
|
|
var level = LevelManager.Instance.CurrentLevel;
|
|
|
|
|
|
if (level == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("当前剧情战斗关卡为空!!!无法获取上阵NPC列表");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var levelInfo = level.GetLevelInfo();
|
|
|
|
|
|
if (levelInfo == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("当前剧情战斗关卡的关卡信息为空!!!无法获取上阵NPC列表");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var fightStoryData = levelInfo.fightStoryData;
|
|
|
|
|
|
if (fightStoryData == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("当前剧情战斗关卡的剧情战斗相关数据为空!!!无法获取上阵NPC列表");
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var playerTeamData = fightStoryData.playerTeamData;
|
|
|
|
|
|
var memberList = playerTeamData.memberList;
|
|
|
|
|
|
var infightUnits = GameUnitManager.instance.infightUnits;
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < memberList.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var memberData = memberList[i];
|
|
|
|
|
|
var monsterID = memberData.monsterId;
|
|
|
|
|
|
if (monsterID == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
var npcMonsterData = TableManager.Instance.Tables.Monster.Get(monsterID);
|
|
|
|
|
|
if (npcMonsterData == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError($"Monster表无法获取,monsterID:{monsterID}");
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
var unit = infightUnits.SearchByLocalId(memberData.unitLocalId);
|
|
|
|
|
|
if (unit != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var teamUnitInfo = new TeamUnitInfo(npcMonsterData, unit.GetID());
|
|
|
|
|
|
teamUnitInfo.SetVehicleNID((uint)npcMonsterData.MonsterClassID);
|
|
|
|
|
|
unit.unitUIData.isNPC = true;
|
|
|
|
|
|
selectList.Add(teamUnitInfo);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//var teamUnitInfo = new TeamUnitInfo()
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-11-14 15:43:20 +08:00
|
|
|
|
#endregion
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
|
|
|
|
|
bool IsDead(uint uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!m_allCharactersMap.ContainsKey(uid))
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("传入ID有误!!!");
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
return m_allCharactersMap[uid].GetIsDead();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-03 16:09:24 +08:00
|
|
|
|
private List<uint> GetCharacterIDs()
|
|
|
|
|
|
{
|
|
|
|
|
|
List<uint> retList = new List<uint>();
|
|
|
|
|
|
for (int i = 0; i < m_allIDList.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var id = m_allIDList[i];
|
2024-11-14 15:43:20 +08:00
|
|
|
|
if (GetUnitType(id) == TeamUnitInfo.CharacType.Hero)
|
2024-01-03 16:09:24 +08:00
|
|
|
|
{
|
|
|
|
|
|
retList.Add(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return retList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<uint> GetVehicleIDs()
|
|
|
|
|
|
{
|
|
|
|
|
|
List<uint> retList = new List<uint>();
|
|
|
|
|
|
for (int i = 0; i < m_allIDList.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var id = m_allIDList[i];
|
2024-11-14 15:43:20 +08:00
|
|
|
|
if (GetUnitType(id) == TeamUnitInfo.CharacType.Vehicle)
|
2024-01-03 16:09:24 +08:00
|
|
|
|
{
|
|
|
|
|
|
retList.Add(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return retList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
//战前上阵队列变化
|
|
|
|
|
|
void SendWaitToFightBefore(uint toFightUId)
|
|
|
|
|
|
{
|
|
|
|
|
|
foreach (var uid in m_waitFightIDList)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (toFightUId == uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (GetCharacterDataInfo(uid).IsVehicle())
|
|
|
|
|
|
{
|
|
|
|
|
|
m_onFightIDList.Insert(0, uid);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
m_onFightIDList.Add(toFightUId);
|
|
|
|
|
|
}
|
|
|
|
|
|
m_waitFightIDList.Remove(toFightUId);
|
|
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.LevelFightStartChange);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
//战斗中上阵
|
|
|
|
|
|
void SendWaitToFightFighting(uint toFightUId)
|
|
|
|
|
|
{
|
2023-12-26 12:44:45 +08:00
|
|
|
|
if (!m_allCharactersMap.ContainsKey(toFightUId))
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
if (IsDead(toFightUId))
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
foreach (var uid in m_waitFightIDList)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (toFightUId == uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (GetCharacterDataInfo(uid).IsVehicle())
|
|
|
|
|
|
{
|
|
|
|
|
|
m_onFightIDList.Insert(0, uid);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
m_onFightIDList.Add(toFightUId);
|
|
|
|
|
|
}
|
|
|
|
|
|
m_waitFightIDList.Remove(toFightUId);
|
|
|
|
|
|
//EventSystem.Instance.Send(EventSystem.EventName.LevelFightStartChange);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//战前下阵队列变化
|
2024-11-14 19:58:45 +08:00
|
|
|
|
void SendFightToWaitBefore(uint toWaitUid,
|
|
|
|
|
|
bool fightDontMove = true)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
foreach (var uid in m_onFightIDList)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (toWaitUid == uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (GetCharacterDataInfo(uid).IsVehicle())
|
|
|
|
|
|
{
|
|
|
|
|
|
m_waitFightIDList.Insert(0, uid);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
m_waitFightIDList.Add(toWaitUid);
|
|
|
|
|
|
}
|
|
|
|
|
|
m_onFightIDList.Remove(toWaitUid);
|
|
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.LevelFightStartChange);
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-12-19 16:17:55 +08:00
|
|
|
|
if (fightDontMove)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameUnitManager.instance.MoveUnitToPrepare(toWaitUid);
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
//战斗中下阵
|
|
|
|
|
|
void SendFightToWaitFighting(uint toWaitUid)
|
|
|
|
|
|
{
|
|
|
|
|
|
//LevelManager.Instance.CurrentLevel.CharacterManager.Remove(toWaitUid);
|
2023-12-26 12:44:45 +08:00
|
|
|
|
if (!m_allCharactersMap.ContainsKey(toWaitUid))
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
bool isDead = false;
|
|
|
|
|
|
if (IsDead(toWaitUid) && !m_deadIDList.Contains(toWaitUid))
|
|
|
|
|
|
{
|
|
|
|
|
|
if (GetCharacterDataInfo(toWaitUid).IsVehicle())
|
|
|
|
|
|
{
|
|
|
|
|
|
m_deadIDList.Insert(0, toWaitUid);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
m_deadIDList.Add(toWaitUid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
isDead = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int idx = m_onFightIDList.FindIndex((id) =>
|
|
|
|
|
|
{
|
2023-10-19 15:00:19 +08:00
|
|
|
|
if (m_deadIDList.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_deadIDList[0] == id;
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
});
|
2023-10-19 15:00:19 +08:00
|
|
|
|
idx = idx < 0 ? m_waitFightIDList.Count - m_deadIDList.Count : idx;
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
if (isDead)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_deadIDList.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_allCharactersMap[toWaitUid].IsVehicle())
|
|
|
|
|
|
{
|
|
|
|
|
|
m_waitFightIDList.Insert(idx, toWaitUid);
|
|
|
|
|
|
m_onFightIDList.Remove(toWaitUid);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
m_waitFightIDList.Add(toWaitUid);
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
m_waitFightIDList.Insert(idx, toWaitUid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_onFightIDList.Remove(toWaitUid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void Release()
|
|
|
|
|
|
{
|
2024-02-22 12:48:35 +08:00
|
|
|
|
UnLoadAllPost();
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
m_allIDList.Clear();
|
2023-08-22 19:08:45 +08:00
|
|
|
|
m_onFightIDList.Clear();
|
|
|
|
|
|
m_waitFightIDList.Clear();
|
|
|
|
|
|
m_allCharactersMap.Clear();
|
2023-10-19 15:00:19 +08:00
|
|
|
|
_inVehicleIDList.Clear();
|
2023-08-22 19:08:45 +08:00
|
|
|
|
if (m_deadIDList != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_deadIDList.Clear();
|
|
|
|
|
|
}
|
|
|
|
|
|
m_instance = null;
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
2024-11-20 15:18:21 +08:00
|
|
|
|
_isFightStory = false;
|
2024-02-22 12:48:35 +08:00
|
|
|
|
//InputManager.Instance.OnFingerUp -= _OnFingerUp;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-14 15:43:20 +08:00
|
|
|
|
#region Load
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
2024-11-14 15:43:20 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 初始化战斗内UI
|
|
|
|
|
|
/// </summary>
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public async UniTask TeamUIInit()
|
|
|
|
|
|
{
|
2023-12-14 16:10:28 +08:00
|
|
|
|
await _Init();
|
2024-02-22 12:48:35 +08:00
|
|
|
|
//InputManager.Instance.OnFingerUp += _OnFingerUp;
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
|
|
|
|
|
var window = await UIManager.Instance.LoadWindow(UINameConst.UIFightScene);
|
|
|
|
|
|
UIManager.Instance.PushWindow(window);
|
2024-11-26 17:29:26 +08:00
|
|
|
|
window = await UIManager.Instance.LoadWindow(UINameConst.UIFightTarget);
|
|
|
|
|
|
UIManager.Instance.PushWindow(window);
|
2024-11-14 19:58:45 +08:00
|
|
|
|
window = await UIManager.Instance.LoadWindow(UINameConst.UI_StartBtn_CMSBtn);
|
|
|
|
|
|
UIManager.Instance.PushWindow(window);
|
|
|
|
|
|
window = await UIManager.Instance.LoadWindow(UINameConst.UITeamFight);
|
|
|
|
|
|
UIManager.Instance.PushWindow(window);
|
|
|
|
|
|
window = await UIManager.Instance.LoadWindow(UINameConst.UIFightClock);
|
|
|
|
|
|
UIManager.Instance.PushWindow(window);
|
2024-11-26 19:28:33 +08:00
|
|
|
|
// window = await UIManager.Instance.LoadWindow(UINameConst.UISKillPut);
|
|
|
|
|
|
// UIManager.Instance.PushWindow(window);
|
|
|
|
|
|
var skillWindow = await UISkillPutController.Open();
|
|
|
|
|
|
skillWindow.HideWindow();
|
|
|
|
|
|
FightSkillPutManager.Instance.SetSKillPutWindow(skillWindow);
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
2024-11-21 17:39:33 +08:00
|
|
|
|
var storyWindow = await UIStoryFightMainController.Open();
|
|
|
|
|
|
if (storyWindow != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
storyWindow.HideWindow();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-14 19:58:45 +08:00
|
|
|
|
AssetManager.Instance.PostPreload(string.Format(UIManager.UI_PREFAB_PATH, UINameConst.UICharacterStateBar));
|
|
|
|
|
|
AssetManager.Instance.PostPreload(string.Format(UIManager.UI_PREFAB_PATH, UINameConst.UIVehicleStateBar));
|
|
|
|
|
|
AssetManager.Instance.PostPreload(string.Format(UIManager.UI_PREFAB_PATH, UINameConst.UIEnemyStateBar));
|
|
|
|
|
|
AssetManager.Instance.PostPreload(string.Format(UIManager.UI_PREFAB_PATH, UINameConst.UICharacterDamage));
|
|
|
|
|
|
|
|
|
|
|
|
//预加载士气值图片
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(LevelUIManager.GetMoralePic(true));
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(LevelUIManager.GetMoralePic(false));
|
|
|
|
|
|
//预加载数字图片
|
|
|
|
|
|
for (int i = 0; i < 10; i++)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2024-11-14 19:58:45 +08:00
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(LevelUIManager.GetNumberImage(i));
|
|
|
|
|
|
}
|
|
|
|
|
|
for (int i = 0; i < 7; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(LevelUIManager.GetNumberImgPath(i));
|
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
2024-11-14 19:58:45 +08:00
|
|
|
|
var teamCharacterIDs = GetCharacterIDs();
|
|
|
|
|
|
var vehicleIDs = GetVehicleIDs();
|
|
|
|
|
|
for (int i = 0; i < teamCharacterIDs.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var uid = teamCharacterIDs[i];
|
|
|
|
|
|
var singleData = m_allCharactersMap[uid];
|
|
|
|
|
|
var cfg = singleData.GetConfigInfo();
|
|
|
|
|
|
var str = CommonUtils.GetCharacterPicPath(cfg.Cfg.RoleID, CommonUtils.ECharacterPicPathType.HeadPic, (int)cfg.SkinID); //CommonUtils.GetDefaultHeadPathByUid((uint)cfg.Cfg.RoleID);
|
|
|
|
|
|
var posterStr = CommonUtils.GetCharacterPicPath(cfg.Cfg.RoleID, CommonUtils.ECharacterPicPathType.Poster);
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(str);
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(posterStr);
|
|
|
|
|
|
}
|
2024-01-03 16:09:24 +08:00
|
|
|
|
|
2024-11-14 19:58:45 +08:00
|
|
|
|
for (int i = 0; i < vehicleIDs.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var uid = vehicleIDs[i];
|
|
|
|
|
|
var singleData = m_allCharactersMap[uid];
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(CommonUtils.GetDefaultVehicleHeadPath((uint)singleData.GetVehicleInfo().Cfg.ID)); //singleData.GetVehicleInfo().Cfg.UIHeadPath
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
|
|
|
|
|
//预加载职业图标
|
|
|
|
|
|
for (var i = Ejob.Job_Commander; i < Ejob.Job_Other; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var path = JobHelper.GetJobSpritePathFight(i);
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(path);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//预加载状态图片
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(Constants.UI_RETREATE_STATE);
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(Constants.UI_SUPPRESS_STATE);
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(Constants.UI_RETREATE_STATE_MAP);
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(Constants.UI_SUPPRESS_STATE_MAP);
|
|
|
|
|
|
AssetManager.Instance.PostPreload<Sprite>(Constants.UI_INVEHICLE_STATE);
|
|
|
|
|
|
|
|
|
|
|
|
//预加载血条Prefab
|
|
|
|
|
|
AssetManager.Instance.PostPreload<GameObject>(Constants.UI_STATE_BAR_SELF_CHARACTER);
|
|
|
|
|
|
AssetManager.Instance.PostPreload<GameObject>(Constants.UI_STATE_BAR_SELF_VEHICLE);
|
|
|
|
|
|
AssetManager.Instance.PostPreload<GameObject>(Constants.UI_STATE_BAR_ENEMY_VEHICLE);
|
|
|
|
|
|
AssetManager.Instance.PostPreload<GameObject>(Constants.UI_STATE_BAR_SELF_SUMMON);
|
|
|
|
|
|
AssetManager.Instance.PostPreload<GameObject>(Constants.UI_STATE_BAR_SELF_PROTECTED);
|
|
|
|
|
|
AssetManager.Instance.PostPreload<GameObject>(Constants.UI_STATE_BAR_ENEMY_CHARACTER);
|
|
|
|
|
|
AssetManager.Instance.PostPreload<GameObject>(Constants.UI_STATE_BAR_ENEMY_BUILDING);
|
2024-11-20 15:18:21 +08:00
|
|
|
|
AssetManager.Instance.PostPreload<GameObject>(Constants.UI_STATE_BAR_NPC_CHARACTER);
|
|
|
|
|
|
AssetManager.Instance.PostPreload<GameObject>(Constants.UI_STATE_BAR_NPC_VEHICLE);
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
|
|
|
|
|
await AssetManager.Instance.WaitAllPreloads();
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-14 15:43:20 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 释放加载的UI相关资源
|
|
|
|
|
|
/// </summary>
|
2024-02-22 12:48:35 +08:00
|
|
|
|
public void UnLoadAllPost()
|
|
|
|
|
|
{
|
2024-05-08 12:44:22 +08:00
|
|
|
|
AssetManager.Instance.Unload(string.Format(UIManager.UI_PREFAB_PATH, UINameConst.UICharacterStateBar), true);
|
|
|
|
|
|
AssetManager.Instance.Unload(string.Format(UIManager.UI_PREFAB_PATH, UINameConst.UIVehicleStateBar), true);
|
|
|
|
|
|
AssetManager.Instance.Unload(string.Format(UIManager.UI_PREFAB_PATH, UINameConst.UIEnemyStateBar), true);
|
|
|
|
|
|
AssetManager.Instance.Unload(string.Format(UIManager.UI_PREFAB_PATH, UINameConst.UICharacterDamage), true);
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
2024-05-08 12:44:22 +08:00
|
|
|
|
AssetManager.Instance.Unload(LevelUIManager.GetMoralePic(true), true);
|
|
|
|
|
|
AssetManager.Instance.Unload(LevelUIManager.GetMoralePic(false), true);
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
2024-02-22 12:48:35 +08:00
|
|
|
|
for (int i = 0; i < 10; i++)
|
|
|
|
|
|
{
|
2024-05-08 12:44:22 +08:00
|
|
|
|
AssetManager.Instance.Unload(LevelUIManager.GetNumberImage(i), true);
|
2024-02-22 12:48:35 +08:00
|
|
|
|
}
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
2024-05-08 12:44:22 +08:00
|
|
|
|
var teamCharacterIDs = GetCharacterIDs();
|
|
|
|
|
|
var vehicleIDs = GetVehicleIDs();
|
|
|
|
|
|
for (int i = 0; i < teamCharacterIDs.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
var uid = teamCharacterIDs[i];
|
|
|
|
|
|
var singleData = m_allCharactersMap[uid];
|
|
|
|
|
|
var cfg = singleData.GetConfigInfo();
|
2024-11-14 19:58:45 +08:00
|
|
|
|
var str = CommonUtils.GetCharacterPicPath(cfg.Cfg.RoleID, CommonUtils.ECharacterPicPathType.HeadPic, (int)cfg.SkinID); //CommonUtils.GetDefaultHeadPathByUid((uint)cfg.Cfg.RoleID);
|
|
|
|
|
|
var posterStr = CommonUtils.GetCharacterPicPath(cfg.Cfg.RoleID, CommonUtils.ECharacterPicPathType.Poster);
|
2024-05-08 12:44:22 +08:00
|
|
|
|
AssetManager.Instance.Unload(str);
|
|
|
|
|
|
AssetManager.Instance.Unload(posterStr);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (vehicleIDs.Count > 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
var uid = vehicleIDs[0];
|
|
|
|
|
|
var singleData = m_allCharactersMap[uid];
|
2024-11-14 19:58:45 +08:00
|
|
|
|
AssetManager.Instance.Unload(CommonUtils.GetDefaultVehicleHeadPath((uint)singleData.GetVehicleInfo().Cfg.ID)); //singleData.GetVehicleInfo().Cfg.UIHeadPath
|
2024-05-08 12:44:22 +08:00
|
|
|
|
}
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
2024-05-08 12:44:22 +08:00
|
|
|
|
AssetManager.Instance.Unload(Constants.UI_RETREATE_STATE, true);
|
|
|
|
|
|
AssetManager.Instance.Unload(Constants.UI_SUPPRESS_STATE, true);
|
|
|
|
|
|
AssetManager.Instance.Unload(Constants.UI_RETREATE_STATE_MAP, true);
|
|
|
|
|
|
AssetManager.Instance.Unload(Constants.UI_SUPPRESS_STATE_MAP, true);
|
|
|
|
|
|
AssetManager.Instance.Unload(Constants.UI_INVEHICLE_STATE, true);
|
2024-02-22 12:48:35 +08:00
|
|
|
|
}
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
2024-01-10 15:21:05 +08:00
|
|
|
|
private void _OnFingerUp(Vector2 pos)
|
|
|
|
|
|
{
|
|
|
|
|
|
// if (IsHideAllUI)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// IsHideAllUI = false;
|
|
|
|
|
|
// }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-14 15:43:20 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 打开加载好的战斗内UI
|
|
|
|
|
|
/// </summary>
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public void TeamUIOpen()
|
|
|
|
|
|
{
|
2024-11-26 19:28:33 +08:00
|
|
|
|
//UIManager.Instance.OpenLoadedNormalUI(UINameConst.UISkillPut);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
UIManager.Instance.OpenLoadedNormalUI(UINameConst.UI_StartBtn_CMSBtn);
|
2024-11-26 17:29:26 +08:00
|
|
|
|
UIManager.Instance.OpenLoadedNormalUI(UINameConst.UIFightTarget);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
UIManager.Instance.OpenLoadedNormalUI(UINameConst.UITeamFight);
|
|
|
|
|
|
UIManager.Instance.OpenLoadedNormalUI(UINameConst.UIFightClock);
|
|
|
|
|
|
UIManager.Instance.OpenLoadedNormalUI(UINameConst.UIFightScene);
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
2024-11-20 15:18:21 +08:00
|
|
|
|
var level = LevelManager.Instance.CurrentLevel;
|
|
|
|
|
|
if (level != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var levelInfo = level.GetLevelInfo();
|
|
|
|
|
|
if (levelInfo.fightStoryData != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
EventManager.Instance.Send(EventManager.EventName.UI_FIGHT_STORY_PREPARE);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-21 16:08:31 +08:00
|
|
|
|
LevelManager.Instance.CurrentLevel.Map.ShowInfo(Map.InfoMask.ShowCells, true);
|
|
|
|
|
|
AreaManager.instance.readyAreaManager.ShowReadyArea();
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-28 16:13:10 +08:00
|
|
|
|
public void TeamUIClose()
|
|
|
|
|
|
{
|
|
|
|
|
|
UIManager.Instance.CloseWindow(UINameConst.UI_StartBtn_CMSBtn);
|
2024-11-26 19:28:33 +08:00
|
|
|
|
UIManager.Instance.CloseWindow(UINameConst.UISkillPut);
|
2024-03-28 16:13:10 +08:00
|
|
|
|
UIManager.Instance.CloseWindow(UINameConst.UITeamFight);
|
|
|
|
|
|
UIManager.Instance.CloseWindow(UINameConst.UIFightClock);
|
2024-11-26 17:29:26 +08:00
|
|
|
|
UIManager.Instance.CloseWindow(UINameConst.UIFightTarget);
|
2024-03-28 16:13:10 +08:00
|
|
|
|
UIManager.Instance.CloseWindow(UINameConst.UIFightScene);
|
2024-10-30 18:52:22 +08:00
|
|
|
|
LevelManager.Instance.SkillInfoClose(true);
|
2024-03-28 16:13:10 +08:00
|
|
|
|
}
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
2024-11-14 15:43:20 +08:00
|
|
|
|
#endregion
|
2024-03-28 16:13:10 +08:00
|
|
|
|
|
2023-12-18 16:14:18 +08:00
|
|
|
|
public void SetSelectID(uint uid = Constants.INVALID_UINT_ID)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
m_selectID = uid;
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
bool isNeedShow = ValueValidator.IsIdValid(m_selectID);
|
|
|
|
|
|
if (LevelManager.Instance.CurrentLevel.IsPreparing())
|
|
|
|
|
|
{
|
2024-03-21 16:08:31 +08:00
|
|
|
|
//AreaManager.instance.readyAreaManager.ShowReadyArea();
|
|
|
|
|
|
// if (!isNeedShow)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// AreaManager.instance.readyAreaManager.HideReadyArea();
|
|
|
|
|
|
// }
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
else if (LevelManager.Instance.CurrentLevel.IsInBattle())
|
2023-10-19 15:00:19 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (m_waitFightIDList.Contains(uid))
|
|
|
|
|
|
{
|
2023-12-18 16:14:18 +08:00
|
|
|
|
if (GameUnitManager.instance.infightUnits.Contains(uid))
|
|
|
|
|
|
{
|
2024-03-28 16:13:10 +08:00
|
|
|
|
var unit = GameUnitManager.instance.infightUnits.Search(uid);
|
|
|
|
|
|
if (unit.statusData.isOnVehicle)
|
|
|
|
|
|
{
|
|
|
|
|
|
// 在战斗中
|
2024-09-29 18:22:23 +08:00
|
|
|
|
AreaManager.instance.readyAreaManager.ShowReadyArea(EReadyAreaStatus.AroundVehicle, unit);
|
2024-03-28 16:13:10 +08:00
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
else if (GameUnitManager.instance.prepareUnits.Contains(uid))
|
|
|
|
|
|
{
|
|
|
|
|
|
// 备战席
|
|
|
|
|
|
AreaManager.instance.readyAreaManager.ShowReadyArea();
|
|
|
|
|
|
}
|
|
|
|
|
|
else if (GameUnitManager.instance.deadUnits.Contains(uid))
|
|
|
|
|
|
{
|
|
|
|
|
|
// 已死亡
|
|
|
|
|
|
AreaManager.instance.readyAreaManager.HideReadyArea();
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
// 未知情况
|
|
|
|
|
|
DebugUtil.LogError("未知上阵情况!");
|
|
|
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
AreaManager.instance.readyAreaManager.HideReadyArea();
|
|
|
|
|
|
}
|
2024-11-26 14:59:20 +08:00
|
|
|
|
|
|
|
|
|
|
// LevelManager.Instance.CurrentLevel.Map.ShowInfo(Map.InfoMask.ShowCells, isNeedShow);
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2024-11-14 19:58:45 +08:00
|
|
|
|
|
2024-01-11 13:54:58 +08:00
|
|
|
|
if (uid == Constants.INVALID_UINT_ID)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (IsHideAllUI)
|
|
|
|
|
|
{
|
|
|
|
|
|
IsHideAllUI = false;
|
2024-03-21 19:02:37 +08:00
|
|
|
|
CloseFightPosterUI();
|
2024-01-11 13:54:58 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//获取某一个角色的信息
|
2024-11-14 15:43:20 +08:00
|
|
|
|
public TeamUnitInfo GetCharacterDataInfo(uint uid)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
2023-12-14 19:42:05 +08:00
|
|
|
|
if (m_allCharactersMap.TryGetValue(uid, out var result))
|
|
|
|
|
|
{
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
return null;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
//获取各个队列
|
|
|
|
|
|
public List<uint> GetWaitList()
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_waitFightIDList;
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public List<uint> GetFightList()
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_onFightIDList;
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public List<uint> GetDeadList()
|
|
|
|
|
|
{
|
2024-10-10 20:01:31 +08:00
|
|
|
|
if (m_deadIDList == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError("Null!");
|
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
return m_deadIDList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
public List<uint> GetInVehicleList()
|
|
|
|
|
|
{
|
|
|
|
|
|
return _inVehicleIDList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public List<uint> GetEnemyList()
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_enemyIDList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void AddEnemyID(uint uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_enemyIDList.Add(uid);
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public void ClearEnemyID(uint uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_enemyIDList.Remove(uid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-14 15:43:20 +08:00
|
|
|
|
public TeamUnitInfo GetTeamUnitInfoByUid(uint uid)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
return m_allCharactersMap[uid];
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
//上下载具
|
|
|
|
|
|
public void InVehicleAdd(uint id)
|
|
|
|
|
|
{
|
|
|
|
|
|
_inVehicleIDList.Add(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void InVehicleRemove(uint id)
|
|
|
|
|
|
{
|
|
|
|
|
|
_inVehicleIDList.Remove(id);
|
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
|
|
|
|
|
//选中一个准备上阵
|
|
|
|
|
|
public void SelectToFight(uint selectUid = Constants.INVALID_UINT_ID)
|
|
|
|
|
|
{
|
|
|
|
|
|
SetSelectID(selectUid);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//从Level中选择的传入到UI层
|
|
|
|
|
|
public void SelectToWait(uint selectUid = Constants.INVALID_UINT_ID)
|
|
|
|
|
|
{
|
|
|
|
|
|
SetSelectID(selectUid);
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
//上阵成功
|
|
|
|
|
|
public void SendToFight(uint toFightUId)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (LevelManager.Instance.CurrentLevel.IsPreparing())
|
|
|
|
|
|
{
|
|
|
|
|
|
SendWaitToFightBefore(toFightUId);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
SendWaitToFightFighting(toFightUId);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//下阵成功
|
2024-11-14 19:58:45 +08:00
|
|
|
|
public void SendToWait(uint toWaitUid,
|
|
|
|
|
|
bool fightDontMove = true)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (LevelManager.Instance.CurrentLevel.IsPreparing())
|
|
|
|
|
|
{
|
2023-12-19 16:17:55 +08:00
|
|
|
|
SendFightToWaitBefore(toWaitUid, fightDontMove);
|
2023-08-22 19:08:45 +08:00
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// if (LevelManager.Instance.CurrentLevel.IsInBattle())
|
|
|
|
|
|
// {
|
|
|
|
|
|
SendFightToWaitFighting(toWaitUid);
|
|
|
|
|
|
// }
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
//战斗时选中已上阵
|
|
|
|
|
|
public void SelectCharacterFighting(int uid)
|
|
|
|
|
|
{
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//记录战斗开始时间
|
|
|
|
|
|
public void StartFightTime()
|
|
|
|
|
|
{
|
|
|
|
|
|
//InitFightTime();
|
|
|
|
|
|
//MonoHelper.instance.AddAction(EActionType.UPDATE, FightPassAddDeltaTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FightPassAddDeltaTime()
|
|
|
|
|
|
{
|
|
|
|
|
|
bool isPause = LevelManager.Instance.CurrentLevel.IsPause();
|
|
|
|
|
|
if (!isPause)
|
|
|
|
|
|
{
|
|
|
|
|
|
FightPastTimeAddSecond(Time.deltaTime);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void InitFightTime()
|
|
|
|
|
|
{
|
|
|
|
|
|
m_fightPastTimeCount = 0;
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public void SetFightPastTime(float time)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_fightPastTimeCount = time;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FightPastTimeAddMs(float ms)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_fightPastTimeCount += ms / 1000f;
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
void FightPastTimeAddSecond(float second)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_fightPastTimeCount += second;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public float GetFightPastTime()
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_fightPastTimeCount;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int GetFightPastHour()
|
|
|
|
|
|
{
|
2024-10-31 14:37:12 +08:00
|
|
|
|
if (LevelManager.Instance.CurrentLevel == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
var time = LevelManager.Instance.CurrentLevel.LevelTime;
|
|
|
|
|
|
int curTimeSecond = Convert.ToInt32(Math.Floor(time));
|
|
|
|
|
|
int hour = Convert.ToInt32(Math.Floor(curTimeSecond / 3600f));
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
return hour;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int GetFightPastMinute()
|
|
|
|
|
|
{
|
2024-10-31 14:37:12 +08:00
|
|
|
|
if (LevelManager.Instance.CurrentLevel == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
var time = LevelManager.Instance.CurrentLevel.LevelTime;
|
|
|
|
|
|
int curTimeSecond = Convert.ToInt32(Math.Floor(time));
|
|
|
|
|
|
int hour = GetFightPastHour();
|
|
|
|
|
|
int min = Convert.ToInt32(Math.Floor(curTimeSecond / 60f - hour * 60f));
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
return min;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int GetFightPastSecond()
|
|
|
|
|
|
{
|
2024-10-31 14:37:12 +08:00
|
|
|
|
if (LevelManager.Instance.CurrentLevel == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
var time = LevelManager.Instance.CurrentLevel.LevelTime;
|
|
|
|
|
|
int curTimeSecond = Convert.ToInt32(Math.Floor(time));
|
|
|
|
|
|
int hour = GetFightPastHour();
|
|
|
|
|
|
int min = GetFightPastMinute();
|
|
|
|
|
|
int sec = (curTimeSecond - min * 60 - hour * 3600);
|
|
|
|
|
|
|
|
|
|
|
|
return sec;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-14 15:43:20 +08:00
|
|
|
|
public TeamUnitInfo.CharacType GetUnitType(uint uid)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
if (m_allCharactersMap.ContainsKey(uid))
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_allCharactersMap[uid].Type;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
DebugUtil.LogError("请检查传入对象的类型(载具/角色)!!!uid = {0}", uid);
|
2024-11-14 15:43:20 +08:00
|
|
|
|
return TeamUnitInfo.CharacType.Hero;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsCharacter(uint uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (LevelManager.Instance.CurrentLevel.IsInBattle())
|
|
|
|
|
|
{
|
2023-12-19 16:17:55 +08:00
|
|
|
|
return GameUnitManager.instance.totalUnits.Search(uid).gameunitType == EGameUnitType.Character;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-11-14 15:43:20 +08:00
|
|
|
|
return GetUnitType(uid) == TeamUnitInfo.CharacType.Hero;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public bool IsVehicle(uint uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (LevelManager.Instance.CurrentLevel.IsInBattle())
|
|
|
|
|
|
{
|
2023-12-14 18:25:52 +08:00
|
|
|
|
return GameUnitManager.instance.infightUnits.Search(uid).gameunitType == EGameUnitType.Vehicle;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2024-11-14 15:43:20 +08:00
|
|
|
|
return GetUnitType(uid) == TeamUnitInfo.CharacType.Vehicle;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public bool GetIsChanging()
|
|
|
|
|
|
{
|
|
|
|
|
|
return _isChanging;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetIsChanging(bool state)
|
|
|
|
|
|
{
|
|
|
|
|
|
_isChanging = state;
|
|
|
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
|
|
|
|
|
|
public void BornInLevel(uint uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!m_allCharactersMap.ContainsKey(uid))
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
m_allCharactersMap[uid].IsInLevel = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void RemoveInLevel(uint uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!m_allCharactersMap.ContainsKey(uid))
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
m_allCharactersMap[uid].IsInLevel = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsInLevel(uint uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!m_allCharactersMap.ContainsKey(uid))
|
|
|
|
|
|
{
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return m_allCharactersMap[uid].IsInLevel;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-12-19 16:17:55 +08:00
|
|
|
|
public void SetIDReborn(uint uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (!m_waitFightIDList.Contains(uid))
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!m_deadIDList.Contains(uid))
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
m_waitFightIDList.Remove(uid);
|
|
|
|
|
|
m_deadIDList.Remove(uid);
|
|
|
|
|
|
var idx = m_waitFightIDList.Count - m_deadIDList.Count;
|
|
|
|
|
|
m_waitFightIDList.Insert(idx, uid);
|
|
|
|
|
|
BornInLevel(uid);
|
|
|
|
|
|
var singleUnit = m_allCharactersMap[uid];
|
|
|
|
|
|
singleUnit.SetIsDead();
|
|
|
|
|
|
}
|
2023-10-19 15:00:19 +08:00
|
|
|
|
public List<uint> GetAllIDList()
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_allIDList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsFightListLimit(uint uid)
|
|
|
|
|
|
{
|
2024-10-09 17:10:43 +08:00
|
|
|
|
return false;
|
|
|
|
|
|
// int totalNum = 0;
|
|
|
|
|
|
// int vehicleNum = 0;
|
|
|
|
|
|
// var unitList = GameUnitManager.instance.infightUnits;
|
|
|
|
|
|
// for (int i = 0; i < unitList.count; i++)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// var unit = unitList.GetByIndex(i);
|
|
|
|
|
|
// if (unit.commonData.troopId == ETroopsId.Self)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// if (unit.gameunitType == EGameUnitType.Character)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// ++totalNum;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if(unit.gameunitType == EGameUnitType.Vehicle)
|
|
|
|
|
|
// {
|
|
|
|
|
|
// ++vehicleNum;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// if (IsCharacter(uid))
|
|
|
|
|
|
// {
|
|
|
|
|
|
// return totalNum >= FIGHT_LIMIT;
|
|
|
|
|
|
// }
|
|
|
|
|
|
//
|
|
|
|
|
|
// return vehicleNum >= VEHICLE_FIGHT_LIMIT;
|
2023-10-19 15:00:19 +08:00
|
|
|
|
}
|
2023-12-26 13:25:05 +08:00
|
|
|
|
|
|
|
|
|
|
public bool IsInTeam(uint uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_allCharactersMap.ContainsKey(uid);
|
|
|
|
|
|
}
|
2024-09-04 16:02:38 +08:00
|
|
|
|
|
|
|
|
|
|
public bool CheckIsOnCancel()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (UIManager.Instance.GetOpenedWindowByPath(UINameConst.UIFightPoster) is UIPosterAndSkillInfoController window)
|
|
|
|
|
|
{
|
|
|
|
|
|
return window.CheckIsInCancel();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
2024-09-29 14:40:35 +08:00
|
|
|
|
|
|
|
|
|
|
public void SetCancelImageShow()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (UIManager.Instance.GetOpenedWindowByPath(UINameConst.UIFightPoster) is UIPosterAndSkillInfoController window)
|
|
|
|
|
|
{
|
|
|
|
|
|
window.SetCancelShow();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//单个队列中的角色信息
|
2024-11-14 15:43:20 +08:00
|
|
|
|
public class TeamUnitInfo
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
private CharacterDataInfo _characterData;
|
2024-01-04 13:45:27 +08:00
|
|
|
|
private VehicleCultivateData _vConfigData;
|
2024-11-20 15:18:21 +08:00
|
|
|
|
public readonly bool IsNPC = false;
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
|
|
|
|
|
private bool m_isDead;
|
2023-12-18 16:14:18 +08:00
|
|
|
|
private bool _isInLevel = false; //是否被创建到战场中,没有的话不能取到各种值
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
//测试数据
|
2024-11-14 19:58:45 +08:00
|
|
|
|
private uint m_uid; //战场中生成的UID
|
2023-08-22 19:08:45 +08:00
|
|
|
|
private CharacType m_type;
|
|
|
|
|
|
|
2024-03-20 19:58:18 +08:00
|
|
|
|
public readonly uint OutUid; //养成界面的UID
|
2024-11-20 15:18:21 +08:00
|
|
|
|
public const uint NPC_OUT_UID = 0;
|
2023-12-14 16:10:28 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public enum CharacType
|
|
|
|
|
|
{
|
|
|
|
|
|
Hero,
|
|
|
|
|
|
Vehicle
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-10-19 15:00:19 +08:00
|
|
|
|
public bool IsInLevel
|
|
|
|
|
|
{
|
|
|
|
|
|
get => _isInLevel;
|
|
|
|
|
|
set => _isInLevel = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-20 15:18:21 +08:00
|
|
|
|
public TeamUnitInfo(DataMonster monsterData, uint uid)
|
|
|
|
|
|
{
|
|
|
|
|
|
IsNPC = true;
|
|
|
|
|
|
if (monsterData.NpcType == ENpcType.SELF_CHARACTER)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_type = CharacType.Hero;
|
|
|
|
|
|
_characterData = _CreateFakeCharacterData(monsterData);
|
|
|
|
|
|
m_uid = uid;
|
|
|
|
|
|
OutUid = NPC_OUT_UID;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (monsterData.NpcType == ENpcType.SELF_VEHICLE)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_type = CharacType.Vehicle;
|
|
|
|
|
|
m_uid = uid;
|
|
|
|
|
|
OutUid = NPC_OUT_UID;
|
|
|
|
|
|
_vConfigData = _CreateFakeVehicleData(monsterData);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-11-14 15:43:20 +08:00
|
|
|
|
public TeamUnitInfo(CharacterDataInfo configData,
|
2023-12-18 16:14:18 +08:00
|
|
|
|
uint uid,
|
|
|
|
|
|
CharacType type = CharacType.Hero)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
_characterData = configData;
|
2023-12-14 16:10:28 +08:00
|
|
|
|
m_uid = uid;
|
|
|
|
|
|
OutUid = configData.Uid;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
m_type = type;
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2024-11-14 15:43:20 +08:00
|
|
|
|
public TeamUnitInfo(uint uid,
|
2024-01-04 13:45:27 +08:00
|
|
|
|
VehicleCultivateData configData,
|
2023-12-18 16:14:18 +08:00
|
|
|
|
CharacType type = CharacType.Vehicle)
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
_vConfigData = configData;
|
|
|
|
|
|
//m_leftBlood = configData.Blood();
|
2024-10-10 17:34:13 +08:00
|
|
|
|
OutUid = configData.nID;
|
2023-08-22 19:08:45 +08:00
|
|
|
|
m_uid = uid;
|
|
|
|
|
|
m_type = type;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-11-20 15:18:21 +08:00
|
|
|
|
private CharacterDataInfo _CreateFakeCharacterData(DataMonster monsterData)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (monsterData.NpcType == ENpcType.SELF_CHARACTER)
|
|
|
|
|
|
{
|
|
|
|
|
|
var npcData = TableManager.Instance.Tables.FightNPCConfig.Get(monsterData.MonsterClassID);
|
|
|
|
|
|
CharacterDataInfo characterDataInfo = new CharacterDataInfo();
|
|
|
|
|
|
characterDataInfo.ID = (uint)npcData.ConfigId; //用NPC表ID覆盖
|
|
|
|
|
|
characterDataInfo.Level = (uint)monsterData.MonsterLevel;
|
|
|
|
|
|
characterDataInfo.BreakLevel = 0;
|
|
|
|
|
|
characterDataInfo.AwakeLevel = 0;
|
|
|
|
|
|
characterDataInfo.LikelyExp = 0;
|
|
|
|
|
|
characterDataInfo.LikelyLevel = 0;
|
|
|
|
|
|
characterDataInfo.UltraSkillLevel = 0;
|
|
|
|
|
|
characterDataInfo.SkinID = 1;
|
|
|
|
|
|
|
|
|
|
|
|
var cfgTemp = TableManager.Instance.Tables.CharacterAttri.DataList[0];
|
|
|
|
|
|
var cfg = new DataCharacterAttri(
|
|
|
|
|
|
cfgTemp.RoleID,
|
|
|
|
|
|
"测试",
|
|
|
|
|
|
"昵称",
|
|
|
|
|
|
cfgTemp.BirthDay,
|
|
|
|
|
|
cfgTemp.StartStar,
|
|
|
|
|
|
cfgTemp.ExchangePiece,
|
|
|
|
|
|
cfgTemp.ExchangeCount,
|
|
|
|
|
|
cfgTemp.EmojiEyeBowsType,
|
|
|
|
|
|
cfgTemp.EmojiEyesColor,
|
|
|
|
|
|
cfgTemp.EmojiEyeBowsColor,
|
|
|
|
|
|
cfgTemp.DefaultEmojiImgId,
|
|
|
|
|
|
cfgTemp.DefaultDisplayEmojiId,
|
|
|
|
|
|
npcData.StandCrossLevel,
|
|
|
|
|
|
npcData.MoveCrossLevel,
|
|
|
|
|
|
cfgTemp.Defence,
|
|
|
|
|
|
cfgTemp.Hp,
|
|
|
|
|
|
cfgTemp.Shield,
|
|
|
|
|
|
npcData.WeaponGrasp,
|
|
|
|
|
|
npcData.WeaponDegree,
|
|
|
|
|
|
cfgTemp.DefenceNoMoveScale,
|
|
|
|
|
|
npcData.Speed,
|
|
|
|
|
|
npcData.RetreatSpeed,
|
|
|
|
|
|
npcData.MaxMorale,
|
|
|
|
|
|
npcData.CorrageRecover,
|
|
|
|
|
|
npcData.CriticalRatio,
|
|
|
|
|
|
npcData.CriticalDamage,
|
|
|
|
|
|
npcData.WeaponId,
|
|
|
|
|
|
cfgTemp.ShootDistanceScale,
|
|
|
|
|
|
cfgTemp.AttackLoopCount,
|
|
|
|
|
|
npcData.MoveShootType,
|
|
|
|
|
|
npcData.Job,
|
|
|
|
|
|
npcData.ProvideJob,
|
|
|
|
|
|
cfgTemp.SpendLeadership,
|
|
|
|
|
|
npcData.Army,
|
|
|
|
|
|
npcData.Fraction,
|
|
|
|
|
|
cfgTemp.FacDetail,
|
|
|
|
|
|
cfgTemp.FacIcon
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
characterDataInfo.ForceSetCfg(cfg);
|
|
|
|
|
|
return characterDataInfo;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DebugUtil.LogError($"创建NPC角色时出现错误!Monster NPCType不为角色!MonsterID:{monsterData.MonsterID}");
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private VehicleCultivateData _CreateFakeVehicleData(DataMonster monsterData)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (monsterData.NpcType == ENpcType.SELF_VEHICLE)
|
|
|
|
|
|
{
|
|
|
|
|
|
var vehicleData = new VehicleCultivateData();
|
|
|
|
|
|
var vehicleID = monsterData.MonsterClassID;
|
|
|
|
|
|
var vehicleCfg = TableManager.Instance.Tables.VehicleConfig.GetOrDefault(vehicleID);
|
|
|
|
|
|
if (vehicleCfg == null)
|
|
|
|
|
|
{
|
|
|
|
|
|
DebugUtil.LogError($"创建NPC载具时出现错误,无法获取配置数据!, MonsterClassID:{monsterData.MonsterClassID}");
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
vehicleData.Cfg = vehicleCfg;
|
|
|
|
|
|
return vehicleData;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
DebugUtil.LogError($"创建NPC载具时出现错误,Monster数据不为载具!, MonsterID:{monsterData.MonsterID}");
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetVehicleNID(uint nID)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (m_type == CharacType.Vehicle)
|
|
|
|
|
|
{
|
|
|
|
|
|
_vConfigData.nID = nID;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
|
|
|
|
|
|
public uint Uid
|
|
|
|
|
|
{
|
2024-01-04 13:45:27 +08:00
|
|
|
|
get { return m_uid; }
|
2023-08-22 19:08:45 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public CharacType Type
|
|
|
|
|
|
{
|
|
|
|
|
|
get { return m_type; }
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool IsVehicle()
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_type == CharacType.Vehicle;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public int GetTid()
|
|
|
|
|
|
{
|
|
|
|
|
|
return _characterData.Cfg.RoleID;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public CharacterDataInfo GetConfigInfo()
|
|
|
|
|
|
{
|
|
|
|
|
|
return _characterData;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-04 13:45:27 +08:00
|
|
|
|
public VehicleCultivateData GetVehicleInfo()
|
2023-08-22 19:08:45 +08:00
|
|
|
|
{
|
|
|
|
|
|
return _vConfigData;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool GetIsDead()
|
|
|
|
|
|
{
|
|
|
|
|
|
return m_isDead;
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
|
2023-08-22 19:08:45 +08:00
|
|
|
|
public void SetIsDead(bool state = false)
|
|
|
|
|
|
{
|
|
|
|
|
|
m_isDead = state;
|
|
|
|
|
|
}
|
2023-12-18 16:14:18 +08:00
|
|
|
|
}
|