//-------------------------------------------------------- // [Author]: 玩个游戏 // [ Date ]: Tuesday, July 24, 2018 //-------------------------------------------------------- using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; ////开服庆典 - 礼包 public class OSGalaGiftWin : UIBase { [SerializeField] ScrollerController scrollerController; protected override void OnPreOpen() { scrollerController.OnRefreshCell += OnRefreshCell; StoreModel.Instance.RefreshBuyShopLimitEvent += RefreshStore; RechargeManager.Instance.rechargeCountEvent += OnRechargeCountEvent; OSActivityManager.Instance.RefreshOSGalaGiftSortList(); Display(); } protected override void OnPreClose() { scrollerController.OnRefreshCell -= OnRefreshCell; StoreModel.Instance.RefreshBuyShopLimitEvent -= RefreshStore; RechargeManager.Instance.rechargeCountEvent -= OnRechargeCountEvent; } void OnRefreshCell(ScrollerDataType type, CellView cell) { var _cell = cell as OSGalaGiftCell; _cell.Display(cell.index); } void Display() { scrollerController.Refresh(); for (int i = 0; i < OSActivityManager.Instance.osGalaGiftSortList.Count; i++) { scrollerController.AddCell(ScrollerDataType.Header, i); } scrollerController.Restart(); } void RefreshStore() { scrollerController.m_Scorller.RefreshActiveCellViews(); } void OnRechargeCountEvent(int id) { scrollerController.m_Scorller.RefreshActiveCellViews(); } }