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() { List SecondCost = CommonDataManager.Tables.TblGlobalCfg.DailySignConsume.ToGfgGameItemParam(); List FirstCost = CommonDataManager.Tables.TblGlobalCfg.SecDailySignConsume.ToGfgGameItemParam(); int needNum = 1; hasNum = ItemDataManager.GetItemNum(FirstCost[0].ItemId); if(hasNum >= FirstCost[0].Count) { _ui.m_txtTips.text = string.Format("是否花费{0}进行一次补签?",CommonDataManager.Tables.TblItemCfg.GetOrDefault(FirstCost[0].ItemId).Name); type = 1; itemId = FirstCost[0].ItemId; needNum = FirstCost[0].Count; } else { type = 0; itemId = SecondCost[0].ItemId; needNum = SecondCost[0].Count; hasNum = ItemDataManager.GetItemNum(SecondCost[0].ItemId); _ui.m_txtTips.text = string.Format("{0}不足,是否花费{1}{2}进行一次补签?", CommonDataManager.Tables.TblItemCfg.GetOrDefault(FirstCost[0].ItemId).Name, SecondCost[0].Count, CommonDataManager.Tables.TblItemCfg.GetOrDefault(SecondCost[0].ItemId).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(); } } }