CollegeSproxy.cs 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. using ET;
  2. using GFGGame;
  3. using System;
  4. using System.Collections.Generic;
  5. using cfg.GfgCfg;
  6. namespace ET
  7. {
  8. public static class CollegeSProxy
  9. {
  10. public static async ETTask<bool> ReqCollectUpgradeInfo()
  11. {
  12. var response = (M2C_GetDressUpSkillDes)await MessageHelper.SendToServer(new C2M_GetDressUpSkillDes());
  13. if (!(response is { Error: ErrorCode.ERR_Success })) return false;
  14. int Count = response.CollectPartInfos.Count;
  15. CollegeBoostCfg collectcfg;
  16. for (int i = 0; i < response.CollectPartInfos.Count; i++)
  17. {
  18. List<int> item = new List<int>()
  19. { response.CollectPartInfos[i].Stage, response.CollectPartInfos[i].Lvl };
  20. collectcfg =
  21. CollegeBoostCfgArray.Instance.GetCollegeBoostCfgListByTypePartsAndTypePhaseAndLayer(i, item[0],
  22. item[1]);
  23. if (collectcfg == null)
  24. {
  25. item.Add(0);
  26. }
  27. else
  28. {
  29. item.Add(collectcfg.Value);
  30. }
  31. if (CollectPartDataManager.Instance.CollectPartDataDic.ContainsKey(response.CollectPartInfos[i]
  32. .CollectPartType))
  33. {
  34. CollectPartDataManager.Instance.CollectPartDataDic[response.CollectPartInfos[i].CollectPartType] =
  35. item;
  36. }
  37. else
  38. {
  39. CollectPartDataManager.Instance.CollectPartDataDic.Add(response.CollectPartInfos[i].CollectPartType,
  40. item);
  41. }
  42. }
  43. return true;
  44. }
  45. public static async ETTask<bool> ReqCollectUpgrade(int partType, int stage, int lv)
  46. {
  47. var response = (M2C_UpDressUpSkill)await MessageHelper.SendToServer(new C2M_UpDressUpSkill()
  48. { CollectPartType = partType, Stage = stage, Lvl = lv });
  49. if (!(response is { Error: ErrorCode.ERR_Success })) return false;
  50. List<int> item = new List<int>() { response.CollectPartInfo.Stage, response.CollectPartInfo.Lvl };
  51. CollegeBoostCfg collectcfg =
  52. CollegeBoostCfgArray.Instance.GetCollegeBoostCfgListByTypePartsAndTypePhaseAndLayer(
  53. response.CollectPartInfo.CollectPartType, item[0], item[1]);
  54. if (collectcfg == null)
  55. {
  56. item.Add(0);
  57. }
  58. else
  59. {
  60. item.Add(collectcfg.Value);
  61. }
  62. if (CollectPartDataManager.Instance.CollectPartDataDic.ContainsKey(response.CollectPartInfo
  63. .CollectPartType))
  64. {
  65. CollectPartDataManager.Instance.CollectPartDataDic[response.CollectPartInfo.CollectPartType] = item;
  66. }
  67. else
  68. {
  69. CollectPartDataManager.Instance.CollectPartDataDic.Add(response.CollectPartInfo.CollectPartType, item);
  70. }
  71. EventAgent.DispatchEvent(ConstMessage.COLLEGE_UPGRADE);
  72. return true;
  73. }
  74. }
  75. }