Sanguosha.UI.Controls.PlayerViewModel.SubmitCardUsageCommand C# (CSharp) Méthode

SubmitCardUsageCommand() public méthode

public SubmitCardUsageCommand ( object parameter ) : void
parameter object
Résultat void
        public void SubmitCardUsageCommand(object parameter)
        {
            List<Card> cards = _GetSelectedNonEquipCards();
            List<Player> players = _GetSelectedPlayers();
            ISkill skill = null;
            bool isEquipSkill;
            SkillCommand skillCommand = _GetSelectedSkillCommand(out isEquipSkill);

            if (skillCommand != null)
            {
                skill = skillCommand.Skill;
            }

            // are we really able to use this equip as command?
            if (isEquipSkill)
            {
                Trace.Assert(skill != null);
                if (currentUsageVerifier.Verify(HostPlayer, skill, new List<Card>(), new List<Player>()) == VerifierResult.Fail)
                {
                    //nope, not really
                    isEquipSkill = false;
                    skill = null;
                }
            }

            foreach (var equipCommand in EquipCommands)
            {
                if (!isEquipSkill && equipCommand.IsSelected)
                {
                    cards.Add(equipCommand.Card);
                }
            }

            // Card usage question
            var guHuoSkill = skill as IAdditionalTypedSkill;
            if (guHuoSkill != null)
            {
                // Reset all will also clear the GuHuoChoice recorded. So restore it after resetting the buttons.
                var backup = guHuoSkill.AdditionalType;
                _ResetAll();
                guHuoSkill.AdditionalType = backup;
            }
            else
            {
                _ResetAll();
            }
            if (currentUsageVerifier != null)
            {
                currentUsageVerifier = null;
                CardUsageAnsweredEvent(skill, cards, players);
            }
        }