| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 | using System.Collections.Generic;using FairyGUI;using UI.CommonGame;using UI.Task;namespace GFGGame{    public class OpenBattlePassView : BaseWindow    {        private UI_OpenBattlePassUI _ui;        public override void Dispose()        {            if (_ui != null)            {                _ui.Dispose();                _ui = null;            }            base.Dispose();        }        protected override void OnInit()        {            base.OnInit();            packageName = UI_OpenBattlePassUI.PACKAGE_NAME;            _ui = UI_OpenBattlePassUI.Create();            viewCom = _ui.target;            viewCom.Center();            _ui.m_CloseBtn.onClick.Add(Hide);            // clickBlankToClose = false;            _ui.m_Rewards.itemRenderer = SpecialRewardRender;            _ui.m_OpenBtn.onClick.Add(OnBtnOpenClick);        }        private void OnBtnOpenClick(EventContext context)        {            //TODO:打开购买界面        }        protected override void OnShown()        {            base.OnShown();            SetPrizeData();        }                        private static void SpecialRewardRender(int index, GObject obj)        {            var itemInfos = (List<KeyValuePair<int, int>>)obj.parent.data;            var itemInfo = itemInfos[index];            ItemUtil.CreateItemView(new[]{itemInfo.Key,itemInfo.Value}, obj as GComponent);        }        private void SetPrizeData()        {            //获取所有特别奖励数据            var dataManager = BattlePassTaskDataManager.Instance;            var allSpecialCfg = dataManager.GetAllSpecialCfg();            _ui.m_Rewards.data = allSpecialCfg;            _ui.m_Rewards.numItems = allSpecialCfg.Count;        }    }}
 |