Exemplo n.º 1
0
        private void Btn_SaveChar_Click(object sender, EventArgs e)
        {
            string name          = Txt_CharName.Text;
            string selectedClass = Cbo_CharClass.Text;

            EntityGender gender      = Rdo_GenderMale.Checked ? EntityGender.Male: EntityGender.Female;
            var          entityClass = ClassSelect(selectedClass);

            if (!string.IsNullOrWhiteSpace(name) && !string.IsNullOrWhiteSpace(selectedClass))
            {
                PlayerBase hero          = null;
                Item[]     startingItems = new Item[] { new HealthPotion(), new HealthPotion(), new HealthPotion() };
                switch (selectedClass)
                {
                case "Shaman":
                    hero = new Shaman(name, gender, startingItems);
                    break;

                case "Berserker":
                    hero = new Berserker(name, gender, startingItems);
                    break;

                case "Rogue":
                    //hero = new Rogue(name, gender);
                    break;

                case "Warrior":
                    //hero = new Warrior(name, gender);
                    break;

                case "Wizard":
                    //hero = new Wizard(name, gender);
                    break;

                default:
                    break;
                }
                if (hero != null)
                {
                    FileManager.StoreCharacter(hero);
                    Frm_GameMenu gameMenu = new Frm_GameMenu();
                    gameMenu.Show();
                    Close();
                }
                else
                {
                    MessageBox.Show("You need to choose a class!");
                }
            }

            else if (string.IsNullOrWhiteSpace(name) || name[0] == ' ')
            {
                MessageBox.Show("Your characters name can't be empty or begin with a space.");
            }
            else
            {
                MessageBox.Show("You need to select a class for your character!");
            }
        }
Exemplo n.º 2
0
        private void Btn_LoadGame_Click(object sender, EventArgs e)
        {
            Frm_GameMenu gameMenu = new Frm_GameMenu();

            gameMenu.Show();
        }