|
@@ -2,6 +2,8 @@ using FairyGUI;
|
|
|
using UI.LuckyBox;
|
|
|
using UI.CommonGame;
|
|
|
using System;
|
|
|
+using System.Collections.Generic;
|
|
|
+using UnityEngine;
|
|
|
|
|
|
namespace GFGGame
|
|
|
{
|
|
@@ -10,7 +12,16 @@ namespace GFGGame
|
|
|
private UI_LuckyBoxUI _ui;
|
|
|
private ValueBarController _valueBarController;
|
|
|
|
|
|
+ private GameObject _gameObject;
|
|
|
+ private GoWrapper _wrapper;
|
|
|
+ private GameObject _gameObject1;
|
|
|
+ private GoWrapper _wrapper1;
|
|
|
+ private GameObject _gameObject2;
|
|
|
+ private GoWrapper _wrapper2;
|
|
|
+ private GameObject _gameObject3;
|
|
|
+ private GoWrapper _wrapper3;
|
|
|
|
|
|
+ private bool isActiveBoxOpen = false;
|
|
|
private int _selectedIndex = 0;
|
|
|
|
|
|
public override void Dispose()
|
|
@@ -32,8 +43,8 @@ namespace GFGGame
|
|
|
_valueBarController = new ValueBarController(_ui.m_valueBar);
|
|
|
_ui.m_btnBack.onClick.Add(OnClickBtnBack);
|
|
|
_ui.m_btnHome.onClick.Add(OnClickBtnHome);
|
|
|
- _ui.m_btnBuyOne.onClick.Add(OnClickBtnBuyOne);
|
|
|
- _ui.m_btnBuyTen.onClick.Add(OnClickBtnBuyTen);
|
|
|
+ _ui.m_btnBuyOne.target.onClick.Add(OnClickBtnBuyOne);
|
|
|
+ _ui.m_btnBuyTen.target.onClick.Add(OnClickBtnBuyTen);
|
|
|
_ui.m_btnPreview.onClick.Add(OnClickBtnPreview);
|
|
|
_ui.m_btnExchange.onClick.Add(OnClickBtnExChange);
|
|
|
_ui.m_btnLeft.onClick.Add(() => { onClickChange(-1); });
|
|
@@ -65,8 +76,9 @@ namespace GFGGame
|
|
|
boxId = (int)this.viewData;
|
|
|
}
|
|
|
}
|
|
|
- // int boxId = this.viewData != null ? (int)this.viewData : LuckyBoxDataManager.Instance.luckyBoxIds[0];
|
|
|
+
|
|
|
LuckyBoxBonusDataCache.currentBoxId = boxId;
|
|
|
+ isActiveBoxOpen = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.BOX_ID_1) >= 0;
|
|
|
|
|
|
_ui.m_listBg.numItems = LuckyBoxDataManager.Instance.luckyBoxIds.Length;
|
|
|
_ui.m_listBg.ScrollToView(Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxBonusDataCache.currentBoxId));
|
|
@@ -78,8 +90,9 @@ namespace GFGGame
|
|
|
_valueBarController.Controller(4);
|
|
|
|
|
|
onClickChange(0);
|
|
|
-
|
|
|
+ updateActiveBox();
|
|
|
}
|
|
|
+
|
|
|
private void RenderListBgItem(int index, GObject obj)
|
|
|
{
|
|
|
UI_ComListBgItem item = UI_ComListBgItem.Proxy(obj);
|
|
@@ -88,8 +101,8 @@ namespace GFGGame
|
|
|
}
|
|
|
private void CheckTime(object param = null)
|
|
|
{
|
|
|
- int index = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.BOX_ID_1);
|
|
|
- if (index < 0)
|
|
|
+ // int index = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.BOX_ID_1);
|
|
|
+ if (!isActiveBoxOpen)
|
|
|
{
|
|
|
//活动未开启
|
|
|
LuckyBoxBonusDataCache.currentBoxId = LuckyBoxDataManager.Instance.luckyBoxIds[0];
|
|
@@ -107,7 +120,10 @@ namespace GFGGame
|
|
|
UI_ComListBgItem item = UI_ComListBgItem.Proxy(_ui.m_listBg.GetChildAt(_ui.m_c1.selectedIndex));
|
|
|
LuckyBoxBonusDataCache.currentBoxId = LuckyBoxDataManager.Instance.luckyBoxIds[_ui.m_c1.selectedIndex];
|
|
|
item.m_txtTime.visible = LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
|
|
|
+ item.m_imgTitle.visible = LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
|
|
|
item.m_loaImg.visible = LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_3;
|
|
|
+ item.m_holder.visible = isActiveBoxOpen && LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
|
|
|
+ item.m_holder1.visible = isActiveBoxOpen && LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
|
|
|
|
|
|
onClickChange(0);
|
|
|
UpdateNormal();
|
|
@@ -137,13 +153,29 @@ namespace GFGGame
|
|
|
_ui.m_imgSpecial.visible = LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
|
|
|
_ui.m_btnRight.visible = _ui.m_c1.selectedIndex != _ui.m_listBg.numItems - 1;
|
|
|
_ui.m_btnLeft.visible = _ui.m_c1.selectedIndex != 0;
|
|
|
+ _ui.m_btnBuyOne.m_holder.visible = LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
|
|
|
+ _ui.m_btnBuyTen.m_holder.visible = LuckyBoxBonusDataCache.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
|
|
|
}
|
|
|
|
|
|
+ private void updateActiveBox()
|
|
|
+ {
|
|
|
+ if (isActiveBoxOpen)
|
|
|
+ {
|
|
|
+ int index = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.BOX_ID_1);
|
|
|
+ UI_ComListBgItem item = UI_ComListBgItem.Proxy(_ui.m_listBg.GetChildAt(index));
|
|
|
+ string resPath = ResPathUtil.GetViewEffectPath("ui_cj", "ui_cj_bt");
|
|
|
+ SceneController.AddObjectToView(_gameObject, _wrapper, item.m_holder, resPath, out _gameObject, out _wrapper);
|
|
|
+ string resPath3 = ResPathUtil.GetDressUpAnimationPath("dz_jiyuet");
|
|
|
+ SceneController.AddObjectToView(_gameObject3, _wrapper3, item.m_holder1, resPath3, out _gameObject3, out _wrapper3, 120);
|
|
|
|
|
|
+ string resPath1 = ResPathUtil.GetViewEffectPath("ui_cj", "ui_cj_sl");
|
|
|
+ SceneController.AddObjectToView(_gameObject1, _wrapper1, _ui.m_btnBuyOne.m_holder, resPath1, out _gameObject1, out _wrapper1);
|
|
|
+ SceneController.AddObjectToView(_gameObject2, _wrapper2, _ui.m_btnBuyTen.m_holder, resPath1, out _gameObject2, out _wrapper2);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
private void OnClickBtnExChange()
|
|
|
{
|
|
|
- // int storeId = ConstStoreId.CLOTHING_STORE_ID;
|
|
|
-
|
|
|
int storeId = LuckyBoxBonusDataCache.currentBoxId == 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, LuckyBoxBonusDataCache.currentBoxId });
|
|
|
this.Hide();
|
|
@@ -193,7 +225,7 @@ namespace GFGGame
|
|
|
{
|
|
|
if (GRoot.inst.GetTopWindow() == this.viewCom)
|
|
|
{
|
|
|
- if (GuideController.TryGuideByGuideId(_ui.m_btnBuyTen, ConstGuideId.MAIN_UI_BTN_ZHAI_XING, 1, true, "点击摘取十次"))
|
|
|
+ if (GuideController.TryGuideByGuideId(_ui.m_btnBuyTen.target, ConstGuideId.MAIN_UI_BTN_ZHAI_XING, 1, true, "点击摘取十次"))
|
|
|
{
|
|
|
Timers.inst.Remove(UpdateToCheckGuide);
|
|
|
}
|