コード例 #1
0
ファイル: PlayerInfo.cs プロジェクト: Craydel/DM_UBER_TOOL
        /// <summary>
        /// PlayerInfo form constructor
        /// Pulls a list of files from character directory and lists them without the extention to create a selectable character list.
        /// </summary>
        public PlayerInfo()
        {
            InitializeComponent();

            currentPlayer = null;

            LoadCharacterList();

            splitContainer1.Panel2Collapsed = true;
            this.Width = 365;
            lblACDexMod.Text = "0";
            cboGender.SelectedIndex = 0;

            cboRace.Items.Clear();
            cboRace.Items.Add("Human");
            cboRace.Items.Add("Dwarf");
            cboRace.Items.Add("Elf");
            cboRace.Items.Add("Gnome");
            cboRace.Items.Add("Half-Elf");
            cboRace.Items.Add("Half-Orc");
            cboRace.Items.Add("Halfling");
        }
コード例 #2
0
ファイル: PlayerInfo.cs プロジェクト: Craydel/DM_UBER_TOOL
        /// <summary>
        /// Method: save Info from "Player Info" Form to character text document
        /// </summary>
        private void SaveCharacterSheet()
        {
            // cannot assume the currentPlayer has any values - might be a new character.
            currentPlayer = new Player();

            // if this is the first character AND it's a new one being saved....
            if (lastSelectedPlayerName == "")
                lastSelectedPlayerName = cboName.Text;

            if (lastSelectedPlayerName.Trim() == "")
            {
                MessageBox.Show("For new characters, a name must be provided!");
                return; // exit this method without doing anything else...prevents saving a file named ".txt"
            }

            // set all values to be saved.
            currentPlayer.CharName = charname;
            currentPlayer.Race = race;
            currentPlayer.CharSize = charsize;
            currentPlayer.PlayerClass = plyrclass;
            currentPlayer.Level = level;
            currentPlayer.Gender = gender;
            currentPlayer.Age = age;
            currentPlayer.Height = height;
            currentPlayer.Weight = weight;
            currentPlayer.Diety = diety;
            currentPlayer.Alignmnt = alignmnt;
            currentPlayer.Strength = strength;
            currentPlayer.Dexterity = dexterity;
            currentPlayer.Constitution = constitution;
            currentPlayer.Intelligence = intelligence;
            currentPlayer.Wisdom = wisdom;
            currentPlayer.Charisma = charisma;
            currentPlayer.Speed = speed;
            currentPlayer.Overhead = overhead;
            currentPlayer.Offground = offground;
            currentPlayer.Pushdrag = pushdrag;
            currentPlayer.Fortitude = fortitude;
            currentPlayer.Reflex = reflex;
            currentPlayer.Will = will;
            currentPlayer.Armorclass = armorclass;
            currentPlayer.FlatFoot = flatfoot;
            currentPlayer.Touch = touch;
            currentPlayer.Damage = damage;
            currentPlayer.Hitpoints = hitpoints;
            currentPlayer.Subdual = subdual;

            // Moved the file save to the Player class - since other forms might want
            //  to create player sheets (like, say, the Monster Generator), the Player
            //  object created should be able to save itself.
            // Just give it a name to save as.
            currentPlayer.Save();

            // since we may have just created a new character, refresh the dropdown list real quick
            LoadCharacterList();
        }
コード例 #3
0
ファイル: PlayerInfo.cs プロジェクト: Craydel/DM_UBER_TOOL
        /// <summary>
        /// Selectable Dropdown for previously created characters.  
        /// If sheet is empty will load character values into text and combo boxes.  
        /// If not empty will display a conformation box before loading new character.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lastSelectedPlayerName.Trim() != "")
            {
                if (DialogResult.Yes == MessageBox.Show("Save current player sheet?",
                                                        "Save File",
                                                        MessageBoxButtons.YesNo,
                                                        MessageBoxIcon.Hand,
                                                        MessageBoxDefaultButton.Button1
                                                       )
                  )
                {
                    // user clicked "Yes" to save current file first... so, save it.
                    SaveCharacterSheet();
                }
            }

            // then proceed to load the selected character
            lastSelectedPlayerName = cboName.Text;

            currentPlayer = new Player(cboName.SelectedItem.ToString());
            txtSTR.Text = currentPlayer.Strength;
            cboName.Text = currentPlayer.CharName;
            cboRace.Text = currentPlayer.Race;
            cboSize.Text = currentPlayer.CharSize;
            cboClass.Text = currentPlayer.PlayerClass;
            cboLevel.Text = currentPlayer.Level;
            cboGender.Text = currentPlayer.Gender;
            cboAge.Text = currentPlayer.Age;
            cboHeight.Text = currentPlayer.Height;
            cboWeight.Text = currentPlayer.Weight;
            cboDiety.Text = currentPlayer.Diety;
            cboAlignment.Text = currentPlayer.Alignmnt;
            txtSTR.Text = currentPlayer.Strength;
            txtDEX.Text = currentPlayer.Dexterity;
            txtCON.Text = currentPlayer.Constitution;
            txtINT.Text = currentPlayer.Intelligence;
            txtWIS.Text = currentPlayer.Wisdom;
            txtCHA.Text = currentPlayer.Charisma;
            txtSpeed.Text = currentPlayer.Speed;
            txtOverHead.Text = currentPlayer.Overhead;
            txtOffGround.Text = currentPlayer.Offground;
            txtPushDrag.Text = currentPlayer.Pushdrag;
            txtFortitude.Text = currentPlayer.Fortitude;
            txtReflex.Text = currentPlayer.Reflex;
            txtWillPower.Text = currentPlayer.Will;
            txtArmorClass.Text = currentPlayer.Armorclass;
            txtAC_FlatFoot.Text = currentPlayer.FlatFoot;
            txtAC_VsTouch.Text = currentPlayer.Touch;
            txtCurrent_HP.Text = currentPlayer.Damage;
            txtTotal_HP.Text = currentPlayer.Hitpoints;
            txtSub_Dual.Text = currentPlayer.Subdual;
        }