//根据cardInfo获取一张卡的实例 public CardEntry GetCardEntryBCardInfo(CardInfo cardInfo) { CardEntry cardEntry = new CardEntry(); cardEntry.InitializeByCardInfo(cardInfo); AddTimeTriggerForCardEntry(cardEntry); return(cardEntry); }
//根据code获取一张卡的实例 public CardEntry GetCardEntryByCode(string cardCode) { CardEntry cardEntry = new CardEntry(); cardEntry.InitializeByCardInfo(this.GetCardInfoByCode(cardCode)); AddTimeTriggerForCardEntry(cardEntry); return(cardEntry); }
//给一张卡绑定上时点关系 public void AddTimeTriggerForCardEntry(CardEntry addTTcardEntry) { addTTcardEntry.ttNeedChangeGameContainerType = (CardEntry cardEntry) => { SendNotification(GameContainerEvent.GAME_CONTAINER_SYS, cardEntry, GameContainerEvent.GAME_CONTAINER_SYS_CARD_NEED_MOVE); }; addTTcardEntry.ttCardChangeGameContainerType = (CardEntry cardEntry) => { SendNotification(UIViewSystemEvent.UI_CARD_ENTRY_SYS, cardEntry, StringUtil.GetNTByNotificationTypeAndPlayerCode(UIViewSystemEvent.UI_CARD_ENTRY_SYS_CHANGE_GAME_CONTAINER_TYPE, cardEntry.controllerPlayerItem.playerCode)); SendNotification(TimeTriggerEvent.TIME_TRIGGER_SYS, cardEntry, StringUtil.GetNTByNotificationTypeAndPlayerCode(TimeTriggerEvent.TIME_TRIGGER_SYS_CARD_CHANGE_GAME_CONTAINER_TYPE, cardEntry.controllerPlayerItem.playerCode)); SendNotification(HexSystemEvent.HEX_VIEW_SYS, cardEntry, HexSystemEvent.HEX_VIEW_SYS_CARD_CHANGE_GAME_CONTAINER_TYPE); }; addTTcardEntry.ttCardNeedHideInView = (CardEntry cardEntry) => { SendNotification(UIViewSystemEvent.UI_CARD_ENTRY_SYS, cardEntry, StringUtil.GetNTByNotificationTypeAndPlayerCode(UIViewSystemEvent.UI_CARD_ENTRY_SYS_CARD_NEED_HIDE_IN_VIEW, cardEntry.controllerPlayerItem.playerCode)); }; addTTcardEntry.ttCardNeedAddToTTS = (CardEntry cardEntry) => { SendNotification(GameContainerEvent.GAME_CONTAINER_SYS, cardEntry, GameContainerEvent.GAME_CONTAINER_SYS_CARD_NEED_ADD_TO_TTS); }; }
//创建牌池 public void CreateCardEntryPool() { List <CardInfo> cardInfos = new List <CardInfo>(); foreach (CardInfo cardInfo in cardDbItem.cardInfoMap.Values) { if (!cardInfo.type.Equals(CardMetrics.CARD_TYPE_SHIP)) { cardInfos.Add(cardInfo); } } for (int n = 0; n < cardInfos.Count; n++) { int quantity = cardInfos[n].quantity; for (int m = 0; m < quantity; m++) { CardEntry card = this.GetCardEntryBCardInfo(cardInfos[n]); cardDbItem.cardEntryPool.Add(card); } } //创建牌池组 CreateCardEntryListPool(); }
//生物反击某一个生物 public void CounterAttackTargetMinion(CardEntry attackMinionCellItem) { this.attackTargetIndex = attackMinionCellItem.nowIndex; ttExecuteAnAttack(); attackMinionCellItem.SufferDamage(cardEntryVariableAttributeMap.GetValueByCodeAndType("Atk", VATtrtype.CalculatedValue)); }
//玩家选择完成后从卡牌池移除此牌 public void RemoveOneCardEntry(CardEntry cardEntry) { cardDbItem.cardEntryPool.Remove(cardEntry); }