FieldSProxy.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. using System.Collections.Generic;
  2. using ET;
  3. using GFGGame;
  4. namespace GFGGame
  5. {
  6. public static class FieldSProxy
  7. {
  8. public static async ETTask<bool> ReqFieldInstanceInfos(List<int> itemIds, List<int> itemNums)
  9. {
  10. M2C_GetFieldInstanceInfos response = null;
  11. response = (M2C_GetFieldInstanceInfos)await MessageHelper.SendToServer(new C2M_GetFieldInstanceInfos());
  12. if (response != null)
  13. {
  14. if (response.Error == ErrorCode.ERR_Success)
  15. {
  16. FieldInfos fieldInfos = FieldDataManager.Instance.fieldInfos;
  17. fieldInfos.theme = response.Theme;
  18. fieldInfos.highestLvls = response.HighestLvls;
  19. fieldInfos.bonusWeekly = response.BonusWeekly;
  20. fieldInfos.bonusMaxLimit = response.BonusMaxLimit;
  21. fieldInfos.hasBonus = response.HasBonus;
  22. fieldInfos.taskDic = new Dictionary<int, int>();
  23. for (int i = 0; i < response.kTaskIds.Count; i++)
  24. {
  25. fieldInfos.taskDic.Add(response.kTaskIds[i], response.vTaskStatus[i]);
  26. }
  27. return true;
  28. }
  29. }
  30. return false;
  31. }
  32. public static async ETTask<bool> ReqFieldInstanceResult()
  33. {
  34. M2C_GetFieldInstanceResult response = null;
  35. response = (M2C_GetFieldInstanceResult)await MessageHelper.SendToServer(new C2M_GetFieldInstanceResult());
  36. if (response != null)
  37. {
  38. if (response.Error == ErrorCode.ERR_Success)
  39. {
  40. FieldResult fieldResult = FieldDataManager.Instance.fieldResult;
  41. fieldResult.passLvl = response.PassLvl;
  42. fieldResult.bonusList = ItemUtil.CreateItemDataList(response.BonusList);
  43. fieldResult.costNum = response.CostNum;
  44. fieldResult.hardLvl = response.HardLvl;
  45. FieldInfos fieldInfos = FieldDataManager.Instance.fieldInfos;
  46. fieldInfos.highestLvls[response.HardLvl] = response.HighestLvl;
  47. fieldInfos.bonusWeekly = response.BonusWeekly;
  48. for (int i = 0; i < response.kTaskIds.Count; i++)
  49. {
  50. fieldInfos.taskDic.Add(response.kTaskIds[i], response.vTaskStatus[i]);
  51. }
  52. return true;
  53. }
  54. }
  55. return false;
  56. }
  57. public static async ETTask<bool> ReqFieldTaskBonus(int taskId)
  58. {
  59. M2C_GetFieldTaskBonus response = null;
  60. response = (M2C_GetFieldTaskBonus)await MessageHelper.SendToServer(new GetFieldTaskBonus() { TaskId = taskId });
  61. if (response != null)
  62. {
  63. if (response.Error == ErrorCode.ERR_Success)
  64. {
  65. FieldInfos fieldInfos = FieldDataManager.Instance.fieldInfos;
  66. fieldInfos.bonusMaxLimit = response.BonusMaxLimit;
  67. // fieldInfos.taskDic[]
  68. return true;
  69. }
  70. }
  71. return false;
  72. }
  73. }
  74. }