コード例 #1
0
        private void AddNewAttack(Attack newAttack, Participant participant)
        {
            if (participant.CurrentAttacks.Any())
            {
                var message = String.Format("{0} already has an attack prepared.  Switch attack to new attack?\n\nPress \"Yes\" to switch {0}'s current attack from {1} to {2}.\nPress \"No\" to add {2} to {0}'s attacks, in addition to {1}.\nPress \"Cancel\" to not add the attack to {0}'s current attacks.", participant.Name, participant.CurrentAttacksToString(), newAttack.Name);
                var result = MessageBox.Show(message, "Attack already there", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);

                if (result == DialogResult.Yes)
                    foreach (var attack in participant.Attacks)
                        attack.Prepped = false;

                if (result == DialogResult.No || result == DialogResult.Yes)
                    newAttack.Prepped = true;
            }
            else
            {
                newAttack.Prepped = true;
            }

            participant.AddAttack(newAttack);
        }
コード例 #2
0
        private void SwitchCurrentAttack(Attack newAttack, Participant participant, String message)
        {
            message += String.Format("\n\nPress \"Yes\" to switch {0}'s current attack from {1} to {2}.", participant.Name, participant.CurrentAttacksToString(), newAttack.Name);
            message += String.Format("\nPress \"No\" to add {2} to {0}'s attacks, in addition to {1}.", participant.Name, participant.CurrentAttacksToString(), newAttack.Name);
            message += String.Format("\nPress \"Cancel\" to not add the attack to {0}'s current attacks.", participant.Name);

            var result = MessageBox.Show(message, "Attack already there", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);

            if (result == DialogResult.Yes)
                foreach (var currentAttack in participant.CurrentAttacks)
                    currentAttack.Prepped = false;

            if (result == DialogResult.No || result == DialogResult.Yes)
                newAttack.Prepped = true;
        }