CollegeSproxy.cs 2.9 KB

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