コード例 #1
0
ファイル: Main.cs プロジェクト: cyprix7/DnDTools
 private void lblValueGold_Click(object sender, EventArgs e)
 {
     FormController.LblMakeVisible(this, true, "lblStatsValue");
     lblStatsValueGold.Visible = false;
     FormController.TbxMakeVisible(this, false, "tbxStatsSet");
     FormController.BtnMakeVisible(this, false, "btnStatsSet");
     tbxStatsSetGold.Visible = true;
     btnStatsSetGold.Visible = true;
     tbxStatsSetGold.Text    = DataStorage.PartyCharacters[_currentCharacter].Gold.ToString();
     tbxStatsSetGold.Focus();
 }
コード例 #2
0
ファイル: Main.cs プロジェクト: cyprix7/DnDTools
        private void ClickLabel(Label lbl, Button btn, TextBox tbx)
        {
            FormController.LblMakeVisible(this, true, "lblStatsValue");
            FormController.TbxMakeVisible(this, false, "tbxStatsSet");
            FormController.BtnMakeVisible(this, false, "btnStatsSet");

            lbl.Visible = false;
            btn.Visible = false;
            tbx.Visible = true;
            tbx.Focus();
            AcceptButton = btn;
        }
コード例 #3
0
ファイル: Main.cs プロジェクト: cyprix7/DnDTools
 private void btnSetGold_Click(object sender, EventArgs e)
 {
     if (tbxStatsSetGold.Text != "")
     {
         DataStorage.PartyCharacters[_currentCharacter].Gold = Validation.CheckIfValidInt(tbxStatsSetGold.Text.ToString());
         FormController.TbxClear(this, "tbxStatsSet");
         lblStatsValueGold.Visible = true;
         btnStatsSetGold.Visible   = false;
         tbxStatsSetGold.Visible   = false;
         RefreshStats(_currentCharacter);
     }
 }
コード例 #4
0
ファイル: Main.cs プロジェクト: cyprix7/DnDTools
 // Spell slots
 #region Spell slots
 private void lblStatsValueSpellSlot1stLevel_Click(object sender, EventArgs e)
 {
     FormController.LblMakeVisible(this, true, "lblStatsValue");
     FormController.TbxMakeVisible(this, false, "tbxStatsSet");
     FormController.BtnMakeVisible(this, false, "btnStatsSet");
     lblStatsValueSpellSlot1stLevel.Visible = false;
     btnStatsCastSpellSlots1stLevel.Visible = false;
     btnStatsSetSpellSlots1stLevel.Visible  = true;
     tbxStatsSetSpellSlot1stLevel.Visible   = true;
     tbxStatsSetSpellSlot1stLevel.Text      = DataStorage.PartyCharacters[_currentCharacter].SpellSlots1stLevelCurrent.ToString();
     tbxStatsSetSpellSlot1stLevel.Focus();
     AcceptButton = btnStatsSetSpellSlots1stLevel;
 }
コード例 #5
0
ファイル: Main.cs プロジェクト: cyprix7/DnDTools
 private void btnStatsSetSpellSlots1stLevel_Click(object sender, EventArgs e)
 {
     if (Validation.CheckIfValidInt(tbxStatsSetSpellSlot1stLevel.Text.ToString()) <= DataStorage.PartyCharacters[_currentCharacter].SpellSlots1stLevelMaximum &&
         Validation.CheckIfValidInt(tbxStatsSetSpellSlot1stLevel.Text.ToString()) >= 0)
     {
         DataStorage.PartyCharacters[_currentCharacter].SpellSlots1stLevelCurrent = Validation.CheckIfValidInt(tbxStatsSetSpellSlot1stLevel.Text.ToString());
     }
     else if (Validation.CheckIfValidInt(tbxStatsSetSpellSlot1stLevel.Text.ToString()) > DataStorage.PartyCharacters[_currentCharacter].SpellSlots1stLevelMaximum)
     {
         DataStorage.PartyCharacters[_currentCharacter].SpellSlots1stLevelCurrent = DataStorage.PartyCharacters[_currentCharacter].SpellSlots1stLevelMaximum;
     }
     else
     {
         DataStorage.PartyCharacters[_currentCharacter].SpellSlots1stLevelCurrent = 0;
     }
     FormController.TbxClear(this, "tbxStatsSet");
     lblStatsValueSpellSlot1stLevel.Visible = true;
     btnStatsCastSpellSlots1stLevel.Visible = true;
     btnStatsSetSpellSlots1stLevel.Visible  = false;
     tbxStatsSetSpellSlot1stLevel.Visible   = false;
     RefreshStats(_currentCharacter);
 }
