using ET; using FairyGUI; using UI.DailyWelfare; using System; using System.Collections.Generic; using ET; namespace GFGGame { //改弹窗只用与每日签到补签 //public delegate void TipsCallback(); class ReDailySignTipsView : BaseWindow { private UI_DailySignRechargeTipsUI _ui; //private TipsCallback m_leftButtonCallback = null; //private TipsCallback m_rightButtonCallback = null; private int itemId = 0; private string showTipsText = ""; private long hasNum; private int type; private int day = 1; public override void Dispose() { if (_ui != null) { _ui.Dispose(); _ui = null; } base.Dispose(); } protected override void OnInit() { base.OnInit(); packageName = UI_DailySignRechargeTipsUI.PACKAGE_NAME; _ui = UI_DailySignRechargeTipsUI.Create(); this.viewCom = _ui.target; this.modal = true; this.viewCom.Center(); viewAnimationType = EnumViewAnimationType.ZOOM_CENTER; _ui.m_btnConfirm.onClick.Add(OnClickBtnConfirm); _ui.m_btnCancel.onClick.Add(OnClickBtnCancel); //_ui.m_btnCancel.onClick.Add(() => //{ // this.Hide(); // m_leftButtonCallback?.Invoke(); //}); //_ui.m_btnConfirm.onClick.Add(() => //{ // this.Hide(); // m_rightButtonCallback?.Invoke(); //}); } protected override void OnShown() { base.OnShown(); day = (int)this.viewData; UpdateView(); } private void UpdateView() { CheckItemId(); } protected override void OnHide() { //m_leftButtonCallback = null; //m_rightButtonCallback = null; base.OnHide(); } private void CheckItemId() { int[][] SecondCost = GlobalCfgArray.globalCfg.dailySignConsumeArr; int[][] FirstCost = GlobalCfgArray.globalCfg.SecDailySignConsumeArr; int needNum = 1; hasNum = ItemDataManager.GetItemNum(FirstCost[0][0]); if(hasNum >= FirstCost[0][1]) { _ui.m_txtTips.text = string.Format("是否花费{0}进行一次补签?",ItemCfgArray.Instance.GetCfg(FirstCost[0][0]).name); type = 1; itemId = FirstCost[0][0]; needNum = FirstCost[0][1]; } else { type = 0; itemId = SecondCost[0][0]; needNum = SecondCost[0][1]; hasNum = ItemDataManager.GetItemNum(SecondCost[0][0]); _ui.m_txtTips.text = string.Format("{0}不足,是否花费{1}{2}进行一次补签?", ItemCfgArray.Instance.GetCfg(FirstCost[0][0]).name, SecondCost[0][1], ItemCfgArray.Instance.GetCfg(SecondCost[0][0]).name); _ui.m_comCostItem.visible = false; } ItemUtil.UpdateItemAndNeed(_ui.m_comCostItem, itemId, needNum, true); } private void OnClickBtnCancel() { this.Hide(); } private async void OnClickBtnConfirm() { if (!ItemUtil.CheckItemEnough(itemId, (int)hasNum) && itemId == 1000005) { long has = ItemDataManager.GetItemNum((int)hasNum); ItemUtil.BuyCurrency(itemId, (int)hasNum - has); return; } bool result = await DailyWelfareSProxy.ReqReSign(day,type); this.Hide(); } } }