|
@@ -1,5 +1,6 @@
|
|
|
|
|
|
using ET;
|
|
using ET;
|
|
|
|
+using FairyGUI;
|
|
using UI.Field;
|
|
using UI.Field;
|
|
using UnityEngine;
|
|
using UnityEngine;
|
|
|
|
|
|
@@ -37,24 +38,22 @@ namespace GFGGame
|
|
_ui.m_c1.onChanged.Add(OnDifficultyChange);
|
|
_ui.m_c1.onChanged.Add(OnDifficultyChange);
|
|
_valueBarController = new ValueBarController(_ui.m_comValueBar);
|
|
_valueBarController = new ValueBarController(_ui.m_comValueBar);
|
|
|
|
|
|
- // FieldDataManager.Instance.fieldInfos.theme = 1;
|
|
|
|
- // FieldDataManager.Instance.fieldInfos.bonusWeekly = 250;
|
|
|
|
- // FieldDataManager.Instance.fieldInfos.bonusMaxLimit = 800;
|
|
|
|
- // FieldDataManager.Instance.fieldInfos.highestLvls = new System.Collections.Generic.Dictionary<int, int>();
|
|
|
|
- // FieldDataManager.Instance.fieldInfos.taskDic = new System.Collections.Generic.Dictionary<int, int>();
|
|
|
|
|
|
+ EventAgent.AddEventListener(ConstMessage.FIELD_RESULT, UpdateView);
|
|
|
|
+ EventAgent.AddEventListener(ConstMessage.FIELD_TASK, UpdateView);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
protected override void OnShown()
|
|
{
|
|
{
|
|
base.OnShown();
|
|
base.OnShown();
|
|
_valueBarController.OnShown();
|
|
_valueBarController.OnShown();
|
|
- _selectedIndex = 0;
|
|
|
|
|
|
+ _dataManager = FieldDataManager.Instance;
|
|
|
|
+ _selectedIndex = _dataManager.difficulty;
|
|
_ui.m_c1.selectedIndex = _selectedIndex;
|
|
_ui.m_c1.selectedIndex = _selectedIndex;
|
|
|
|
|
|
_curCfg = FieldCfgArray.Instance.dataArray[_selectedIndex];
|
|
_curCfg = FieldCfgArray.Instance.dataArray[_selectedIndex];
|
|
- _dataManager = FieldDataManager.Instance;
|
|
|
|
_dataManager.chapterId = _curCfg.id;
|
|
_dataManager.chapterId = _curCfg.id;
|
|
- _dataManager.currFightLv = 1;
|
|
|
|
|
|
+
|
|
|
|
|
|
FieldCfg[] cfgs = FieldCfgArray.Instance.dataArray;
|
|
FieldCfg[] cfgs = FieldCfgArray.Instance.dataArray;
|
|
for (int i = 0; i < cfgs.Length; i++)
|
|
for (int i = 0; i < cfgs.Length; i++)
|
|
@@ -63,16 +62,21 @@ namespace GFGGame
|
|
_ui.target.GetChild("btn" + i).asButton.GetChild("imgLock").asImage.visible = !isPass;
|
|
_ui.target.GetChild("btn" + i).asButton.GetChild("imgLock").asImage.visible = !isPass;
|
|
}
|
|
}
|
|
UpdateView();
|
|
UpdateView();
|
|
|
|
+ Timers.inst.Add(1, 0, UpdateShowTime);
|
|
|
|
+
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
protected override void OnHide()
|
|
{
|
|
{
|
|
base.OnHide();
|
|
base.OnHide();
|
|
|
|
+ Timers.inst.Remove(UpdateShowTime);
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
private void OnClickBtnBack()
|
|
private void OnClickBtnBack()
|
|
{
|
|
{
|
|
|
|
+ _dataManager.difficulty = 0;
|
|
ViewManager.GoBackFrom(typeof(FieldView).FullName);
|
|
ViewManager.GoBackFrom(typeof(FieldView).FullName);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -100,6 +104,7 @@ namespace GFGGame
|
|
_selectedIndex = _ui.m_c1.selectedIndex;
|
|
_selectedIndex = _ui.m_c1.selectedIndex;
|
|
_curCfg = FieldCfgArray.Instance.dataArray[_selectedIndex]; ;
|
|
_curCfg = FieldCfgArray.Instance.dataArray[_selectedIndex]; ;
|
|
_dataManager.chapterId = _curCfg.id;
|
|
_dataManager.chapterId = _curCfg.id;
|
|
|
|
+ _dataManager.difficulty = _selectedIndex;
|
|
UpdateView();
|
|
UpdateView();
|
|
}
|
|
}
|
|
private void UpdateView()
|
|
private void UpdateView()
|
|
@@ -109,6 +114,12 @@ namespace GFGGame
|
|
_ui.m_txtConsume.text = string.Format("x{0}", _curCfg.needPower);
|
|
_ui.m_txtConsume.text = string.Format("x{0}", _curCfg.needPower);
|
|
_ui.m_proTaskReward.max = _dataManager.fieldInfos.bonusMaxLimit;
|
|
_ui.m_proTaskReward.max = _dataManager.fieldInfos.bonusMaxLimit;
|
|
_ui.m_proTaskReward.value = _dataManager.fieldInfos.bonusWeekly;
|
|
_ui.m_proTaskReward.value = _dataManager.fieldInfos.bonusWeekly;
|
|
|
|
+ _ui.m_loaTaskReward.url = ResPathUtil.GetIconPath(ItemCfgArray.Instance.GetCfg(ConstItemID.DIAMOND_RED));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ private void UpdateShowTime(object param)
|
|
|
|
+ {
|
|
|
|
+ _ui.m_txtTime.text = string.Format("{0}后刷新", TimeUtil.FormattingTime(TimeHelper.ServerNowSecs, TimeUtil.GetNextWeekTime(GlobalCfgArray.globalCfg.refreshTime)));
|
|
}
|
|
}
|
|
private void OnClickBtnGo()
|
|
private void OnClickBtnGo()
|
|
{
|
|
{
|