1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using System.Collections.Generic;
- using ET;
- using GFGGame;
- namespace ET
- {
- public class NoticeGetNewCard : AMHandler<M2C_GetNewCard>
- {
- protected override async ETTask Run(Session session, M2C_GetNewCard message)
- {
- CardDataManager.Add(message.CardInfo);
- SkillDataManager.Instance.InitServerData(message.CardInfo.CardId, message.CardInfo.KsSkill, message.CardInfo.VsSkill);
- await ETTask.CompletedTask;
- }
- }
- }
- namespace GFGGame
- {
- public static class CardSProxy
- {
- public static async ETTask GetCardInfos()
- {
- M2C_GetCardInfos response = null;
- response = (M2C_GetCardInfos)await MessageHelper.SendToServer(new C2M_GetCardInfos() { });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- for (int i = 0; i < response.CardInfos.Count; i++)
- {
- CardDataManager.Add(response.CardInfos[i]);
- SkillDataManager.Instance.InitServerData(response.CardInfos[i].CardId, response.CardInfos[i].KsSkill, response.CardInfos[i].VsSkill);
- }
- }
- }
- }
- public static async ETTask<bool> UpgradeCardLvl(int cardId, List<int> itemNums)
- {
- M2C_UpgradeCardLvl response = null;
- response = (M2C_UpgradeCardLvl)await MessageHelper.SendToServer(new C2M_UpgradeCardLvl() { CardId = cardId, ItemNums = itemNums });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- return true;
- }
- }
- return false;
- }
- public static async ETTask<bool> UpgradeCardStar(int cardId)
- {
- M2C_UpgradeCardStar response = null;
- response = (M2C_UpgradeCardStar)await MessageHelper.SendToServer(new C2M_UpgradeCardStar() { CardId = cardId });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- return true;
- }
- }
- return false;
- }
- //resIndex:0默认,1特殊
- public static async ETTask<bool> ChangeCardRes(int cardId, int resIndex)
- {
- M2C_ChangeCardLvl response = null;
- response = (M2C_ChangeCardLvl)await MessageHelper.SendToServer(new C2M_ChangeCardLvl() { CardId = cardId, ResIndex = resIndex });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- return true;
- }
- }
- return false;
- }
- public static async ETTask UpgradeCardSkill(int cardId, int skillId)
- {
- M2C_UpgradeCardSkill response = null;
- response = (M2C_UpgradeCardSkill)await MessageHelper.SendToServer(new C2M_UpgradeCardSkill() { CardId = cardId, SkillId = skillId });
- if (response != null)
- {
- if (response.Error == ErrorCode.ERR_Success)
- {
- SkillDataManager.Instance.UpdateSkill(response.CardId, response.SkillId, response.SkillLvl);
- EventAgent.DispatchEvent(ConstMessage.CARD_UP_SKILL);
- }
- }
- }
- }
- }
|