|
@@ -31,6 +31,7 @@ namespace GFGGame
|
|
|
private DressUpObjUI _dressUpObjUIChangXi;
|
|
|
|
|
|
private bool isActiveBoxOpen = false;
|
|
|
+ private int _activeBoxId = 0;
|
|
|
private int _bgIndex = 0;
|
|
|
private int _curIndex = 0;
|
|
|
|
|
@@ -96,10 +97,14 @@ namespace GFGGame
|
|
|
EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, OnListBgScroll);
|
|
|
EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, OnListBgScroll);
|
|
|
}
|
|
|
- protected override void OnShown()
|
|
|
+ protected override async void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
|
|
|
+ LuckyBoxDataManager.Instance.luckyBoxIds.Clear();
|
|
|
+ LuckyBoxDataManager.Instance.luckyBoxIds.Add(LuckyBoxDataManager.BOX_ID_2);
|
|
|
+ LuckyBoxDataManager.Instance.luckyBoxIds.Add(LuckyBoxDataManager.BOX_ID_3);
|
|
|
+
|
|
|
int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[0];
|
|
|
if (this.viewData != null)
|
|
|
{
|
|
@@ -113,20 +118,26 @@ namespace GFGGame
|
|
|
boxId = (int)this.viewData;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
if (GuideDataManager.IsGuideFinish(ConstGuideId.LUCKY_BOX) <= 0) boxId = LuckyBoxDataManager.BOX_ID_2;
|
|
|
LuckyBoxDataManager.Instance.currentBoxId = boxId;
|
|
|
|
|
|
- isActiveBoxOpen = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.BOX_ID_1) >= 0;
|
|
|
- if (isActiveBoxOpen)
|
|
|
+ _activeBoxId = 0;
|
|
|
+ int result = await LuckyBoxSProxy.ReqGetLuckyBoxRotatingInfo();
|
|
|
+ if (result > 0)
|
|
|
{
|
|
|
+ RotatingLuckyBoxCfg rotatingLuckyBox = RotatingLuckyBoxCfgArray.Instance.GetCfg(result);
|
|
|
+ _activeBoxId = rotatingLuckyBox.luckyBoxId;
|
|
|
+ LuckyBoxDataManager.Instance.endTime = TimeUtil.GetTimestamp(rotatingLuckyBox.endTime);
|
|
|
+ LuckyBoxDataManager.Instance.luckyBoxIds.Insert(0, _activeBoxId);
|
|
|
Timers.inst.Add(1, 0, CheckTime);
|
|
|
}
|
|
|
|
|
|
_valueBarController.OnShown();
|
|
|
_valueBarController.Controller(4);
|
|
|
|
|
|
- _curIndex = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, boxId);
|
|
|
- _ui.m_listBg.numItems = LuckyBoxDataManager.Instance.luckyBoxIds.Length;
|
|
|
+ _curIndex = LuckyBoxDataManager.Instance.luckyBoxIds.IndexOf(boxId);
|
|
|
+ _ui.m_listBg.numItems = LuckyBoxDataManager.Instance.luckyBoxIds.Count;
|
|
|
_ui.m_listBg.ScrollToView(_curIndex);
|
|
|
_ui.m_listBg.scrollPane.decelerationRate = 0.8f;
|
|
|
|
|
@@ -137,8 +148,15 @@ namespace GFGGame
|
|
|
}
|
|
|
private string GetListItemResource(int index)
|
|
|
{
|
|
|
- int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[index];
|
|
|
- return string.Format("UI://LuckyBox/ComBox_{0}", boxId);
|
|
|
+ if (index == 0 && _activeBoxId > 0)
|
|
|
+ {
|
|
|
+ return "UI://LuckyBox/ComBox";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ int boxId = LuckyBoxDataManager.Instance.luckyBoxIds[index];
|
|
|
+ return string.Format("UI://LuckyBox/ComBox_{0}", boxId);
|
|
|
+ }
|
|
|
}
|
|
|
private void RenderListBgItem(int index, GObject obj)
|
|
|
{
|
|
@@ -149,8 +167,8 @@ namespace GFGGame
|
|
|
loaBg.url = ResPathUtil.GetBgImgPath(cfg.resArr[0]);
|
|
|
GButton btnPreview = (obj as GComponent).GetChild("btnPreview").asButton;
|
|
|
btnPreview.GetController("c1").selectedIndex = boxId;
|
|
|
- GButton btnExchange = (obj as GComponent).GetChild("btnExchange").asButton;
|
|
|
- btnExchange.GetController("c1").selectedIndex = boxId;
|
|
|
+ // GButton btnExchange = (obj as GComponent).GetChild("btnExchange").asButton;
|
|
|
+ // btnExchange.GetController("c1").selectedIndex = boxId;
|
|
|
GTextField txtOwned = (obj as GComponent).GetChild("txtOwned").asTextField;
|
|
|
LuckyBoxDataManager.Instance.GetOwnedCount(boxId, out int count, out int totalCount);
|
|
|
txtOwned.SetVar("v1", "" + count).FlushVars();
|
|
@@ -182,11 +200,11 @@ namespace GFGGame
|
|
|
}
|
|
|
btnBuyTen.data = boxId;
|
|
|
|
|
|
- if (btnExchange.data == null)
|
|
|
- {
|
|
|
- btnExchange.onClick.Add(OnClickBtnExChange);
|
|
|
- }
|
|
|
- btnExchange.data = boxId;
|
|
|
+ // if (btnExchange.data == null)
|
|
|
+ // {
|
|
|
+ // btnExchange.onClick.Add(OnClickBtnExChange);
|
|
|
+ // }
|
|
|
+ // btnExchange.data = boxId;
|
|
|
if (btnPreview.data == null)
|
|
|
{
|
|
|
btnPreview.onClick.Add(OnClickBtnPreview);
|
|
@@ -195,33 +213,39 @@ namespace GFGGame
|
|
|
|
|
|
obj.data = boxId;
|
|
|
|
|
|
- if (boxId == 1)
|
|
|
+ if (boxId == _activeBoxId)
|
|
|
{
|
|
|
long endTime = LuckyBoxDataManager.Instance.endTime;
|
|
|
long curTime = TimeHelper.ServerNow();
|
|
|
TimeUtil.FormattingTime(curTime, endTime, out int num, out string str);
|
|
|
(obj as GComponent).GetChild("txtTime").asTextField.text = string.Format("剩余{0}{1}", num, str);
|
|
|
+
|
|
|
GGraph holder = (obj as GComponent).GetChild("holder").asGraph;
|
|
|
- GGraph holder1 = (obj as GComponent).GetChild("holder1").asGraph;
|
|
|
+ holder.visible = false;
|
|
|
+ if (cfg.suitShowArr.Length > 0)
|
|
|
+ {
|
|
|
+ //羲和
|
|
|
+ holder.SetXY(cfg.suitShowArr[0][1], cfg.suitShowArr[0][2]);
|
|
|
+ _dressUpObjUIXiHe.ResetSceneObj(100, false, false, null, false);
|
|
|
+ _dressUpObjUIXiHe.dressUpObj.PutOnSuitCfg(cfg.suitShowArr[0][0], true, null, false, false);
|
|
|
+ _dressUpObjUIXiHe.UpdateWrapper(holder);
|
|
|
+ }
|
|
|
|
|
|
- //羲和
|
|
|
- _dressUpObjUIXiHe.ResetSceneObj(100, false, false, null, false);
|
|
|
- _dressUpObjUIXiHe.dressUpObj.PutOnSuitCfg(201013, true, null, false, false);
|
|
|
- _dressUpObjUIXiHe.UpdateWrapper(holder);
|
|
|
|
|
|
- //常曦
|
|
|
- _dressUpObjUIChangXi.ResetSceneObj(100, false, false, null, false);
|
|
|
- _dressUpObjUIChangXi.dressUpObj.PutOnSuitCfg(201006, true, null, false, false);
|
|
|
- _dressUpObjUIChangXi.UpdateWrapper(holder1);
|
|
|
+ GGraph holder1 = (obj as GComponent).GetChild("holder1").asGraph;
|
|
|
+ holder1.visible = false;
|
|
|
+ if (cfg.suitShowArr.Length > 1)
|
|
|
+ {
|
|
|
+ //羲和
|
|
|
+ holder.SetXY(cfg.suitShowArr[1][1], cfg.suitShowArr[1][2]);
|
|
|
+ //常曦
|
|
|
+ _dressUpObjUIChangXi.ResetSceneObj(100, false, false, null, false);
|
|
|
+ _dressUpObjUIChangXi.dressUpObj.PutOnSuitCfg(cfg.suitShowArr[1][0], true, null, false, false);
|
|
|
+ _dressUpObjUIChangXi.UpdateWrapper(holder1);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // private void UpdateTime(object param)
|
|
|
- // {
|
|
|
- // GTextField txtTime = _ui.m_listBg.GetChildAt(0).asCom.GetChild("txtTime").asTextField;
|
|
|
- // txtTime.text = TimeUtil.FormattingTime(LuckyBoxDataManager.Instance.startTime, LuckyBoxDataManager.Instance.startTime);
|
|
|
- // }
|
|
|
-
|
|
|
private void UpdateBg(object param)
|
|
|
{
|
|
|
string[] resArr = LuckyBoxCfgArray.Instance.GetCfg(LuckyBoxDataManager.Instance.currentBoxId).resArr;
|
|
@@ -262,19 +286,11 @@ namespace GFGGame
|
|
|
_ui.m_btnLeft.grayed = _curIndex <= 0;
|
|
|
_ui.m_btnRight.grayed = _curIndex >= _ui.m_listBg.numItems - 1;
|
|
|
|
|
|
- // if (LuckyBoxDataManager.Instance.currentBoxId == LuckyBoxDataManager.BOX_ID_1)
|
|
|
- // {
|
|
|
- // Timers.inst.Add(1, 0, CheckTime);
|
|
|
- // }
|
|
|
- // else
|
|
|
- // {
|
|
|
- // Timers.inst.Remove(CheckTime);
|
|
|
- // }
|
|
|
}
|
|
|
|
|
|
private void CheckTime(object param = null)
|
|
|
{
|
|
|
- if (LuckyBoxDataManager.Instance.currentBoxId != LuckyBoxDataManager.BOX_ID_1) return;
|
|
|
+ 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);
|
|
@@ -303,14 +319,14 @@ namespace GFGGame
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- private void OnClickBtnExChange(EventContext context)
|
|
|
- {
|
|
|
- GObject obj = context.sender as GObject;
|
|
|
- int boxId = (int)obj.data;
|
|
|
- int storeId = boxId == LuckyBoxDataManager.BOX_ID_1 ? ConstStoreId.LUCKY_BOX_ACTIVITY_STORE_ID : ConstStoreId.LUCKY_BOX_STORE_ID;
|
|
|
- ViewManager.Show(ViewName.CLOTHING_SHOP_VIEW, new object[] { storeId }, new object[] { ViewName.LUCKY_BOX_VIEW, boxId });
|
|
|
- this.Hide();
|
|
|
- }
|
|
|
+ // private void OnClickBtnExChange(EventContext context)
|
|
|
+ // {
|
|
|
+ // GObject obj = context.sender as GObject;
|
|
|
+ // int boxId = (int)obj.data;
|
|
|
+ // int storeId = boxId == LuckyBoxDataManager.BOX_ID_1 ? ConstStoreId.LUCKY_BOX_ACTIVITY_STORE_ID : ConstStoreId.LUCKY_BOX_STORE_ID;
|
|
|
+ // ViewManager.Show(ViewName.CLOTHING_SHOP_VIEW, new object[] { storeId }, new object[] { ViewName.LUCKY_BOX_VIEW, boxId });
|
|
|
+ // this.Hide();
|
|
|
+ // }
|
|
|
private void OnClickBtnPreview(EventContext context)
|
|
|
{
|
|
|
GObject obj = context.sender as GObject;
|