|
@@ -5,6 +5,7 @@ using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine;
|
|
using ET;
|
|
using ET;
|
|
|
|
+using System.Linq;
|
|
|
|
|
|
namespace GFGGame
|
|
namespace GFGGame
|
|
{
|
|
{
|
|
@@ -91,6 +92,7 @@ namespace GFGGame
|
|
EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdateListItemData);
|
|
EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdateListItemData);
|
|
EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateListItemData);
|
|
EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateListItemData);
|
|
EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_FREE_TIME_CHANGED, UpdateFreeInfo);
|
|
EventAgent.AddEventListener(ConstMessage.LUCKY_BOX_FREE_TIME_CHANGED, UpdateFreeInfo);
|
|
|
|
+
|
|
}
|
|
}
|
|
protected override void OnShown()
|
|
protected override void OnShown()
|
|
{
|
|
{
|
|
@@ -100,6 +102,10 @@ namespace GFGGame
|
|
LuckyBoxDataManager.Instance.luckyBoxIds.Add(LuckyBoxDataManager.BOX_ID_2);
|
|
LuckyBoxDataManager.Instance.luckyBoxIds.Add(LuckyBoxDataManager.BOX_ID_2);
|
|
LuckyBoxDataManager.Instance.luckyBoxIds.Add(LuckyBoxDataManager.BOX_ID_3);
|
|
LuckyBoxDataManager.Instance.luckyBoxIds.Add(LuckyBoxDataManager.BOX_ID_3);
|
|
_activeBoxId = 0;
|
|
_activeBoxId = 0;
|
|
|
|
+ int activityId = ActivityDataManager.Instance.GetCurOpenActiveByType(ConstLimitTimeActivityType.ActLimitTsy);
|
|
|
|
+ if (activityId > 0)
|
|
|
|
+ GetWishingPoolInfo();
|
|
|
|
+
|
|
if (LuckyBoxDataManager.Instance.RotatingId > 0)
|
|
if (LuckyBoxDataManager.Instance.RotatingId > 0)
|
|
{
|
|
{
|
|
RotatingLuckyBoxCfg rotatingLuckyBox = RotatingLuckyBoxCfgArray.Instance.GetCfg(LuckyBoxDataManager.Instance.RotatingId);
|
|
RotatingLuckyBoxCfg rotatingLuckyBox = RotatingLuckyBoxCfgArray.Instance.GetCfg(LuckyBoxDataManager.Instance.RotatingId);
|
|
@@ -108,7 +114,7 @@ namespace GFGGame
|
|
LuckyBoxDataManager.Instance.luckyBoxIds.Insert(0, _activeBoxId);
|
|
LuckyBoxDataManager.Instance.luckyBoxIds.Insert(0, _activeBoxId);
|
|
}
|
|
}
|
|
|
|
|
|
- int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[0];
|
|
|
|
|
|
+ int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[1];
|
|
if (this.viewData != null)
|
|
if (this.viewData != null)
|
|
{
|
|
{
|
|
boxId = (int)this.viewData;
|
|
boxId = (int)this.viewData;
|
|
@@ -117,7 +123,7 @@ namespace GFGGame
|
|
if (GuideDataManager.IsGuideFinish(ConstGuideId.LUCKY_BOX) <= 0) boxId = LuckyBoxDataManager.BOX_ID_2;
|
|
if (GuideDataManager.IsGuideFinish(ConstGuideId.LUCKY_BOX) <= 0) boxId = LuckyBoxDataManager.BOX_ID_2;
|
|
LuckyBoxDataManager.Instance.currentBoxId = boxId;
|
|
LuckyBoxDataManager.Instance.currentBoxId = boxId;
|
|
|
|
|
|
- if (_activeBoxId > 0) Timers.inst.Add(1, 0, CheckTime);
|
|
|
|
|
|
+ if (_activeBoxId > 0 || boxId == LuckyBoxDataManager.BOX_ID_2) Timers.inst.Add(1, 0, CheckTime);
|
|
|
|
|
|
_valueBarController.OnShown();
|
|
_valueBarController.OnShown();
|
|
_valueBarController.Controller(4);
|
|
_valueBarController.Controller(4);
|
|
@@ -136,6 +142,17 @@ namespace GFGGame
|
|
Timers.inst.Add(1f, 0, OnTimerUpdate, 1);
|
|
Timers.inst.Add(1f, 0, OnTimerUpdate, 1);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private async void GetWishingPoolInfo()
|
|
|
|
+ {
|
|
|
|
+ bool result = await LuckyBoxSProxy.ReqGetWishingPoolInfo();
|
|
|
|
+ if (result)
|
|
|
|
+ {
|
|
|
|
+ int index = LuckyBoxDataManager.Instance.KsActivityId.IndexOf(5001);
|
|
|
|
+ if (index < 0 || !LuckyBoxDataManager.Instance.VsStatus[index])
|
|
|
|
+ ViewManager.Show<LuckyBoxWishView>(ConstLimitTimeActivityType.ActLimitTsy);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private void OnTimerUpdate(object param)
|
|
private void OnTimerUpdate(object param)
|
|
{
|
|
{
|
|
int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex];
|
|
int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex];
|
|
@@ -212,6 +229,14 @@ namespace GFGGame
|
|
GObject obj = _ui.m_listBg.GetChildAt(_curIndex);
|
|
GObject obj = _ui.m_listBg.GetChildAt(_curIndex);
|
|
UI_ComBox1 comBox = UI_ComBox1.Proxy(obj);
|
|
UI_ComBox1 comBox = UI_ComBox1.Proxy(obj);
|
|
|
|
|
|
|
|
+ int activityId = ActivityDataManager.Instance.GetCurOpenActiveByType(ConstLimitTimeActivityType.ActLimitTsy);
|
|
|
|
+ if (activityId > 0 && boxId == LuckyBoxDataManager.BOX_ID_2) {
|
|
|
|
+ comBox.m_showActivityType.selectedIndex = 1;
|
|
|
|
+ UpGiftBox(comBox);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ comBox.m_showActivityType.selectedIndex = 0;
|
|
|
|
+
|
|
if (!_lcukyBoxCtrl.ContainsKey(boxId))
|
|
if (!_lcukyBoxCtrl.ContainsKey(boxId))
|
|
{
|
|
{
|
|
_lcukyBoxCtrl.Add(boxId, new LuckyBoxController(comBox.m_comModel.target));
|
|
_lcukyBoxCtrl.Add(boxId, new LuckyBoxController(comBox.m_comModel.target));
|
|
@@ -220,11 +245,11 @@ namespace GFGGame
|
|
_lcukyBoxCtrl[LuckyBoxDataManager.Instance.currentBoxId].OnShown(LuckyBoxDataManager.Instance.currentBoxId);
|
|
_lcukyBoxCtrl[LuckyBoxDataManager.Instance.currentBoxId].OnShown(LuckyBoxDataManager.Instance.currentBoxId);
|
|
|
|
|
|
comBox.m_comLuckBoxBtn.m_imgSpecial.visible = boxId != LuckyBoxDataManager.BOX_ID_3;
|
|
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;
|
|
|
|
|
|
+ //GGraph holder = comBox.m_comLuckBoxBtn.m_btnBuyTen.GetChild("holder").asGraph;
|
|
|
|
+ //holder.visible = boxId != LuckyBoxDataManager.BOX_ID_3;
|
|
comBox.m_comLuckBoxBtn.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");
|
|
|
|
|
|
+ //_effectUI1 = EffectUIPool.CreateEffectUI(holder, "ui_LuckyBox", "Button_Glow");
|
|
_effectUI2 = EffectUIPool.CreateEffectUI(comBox.m_comLuckBoxBtn.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_txtCost.text = cfg.costNum.ToString();
|
|
@@ -250,9 +275,17 @@ namespace GFGGame
|
|
}
|
|
}
|
|
comBox.m_btnPreview.data = boxId;
|
|
comBox.m_btnPreview.data = boxId;
|
|
|
|
|
|
|
|
+ if (comBox.m_btnReward.data == null)
|
|
|
|
+ {
|
|
|
|
+ comBox.m_btnReward.onClick.Add(OnClikcBtnReward);
|
|
|
|
+ comBox.m_btnShop.onClick.Add(OnClikcBtnShop);
|
|
|
|
+ comBox.m_btnGiftBag.onClick.Add(OnClikcBtnGiftBag);
|
|
|
|
+ }
|
|
|
|
+ comBox.m_btnReward.data = boxId;
|
|
|
|
+
|
|
obj.data = boxId;
|
|
obj.data = boxId;
|
|
|
|
|
|
- comBox.m_grpTime.visible = boxId == _activeBoxId;
|
|
|
|
|
|
+ comBox.m_grpTime.visible = (boxId == _activeBoxId || boxId == LuckyBoxDataManager.BOX_ID_2);
|
|
if (boxId == _activeBoxId)
|
|
if (boxId == _activeBoxId)
|
|
{
|
|
{
|
|
long endTime = LuckyBoxDataManager.Instance.endTime;
|
|
long endTime = LuckyBoxDataManager.Instance.endTime;
|
|
@@ -271,6 +304,84 @@ namespace GFGGame
|
|
UpdateListItemData();
|
|
UpdateListItemData();
|
|
UpdateFreeInfo();
|
|
UpdateFreeInfo();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ private void OnClikcBtnReward()
|
|
|
|
+ {
|
|
|
|
+ ViewManager.Show<ActivityThemeLuckyBoxBonusView>();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void OnClikcBtnShop()
|
|
|
|
+ {
|
|
|
|
+ ViewManager.Show<StoreView>(new object[] { ConstStoreTabId.STORE_GIFT_BAG, ConstStoreSubId.STORE_GIFT_BAG_ACTIVITY }, new object[] { typeof(LuckyBoxView).FullName });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //刷新摘星活动期间的数据
|
|
|
|
+ private void UpGiftBox(UI_ComBox1 comBox)
|
|
|
|
+ {
|
|
|
|
+ int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex];
|
|
|
|
+ LuckyBoxCfg cfg = LuckyBoxCfgArray.Instance.GetCfg(boxId);
|
|
|
|
+ comBox.m_txtCount.SetVar("value", ActivityDataManager.Instance.lastDrawCount.ToString()).FlushVars();
|
|
|
|
+ comBox.m_txtCount.SetVar("name", cfg.name).FlushVars();
|
|
|
|
+
|
|
|
|
+ var activityInfoByTypeList = ActivityGlobalDataManager.Instance.GetActivityInfoByType(ActivityType.XSLB3);
|
|
|
|
+ var list = activityInfoByTypeList.Where(a => a.EndTime > TimeInfo.Instance.ServerNow()).ToList();
|
|
|
|
+ if (list.Count == 0)
|
|
|
|
+ {
|
|
|
|
+ comBox.m_comBagTime.target.visible = false;
|
|
|
|
+ comBox.m_btnGiftBag.visible = false;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ bool isSoldOut = true;
|
|
|
|
+ foreach (var activityInfo in list)
|
|
|
|
+ {
|
|
|
|
+ ActivityOpenCfg activityOpenCfg = ActivityOpenCfgArray.Instance.GetCfg(activityInfo.ActivityId);
|
|
|
|
+ var paramsArr = activityOpenCfg.paramsArr;
|
|
|
|
+ foreach (var shopCfgId in paramsArr)
|
|
|
|
+ {
|
|
|
|
+ var shopCfg = ShopCfgArray.Instance.GetCfg(shopCfgId);
|
|
|
|
+ var remainBuyNum = shopCfg.maxBuyNum - ShopDataManager.Instance.GetGoodsBuyNumById(shopCfgId);
|
|
|
|
+ //只要有一个商品还能购买,就不是售罄
|
|
|
|
+ if (remainBuyNum > 0)
|
|
|
|
+ {
|
|
|
|
+ isSoldOut = false;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (isSoldOut)
|
|
|
|
+ {
|
|
|
|
+ comBox.m_comBagTime.target.visible = false;
|
|
|
|
+ comBox.m_btnGiftBag.visible = false;
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ comBox.m_comBagTime.m_txtGiftBagTime.text = TimeUtil.GetTimeLeft(TimeInfo.Instance.ServerNow(), list[0].EndTime);
|
|
|
|
+ comBox.m_comBagTime.target.visible = true;
|
|
|
|
+ comBox.m_btnGiftBag.visible = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //限时礼包按钮点击执行方法
|
|
|
|
+ private void OnClikcBtnGiftBag()
|
|
|
|
+ {
|
|
|
|
+ var activityInfoByTypeList =
|
|
|
|
+ ActivityGlobalDataManager.Instance.GetActivityInfoByType(ActivityType.XSLB3);
|
|
|
|
+
|
|
|
|
+ var list = activityInfoByTypeList
|
|
|
|
+ .Where(a => a.EndTime > TimeInfo.Instance.ServerNow()).ToList();
|
|
|
|
+ if (list.Count == 0)
|
|
|
|
+ {
|
|
|
|
+ PromptController.Instance.ShowFloatTextPrompt("活动已结束");
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ ViewManager.Show<RushSaleGiftBoxView>(new object[] { ActivityType.XSLB3, this.viewData });
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private void UpdateListItemData()
|
|
private void UpdateListItemData()
|
|
{
|
|
{
|
|
int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex];
|
|
int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[_curIndex];
|
|
@@ -285,28 +396,36 @@ namespace GFGGame
|
|
UI_ComBox1.ProxyEnd();
|
|
UI_ComBox1.ProxyEnd();
|
|
}
|
|
}
|
|
|
|
|
|
- private void UpdateEffect()
|
|
|
|
|
|
+ private void CheckTime(object param = null)
|
|
{
|
|
{
|
|
|
|
+ if (LuckyBoxDataManager.Instance.currentBoxId == _activeBoxId)
|
|
|
|
+ {
|
|
|
|
+ if (LuckyBoxDataManager.Instance.currentBoxId != _activeBoxId) return;
|
|
|
|
+ long endTime = LuckyBoxDataManager.Instance.endTime;
|
|
|
|
+ long curTime = TimeHelper.ServerNow();
|
|
|
|
+ TimeUtil.FormattingTime(curTime, endTime, out int num, out string str);
|
|
|
|
|
|
|
|
+ GObject item = _ui.m_listBg.GetChildAt(0);
|
|
|
|
+ if (item == null) return;
|
|
|
|
+ GObject textField = item.asCom.GetChild("txtTime");
|
|
|
|
+ if (textField == null) return;
|
|
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
- private void CheckTime(object param = null)
|
|
|
|
- {
|
|
|
|
- if (LuckyBoxDataManager.Instance.currentBoxId != _activeBoxId) return;
|
|
|
|
- long endTime = LuckyBoxDataManager.Instance.endTime;
|
|
|
|
- long curTime = TimeHelper.ServerNow();
|
|
|
|
- TimeUtil.FormattingTime(curTime, endTime, out int num, out string str);
|
|
|
|
-
|
|
|
|
- GObject item = _ui.m_listBg.GetChildAt(0);
|
|
|
|
- if (item == null) return;
|
|
|
|
- GObject textField = item.asCom.GetChild("txtTime");
|
|
|
|
- if (textField == null) return;
|
|
|
|
-
|
|
|
|
- long time = endTime - curTime;
|
|
|
|
- string strTime = time > TimeUtil.SECOND_PER_DAY * 100 ? TimeUtil.FormattingTimeTo_DDHHmm(time) : TimeUtil.FormattingTimeTo_HHmmss(time);
|
|
|
|
- textField.asTextField.text = string.Format("活动时间:剩余{0}", strTime);
|
|
|
|
|
|
+ long time = endTime - curTime;
|
|
|
|
+ string strTime = time > TimeUtil.SECOND_PER_DAY * 100 ? TimeUtil.FormattingTimeTo_DDHHmm(time) : TimeUtil.FormattingTimeTo_HHmmss(time);
|
|
|
|
+ textField.asTextField.text = string.Format("活动时间:剩余{0}", strTime);
|
|
|
|
+ }
|
|
|
|
+ else if(LuckyBoxDataManager.Instance.currentBoxId == LuckyBoxDataManager.BOX_ID_2)
|
|
|
|
+ {
|
|
|
|
+ GObject item = _ui.m_listBg.GetChildAt(1);
|
|
|
|
+ if (item == null) return;
|
|
|
|
+ GObject textField = item.asCom.GetChild("txtTime");
|
|
|
|
+ if (textField == null) return;
|
|
|
|
+ long time = 100;
|
|
|
|
+ string strTime = time > TimeUtil.SECOND_PER_DAY * 100 ? TimeUtil.FormattingTimeTo_DDHHmm(time) : TimeUtil.FormattingTimeTo_HHmmss(time);
|
|
|
|
+ textField.asTextField.text = string.Format("概率提升剩余:{0}", strTime);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
private void updateBoxEffect()
|
|
private void updateBoxEffect()
|
|
{
|
|
{
|
|
if (isActiveBoxOpen)
|
|
if (isActiveBoxOpen)
|
|
@@ -411,7 +530,6 @@ namespace GFGGame
|
|
{
|
|
{
|
|
Reset();
|
|
Reset();
|
|
ViewManager.GoBackFrom(typeof(LuckyBoxView).FullName);
|
|
ViewManager.GoBackFrom(typeof(LuckyBoxView).FullName);
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
private void OnClickBtnHome()
|
|
private void OnClickBtnHome()
|