/// <summary> /// Add card to battle arena /// </summary> /// <param name="view"></param> private void AddCardToBattleArena(CardView view) { var activePlayer = BattleArena.GetActivePlayer(); if (activePlayer.ManaPull == 0) { AddHistoryLogSignal.Dispatch(new[] { "Player '", activePlayer.Name, "' Has ERROR! add card '", view.Card.SourceCard.name, "' to battle 'not enough mana!'" }, LogType.Hand); return; } var battleCard = view.Card; if (_cardUnitViews.Count >= Arena.ArenaCartCount || battleCard.Status != BattleStatus.Wait) { AddHistoryLogSignal.Dispatch(new[] { "PLAYER '", activePlayer.Name, "' has ERROR! Add Cart '", battleCard.SourceCard.name, "' to Arena 'not enough space'" }, LogType.Hand); return; } if (!activePlayer.LessManaPull(battleCard.Mana)) { AddHistoryLogSignal.Dispatch(new[] { "Player '", activePlayer.Name, "' Has ERROR! add card '", battleCard.SourceCard.name, "' to battle 'not enough mana!'" }, LogType.Hand); return; } // add history battle log AddHistoryLogSignal.Dispatch(new[] { "Player '", activePlayer.Name, "' Add card '", battleCard.SourceCard.name, "' to battle!" }, LogType.Hand); // Create card unit on battle arena var unitView = View.CreateCardUnit(battleCard); _cardUnitViews.Add(unitView); // remove card from hand view.DestroyView(); // Init mana view InitManaSignal.Dispatch(); }