コード例 #6
0
        private void btnSubmit_Click(object sender, EventArgs e)
        {
            CharacterParty partyCharacter = new CharacterParty();

            lblFeedback.Visible = false;

            if (tbxName.Text != "" && tbxHealthCurrent.Text != "")
            {
                #region Set properties
                partyCharacter.Name          = tbxName.Text;
                partyCharacter.HealthCurrent = Validation.CheckIfValidInt(tbxHealthCurrent.Text);
                partyCharacter.HealthMaximum = Validation.CheckIfValidInt(tbxHealthMaximum.Text);
                partyCharacter.Rations       = Validation.CheckIfValidDouble(tbxRations.Text);
                partyCharacter.Gold          = Validation.CheckIfValidInt(tbxGold.Text);

                partyCharacter.SpellSlots1stLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot1stLevelCurrent.Text);
                partyCharacter.SpellSlots2ndLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot2ndLevelCurrent.Text);
                partyCharacter.SpellSlots3rdLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot3rdLevelCurrent.Text);
                partyCharacter.SpellSlots4thLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot4thLevelCurrent.Text);
                partyCharacter.SpellSlots5thLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot5thLevelCurrent.Text);
                partyCharacter.SpellSlots6thLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot6thLevelCurrent.Text);
                partyCharacter.SpellSlots7thLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot7thLevelCurrent.Text);
                partyCharacter.SpellSlots8thLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot8thLevelCurrent.Text);
                partyCharacter.SpellSlots9thLevelCurrent = Validation.CheckIfValidInt(tbxSpellSlot9thLevelCurrent.Text);

                partyCharacter.SpellSlots1stLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot1stLevelMaximum.Text);
                partyCharacter.SpellSlots2ndLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot2ndLevelMaximum.Text);
                partyCharacter.SpellSlots3rdLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot3rdLevelMaximum.Text);
                partyCharacter.SpellSlots4thLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot4thLevelMaximum.Text);
                partyCharacter.SpellSlots5thLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot5thLevelMaximum.Text);
                partyCharacter.SpellSlots6thLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot6thLevelMaximum.Text);
                partyCharacter.SpellSlots7thLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot7thLevelMaximum.Text);
                partyCharacter.SpellSlots8thLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot8thLevelMaximum.Text);
                partyCharacter.SpellSlots9thLevelMaximum = Validation.CheckIfValidInt(tbxSpellSlot9thLevelMaximum.Text);

                #endregion

                #region Check inputs
                if (!(partyCharacter.HealthCurrent <= 0))
                {
                    if (!(partyCharacter.HealthMaximum < partyCharacter.HealthCurrent))
                    {
                        if (!(partyCharacter.SpellSlots1stLevelMaximum < partyCharacter.SpellSlots1stLevelCurrent) &&
                            !(partyCharacter.SpellSlots2ndLevelMaximum < partyCharacter.SpellSlots2ndLevelCurrent) &&
                            !(partyCharacter.SpellSlots3rdLevelMaximum < partyCharacter.SpellSlots3rdLevelCurrent) &&
                            !(partyCharacter.SpellSlots4thLevelMaximum < partyCharacter.SpellSlots4thLevelCurrent) &&
                            !(partyCharacter.SpellSlots5thLevelMaximum < partyCharacter.SpellSlots5thLevelCurrent) &&
                            !(partyCharacter.SpellSlots6thLevelMaximum < partyCharacter.SpellSlots6thLevelCurrent) &&
                            !(partyCharacter.SpellSlots7thLevelMaximum < partyCharacter.SpellSlots7thLevelCurrent) &&
                            !(partyCharacter.SpellSlots8thLevelMaximum < partyCharacter.SpellSlots8thLevelCurrent) &&
                            !(partyCharacter.SpellSlots9thLevelMaximum < partyCharacter.SpellSlots9thLevelCurrent))
                        {
                            FormMain.DataStorage.CreatePartyCharacter(partyCharacter);

                            lblFeedback.Visible = true;
                            lblFeedback.Text    = $"{tbxName.Text} added!";
                            FormController.TbxClear(this);
                        }
                        else
                        {
                            MessageBox.Show("Current spell slots cannot be greater than maximum spell slots.", "Error");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Current health cannot be greater than maximum health.", "Error");
                    }
                }
                else
                {
                    MessageBox.Show("You cannot have a character with 0 starting health or less.", "Error");
                }
            }
            else
            {
                MessageBox.Show("You must enter at least a name and starting health.", "Error");
            }

            #endregion
        }