| | |
| | | { |
| | | // 英雄当前所有在的队伍 |
| | | List<int> heroTeams = heroInfo.itemHero.GetUseData(81); |
| | | |
| | | Dictionary<TeamType, KeyValuePair<int, int>> teamTypeShapeTypePositionDict = new Dictionary<TeamType, KeyValuePair<int, int>>(); |
| | | foreach (var teamMsg in heroTeams) |
| | | if (heroTeams == null || heroTeams.Count == 0) |
| | | { |
| | | // 所在阵容信息列表 [阵容类型*10000+阵型类型*100+位置编号, ...] |
| | | int teamType = teamMsg / 10000; |
| | | int shapeType = (teamMsg % 10000) / 100; |
| | | int positionIndex = teamMsg % 100; |
| | | return; |
| | | } |
| | | |
| | | if (teamTypeShapeTypePositionDict.ContainsKey((TeamType)teamType)) |
| | | |
| | | // 当前英雄所在的队伍信息 <队伍类型, <队形, 位置>> |
| | | Dictionary<TeamType, KeyValuePair<int, int>> teamTypeShapeTypePositionDict = new Dictionary<TeamType, KeyValuePair<int, int>>(); |
| | | |
| | | |
| | | // 处理当前记录在英雄信息里的队伍信息 |
| | | if (null != heroTeams) |
| | | { |
| | | foreach (var teamMsg in heroTeams) |
| | | { |
| | | // 队伍类型相同,更新阵型和位置 |
| | | Debug.LogError("当前英雄拥有两个相同的队伍信息: " + teamType + " " + shapeType + " " + positionIndex + ", hero guid is " + heroInfo.itemHero.guid); |
| | | } |
| | | else |
| | | { |
| | | // 队伍类型不同,添加新的 |
| | | KeyValuePair<int, int> shapeTypePosition = new KeyValuePair<int, int>(shapeType, positionIndex); |
| | | teamTypeShapeTypePositionDict.Add((TeamType)teamType, shapeTypePosition); |
| | | // 所在阵容信息列表 [阵容类型*10000+阵型类型*100+位置编号, ...] |
| | | int teamType = teamMsg / 10000; |
| | | int shapeType = (teamMsg % 10000) / 100; |
| | | int positionIndex = teamMsg % 100; |
| | | |
| | | if (teamTypeShapeTypePositionDict.ContainsKey((TeamType)teamType)) |
| | | { |
| | | // 队伍类型相同,更新阵型和位置 |
| | | Debug.LogError("当前英雄拥有两个相同的队伍信息: " + teamType + " " + shapeType + " " + positionIndex + ", hero guid is " + heroInfo.itemHero.guid); |
| | | } |
| | | else |
| | | { |
| | | // 队伍类型不同,添加新的 |
| | | KeyValuePair<int, int> shapeTypePosition = new KeyValuePair<int, int>(shapeType, positionIndex); |
| | | teamTypeShapeTypePositionDict.Add((TeamType)teamType, shapeTypePosition); |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | // 遍历当前所有队伍 判断当前队伍里是否有该英雄 |
| | | // 如果有的话 读取一下当前是否该英雄还在队伍里 位置是否发生变化 |
| | | // 或者是阵型发生变化 或者单纯的英雄发生变化 |
| | | // 如果有的话 根据英雄里的信息当前是否该英雄还在队伍里 是否发生变化 |
| | | // =>1.阵型发生变化 2.位置发生变化 |
| | | // 如果没有的话 就说明该英雄被移出队伍了 |
| | | foreach (var team in teamDict.Values) |
| | | { |
| | |
| | | |
| | | if (!teamDict.TryGetValue(teamType, out team)) |
| | | { |
| | | team = new TeamBase(teamType); |
| | | team.CreateDefault(HeroManager.Instance.GetPowerfulHeroList()); |
| | | teamDict.Add(teamType, team); |
| | | // 测试用 |
| | | // team = new TeamBase(teamType); |
| | | // team.CreateDefault(HeroManager.Instance.GetPowerfulHeroList()); |
| | | // teamDict.Add(teamType, team); |
| | | } |
| | | |
| | | return team; |