Ejemplo n.º 1
0
        private void saveBtn_Click(object sender, EventArgs e)
        {
            if (!(tbCharName.Text.Length == 0))
            {
                selectedChar.CharacterName = tbCharName.Text;
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Character name cannot be empty.");
                return;
            }

            selectedChar.Health = healthSlider.Value;

            //Updating character values
            selectedChar.CharacterExperience = Convert.ToInt32(experienceIn.Value);
            selectedChar.WeightLimit         = Convert.ToDouble(weightLimitIn.Value);
            if (selectedChar is BlackWitch)
            {
                BlackWitch temp = selectedChar as BlackWitch;
                temp.DarkPower        = Convert.ToInt32(polyNumeric1.Value);
                temp.MagicProficiency = Convert.ToInt32(polyNumeric2.Value);
                selectedChar          = temp;
            }

            if (selectedChar is Brawler)
            {
                Brawler temp = selectedChar as Brawler;
                temp.PunchDamage = Convert.ToInt32(polyNumeric1.Value);
                temp.Strength    = Convert.ToInt32(polyNumeric2.Value);
                selectedChar     = temp;
            }

            if (selectedChar is Cleric)
            {
                Cleric temp = selectedChar as Cleric;
                temp.PietyLevel = Convert.ToInt32(polyNumeric1.Value);
                selectedChar    = temp;
            }

            if (selectedChar is Orc)
            {
                Orc temp = selectedChar as Orc;
                temp.Ferociousness = Convert.ToInt32(polyNumeric1.Value);
                temp.Strength      = Convert.ToInt32(polyNumeric2.Value);
                selectedChar       = temp;
            }


            editingMenuPanel.Hide();
            charLayoutPanel.Controls.Clear();
            displayCharacters();

            selectedChar = null;
        }
Ejemplo n.º 2
0
        private void saveBtn_Click(object sender, EventArgs e)
        {
            if (!(tbCharName.Text.Length == 0))
            {
                newChar.CharacterName = tbCharName.Text;
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("Character name cannot be empty.");
                return;
            }

            newChar.Health = healthSlider.Value;
            newChar.CharacterExperience = Convert.ToInt32(experienceIn.Value);
            newChar.WeightLimit         = Convert.ToDouble(weightLimitIn.Value);
            if (newChar is BlackWitch)
            {
                BlackWitch temp = newChar as BlackWitch;
                temp.DarkPower        = Convert.ToInt32(polyNumeric1.Value);
                temp.MagicProficiency = Convert.ToInt32(polyNumeric2.Value);
                newChar = temp;
            }

            if (newChar is Brawler)
            {
                Brawler temp = newChar as Brawler;
                temp.PunchDamage = Convert.ToInt32(polyNumeric1.Value);
                temp.Strength    = Convert.ToInt32(polyNumeric2.Value);
                newChar          = temp;
            }

            if (newChar is Cleric)
            {
                Cleric temp = newChar as Cleric;
                temp.PietyLevel = Convert.ToInt32(polyNumeric1.Value);
                newChar         = temp;
            }

            if (newChar is Orc)
            {
                Orc temp = newChar as Orc;
                temp.Ferociousness = Convert.ToInt32(polyNumeric1.Value);
                temp.Strength      = Convert.ToInt32(polyNumeric2.Value);
                newChar            = temp;
            }

            charList.Add(newChar);
            originForm.displayCharacters();
            this.Close();
        }
Ejemplo n.º 3
0
        private void openEditingMenu(GameCharacter selectedChar)
        {
            layout.ColumnCount = 2;

            tbCharName.Text    = selectedChar.CharacterName;
            healthSlider.Value = selectedChar.Health;
            experienceIn.Text  = selectedChar.CharacterExperience.ToString();
            weightLimitIn.Text = selectedChar.WeightLimit.ToString();


            if (selectedChar is BlackWitch)
            {
                BlackWitch temp = selectedChar as BlackWitch;

                polyLbl1.Text        = "Dark Power:";
                polyNumeric1.Maximum = 100;
                polyNumeric1.Value   = temp.DarkPower;

                polyLbl2.Text        = "M. Proficiency: ";
                polyNumeric2.Maximum = 100;
                polyNumeric2.Value   = temp.MagicProficiency;
                polyLbl2.Show();
                polyNumeric2.Show();
            }

            if (selectedChar is Brawler)
            {
                Brawler temp = selectedChar as Brawler;

                polyLbl1.Text        = "Punch Damage:";
                polyNumeric1.Maximum = 100;
                polyNumeric1.Value   = temp.PunchDamage;

                polyLbl2.Text        = "Strength: ";
                polyNumeric2.Maximum = 100;
                polyNumeric2.Value   = temp.Strength;
                polyLbl2.Show();
                polyNumeric2.Show();
            }

            if (selectedChar is Cleric)
            {
                Cleric temp = selectedChar as Cleric;

                polyLbl1.Text        = "Piety Level:";
                polyNumeric1.Maximum = 100;
                polyNumeric1.Value   = temp.PietyLevel;

                polyLbl2.Hide();
                polyNumeric2.Hide();
            }

            if (selectedChar is Orc)
            {
                Orc temp = selectedChar as Orc;

                polyLbl1.Text        = "Ferociousness:";
                polyNumeric1.Maximum = 100;
                polyNumeric1.Value   = temp.Ferociousness;

                polyLbl2.Text        = "Strength: ";
                polyNumeric2.Maximum = 100;
                polyNumeric2.Value   = temp.Strength;
                polyLbl2.Show();
                polyNumeric2.Show();
            }



            editingMenuPanel.Controls.Add(layout);
            editingMenuPanel.Show();
        }