using System.Collections.Generic; 
 | 
using System.Linq; 
 | 
using UnityEngine; 
 | 
using UnityEngine.UI; 
 | 
  
 | 
  
 | 
/// <summary> 
 | 
/// 武将天赋总览界面 
 | 
/// </summary> 
 | 
public class HeroGiftWin : UIBase 
 | 
{ 
 | 
    [SerializeField] ScrollerController scroller; 
 | 
  
 | 
  
 | 
  
 | 
  
 | 
    protected override void OnPreOpen() 
 | 
    { 
 | 
        scroller.OnRefreshCell += OnRefreshCell; 
 | 
         
 | 
        CreateScroller(); 
 | 
    } 
 | 
  
 | 
    protected override void OnPreClose() 
 | 
    { 
 | 
        scroller.OnRefreshCell -= OnRefreshCell; 
 | 
  
 | 
    } 
 | 
  
 | 
    List<int> configList = new List<int>(); 
 | 
    void CreateScroller() 
 | 
    { 
 | 
        configList = HeroTalentConfig.GetKeys().ToList(); 
 | 
        var totalCount = configList.Count; 
 | 
  
 | 
        scroller.Refresh(); 
 | 
        for (int i = 0; i < totalCount; i++) 
 | 
        { 
 | 
            if (i % 5 == 0) 
 | 
            { 
 | 
                scroller.AddCell(ScrollerDataType.Header, i); 
 | 
            } 
 | 
        } 
 | 
        scroller.Restart(); 
 | 
    } 
 | 
  
 | 
    void OnRefreshCell(ScrollerDataType type, CellView cell) 
 | 
    { 
 | 
        var _cell = cell as HeroGiftLineCell; 
 | 
        _cell.Display(cell.index, configList); 
 | 
    } 
 | 
  
 | 
  
 | 
} 
 |