| | |
| | | |
| | | public class TeamManager : GameSystemManager<TeamManager> |
| | | { |
| | | protected Dictionary<TeamType, TeamBase> teamDict = new Dictionary<TeamType, TeamBase>(); |
| | | protected Dictionary<int, TeamBase> teamDict = new Dictionary<int, TeamBase>(); |
| | | |
| | | public Action<TeamType> OnTeamChange = null; |
| | | public Action<int> OnTeamChange = null; |
| | | |
| | | public override void Init() |
| | | { |
| | |
| | | public void OnHeroChangeEvent(HB124_tagSCHeroPresetInfo vNetData) |
| | | { |
| | | var heroPack = PackManager.Instance.GetSinglePack(PackType.Hero); |
| | | HashSet<TeamType> teamTypeSet = new HashSet<TeamType>(); |
| | | HashSet<int> teamTypeSet = new HashSet<int>(); |
| | | for (int i = 0; i < vNetData.PresetCnt; i++) |
| | | { |
| | | TeamType teamType = (TeamType)vNetData.PresetList[i].PresetID; |
| | | int teamType = vNetData.PresetList[i].PresetID; |
| | | teamTypeSet.Add(teamType); |
| | | var team = GetTeam(teamType); |
| | | for (int j = 0; j < vNetData.PresetList[i].HeroCnt; j++) |
| | |
| | | hero = HeroManager.Instance.GetHero(item.guid); |
| | | |
| | | } |
| | | team.RefreshServerData(vNetData.PresetList[i].ShapeType, j, hero); |
| | | team.RefreshServerData(j, hero); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | public bool HasTeam(TeamType teamType) |
| | | public bool HasTeam(int teamType) |
| | | { |
| | | return teamDict.ContainsKey(teamType); |
| | | } |
| | | |
| | | public TeamBase GetTeam(TeamType teamType) |
| | | //通过阵容方案ID获取阵容 |
| | | public TeamBase GetTeam(int teamType) |
| | | { |
| | | TeamBase team = null; |
| | | |
| | |
| | | |
| | | return team; |
| | | } |
| | | |
| | | //通过战斗类型获取阵容 |
| | | public TeamBase GetTeam(BattlePreSetType battlePassType) |
| | | { |
| | | int presetID = GetTeamID((int)battlePassType); |
| | | TeamBase team = null; |
| | | |
| | | if (!teamDict.TryGetValue(presetID, out team)) |
| | | { |
| | | team = new TeamBase(presetID); |
| | | // team.CreateDefault(HeroManager.Instance.GetPowerfulHeroList()); |
| | | teamDict.Add(presetID, team); |
| | | } |
| | | |
| | | return team; |
| | | } |
| | | |
| | | // 获取主阵容方案ID |
| | | public int GetMainTeamID() |
| | | { |
| | | return FuncPresetManager.Instance.GetFuncPresetID((int)BattlePreSetType.Story, (int)FuncPresetType.Team); |
| | | } |
| | | |
| | | public int GetTeamID(int battleType) |
| | | { |
| | | return FuncPresetManager.Instance.GetFuncPresetID(battleType, (int)FuncPresetType.Team); |
| | | } |
| | | } |