Пример #1
0
        internal override void UpdateCards()
        {
            var oldHandCards = handCardArea.Cards;

            foreach (var card in oldHandCards)
            {
                card.Disappear(0);
            }

            handCardArea.Cards.Clear();
            weaponArea.Children.Clear();
            armorArea.Children.Clear();
            horse1Area.Children.Clear();
            horse2Area.Children.Clear();
            delayedToolsDock.Children.Clear();
            equipmentArea.Visibility = System.Windows.Visibility.Collapsed;

            base.UpdateCards();

            if (PlayerModel == null)
            {
                return;
            }
            var player = PlayerModel.Player;

            if (player == null)
            {
                return;
            }

            EquipCommand[] commands = { PlayerModel.WeaponCommand,         PlayerModel.ArmorCommand,
                                        PlayerModel.DefensiveHorseCommand, PlayerModel.OffensiveHorseCommand };
            foreach (var equip in commands)
            {
                if (equip != null)
                {
                    AddEquipment(CardView.CreateCard(equip, ParentGameView.GlobalCanvas), true);
                }
            }
            foreach (var dt in player.DelayedTools())
            {
                AddDelayedTool(CardView.CreateCard(dt, ParentGameView.GlobalCanvas), true);
            }
            // Add hand cards last because adding equipment may result in layout change of hand card area.
            AddHandCards(CardView.CreateCards(PlayerModel.HandCards, ParentGameView.GlobalCanvas), true);
        }