|
@@ -11,6 +11,8 @@ namespace GFGGame
|
|
private List<TaskCfg> _cfgs;
|
|
private List<TaskCfg> _cfgs;
|
|
private List<DailyActiveRewardCfg> _rewardCfgs;
|
|
private List<DailyActiveRewardCfg> _rewardCfgs;
|
|
|
|
|
|
|
|
+ private int taskType = TaskType.Daily;
|
|
|
|
+
|
|
public override void Dispose()
|
|
public override void Dispose()
|
|
{
|
|
{
|
|
if (_ui != null)
|
|
if (_ui != null)
|
|
@@ -30,6 +32,8 @@ namespace GFGGame
|
|
viewCom = _ui.target;
|
|
viewCom = _ui.target;
|
|
isfullScreen = true;
|
|
isfullScreen = true;
|
|
clickBlankToClose = false;
|
|
clickBlankToClose = false;
|
|
|
|
+ _ui.m_c1.onChanged.Add(OnCtrlChange);
|
|
|
|
+ _ui.m_TaskList.itemRenderer = TaskItemRender;
|
|
}
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
protected override void OnShown()
|
|
@@ -37,6 +41,24 @@ namespace GFGGame
|
|
base.OnShown();
|
|
base.OnShown();
|
|
_rewardCfgs = new List<DailyActiveRewardCfg>(DailyActiveRewardCfgArray.Instance.dataArray);
|
|
_rewardCfgs = new List<DailyActiveRewardCfg>(DailyActiveRewardCfgArray.Instance.dataArray);
|
|
UpdateLivenessProcess();
|
|
UpdateLivenessProcess();
|
|
|
|
+ UpdateTask();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //切换任务类型
|
|
|
|
+ private void OnCtrlChange()
|
|
|
|
+ {
|
|
|
|
+ taskType = _ui.m_c1.selectedIndex switch
|
|
|
|
+ {
|
|
|
|
+ 0 =>
|
|
|
|
+ //每日任务
|
|
|
|
+ TaskType.Daily,
|
|
|
|
+ 1 =>
|
|
|
|
+ //织造任务
|
|
|
|
+ TaskType.BattlePass,
|
|
|
|
+ _ => taskType
|
|
|
|
+ };
|
|
|
|
+ //更新任务列表
|
|
|
|
+ UpdateTask();
|
|
}
|
|
}
|
|
|
|
|
|
//更新活跃度进度条
|
|
//更新活跃度进度条
|
|
@@ -76,26 +98,16 @@ namespace GFGGame
|
|
//更新任务列表
|
|
//更新任务列表
|
|
private void UpdateTask()
|
|
private void UpdateTask()
|
|
{
|
|
{
|
|
- var selectedIndex = _ui.m_c1.selectedIndex;
|
|
|
|
- switch (selectedIndex)
|
|
|
|
- {
|
|
|
|
- case 0:
|
|
|
|
- _cfgs = TaskDataManager.Instance.GetTaskCfgs(TaskType.Daily);
|
|
|
|
- break;
|
|
|
|
- case 1:
|
|
|
|
- _cfgs = TaskDataManager.Instance.GetTaskCfgs(TaskType.BattlePass);
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- _ui.m_TaskList.itemRenderer = TaskItemIndex;
|
|
|
|
|
|
+ _cfgs = TaskDataManager.Instance.GetTaskCfgs(taskType);
|
|
_ui.m_TaskList.numItems = _cfgs.Count;
|
|
_ui.m_TaskList.numItems = _cfgs.Count;
|
|
}
|
|
}
|
|
|
|
|
|
- private void TaskItemIndex(int index, GObject obj)
|
|
|
|
|
|
+ private void TaskItemRender(int index, GObject obj)
|
|
{
|
|
{
|
|
var item = UI_TaskListItem.Proxy(obj);
|
|
var item = UI_TaskListItem.Proxy(obj);
|
|
//领取状态
|
|
//领取状态
|
|
item.m_c1.selectedIndex = TaskDataManager.Instance.GetTaskStateById(_cfgs[index].id);
|
|
item.m_c1.selectedIndex = TaskDataManager.Instance.GetTaskStateById(_cfgs[index].id);
|
|
|
|
+ item.m_c2.selectedIndex = _cfgs[index].jumpId == "" ? 1 : 0;
|
|
item.m_txtDesc.text = TaskDataManager.Instance.GetTaskDesc(_cfgs[index].id);
|
|
item.m_txtDesc.text = TaskDataManager.Instance.GetTaskDesc(_cfgs[index].id);
|
|
item.m_txtCount.text =
|
|
item.m_txtCount.text =
|
|
$"{TaskDataManager.Instance.GetTaskProgressById(_cfgs[index].id)}/{_cfgs[index].count}";
|
|
$"{TaskDataManager.Instance.GetTaskProgressById(_cfgs[index].id)}/{_cfgs[index].count}";
|
|
@@ -135,8 +147,9 @@ namespace GFGGame
|
|
private async void OnBtnGetClick(EventContext context)
|
|
private async void OnBtnGetClick(EventContext context)
|
|
{
|
|
{
|
|
var btnGet = context.sender as GObject;
|
|
var btnGet = context.sender as GObject;
|
|
- var result = await DailyTaskSProxy.ReqDailyTaskBonus((int)btnGet.data);
|
|
|
|
- if (!result) return;
|
|
|
|
|
|
+ //TODO 通用任务领奖
|
|
|
|
+ // var result = await DailyTaskSProxy.ReqDailyTaskBonus((int)btnGet.data);
|
|
|
|
+ // if (!result) return;
|
|
UpdateLivenessProcess();
|
|
UpdateLivenessProcess();
|
|
UpdateTask();
|
|
UpdateTask();
|
|
LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.MEI_RI_REN_WU, 2);
|
|
LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.MEI_RI_REN_WU, 2);
|
|
@@ -146,7 +159,7 @@ namespace GFGGame
|
|
{
|
|
{
|
|
Hide();
|
|
Hide();
|
|
var btnGo = context.sender as GObject;
|
|
var btnGo = context.sender as GObject;
|
|
- ViewManager.Show($"GFGGame.{btnGo.data}", null, new[] { typeof(CombTaskView).FullName, viewData }, true);
|
|
|
|
|
|
+ ViewManager.Show($"GFGGame.{btnGo.data}", null, new[] { typeof(TaskView).FullName, viewData }, true);
|
|
}
|
|
}
|
|
|
|
|
|
private async void OnBoxRewardItemClick(EventContext context)
|
|
private async void OnBoxRewardItemClick(EventContext context)
|
|
@@ -176,7 +189,8 @@ namespace GFGGame
|
|
|
|
|
|
private async void OnBtnGetAllClick()
|
|
private async void OnBtnGetAllClick()
|
|
{
|
|
{
|
|
- var result = await DailyTaskSProxy.ReqAllDailyTaskBonus();
|
|
|
|
|
|
+ //通用任务一键领奖
|
|
|
|
+ var result = await TaskSProxy.GetAllTaskBonus(taskType);
|
|
if (!result) return;
|
|
if (!result) return;
|
|
UpdateLivenessProcess();
|
|
UpdateLivenessProcess();
|
|
UpdateTask();
|
|
UpdateTask();
|