예제 #1
0
        private void btAttack_Click(object sender, EventArgs e)
        {
            if (checkBoxPlayer1.Checked == false
                    && checkBoxPlayer2.Checked == false
                    && checkBoxPlayer3.Checked == false
                    && checkBoxPlayer4.Checked == false
                    && checkBoxEnemy.Checked == false)
            {
                MessageForm mes = new MessageForm("You havent choosen any targets!");
                mes.ShowDialog();
            }
            else
            {
                if (character.CurrentTurnPoints.IntValue >= selectedAbility.TurnPointCost)
                {
                    if (checkBoxEnemy.Checked == true & selectedAbility.DamageOrHealing == EnumActiveAbilityType.Damage)
                    {
                        character.CurrentTurnPoints.IntValue -= selectedAbility.TurnPointCost;
                        if (AttackClicked != null)
                            AttackClicked(this, EventArgs.Empty);

                        lbTurnpoints.Text = character.CurrentTurnPoints.IntValue.ToString() + " Turnpoints left";
                    }
                    else if ((checkBoxPlayer1.Checked == true
                        || checkBoxPlayer2.Checked == true
                        || checkBoxPlayer3.Checked == true
                        || checkBoxPlayer4.Checked == true)
                        & selectedAbility.DamageOrHealing == EnumActiveAbilityType.Healing
                        )
                    {
                        character.CurrentTurnPoints.IntValue -= selectedAbility.TurnPointCost;
                        if (AttackClicked != null)
                            AttackClicked(this, EventArgs.Empty);

                        lbTurnpoints.Text = character.CurrentTurnPoints.IntValue.ToString() + " Turnpoints left";
                    }
                }
                else
                {
                    RPG.UI.MessageForm mes = new RPG.UI.MessageForm("You dont have enough turnpoints!");
                    mes.ShowDialog();
                }
            }
        }
예제 #2
0
 //内部方法,不检查参数有效性
 private static DialogResult ShowCore(string message, string caption, string attachMessage, MessageBoxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton defaultButton)
 {
     using (MessageForm f = new MessageForm(message, caption, buttons, icon, defaultButton, attachMessage, EnableAnimate, EnableSound))
     {
         return f.ShowDialog();
     }
 }