|
@@ -23,7 +23,7 @@ namespace GFGGame
|
|
private GoWrapper _wrapper3;
|
|
private GoWrapper _wrapper3;
|
|
|
|
|
|
private bool isActiveBoxOpen = false;
|
|
private bool isActiveBoxOpen = false;
|
|
-
|
|
|
|
|
|
+ private int bgIndex = 0;
|
|
|
|
|
|
public override void Dispose()
|
|
public override void Dispose()
|
|
{
|
|
{
|
|
@@ -79,14 +79,18 @@ namespace GFGGame
|
|
}
|
|
}
|
|
|
|
|
|
LuckyBoxDataManager.Instance.currentBoxId = boxId;
|
|
LuckyBoxDataManager.Instance.currentBoxId = boxId;
|
|
|
|
+ Debug.Log("zoya0:" + LuckyBoxDataManager.Instance.currentBoxId);
|
|
isActiveBoxOpen = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.BOX_ID_1) >= 0;
|
|
isActiveBoxOpen = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.BOX_ID_1) >= 0;
|
|
|
|
+ bgIndex = 0;
|
|
|
|
|
|
int index = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.Instance.currentBoxId);
|
|
int index = Array.IndexOf(LuckyBoxDataManager.Instance.luckyBoxIds, LuckyBoxDataManager.Instance.currentBoxId);
|
|
_ui.m_listBg.numItems = LuckyBoxDataManager.Instance.luckyBoxIds.Length;
|
|
_ui.m_listBg.numItems = LuckyBoxDataManager.Instance.luckyBoxIds.Length;
|
|
_ui.m_listBg.ScrollToView(index);
|
|
_ui.m_listBg.ScrollToView(index);
|
|
_ui.m_listBg.scrollPane.decelerationRate = 0.8f;
|
|
_ui.m_listBg.scrollPane.decelerationRate = 0.8f;
|
|
-
|
|
|
|
- Timers.inst.Add(1, 0, CheckTime);
|
|
|
|
|
|
+ if (isActiveBoxOpen)
|
|
|
|
+ {
|
|
|
|
+ Timers.inst.Add(1, 0, CheckTime);
|
|
|
|
+ }
|
|
|
|
|
|
_valueBarController.OnShown();
|
|
_valueBarController.OnShown();
|
|
_valueBarController.Controller(4);
|
|
_valueBarController.Controller(4);
|
|
@@ -95,20 +99,25 @@ namespace GFGGame
|
|
// UpdateNormal();
|
|
// UpdateNormal();
|
|
OnListBgScroll();
|
|
OnListBgScroll();
|
|
updateBoxEffect();
|
|
updateBoxEffect();
|
|
|
|
+ Timers.inst.Add(8, 0, UpdateBg);
|
|
}
|
|
}
|
|
|
|
|
|
private void RenderListBgItem(int index, GObject obj)
|
|
private void RenderListBgItem(int index, GObject obj)
|
|
{
|
|
{
|
|
UI_ComListBgItem item = UI_ComListBgItem.Proxy(obj);
|
|
UI_ComListBgItem item = UI_ComListBgItem.Proxy(obj);
|
|
- LuckyBoxCfg cfg = LuckyBoxCfgArray.Instance.GetCfg(LuckyBoxDataManager.Instance.luckyBoxIds[index]);
|
|
|
|
- item.m_loaBg.url = string.Format("ui://LuckyBox/{0}", cfg.res);
|
|
|
|
|
|
+ int id = LuckyBoxDataManager.Instance.luckyBoxIds[index];
|
|
|
|
+ LuckyBoxCfg cfg = LuckyBoxCfgArray.Instance.GetCfg(id);
|
|
|
|
+ item.m_loaBg.url = string.Format("ui://LuckyBox/{0}", cfg.resArr[0]);
|
|
|
|
+ item.target.data = id;
|
|
}
|
|
}
|
|
private void CheckTime(object param = null)
|
|
private void CheckTime(object param = null)
|
|
{
|
|
{
|
|
if (!isActiveBoxOpen)
|
|
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);
|
|
Timers.inst.Remove(CheckTime);
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
@@ -121,7 +130,9 @@ namespace GFGGame
|
|
private void OnListBgScroll()
|
|
private void OnListBgScroll()
|
|
{
|
|
{
|
|
UI_ComListBgItem item = UI_ComListBgItem.Proxy(_ui.m_listBg.GetChildAt(_ui.m_c1.selectedIndex));
|
|
UI_ComListBgItem item = UI_ComListBgItem.Proxy(_ui.m_listBg.GetChildAt(_ui.m_c1.selectedIndex));
|
|
- LuckyBoxDataManager.Instance.currentBoxId = LuckyBoxDataManager.Instance.luckyBoxIds[_ui.m_c1.selectedIndex];
|
|
|
|
|
|
+ LuckyBoxDataManager.Instance.currentBoxId = (int)item.target.data;// LuckyBoxDataManager.Instance.luckyBoxIds[_ui.m_c1.selectedIndex];
|
|
|
|
+ Debug.Log("zoya2:" + LuckyBoxDataManager.Instance.currentBoxId);
|
|
|
|
+
|
|
item.m_grpTime.visible = LuckyBoxDataManager.Instance.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
|
|
item.m_grpTime.visible = LuckyBoxDataManager.Instance.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
|
|
item.m_imgTitle.visible = LuckyBoxDataManager.Instance.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
|
|
item.m_imgTitle.visible = LuckyBoxDataManager.Instance.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
|
|
item.m_holder.visible = isActiveBoxOpen && LuckyBoxDataManager.Instance.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
|
|
item.m_holder.visible = isActiveBoxOpen && LuckyBoxDataManager.Instance.currentBoxId == LuckyBoxDataManager.BOX_ID_1;
|
|
@@ -215,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()
|
|
protected override void OnHide()
|
|
{
|
|
{
|
|
base.OnHide();
|
|
base.OnHide();
|
|
@@ -224,6 +244,7 @@ namespace GFGGame
|
|
Timers.inst.Remove(CheckTime);
|
|
Timers.inst.Remove(CheckTime);
|
|
EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, UpdateNormal);
|
|
EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, UpdateNormal);
|
|
EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateNormal);
|
|
EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateNormal);
|
|
|
|
+ Timers.inst.Remove(UpdateBg);
|
|
}
|
|
}
|
|
|
|
|
|
private void OnClickBtnBack()
|
|
private void OnClickBtnBack()
|
|
@@ -242,6 +263,8 @@ namespace GFGGame
|
|
private void Reset()
|
|
private void Reset()
|
|
{
|
|
{
|
|
LuckyBoxDataManager.Instance.currentBoxId = LuckyBoxDataManager.BOX_ID_1;
|
|
LuckyBoxDataManager.Instance.currentBoxId = LuckyBoxDataManager.BOX_ID_1;
|
|
|
|
+ Debug.Log("zoya3:" + LuckyBoxDataManager.Instance.currentBoxId);
|
|
|
|
+
|
|
}
|
|
}
|
|
protected override void UpdateToCheckGuide(object param)
|
|
protected override void UpdateToCheckGuide(object param)
|
|
{
|
|
{
|