12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- using System.Collections.Generic;
- using ET;
- using GFGGame;
- namespace GFGGame
- {
- public static class FieldSProxy
- {
- public static async ETTask<bool> ReqFieldInstanceInfos()
- {
- M2C_GetFieldInstanceInfos response = null;
- response = (M2C_GetFieldInstanceInfos)await MessageHelper.SendToServer(new C2M_GetFieldInstanceInfos());
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- FieldInfos fieldInfos = FieldDataManager.Instance.fieldInfos;
- fieldInfos.theme = response.Theme;
- fieldInfos.highestLvls = new List<int>();
- fieldInfos.highestLvls.AddRange(response.HighestLvls);
- fieldInfos.bonusWeekly = response.BonusWeekly;
- fieldInfos.bonusMaxLimit = response.BonusMaxLimit;
- fieldInfos.hasBonus = response.HasBonus;
- fieldInfos.taskDic = new Dictionary<int, int>();
- for (int i = 0; i < response.kTaskIds.Count; i++)
- {
- fieldInfos.taskDic.Add(response.kTaskIds[i], response.vTaskStatus[i]);
- }
- return true;
- }
- }
- return false;
- }
- public static async ETTask<bool> ReqFieldInstanceResult()
- {
- M2C_GetFieldInstanceResult response = null;
- response = (M2C_GetFieldInstanceResult)await MessageHelper.SendToServer(new C2M_GetFieldInstanceResult());
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- FieldResult fieldResult = FieldDataManager.Instance.fieldResult;
- fieldResult.passLvl = response.PassLvl;
- fieldResult.bonusList = ItemUtil.CreateItemDataList(response.BonusList);
- fieldResult.costNum = response.CostNum;
- fieldResult.hardLvl = response.HardLvl;
- FieldInfos fieldInfos = FieldDataManager.Instance.fieldInfos;
- fieldInfos.highestLvls[response.HardLvl] = response.HighestLvl;
- fieldInfos.bonusWeekly = response.BonusWeekly;
- for (int i = 0; i < response.kTaskIds.Count; i++)
- {
- if (!fieldInfos.taskDic.ContainsKey(response.kTaskIds[i]))
- {
- fieldInfos.taskDic.Add(response.kTaskIds[i], response.vTaskStatus[i]);
- }
- else
- {
- fieldInfos.taskDic[response.kTaskIds[i]] = response.vTaskStatus[i];
- }
- }
- return true;
- }
- }
- return false;
- }
- public static async ETTask<bool> ReqFieldTaskBonus(int taskId)
- {
- M2C_GetFieldTaskBonus response = null;
- response = (M2C_GetFieldTaskBonus)await MessageHelper.SendToServer(new C2M_GetFieldTaskBonus() { TaskId = taskId });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- FieldInfos fieldInfos = FieldDataManager.Instance.fieldInfos;
- fieldInfos.bonusMaxLimit = response.BonusMaxLimit;
- fieldInfos.taskDic[response.TaskId] = response.TaskStatus;
- return true;
- }
- }
- return false;
- }
- }
- }
|