|
@@ -9,7 +9,8 @@ namespace GFGGame
|
|
|
public class DailyTaskView : BaseWindow
|
|
|
{
|
|
|
private UI_DailyTaskUI _ui;
|
|
|
- private List<FieldTaskCfg> _cfgs;
|
|
|
+ private List<DailyTaskCfg> _cfgs;
|
|
|
+ private List<DailyActiveRewardCfg> _rewardCfgs;
|
|
|
|
|
|
public override void Dispose()
|
|
|
{
|
|
@@ -33,9 +34,10 @@ namespace GFGGame
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
- _cfgs = FieldDataManager.Instance.GetTaskCfgs();
|
|
|
+ _cfgs = DailyTaskDataManager.Instance.GetDailyTaskCfgs();
|
|
|
+ _rewardCfgs = new List<DailyActiveRewardCfg>(DailyActiveRewardCfgArray.Instance.dataArray);
|
|
|
_ui.m_list.numItems = _cfgs.Count;
|
|
|
-
|
|
|
+ _ui.m_listReward.numItems = _rewardCfgs.Count;
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
@@ -45,16 +47,50 @@ namespace GFGGame
|
|
|
private void ListItemRender(int index, GObject obj)
|
|
|
{
|
|
|
UI_ListItem item = UI_ListItem.Proxy(obj);
|
|
|
+ item.m_c1.selectedIndex = DailyTaskDataManager.Instance.GetTaskStateById(_cfgs[index].id);
|
|
|
+ item.m_c2.selectedIndex = _cfgs[index].jumpId == "" ? 0 : 1;
|
|
|
|
|
|
+ if (item.m_btnGet.data == null)
|
|
|
+ {
|
|
|
+ item.m_btnGet.onClick.Add(OnBtnGetClick);
|
|
|
+ }
|
|
|
+ item.m_btnGet.data = _cfgs[index].id;
|
|
|
+ if (item.m_btnGo.data == null && _cfgs[index].jumpId != "")
|
|
|
+ {
|
|
|
+ item.m_btnGo.onClick.Add(OnBtnGoClick);
|
|
|
+ }
|
|
|
+ item.m_btnGo.data = _cfgs[index].jumpId;
|
|
|
|
|
|
UI_ListItem.ClearProxy();
|
|
|
}
|
|
|
+ private void OnBtnGetClick(EventContext context)
|
|
|
+ {
|
|
|
+ GObject btnGet = context.sender as GObject;
|
|
|
+
|
|
|
+ }
|
|
|
+ private void OnBtnGoClick(EventContext context)
|
|
|
+ {
|
|
|
+ GObject btnGo = context.sender as GObject;
|
|
|
+ ViewManager.Show(btnGo.data.ToString(), null, new object[] { typeof(DailyTaskView).Name, this.viewData });
|
|
|
+ }
|
|
|
private void ListRewardItemRender(int index, GObject obj)
|
|
|
{
|
|
|
UI_ListRewardItem item = UI_ListRewardItem.Proxy(obj);
|
|
|
|
|
|
-
|
|
|
+ if (item.target.data == null)
|
|
|
+ {
|
|
|
+ item.target.onClick.Add(OnRewardItemClick);
|
|
|
+ }
|
|
|
+ item.target.data = _rewardCfgs[index];
|
|
|
UI_ListRewardItem.ClearProxy();
|
|
|
}
|
|
|
+
|
|
|
+ private void OnRewardItemClick(EventContext context)
|
|
|
+ {
|
|
|
+ GObject item = context.sender as GObject;
|
|
|
+ // UI_ListRewardItem item = UI_ListRewardItem.Proxy(context.data as GObject);
|
|
|
+
|
|
|
+ ViewManager.Show<DailyTaskRewardView>(item.data);
|
|
|
+ }
|
|
|
}
|
|
|
}
|