123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- using System;
- using System.Collections.Generic;
- using ET;
- using GFGGame;
- namespace GFGGame
- {
- public static class DailyWelfareSProxy
- {
- public static async ETTask<bool> ReqDailyTaskInfos()
- {
- M2C_GetDailyTaskInfos response = null;
- response = (M2C_GetDailyTaskInfos)await MessageHelper.SendToServer(new C2M_GetDailyTaskInfos());
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- for (int i = 0; i < response.TaskList.Count; i++)
- {
- TaskInfo taskInfo = new TaskInfo();
- taskInfo.id = response.TaskList[i].Id;
- taskInfo.state = response.TaskList[i].Status;
- taskInfo.progress = response.TaskList[i].Progress;
- DailyTaskDataManager.Instance.UpdateTaskInfo(taskInfo.id, taskInfo);
- }
- for (int i = 0; i < response.kLivenessBox.Count; i++)
- {
- DailyTaskDataManager.Instance.UpdateLivenessBoxInfo(response.kLivenessBox[i], response.vLivenessBox[i]);
- }
- return true;
- }
- }
- return false;
- }
- //每日签到
- public static async ETTask<bool> ReqSign(int taskId)
- {
- S2C_Sign response = null;
- response = (S2C_Sign)await MessageHelper.SendToServer(new C2S_Sign());
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- // DailyWelfareManager.Instance.DailySignDatas.Add(DateTime.Now.Day);
- List<ItemData> bonus = ItemUtil.CreateItemDataList(response.reward);
- BonusController.TryShowBonusList(bonus);
- return true;
- }
- }
- return false;
- }
- //补签
- public static async ETTask<bool> ReqReSign(int day)
- {
- S2C_ReSign response = null;
- response = (S2C_ReSign)await MessageHelper.SendToServer(new C2S_ReSign() { Day = day });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- // DailyWelfareManager.Instance.DailySignDatas.Add(day);
- List<ItemData> bonus = ItemUtil.CreateItemDataList(response.reward);
- BonusController.TryShowBonusList(bonus);
- return true;
- }
- }
- return false;
- }
- //领取签到累计奖励
- public static async ETTask<bool> ReqGetSignReward(int day)
- {
- S2C_GetSignReward response = null;
- response = (S2C_GetSignReward)await MessageHelper.SendToServer(new C2S_GetSignReward() { Day = day });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- // DailyWelfareManager.Instance.AccumulatedSignDatas.Add(day);
- List<ItemData> bonus = ItemUtil.CreateItemDataList(response.reward);
- BonusController.TryShowBonusList(bonus);
- return true;
- }
- }
- return false;
- }
- //领取/补领每日补给
- public static async ETTask<bool> ReqGetSupplyReward(int id)
- {
- S2C_GetSupplyReward response = null;
- response = (S2C_GetSupplyReward)await MessageHelper.SendToServer(new C2S_GetSupplyReward() { Id = id });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- // DailyWelfareManager.Instance.SupplyRewardDatas.Add(id);
- List<ItemData> bonus = ItemUtil.CreateItemDataList(response.reward);
- BonusController.TryShowBonusList(bonus);
- return true;
- }
- }
- return false;
- }
- }
- }
|