|
@@ -9,7 +9,7 @@ namespace GFGGame
|
|
|
public class DailyLoginView : BaseWindow
|
|
|
{
|
|
|
private UI_DailyLoginUI _ui;
|
|
|
- private List<FieldTaskCfg> _cfgs;
|
|
|
+ private DailyLoginCfg[] _cfgs;
|
|
|
|
|
|
public override void Dispose()
|
|
|
{
|
|
@@ -28,14 +28,16 @@ namespace GFGGame
|
|
|
|
|
|
_ui.m_list.itemRenderer = ListItemRender;
|
|
|
_ui.m_list.onClickItem.Add(OnListItemClick);
|
|
|
+ _ui.m_loaIcon.onClick.Add(OnListItemClick);
|
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
- _cfgs = FieldDataManager.Instance.GetTaskCfgs();
|
|
|
- _ui.m_list.numItems = _cfgs.Count;
|
|
|
-
|
|
|
+ _cfgs = DailyLoginCfgArray.Instance.dataArray;
|
|
|
+ _ui.m_list.numItems = _cfgs.Length;
|
|
|
+ _ui.m_loaIcon.url = "ui://DailyLogin/yzhd_dyt_7";
|
|
|
+ _ui.m_loaIcon.data = _cfgs[_cfgs.Length - 1];
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
@@ -44,18 +46,35 @@ namespace GFGGame
|
|
|
}
|
|
|
private void ListItemRender(int index, GObject obj)
|
|
|
{
|
|
|
- // UI_ListItem item = UI_ListItem.Proxy(obj);
|
|
|
-
|
|
|
-
|
|
|
- // UI_ListItem.ClearProxy();
|
|
|
+ DailyLoginCfg cfg = _cfgs[index];
|
|
|
+ UI_ListItem item = UI_ListItem.Proxy(obj);
|
|
|
+ item.m_loaBg.url = string.Format("ui://DailyLogin/yzhd_dyt_{0}", cfg.id);
|
|
|
+ ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.rewardsArr[0][0]);
|
|
|
+ item.m_loaIcon.url = ResPathUtil.GetIconPath(itemCfg);
|
|
|
+ item.m_txtName.text = itemCfg.name;
|
|
|
+ item.m_imgGot.visible = cfg.id < ActivityDataManager.Instance.dailyLoginId;
|
|
|
+ if (cfg.id == ActivityDataManager.Instance.dailyLoginId)
|
|
|
+ {
|
|
|
+ RedDotController.Instance.SetComRedDot(item.target, ActivityDataManager.Instance.dailyLoginBonusStatus == ConstBonusStatus.CAN_GET);
|
|
|
+ }
|
|
|
+ item.target.data = cfg;
|
|
|
+ UI_ListItem.ClearProxy();
|
|
|
}
|
|
|
private async void OnListItemClick(EventContext context)
|
|
|
{
|
|
|
- int id = (int)(context.sender as GObject).data;
|
|
|
- bool result = await ActivitySProxy.ReqGetDailyLoginRewards(id);
|
|
|
- if (result)
|
|
|
+ DailyLoginCfg cfg = (context.sender as GObject).data as DailyLoginCfg;
|
|
|
+
|
|
|
+ if (cfg.id == ActivityDataManager.Instance.dailyLoginId && ActivityDataManager.Instance.dailyLoginBonusStatus == ConstBonusStatus.CAN_GET)
|
|
|
+ {
|
|
|
+ bool result = await ActivitySProxy.ReqGetDailyLoginRewards(cfg.id);
|
|
|
+ if (result)
|
|
|
+ {
|
|
|
+ _ui.m_list.numItems = _cfgs.Length;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
{
|
|
|
- _ui.m_list.numItems = _cfgs.Count;
|
|
|
+ GoodsItemTipsController.ShowItemTips(cfg.rewardsArr[0][0]);
|
|
|
}
|
|
|
}
|
|
|
}
|