コード例 #1
0
ファイル: frmRoll.cs プロジェクト: wiltaylor/AIEDemo.WinForms
        /// <summary>
        /// Event handler for the roll dropbown box change handler.
        /// </summary>
        private void cmbRollName_TextChanged(object sender, EventArgs e)
        {
            if (cmbRollName.Name == string.Empty)
            {
                Roll = new DiceRoll();
                Roll.Clear();
                RefreshView();

                btnOk.Enabled     = false;
                btnRemove.Enabled = false;
                return;
            }


            var newroll = _rollList.FirstOrDefault(d => d.Name == cmbRollName.Text);

            if (newroll == null)
            {
                return;
            }

            Roll = newroll;

            RefreshView();

            btnOk.Enabled     = true;
            btnRemove.Enabled = true;
        }
コード例 #2
0
 /// <summary>
 /// Set the stats from a character from dice rolls.
 /// </summary>
 /// <param name="dice">Dice roll object to set charecter stats from.</param>
 public void SetFromDiceRoll(DiceRoll dice)
 {
     Strength     = dice.Strength;
     Constitution = dice.Constitution;
     Dexterity    = dice.Dexterity;
     Intelligence = dice.Intelligence;
     Wisdom       = dice.Wisdom;
     Charisma     = dice.Charisma;
 }
コード例 #3
0
ファイル: frmMain.cs プロジェクト: wiltaylor/AIEDemo.WinForms
        /// <summary>
        /// Event handler for roll button. Creates a new set of chareceter stats.
        /// </summary>
        private void btnRoll_Click(object sender, EventArgs e)
        {
            var roll = new DiceRoll();

            _charecter.Strength     = roll.Strength;
            _charecter.Constitution = roll.Constitution;
            _charecter.Dexterity    = roll.Dexterity;
            _charecter.Intelligence = roll.Intelligence;
            _charecter.Wisdom       = roll.Wisdom;
            _charecter.Charisma     = roll.Charisma;

            RefreshView();
        }
コード例 #4
0
ファイル: frmRoll.cs プロジェクト: wiltaylor/AIEDemo.WinForms
        /// <summary>
        /// Shows the roll form in Save configuration.
        /// </summary>
        /// <param name="roll">Roll to save.</param>
        public void ShowSave(DiceRoll roll)
        {
            LoadRolls();
            Roll      = roll;
            _saveMode = true;
            this.Text = "Save Roll";

            txtName.Visible     = true;
            cmbRollName.Visible = false;
            btnOk.Enabled       = false;
            btnRemove.Visible   = false;

            RefreshView();
            ShowDialog();
        }
コード例 #5
0
ファイル: frmRoll.cs プロジェクト: wiltaylor/AIEDemo.WinForms
        /// <summary>
        /// Shows the roll form in Load configuration.
        /// </summary>
        public void ShowLoad()
        {
            LoadRolls();
            Roll = new DiceRoll();
            Roll.Clear();
            _saveMode = false;
            this.Text = "Load Roll";

            txtName.Visible     = false;
            cmbRollName.Visible = true;
            btnOk.Enabled       = false;
            btnRemove.Visible   = true;
            btnRemove.Enabled   = false;

            RefreshView();
            ShowDialog();
        }