yyl
2025-09-05 bb145d27787e6d54cb4bf0995cf11a41d1c9e67d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
using System.Collections.Generic;
using UnityEngine;
 
//阵容布阵
public partial class HeroInfo
{
    public Dictionary<TeamType, KeyValuePair<int, int>> GetTeamTypeShapeTypePositionDict()
    {
        //  英雄当前所有在的队伍
        List<int> heroTeams = itemHero.GetUseData(81);
 
        Dictionary<TeamType, KeyValuePair<int, int>> teamTypeShapeTypePositionDict = new Dictionary<TeamType, KeyValuePair<int, int>>();
        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<int, int> shapeTypePosition = new KeyValuePair<int, int>(shapeType, positionIndex);
                teamTypeShapeTypePositionDict.Add((TeamType)teamType, shapeTypePosition);
            }
        }
 
        return teamTypeShapeTypePositionDict;
    }
}