CardSProxy.cs 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System.Collections.Generic;
  2. using ET;
  3. using GFGGame;
  4. namespace ET
  5. {
  6. public class NoticeGetNewCard : AMHandler<M2C_GetNewCard>
  7. {
  8. protected override async ETTask Run(Session session, M2C_GetNewCard message)
  9. {
  10. CardDataManager.Add(message.CardInfo);
  11. SkillDataManager.Instance.InitServerData(message.CardInfo.CardId, message.CardInfo.KsSkill, message.CardInfo.VsSkill);
  12. await ETTask.CompletedTask;
  13. }
  14. }
  15. }
  16. namespace GFGGame
  17. {
  18. public static class CardSProxy
  19. {
  20. public static async ETTask GetCardInfos()
  21. {
  22. M2C_GetCardInfos response = null;
  23. response = (M2C_GetCardInfos)await MessageHelper.SendToServer(new C2M_GetCardInfos() { });
  24. if (response != null)
  25. {
  26. if (response.Error == ErrorCode.ERR_Success)
  27. {
  28. for (int i = 0; i < response.CardInfos.Count; i++)
  29. {
  30. CardDataManager.Add(response.CardInfos[i]);
  31. SkillDataManager.Instance.InitServerData(response.CardInfos[i].CardId, response.CardInfos[i].KsSkill, response.CardInfos[i].VsSkill);
  32. }
  33. }
  34. }
  35. }
  36. public static async ETTask UpgradeCardLvl(int cardId, List<int> itemNums)
  37. {
  38. M2C_UpgradeCardLvl response = null;
  39. response = (M2C_UpgradeCardLvl)await MessageHelper.SendToServer(new C2M_UpgradeCardLvl() { CardId = cardId, ItemNums = itemNums });
  40. if (response != null)
  41. {
  42. if (response.Error == ErrorCode.ERR_Success)
  43. {
  44. }
  45. }
  46. }
  47. public static async ETTask UpgradeCardStar(int cardId)
  48. {
  49. M2C_UpgradeCardStar response = null;
  50. response = (M2C_UpgradeCardStar)await MessageHelper.SendToServer(new C2M_UpgradeCardStar() { CardId = cardId });
  51. if (response != null)
  52. {
  53. if (response.Error == ErrorCode.ERR_Success)
  54. {
  55. }
  56. }
  57. }
  58. //resIndex:0默认,1特殊
  59. public static async ETTask ChangeCardLvl(int cardId, int resIndex)
  60. {
  61. M2C_ChangeCardLvl response = null;
  62. response = (M2C_ChangeCardLvl)await MessageHelper.SendToServer(new C2M_ChangeCardLvl() { CardId = cardId, ResIndex = resIndex });
  63. if (response != null)
  64. {
  65. if (response.Error == ErrorCode.ERR_Success)
  66. {
  67. }
  68. }
  69. }
  70. public static async ETTask UpgradeCardSkill(int cardId, int skillId)
  71. {
  72. M2C_UpgradeCardSkill response = null;
  73. response = (M2C_UpgradeCardSkill)await MessageHelper.SendToServer(new C2M_UpgradeCardSkill() { CardId = cardId, SkillId = skillId });
  74. if (response != null)
  75. {
  76. if (response.Error == ErrorCode.ERR_Success)
  77. {
  78. SkillDataManager.Instance.UpdateSkill(response.CardId, response.SkillId, response.SkillLvl);
  79. EventAgent.DispatchEvent(ConstMessage.CARD_UP_SKILL);
  80. }
  81. }
  82. }
  83. }
  84. }