|
@@ -23,7 +23,7 @@ namespace GFGGame
|
|
|
private GoWrapper _wrapper3;
|
|
|
|
|
|
private bool isActiveBoxOpen = false;
|
|
|
-
|
|
|
+ private int bgIndex = 0;
|
|
|
|
|
|
public override void Dispose()
|
|
|
{
|
|
@@ -81,13 +81,16 @@ namespace GFGGame
|
|
|
LuckyBoxDataManager.Instance.currentBoxId = boxId;
|
|
|
Debug.Log("zoya0:" + LuckyBoxDataManager.Instance.currentBoxId);
|
|
|
isActiveBoxOpen = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.BOX_ID_1) >= 0;
|
|
|
+ bgIndex = 0;
|
|
|
|
|
|
int index = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.Instance.currentBoxId);
|
|
|
_ui.m_listBg.numItems = LuckyBoxDataManager.Instance.luckyBoxIds.Length;
|
|
|
_ui.m_listBg.ScrollToView(index);
|
|
|
_ui.m_listBg.scrollPane.decelerationRate = 0.8f;
|
|
|
-
|
|
|
- Timers.inst.Add(1, 0, CheckTime);
|
|
|
+ if (isActiveBoxOpen)
|
|
|
+ {
|
|
|
+ Timers.inst.Add(1, 0, CheckTime);
|
|
|
+ }
|
|
|
|
|
|
_valueBarController.OnShown();
|
|
|
_valueBarController.Controller(4);
|
|
@@ -96,6 +99,7 @@ namespace GFGGame
|
|
|
// UpdateNormal();
|
|
|
OnListBgScroll();
|
|
|
updateBoxEffect();
|
|
|
+ Timers.inst.Add(8, 0, UpdateBg);
|
|
|
}
|
|
|
|
|
|
private void RenderListBgItem(int index, GObject obj)
|
|
@@ -103,15 +107,15 @@ namespace GFGGame
|
|
|
UI_ComListBgItem item = UI_ComListBgItem.Proxy(obj);
|
|
|
int id = LuckyBoxDataManager.Instance.luckyBoxIds[index];
|
|
|
LuckyBoxCfg cfg = LuckyBoxCfgArray.Instance.GetCfg(id);
|
|
|
- item.m_loaBg.url = string.Format("ui://LuckyBox/{0}", cfg.res);
|
|
|
+ item.m_loaBg.url = string.Format("ui://LuckyBox/{0}", cfg.resArr[0]);
|
|
|
item.target.data = id;
|
|
|
}
|
|
|
private void CheckTime(object param = null)
|
|
|
{
|
|
|
if (!isActiveBoxOpen)
|
|
|
{
|
|
|
- //活动未开启
|
|
|
- // LuckyBoxDataManager.Instance.currentBoxId = LuckyBoxDataManager.Instance.luckyBoxIds[0];
|
|
|
+ //活动未开启
|
|
|
+ LuckyBoxDataManager.Instance.currentBoxId = LuckyBoxDataManager.Instance.luckyBoxIds[0];
|
|
|
Debug.Log("zoya1:" + LuckyBoxDataManager.Instance.currentBoxId);
|
|
|
|
|
|
Timers.inst.Remove(CheckTime);
|
|
@@ -222,7 +226,16 @@ namespace GFGGame
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ private void UpdateBg(object param)
|
|
|
+ {
|
|
|
+ int index = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.Instance.currentBoxId);
|
|
|
+ UI_ComListBgItem item = UI_ComListBgItem.Proxy(_ui.m_listBg.GetChildAt(index));
|
|
|
+ int id = (int)item.target.data;
|
|
|
+ string[] resArr = LuckyBoxCfgArray.Instance.GetCfg(id).resArr;
|
|
|
+ bgIndex++;
|
|
|
+ if (bgIndex == resArr.Length) bgIndex = 0;
|
|
|
+ item.m_loaBg.url = string.Format("ui://LuckyBox/{0}", resArr[bgIndex]);
|
|
|
+ }
|
|
|
protected override void OnHide()
|
|
|
{
|
|
|
base.OnHide();
|
|
@@ -231,6 +244,7 @@ namespace GFGGame
|
|
|
Timers.inst.Remove(CheckTime);
|
|
|
EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, UpdateNormal);
|
|
|
EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateNormal);
|
|
|
+ Timers.inst.Remove(UpdateBg);
|
|
|
}
|
|
|
|
|
|
private void OnClickBtnBack()
|