aboutsummaryrefslogtreecommitdiff
path: root/Histacom2/SaveDialogs/NewGameDialog.cs
blob: e3ecd00c05935475fefef8549753e9e12504521c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Histacom2.Engine;
using Newtonsoft.Json;
using static Histacom2.Engine.SaveSystem;
using System.IO;

namespace Histacom2
{
    public partial class NewGameDialog : Form
    {
        public bool Successful = false;
        public NewGameDialog()
        {
            InitializeComponent();
        }

        private void btnHelp_Click(object sender, EventArgs e)
        {
            MessageBox.Show("You can choose a profile name - this will create a new profile! Whenever you want to Load a game, click 'Load Game' and then choose a profile (You can have as many profiles as you want)");
        }

        private void btnCancl_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnInfo_Click(object sender, EventArgs e)
        {
            MessageBox.Show("The game's profiles are stored in your AppData /Histacom2/Profiles - the rest is for you to figure out!");
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            try
            {
                if (txtProfName.Text != "")
                {
                    if (!(txtProfName.Text.Length > 20))
                    {
                        ProfileName = txtProfName.Text;
                        if (DevMode)
                        {
                            if (Directory.Exists(ProfileDirectory))
                            {
                                Directory.Delete(ProfileDirectory, true);
                                Successful = true;
                                this.Close();
                            }
                        }

                        if (!Directory.Exists(ProfileDirectory))
                        {
                            Successful = true;
                            this.Close();
                        }
                        else
                        {
                            MessageBox.Show("That profile already exists! \n USEFUL INFO: Use 'Load Game' to manage your profiles - from there you can delete the profile!");
                        }
                    }
                    else
                    {
                        MessageBox.Show("The profile name cannot be longer than 20 characters");
                    }

                }
                else
                {
                    MessageBox.Show("You must enter a profile name!");
                }
            } catch
            {

            }
        }

        private void NewGameDialog_Load(object sender, EventArgs e)
        {
            if (DevMode)
            {
                btnDevMode.Show();
            }
        }

        private void btnDevMode_Click(object sender, EventArgs e)
        {
            MessageBox.Show("DevMode (Development Mode) is a special mode that lets you test features without having a large amount of accounts just to test a new feature. How it works is simple:" +
                "\n1. It checks for a profile of the same name.\n2. If so, it deletes the profile and starts a new game.\n3. If not, then it starts a new game.");
        }
    }
}