private void btnLoadGame_Click(object sender, EventArgs e) { if (save == "Yes") { //load save MainGameForm f1 = new MainGameForm(); f1.StartPosition = FormStartPosition.CenterParent; f1.ShowDialog(this); } else { MessageBox.Show("No save found. Start new game."); } }
private void btnStartGame_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("Are you sure you want to start the game as a " + _player.GenderName + " " + _player.MagicAffinityName + _player.RaceName + " " + _player.ClassName + "?", "Warning!!", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { if (AvailableClasses[_player.ClassID - 1] && AvailableRaces[_player.RaceID - 1]) { StreamWriter sw = new StreamWriter("PlayerInfo.txt"); sw.WriteLine(_player.GenderID.ToString()); sw.WriteLine(_player.ClassID.ToString()); sw.WriteLine(_player.RaceID.ToString()); sw.WriteLine(_player.BaseStrengh.ToString()); sw.WriteLine(_player.BaseHp.ToString()); sw.WriteLine(_player.BaseArmor.ToString()); sw.WriteLine(_player.BaseAttackDamage.ToString()); sw.WriteLine(_player.BaseAgility.ToString()); sw.WriteLine(_player.BaseEvasion.ToString()); sw.WriteLine(_player.BaseAttackSpeed.ToString()); sw.WriteLine(_player.BaseArmorPenetration.ToString()); sw.WriteLine(_player.BaseIntelligence.ToString()); sw.WriteLine(_player.BaseMagicDefense.ToString()); sw.WriteLine(_player.BaseMagicPenetration.ToString()); sw.WriteLine(_player.BaseMagicPower.ToString()); sw.WriteLine(_player.ClassName.ToString()); sw.WriteLine(_player.GenderName.ToString()); sw.WriteLine(_player.RaceName.ToString()); sw.Close(); foreach (Weapon s in World.Weapons) { if (s.ID == _player.ClassID) { StreamWriter sw1 = new StreamWriter("EquipedWeapon.txt"); sw1.WriteLine(s.Class); sw1.WriteLine(s.ID); sw1.WriteLine(s.ImageAdress); sw1.WriteLine(s.Info); sw1.WriteLine(s.Lvl); sw1.WriteLine(s.MaxDmg); sw1.WriteLine(s.MinDmg); sw1.WriteLine(s.Name); sw1.WriteLine(s.CritChance); sw1.WriteLine(s.CritMult); sw1.WriteLine(s.Armor); sw1.WriteLine(s.MagicDefense); sw1.WriteLine(s.ArmorPenetration); sw1.Close(); } } StreamWriter sw2 = new StreamWriter("EquipedArmor.txt"); sw2.WriteLine("0"); sw2.WriteLine("0"); sw2.WriteLine("0"); sw2.WriteLine("0"); sw2.WriteLine("0"); sw2.WriteLine("0"); sw2.WriteLine("0"); sw2.WriteLine("0"); sw2.Close(); MainGameForm f = new MainGameForm(); f.StartPosition = FormStartPosition.CenterParent; f.ShowDialog(this); } else { MessageBox.Show("Unavailable class or Race"); } } else if (dialogResult == DialogResult.No) { //do nothing lel } }