| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获得自定义队伍中各个国家的武将数量 |
| | | /// </summary> |
| | | public Dictionary<HeroCountry, int> GetCountryHeroCountByTeamHeroList(List<TeamHero> teamHeroes) |
| | | { |
| | | Dictionary<HeroCountry, int> heroCountryCount = new Dictionary<HeroCountry, int>(); |
| | | if (teamHeroes == null) |
| | | { |
| | | return heroCountryCount; |
| | | } |
| | | for (int i = 0; i < teamHeroes.Count; i++) |
| | | { |
| | | if (teamHeroes[i] == null) |
| | | continue; |
| | | var country = teamHeroes[i].Country; |
| | | |
| | | if (!heroCountryCount.ContainsKey(country)) |
| | | { |
| | | heroCountryCount.Add(country, 1); |
| | | } |
| | | else |
| | | { |
| | | heroCountryCount[country] += 1; |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | return heroCountryCount; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获得上阵中武将数量最大的国家和数量 |
| | | /// </summary> |
| | | /// <param name="teamType"></param> |
| | |
| | | return new Int2((int)country, maxValue); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 获得自定义队伍中武将数量最大的国家和数量 |
| | | /// </summary> |
| | | public Int2 GetMaxCountHeroCountry(List<TeamHero> teamType) |
| | | { |
| | | var countryCountDict = GetCountryHeroCountByTeamHeroList(teamType); |
| | | //找到最大的国家和数量 |
| | | HeroCountry country = HeroCountry.None; |
| | | int maxValue = 0; |
| | | foreach (var data in countryCountDict) |
| | | { |
| | | if (data.Value > maxValue) |
| | | { |
| | | country = data.Key; |
| | | maxValue = data.Value; |
| | | } |
| | | } |
| | | return new Int2((int)country, maxValue); |
| | | } |
| | | |
| | | //在不同页签下选AttackType 0 攻击阵容 1 防守阵容 |
| | | public int GetSelectTeamTypeByAttackType(int AttackType) |
| | | { |