using System.Collections; 
 | 
using System.Collections.Generic; 
 | 
using UnityEngine; 
 | 
using UnityEngine.UI; 
 | 
  
 | 
/// <summary> 
 | 
/// 武将阵型激活界面 
 | 
/// </summary> 
 | 
public class HeroFormationWin : UIBase 
 | 
{ 
 | 
    [SerializeField] Button closeBtn; 
 | 
    [SerializeField] ScrollerController scroller; 
 | 
    [SerializeField] Text totalAttrText;      
 | 
  
 | 
  
 | 
    protected override void InitComponent() 
 | 
    { 
 | 
        closeBtn.AddListener(CloseWindow); 
 | 
    } 
 | 
  
 | 
  
 | 
    protected override void OnPreOpen() 
 | 
    { 
 | 
        scroller.OnRefreshCell += OnRefreshCell; 
 | 
        CreateScroller(); 
 | 
        Int2 result; 
 | 
        if (HeroUIManager.Instance.isCustonHeroFormation) 
 | 
        { 
 | 
            result = HeroUIManager.Instance.GetMaxCountHeroCountry(HeroUIManager.Instance.custonTeamHeroes);; 
 | 
        } 
 | 
        else 
 | 
        { 
 | 
            result = HeroUIManager.Instance.GetMaxCountHeroCountry(HeroUIManager.Instance.selectTeamType, true); 
 | 
        } 
 | 
         
 | 
  
 | 
        var config = HeroLineupHaloConfig.GetConfig(result.x, result.y); 
 | 
        if (config == null) 
 | 
        { 
 | 
            totalAttrText.text = ""; 
 | 
        } 
 | 
        else 
 | 
        { 
 | 
            string lineText = string.Empty; 
 | 
  
 | 
            for (int i = 0; i < config.AttrIDList.Length; i++) 
 | 
            { 
 | 
                string format = "{0}+" + UIHelper.AppendColor(TextColType.Green, "{1}"); 
 | 
                lineText += " " + PlayerPropertyConfig.GetFullDescription(config.AttrIDList[i], config.AttrValueList[i], format); 
 | 
            } 
 | 
            totalAttrText.text = Language.Get("herocard36") + lineText.Trim(); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    protected override void OnPreClose() 
 | 
    { 
 | 
        scroller.OnRefreshCell -= OnRefreshCell; 
 | 
    } 
 | 
  
 | 
  
 | 
  
 | 
    void OnRefreshCell(ScrollerDataType type, CellView cell) 
 | 
    { 
 | 
        var _cell = cell as HeroFormationCell; 
 | 
        _cell.Display(cell.index); 
 | 
    } 
 | 
  
 | 
    void CreateScroller() 
 | 
    { 
 | 
        scroller.Refresh(); 
 | 
        for (int i = 0; i < 4; i++) 
 | 
        { 
 | 
            scroller.AddCell(ScrollerDataType.Header, i); 
 | 
        } 
 | 
        scroller.Restart(); 
 | 
    } 
 | 
  
 | 
} 
 |