1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980 |
- using System.Collections.Generic;
- using ET;
- namespace GFGGame
- {
- public static class DailyWelfareSProxy
- {
- //每日签到
- 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);
- EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
- return true;
- }
- }
- return false;
- }
- //补签
- public static async ETTask<bool> ReqReSign(int day, int type)
- {
- S2C_ReSign response = null;
- response = (S2C_ReSign)await MessageHelper.SendToServer(new C2S_ReSign() { Day = day ,ConsumeType = type});
- 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);
- EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
- 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);
- DailySupplyCfg supplyCfg = DailySupplyCfgArray.Instance.GetCfg(id);
- BonusController.TryShowBonusList(supplyCfg.bonusArr);
- EventAgent.DispatchEvent(ConstMessage.RED_CHANGE);
- return true;
- }
- }
- return false;
- }
- }
- }
|