|
@@ -128,12 +128,38 @@ namespace GFGGame
|
|
|
_ui.m_listBg.scrollPane.decelerationRate = 0.8f;
|
|
|
LuckyBoxDataManager.Instance.luckyBoxIndex = _curIndex;
|
|
|
|
|
|
-
|
|
|
OnListBgScroll();
|
|
|
updateBoxEffect();
|
|
|
- UpdateFreeInfo();
|
|
|
|
|
|
Timers.inst.AddUpdate(CheckGuide);
|
|
|
+
|
|
|
+ Timers.inst.Add(1f, 0, OnTimerUpdate, 1);
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnTimerUpdate(object param)
|
|
|
+ {
|
|
|
+ int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex];
|
|
|
+ long freeTime = LuckyBoxDataManager.Instance.GetFreeTime(boxId);
|
|
|
+ GObject obj = _ui.m_listBg.GetChildAt(_curIndex);
|
|
|
+ UI_ComBox1 comBox = UI_ComBox1.Proxy(obj);
|
|
|
+ if (freeTime > 0)
|
|
|
+ {
|
|
|
+ long timeDifference = freeTime - TimeHelper.ServerNow();
|
|
|
+ if (timeDifference> 0)
|
|
|
+ {
|
|
|
+ comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 0;
|
|
|
+ comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = true;
|
|
|
+ string strFreeTime = TimeUtil.FormattingTimeTo_HHmmss(timeDifference);
|
|
|
+ comBox.m_comLuckBoxBtn.m_txtFreeTime.text = string.Format("{0}后免费", strFreeTime);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 1;
|
|
|
+ comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ UI_ComBox1.ProxyEnd();
|
|
|
}
|
|
|
|
|
|
private void RenderListBgItem(int index, GObject obj)
|
|
@@ -193,29 +219,30 @@ namespace GFGGame
|
|
|
|
|
|
_lcukyBoxCtrl[LuckyBoxDataManager.Instance.currentBoxId].OnShown(LuckyBoxDataManager.Instance.currentBoxId);
|
|
|
|
|
|
- comBox.m_imgSpecial.visible = boxId != LuckyBoxDataManager.BOX_ID_3;
|
|
|
- GGraph holder = comBox.m_btnBuyTen.GetChild("holder").asGraph;
|
|
|
+ comBox.m_comLuckBoxBtn.m_imgSpecial.visible = boxId != LuckyBoxDataManager.BOX_ID_3;
|
|
|
+ GGraph holder = comBox.m_comLuckBoxBtn.m_btnBuyTen.GetChild("holder").asGraph;
|
|
|
holder.visible = boxId != LuckyBoxDataManager.BOX_ID_3;
|
|
|
- comBox.m_holder.visible = boxId != LuckyBoxDataManager.BOX_ID_3;
|
|
|
+ comBox.m_comLuckBoxBtn.m_holder.visible = boxId != LuckyBoxDataManager.BOX_ID_3;
|
|
|
|
|
|
_effectUI1 = EffectUIPool.CreateEffectUI(holder, "ui_LuckyBox", "Button_Glow");
|
|
|
- _effectUI2 = EffectUIPool.CreateEffectUI(comBox.m_holder, "ui_LuckyBox", "but_text_dc");
|
|
|
+ _effectUI2 = EffectUIPool.CreateEffectUI(comBox.m_comLuckBoxBtn.m_holder, "ui_LuckyBox", "but_text_dc");
|
|
|
+
|
|
|
+ comBox.m_comLuckBoxBtn.m_comCostOne.m_txtCost.text = cfg.costNum.ToString();
|
|
|
+ comBox.m_comLuckBoxBtn.m_comCostOne.m_loaCost.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(cfg.costID).res);
|
|
|
|
|
|
- comBox.m_comCostOne.m_txtCost.text = cfg.costNum.ToString();
|
|
|
- comBox.m_comCostOne.m_loaCost.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(cfg.costID).res);
|
|
|
- comBox.m_comCostTen.m_txtCost.text = cfg.costNumTen.ToString();
|
|
|
- comBox.m_comCostTen.m_loaCost.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(cfg.costID).res);
|
|
|
- if (comBox.m_btnBuyOne.data == null)
|
|
|
+ comBox.m_comLuckBoxBtn.m_comCostTen.m_txtCost.text = cfg.costNumTen.ToString();
|
|
|
+ comBox.m_comLuckBoxBtn.m_comCostTen.m_loaCost.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(cfg.costID).res);
|
|
|
+ if (comBox.m_comLuckBoxBtn.m_btnBuyOne.data == null)
|
|
|
{
|
|
|
- comBox.m_btnBuyOne.onClick.Add(OnClickBtnBuyOne);
|
|
|
+ comBox.m_comLuckBoxBtn.m_btnBuyOne.onClick.Add(OnClickBtnBuyOne);
|
|
|
}
|
|
|
- comBox.m_btnBuyOne.data = boxId;
|
|
|
+ comBox.m_comLuckBoxBtn.m_btnBuyOne.data = boxId;
|
|
|
|
|
|
- if (comBox.m_btnBuyTen.data == null)
|
|
|
+ if (comBox.m_comLuckBoxBtn.m_btnBuyTen.data == null)
|
|
|
{
|
|
|
- comBox.m_btnBuyTen.onClick.Add(OnClickBtnBuyTen);
|
|
|
+ comBox.m_comLuckBoxBtn.m_btnBuyTen.onClick.Add(OnClickBtnBuyTen);
|
|
|
}
|
|
|
- comBox.m_btnBuyTen.data = boxId;
|
|
|
+ comBox.m_comLuckBoxBtn.m_btnBuyTen.data = boxId;
|
|
|
|
|
|
if (comBox.m_btnPreview.data == null)
|
|
|
{
|
|
@@ -242,6 +269,7 @@ namespace GFGGame
|
|
|
}
|
|
|
UI_ComBox1.ProxyEnd();
|
|
|
UpdateListItemData();
|
|
|
+ UpdateFreeInfo();
|
|
|
}
|
|
|
private void UpdateListItemData()
|
|
|
{
|
|
@@ -253,7 +281,7 @@ namespace GFGGame
|
|
|
comBox.m_txtOwned.SetVar("v1", "" + count).FlushVars();
|
|
|
comBox.m_txtOwned.SetVar("v2", "" + totalCount).FlushVars();
|
|
|
int boughtCount = GameGlobal.myNumericComponent.GetAsInt(cfg.numericType);
|
|
|
- comBox.m_txtRemainTimes.text = string.Format("今日剩余次数:{0}", cfg.maxCount - boughtCount);
|
|
|
+ comBox.m_comLuckBoxBtn.m_txtRemainTimes.text = string.Format("今日剩余次数:{0}", cfg.maxCount - boughtCount);
|
|
|
UI_ComBox1.ProxyEnd();
|
|
|
}
|
|
|
|
|
@@ -298,7 +326,10 @@ namespace GFGGame
|
|
|
GObject obj = context.sender as GObject;
|
|
|
int boxId = (int)obj.data;
|
|
|
LuckyBoxCfg luckyBoxCfg = LuckyBoxCfgArray.Instance.GetCfg(boxId);
|
|
|
+ long freeTime = LuckyBoxDataManager.Instance.GetFreeTime(boxId);
|
|
|
+
|
|
|
int boughtCount = GameGlobal.myNumericComponent.GetAsInt(luckyBoxCfg.numericType);
|
|
|
+
|
|
|
if (boughtCount + LuckyBoxDataManager.ONCE_TIME > luckyBoxCfg.maxCount)
|
|
|
{
|
|
|
PromptController.Instance.ShowFloatTextPrompt("抽奖次数不足");
|
|
@@ -306,7 +337,12 @@ namespace GFGGame
|
|
|
}
|
|
|
LuckyBoxDataManager.Instance.CheckItemEnough(boxId, LuckyBoxDataManager.ONCE_TIME, async () =>
|
|
|
{
|
|
|
- bool result = await LuckyBoxSProxy.ReqGetBonus(boxId, LuckyBoxDataManager.ONCE_TIME);
|
|
|
+ bool result = false;
|
|
|
+ if (freeTime > 0 && freeTime < TimeHelper.ServerNow())
|
|
|
+ result = await LuckyBoxSProxy.ReqGetBonus(boxId, LuckyBoxDataManager.ONCE_TIME, true);
|
|
|
+ else
|
|
|
+ result = await LuckyBoxSProxy.ReqGetBonus(boxId, LuckyBoxDataManager.ONCE_TIME);
|
|
|
+
|
|
|
if (result)
|
|
|
{
|
|
|
ViewManager.Show<LuckyBoxStarView>(null, new object[] { ViewName.LUCKY_BOX_VIEW, boxId });
|
|
@@ -355,6 +391,7 @@ namespace GFGGame
|
|
|
_lcukyBoxCtrl[key].OnHide();
|
|
|
}
|
|
|
|
|
|
+ Timers.inst.Remove(OnTimerUpdate);
|
|
|
Timers.inst.Remove(CheckTime);
|
|
|
// Timers.inst.Remove(UpdateBg);
|
|
|
Timers.inst.Remove(CheckGuide);
|
|
@@ -418,7 +455,29 @@ namespace GFGGame
|
|
|
|
|
|
private void UpdateFreeInfo()
|
|
|
{
|
|
|
-
|
|
|
+ int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex];
|
|
|
+ LuckyBoxCfg cfg = LuckyBoxCfgArray.Instance.GetCfg(boxId);
|
|
|
+ long freeTime = LuckyBoxDataManager.Instance.GetFreeTime(boxId);
|
|
|
+ GObject obj = _ui.m_listBg.GetChildAt(_curIndex);
|
|
|
+ UI_ComBox1 comBox = UI_ComBox1.Proxy(obj);
|
|
|
+ if (freeTime > 0)
|
|
|
+ {
|
|
|
+ if (freeTime > TimeHelper.ServerNow())
|
|
|
+ {
|
|
|
+ comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 0;
|
|
|
+ comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 1;
|
|
|
+ comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ comBox.m_comLuckBoxBtn.m_comCostOne.m_c1.selectedIndex = 0;
|
|
|
+ comBox.m_comLuckBoxBtn.m_txtFreeTime.visible = false;
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|