Sanguosha.UI.Controls.PlayerView.RemoveEquipment C# (CSharp) Méthode

RemoveEquipment() protected méthode

protected RemoveEquipment ( Sanguosha.Core.Cards.Card card, bool isCopy ) : Sanguosha.UI.Controls.CardView
card Sanguosha.Core.Cards.Card
isCopy bool
Résultat Sanguosha.UI.Controls.CardView
        protected override CardView RemoveEquipment(Card card, bool isCopy)
        {
            Trace.Assert(card.Id >= 0, "Cannot remove unknown card from equip area.");
            Equipment equip = GameEngine.CardSet[card.Id].Type as Equipment;

            if (equip == null)
            {
                throw new ArgumentException("Cannot add non-equip to equip area.");
            }

            Border targetArea = null;
            switch (equip.Category)
            {
                case CardCategory.Weapon:
                    targetArea = weaponArea;
                    break;
                case CardCategory.Armor:
                    targetArea = armorArea;
                    break;
                case CardCategory.DefensiveHorse:
                    targetArea = horse1Area;
                    break;
                case CardCategory.OffensiveHorse:
                    targetArea = horse2Area;
                    break;
                default:
                    throw new ArgumentException("Cannot install non-equips to equip area.");
            }

            if (targetArea.Child == null)
            {
                throw new ArgumentException("No equip is found.");
            }

            SmallEquipView equipLabel = targetArea.Child as SmallEquipView;
            if (!isCopy) targetArea.Child = null;

            CardView result = CardView.CreateCard(card);
            ParentGameView.GlobalCanvas.Children.Add(result);
            result.Opacity = 0;
            result.SetCurrentPosition(ComputeCardCenterPos(result, targetArea));
            return result;
        }