public void AddMech(CardInfo_Mech mechCardInfo, int mechPlaceIndex, List <int> targetMechIds, int clientMechTempId, int handCardInstanceId) { if (BattleGroundIsFull) { return; } int mechId = BattlePlayer.GameManager.GenerateNewMechId(); BattleGroundAddMechRequest request = new BattleGroundAddMechRequest(BattlePlayer.ClientId, mechCardInfo, mechPlaceIndex, mechId, clientMechTempId); BattlePlayer.MyClientProxy.BattleGameManager.Broadcast_AddRequestToOperationResponse(request); ModuleMech mech = new ModuleMech(); mech.M_MechID = mechId; mech.M_ClientTempMechID = clientMechTempId; mech.OriginCardInstanceId = handCardInstanceId; mech.Initiate(mechCardInfo, BattlePlayer); BattlePlayer.CardDeckManager.CardDeck.AddCardInstanceId(mechCardInfo.CardID, handCardInstanceId); BattleGroundAddMech(mechPlaceIndex, mech); ExecutorInfo info = new ExecutorInfo(clientId: BattlePlayer.ClientId, mechId: mechId, targetMechIds: targetMechIds); if (mechCardInfo.MechInfo.IsSoldier) { BattlePlayer.GameManager.EventManager.Invoke(SideEffectExecute.TriggerTime.OnSoldierSummon, info); } else { BattlePlayer.GameManager.EventManager.Invoke(SideEffectExecute.TriggerTime.OnHeroSummon, info); } }
private void OnBattleGroundAddMech(BattleGroundAddMechRequest r) { ClientPlayer cp = GetPlayerByClientId(r.clientId); if (cp == SelfClientPlayer && r.clientMechTempId != (int)Const.SpecialMechID.ClientTempMechIDNormal) { return; } cp.BattlePlayer.BattleGroundManager.AddMech(r.battleGroundIndex); }
private void OnBattleGroundAddMech_PrePass(BattleGroundAddMechRequest r) { ClientPlayer cp = GetPlayerByClientId(r.clientId); cp.BattlePlayer.BattleGroundManager.AddMech_PrePass(r.cardInfo, r.mechId, r.clientMechTempId); }