コード例 #1
0
ファイル: StartMenu.cs プロジェクト: BTopchiyski/repos
        private void StartMenu_StartGame_Click(object sender, EventArgs e)
        {
            string[] file;
            if (File.Exists(@"D:\\HeroWarsSaves.txt"))
            {
                file = File.ReadAllLines(@"D:\\HeroWarsSaves.txt");

                if (file.Length >= 1)
                {
                    this.Hide();
                    Saves saves = new Saves();
                    saves.ShowDialog();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("No characters found! Please create a character!");
                    this.Hide();
                    CharacterCreator createcharacter = new CharacterCreator();
                    createcharacter.ShowDialog();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("No characters found! Please create a character!");
                this.Hide();
                CharacterCreator createcharacter = new CharacterCreator();
                createcharacter.ShowDialog();
                this.Close();
            }
        }
コード例 #2
0
ファイル: Saves.cs プロジェクト: BTopchiyski/UniProjects
        private void Saves_CreateC_Click(object sender, EventArgs e)
        {
            this.Hide();
            CharacterCreator createcharacter = new CharacterCreator();

            createcharacter.ShowDialog();
            this.Close();
        }
コード例 #3
0
ファイル: Saves.cs プロジェクト: BTopchiyski/UniProjects
        private void NoCharacters()
        {
            this.Hide();
            MessageBox.Show("You ran out of characters! Create a new one.");
            CharacterCreator createcharacter = new CharacterCreator();

            createcharacter.ShowDialog();
            this.Close();
        }
コード例 #4
0
ファイル: Saves.cs プロジェクト: BTopchiyski/repos
        private void NoCharacters()
        {
            using (FileStream file = new FileStream(@"D:\\Users.txt", FileMode.Truncate, FileAccess.Write))
            {
                StreamWriter sw = new StreamWriter(file);
                foreach (var c in LogIn.users)
                {
                    sw.WriteLine(c.Name + "|" + c.Password + "|" + c.Heroes);
                }
                sw.Close();
                sw.Dispose();
            }
            this.Hide();
            MessageBox.Show("You ran out of characters! Create a new one.");
            CharacterCreator createcharacter = new CharacterCreator();

            createcharacter.ShowDialog();
            this.Close();
        }