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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
 
public class HeroCountryComponent : MonoBehaviour
{
    [SerializeField] Button countryOnBtn;
    [SerializeField] Image countryOnImg;    //上阵阵型激活国家
    [SerializeField] UIEffectPlayer countryEffect;
    [SerializeField] List<Image> OnCountImgs;    //上阵数量激活
    List<TeamHero> teamHeroes;
    void Awake()
    {
        countryOnBtn.AddListener(() =>
        {
            HeroUIManager.Instance.isCustonHeroFormation = true;
            HeroUIManager.Instance.custonTeamHeroes = teamHeroes;
            UIManager.Instance.OpenWindow<HeroFormationWin>();
        });
    }
 
    //上阵武将国家光环激活
    public void RefreshOnTeamCountry(List<TeamHero> teamHeroes, bool playEffect = false)
    {
        this.teamHeroes = teamHeroes;
        Int2 result = HeroUIManager.Instance.GetMaxCountHeroCountry(teamHeroes);
 
        var config = HeroLineupHaloConfig.GetConfig(result.x, result.y);
        if (config == null)
        {
            countryOnImg.SetSprite("heroTeamCountry0");
            for (int i = 0; i < OnCountImgs.Count; i++)
            {
                OnCountImgs[i].SetActive(false);
            }
        }
        else
        {
            countryOnImg.SetSprite("heroTeamCountry" + result.x);
            for (int i = 0; i < OnCountImgs.Count; i++)
            {
                if (i < result.y)
                {
                    OnCountImgs[i].SetActive(true);
                    OnCountImgs[i].SetSprite("heroTeamCountryPoint" + result.x);
                }
                else
                {
                    OnCountImgs[i].SetActive(false);
                }
            }
            if (playEffect)
                countryEffect.Play();
        }
 
    }
}