| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 | using System.Threading.Tasks;using ET;using FairyGUI;using UI.Store;namespace GFGGame{    public class WeekGiftView : BaseWindow    {        private UI_WeekGiftUI _ui;        private int _vipLv;        public override void Dispose()        {            if (_ui != null)            {                _ui.Dispose();            }            _ui = null;            base.Dispose();        }        protected override void OnHide()        {            base.OnHide();        }        protected override void OnInit()        {            base.OnInit();            packageName = UI_WeekGiftUI.PACKAGE_NAME;            _ui = UI_WeekGiftUI.Create();            this.viewCom = _ui.target;            this.viewCom.Center();            this.modal = true;            _ui.m_listWeekGiftBag.itemRenderer = ListRewardItemRender;            _ui.m_btnGetWeekGiftBag.onClick.Add(OnBtnGetWeekGiftBagClick);        }        protected override void OnShown()        {            base.OnShown();            _vipLv = (int)this.viewData;            VipCfg vipCfg = VipCfgArray.Instance.dataArray[_vipLv];            _ui.m_txtWeekGiftBag.SetVar("value", vipCfg.id.ToString()).FlushVars();            _ui.m_listWeekGiftBag.data = vipCfg.bonusWeekArr;            _ui.m_listWeekGiftBag.numItems = vipCfg.bonusWeekArr.Length;        }        private void ListRewardItemRender(int index, GObject obj)        {            int[][] rewards = (int[][])obj.parent.data;            if (obj.data == null)            {                obj.data = new ItemView(obj as GComponent);            }            ItemData itemData = ItemUtil.createItemData(rewards[index]);            (obj.data as ItemView).SetData(itemData);            (obj.data as ItemView).ChangeTxtCountStyle();        }        private void OnBtnGetWeekGiftBagClick(EventContext context)        {            if (GameGlobal.myNumericComponent.GetAsInt(NumericType.VipWeekGetStatus) == 1)            {                PromptController.Instance.ShowFloatTextPrompt("会员每周礼包已领取");                return;            }            if (RoleDataManager.vipLv < _vipLv)            {                PromptController.Instance.ShowFloatTextPrompt("会员等级不足");                return;            }            //AlertUI.Show("提升VIP等级能领取更高级的礼包,是否继续领取当前等级的VIP礼包?", "(该礼包每周只能领取1次)")            // .SetLeftButton(true, "否").SetRightButton(true, "是", async (object data) =>            // {            GetVipWeekGiftBag();             //});        }        private async void GetVipWeekGiftBag()        {            ViewManager.Hide<WeekGiftView>();            bool result = await ShopSProxy.ReqGetVipWeekGiftBag(_vipLv);            if (result) { }        }    }}
 |