using System.Collections.Generic; using UnityEngine; //阵容布阵 public partial class HeroInfo { public Dictionary> GetTeamTypeShapeTypePositionDict() { // 英雄当前所有在的队伍 List heroTeams = itemHero.GetUseData(81); Dictionary> teamTypeShapeTypePositionDict = new Dictionary>(); foreach (var teamMsg in heroTeams) { // 所在阵容信息列表 [阵容类型*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 " + itemHero.guid); } else { // 队伍类型不同,添加新的 KeyValuePair shapeTypePosition = new KeyValuePair(shapeType, positionIndex); teamTypeShapeTypePositionDict.Add((TeamType)teamType, shapeTypePosition); } } return teamTypeShapeTypePositionDict; } }