|
@@ -33,8 +33,8 @@ namespace GFGGame
|
|
_valueBarController = new ValueBarController(_ui.m_comValueBar);
|
|
_valueBarController = new ValueBarController(_ui.m_comValueBar);
|
|
|
|
|
|
_ui.m_list.itemRenderer = ListItemRender;
|
|
_ui.m_list.itemRenderer = ListItemRender;
|
|
- _ui.m_listReward.itemRenderer = ListRewardItemRender;
|
|
|
|
-
|
|
|
|
|
|
+ _ui.m_listReward.itemRenderer = ListBoxRewardItemRender;
|
|
|
|
+ _ui.m_listReward.onClickItem.Add(OnBoxRewardItemClick);
|
|
}
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
protected override void OnShown()
|
|
@@ -42,9 +42,8 @@ namespace GFGGame
|
|
base.OnShown();
|
|
base.OnShown();
|
|
_valueBarController.OnShown();
|
|
_valueBarController.OnShown();
|
|
|
|
|
|
- _cfgs = DailyTaskDataManager.Instance.GetDailyTaskCfgs();
|
|
|
|
|
|
+ UpdateList();
|
|
_rewardCfgs = new List<DailyActiveRewardCfg>(DailyActiveRewardCfgArray.Instance.dataArray);
|
|
_rewardCfgs = new List<DailyActiveRewardCfg>(DailyActiveRewardCfgArray.Instance.dataArray);
|
|
- _ui.m_list.numItems = _cfgs.Count;
|
|
|
|
_ui.m_listReward.numItems = _rewardCfgs.Count;
|
|
_ui.m_listReward.numItems = _rewardCfgs.Count;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -52,6 +51,12 @@ namespace GFGGame
|
|
{
|
|
{
|
|
base.OnHide();
|
|
base.OnHide();
|
|
}
|
|
}
|
|
|
|
+ private void UpdateList()
|
|
|
|
+ {
|
|
|
|
+ _cfgs = DailyTaskDataManager.Instance.GetDailyTaskCfgs();
|
|
|
|
+ _ui.m_list.numItems = _cfgs.Count;
|
|
|
|
+
|
|
|
|
+ }
|
|
private void ListItemRender(int index, GObject obj)
|
|
private void ListItemRender(int index, GObject obj)
|
|
{
|
|
{
|
|
UI_ListItem item = UI_ListItem.Proxy(obj);
|
|
UI_ListItem item = UI_ListItem.Proxy(obj);
|
|
@@ -69,12 +74,33 @@ namespace GFGGame
|
|
}
|
|
}
|
|
item.m_btnGo.data = _cfgs[index].jumpId;
|
|
item.m_btnGo.data = _cfgs[index].jumpId;
|
|
|
|
|
|
|
|
+ if (item.target.data == null)
|
|
|
|
+ {
|
|
|
|
+ item.m_listTaskReward.itemRenderer = ListTaskRewardItemRender;
|
|
|
|
+ item.m_listTaskReward.numItems = _cfgs[index].rewardsArr.Length;
|
|
|
|
+ }
|
|
|
|
+ item.target.data = _cfgs[index].rewardsArr;
|
|
UI_ListItem.ClearProxy();
|
|
UI_ListItem.ClearProxy();
|
|
}
|
|
}
|
|
- private void OnBtnGetClick(EventContext context)
|
|
|
|
|
|
+ private void ListTaskRewardItemRender(int index, GObject obj)
|
|
|
|
+ {
|
|
|
|
+ UI_ListTaskRewardItem item = UI_ListTaskRewardItem.Proxy(obj);
|
|
|
|
+ int[][] rewards = (int[][])item.target.data;
|
|
|
|
+
|
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(rewards[index][0]);
|
|
|
|
+ item.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(itemCfg.res);
|
|
|
|
+ item.m_txtNum.text = rewards[index][1].ToString();
|
|
|
|
+ }
|
|
|
|
+ private async void OnBtnGetClick(EventContext context)
|
|
{
|
|
{
|
|
GObject btnGet = context.sender as GObject;
|
|
GObject btnGet = context.sender as GObject;
|
|
|
|
|
|
|
|
+ bool result = await DailyTaskSProxy.ReqDailyTaskBonus((int)btnGet.data);
|
|
|
|
+ if (result)
|
|
|
|
+ {
|
|
|
|
+ UpdateList();
|
|
|
|
+ }
|
|
|
|
+
|
|
}
|
|
}
|
|
private void OnBtnGoClick(EventContext context)
|
|
private void OnBtnGoClick(EventContext context)
|
|
{
|
|
{
|
|
@@ -82,24 +108,37 @@ namespace GFGGame
|
|
GObject btnGo = context.sender as GObject;
|
|
GObject btnGo = context.sender as GObject;
|
|
ViewManager.Show(string.Format("GFGGame.{0}", btnGo.data), null, new object[] { typeof(DailyTaskView).Name, this.viewData });
|
|
ViewManager.Show(string.Format("GFGGame.{0}", btnGo.data), null, new object[] { typeof(DailyTaskView).Name, this.viewData });
|
|
}
|
|
}
|
|
- private void ListRewardItemRender(int index, GObject obj)
|
|
|
|
|
|
+ private void ListBoxRewardItemRender(int index, GObject obj)
|
|
{
|
|
{
|
|
- UI_ListRewardItem item = UI_ListRewardItem.Proxy(obj);
|
|
|
|
-
|
|
|
|
- if (item.target.data == null)
|
|
|
|
- {
|
|
|
|
- item.target.onClick.Add(OnRewardItemClick);
|
|
|
|
- }
|
|
|
|
|
|
+ UI_ListBoxRewardItem item = UI_ListBoxRewardItem.Proxy(obj);
|
|
|
|
+ DailyActiveRewardCfg cfg = _rewardCfgs[index];
|
|
|
|
+ item.m_c1.selectedIndex = DailyTaskDataManager.Instance.GetBoxStateById(cfg.id);
|
|
|
|
+ item.m_txtNum.text = cfg.count.ToString();
|
|
|
|
+ // if (item.target.data == null)
|
|
|
|
+ // {
|
|
|
|
+ // item.target.onClick.Add(OnBoxRewardItemClick);
|
|
|
|
+ // }
|
|
item.target.data = _rewardCfgs[index];
|
|
item.target.data = _rewardCfgs[index];
|
|
- UI_ListRewardItem.ClearProxy();
|
|
|
|
|
|
+ UI_ListBoxRewardItem.ClearProxy();
|
|
}
|
|
}
|
|
|
|
|
|
- private void OnRewardItemClick(EventContext context)
|
|
|
|
|
|
+ private async void OnBoxRewardItemClick(EventContext context)
|
|
{
|
|
{
|
|
GObject item = context.sender as GObject;
|
|
GObject item = context.sender as GObject;
|
|
|
|
+ DailyActiveRewardCfg cfg = item.data as DailyActiveRewardCfg;
|
|
// UI_ListRewardItem item = UI_ListRewardItem.Proxy(context.data as GObject);
|
|
// UI_ListRewardItem item = UI_ListRewardItem.Proxy(context.data as GObject);
|
|
-
|
|
|
|
- ViewManager.Show<DailyTaskRewardView>(item.data);
|
|
|
|
|
|
+ if (DailyTaskDataManager.Instance.GetBoxStateById(cfg.id) == ConstBonusStatus.CAN_GET)
|
|
|
|
+ {
|
|
|
|
+ bool result = await DailyTaskSProxy.ReqLivenessBox(cfg.id);
|
|
|
|
+ if (result)
|
|
|
|
+ {
|
|
|
|
+ _ui.m_listReward.numItems = _rewardCfgs.Count;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else
|
|
|
|
+ {
|
|
|
|
+ ViewManager.Show<DailyTaskRewardView>(item.data);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|