|
@@ -1,6 +1,7 @@
|
|
|
|
|
|
using System;
|
|
|
using System.Collections.Generic;
|
|
|
+using System.Threading.Tasks;
|
|
|
using ET;
|
|
|
using FairyGUI;
|
|
|
using UI.DailyWelfare;
|
|
@@ -39,8 +40,9 @@ namespace GFGGame
|
|
|
packageName = UI_DailySupplyUI.PACKAGE_NAME;
|
|
|
_ui = UI_DailySupplyUI.Create();
|
|
|
this.viewCom = _ui.target;
|
|
|
- isfullScreen = true;
|
|
|
-
|
|
|
+ this.viewCom.Center();
|
|
|
+ this.modal = true;
|
|
|
+ viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
|
|
|
// _valueBarController = new ValueBarController(_ui.m_comValueBar);
|
|
|
|
|
|
// _ui.m_btnback.onClick.Add(OnBtnBackClick);
|
|
@@ -49,7 +51,7 @@ namespace GFGGame
|
|
|
protected override void AddEventListener()
|
|
|
{
|
|
|
base.AddEventListener();
|
|
|
- EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateView);
|
|
|
+ EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateSupplyView);
|
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
@@ -84,8 +86,7 @@ namespace GFGGame
|
|
|
_month = DateTime.Now.Month;
|
|
|
_day = DateTime.Now.Day;
|
|
|
}
|
|
|
- // _ui.m_list.ScrollToView(0);
|
|
|
- UpdateView();
|
|
|
+ UpdateSupplyView();
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
@@ -96,7 +97,7 @@ namespace GFGGame
|
|
|
protected override void RemoveEventListener()
|
|
|
{
|
|
|
base.RemoveEventListener();
|
|
|
- EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateView);
|
|
|
+ EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateSupplyView);
|
|
|
}
|
|
|
|
|
|
private void OnBtnBackClick()
|
|
@@ -125,13 +126,7 @@ namespace GFGGame
|
|
|
long endTime = TimeUtil.GetCurDayTime(TimeUtil.GetDateTime(supplyCfg.endTime).ToString("HH:mm:ss"));
|
|
|
item.m_txtTime.text = TimeUtil.FormattingTime6(openTime) + "-" + TimeUtil.FormattingTime6(endTime);
|
|
|
item.m_txtCount.text = supplyCfg.bonusArr[0][1].ToString();
|
|
|
- // if (item.m_comItem.data == null)
|
|
|
- // {
|
|
|
- // item.m_comItem.data = new ItemView(item.m_comItem);
|
|
|
- // }
|
|
|
- // ItemData itemData = ItemUtil.createItemData(supplyCfg.bonusArr[0]);
|
|
|
- // (item.m_comItem.data as ItemView).SetData(itemData);
|
|
|
- // (item.m_comItem.data as ItemView).ShowTips = false;
|
|
|
+
|
|
|
ItemUtil.UpdateItemNeedNum(item.m_comCost, GlobalCfgArray.globalCfg.dailySupplyConsumeArr[0]);
|
|
|
item.m_comCost.visible = false;
|
|
|
|
|
@@ -143,7 +138,7 @@ namespace GFGGame
|
|
|
}
|
|
|
|
|
|
long curTime = TimeHelper.ServerNow();
|
|
|
- if (curTime < openTime)
|
|
|
+ if (curTime < openTime && curTime > TimeUtil.GetCurDayTime(GlobalCfgArray.globalCfg.refreshTime))
|
|
|
{
|
|
|
item.m_btnGet.title = "领取";
|
|
|
item.m_btnGet.enabled = false;
|
|
@@ -166,13 +161,35 @@ namespace GFGGame
|
|
|
item.m_btnGet.data = supplyCfg;
|
|
|
UI_ComSupply.ProxyEnd();
|
|
|
}
|
|
|
- private async void OnBtnGetSupplyClick(EventContext context)
|
|
|
+ private void OnBtnGetSupplyClick(EventContext context)
|
|
|
{
|
|
|
GObject obj = context.sender as GObject;
|
|
|
DailySupplyCfg supplyCfg = obj.data as DailySupplyCfg;
|
|
|
long openTime = TimeUtil.GetCurDayTime(TimeUtil.GetDateTime(supplyCfg.openTime).ToString("HH:mm:ss"));
|
|
|
long endTime = TimeUtil.GetCurDayTime(TimeUtil.GetDateTime(supplyCfg.endTime).ToString("HH:mm:ss"));
|
|
|
- bool result = await DailyWelfareSProxy.ReqGetSupplyReward(supplyCfg.id);
|
|
|
+ if (TimeHelper.ServerNow() > endTime)
|
|
|
+ {
|
|
|
+ int[] cost = GlobalCfgArray.globalCfg.dailySupplyConsumeArr[0];
|
|
|
+ AlertUI.Show(string.Format("是否确定花费{0}{1}补领?", cost[1], ItemCfgArray.Instance.GetCfg(cost[0]).name)).
|
|
|
+ SetLeftButton(true, "否").
|
|
|
+ SetRightButton(true, "是", (object param) =>
|
|
|
+ {
|
|
|
+ if (ItemDataManager.GetItemNum(cost[0]) < cost[1])
|
|
|
+ {
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("消耗不足");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ ReqSupplyAsync(supplyCfg.id);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ReqSupplyAsync(supplyCfg.id);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private async void ReqSupplyAsync(int id)
|
|
|
+ {
|
|
|
+ bool result = await DailyWelfareSProxy.ReqGetSupplyReward(id);
|
|
|
if (result)
|
|
|
{
|
|
|
UpdateSupplyView();
|