aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/MainMenu
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-06-10 22:02:10 -0400
committerMichael <[email protected]>2017-06-10 22:02:10 -0400
commitc3deaa23fffb7011efb2b5b0f7fc3e754d21f600 (patch)
tree4e1cb7c846de1dd454c813eb8e49119a6ef54c70 /ShiftOS.WinForms/MainMenu
parent920e33a2fd329ccbdfeb38ddedd0b4d87e97ed86 (diff)
downloadshiftos_thereturn-c3deaa23fffb7011efb2b5b0f7fc3e754d21f600.tar.gz
shiftos_thereturn-c3deaa23fffb7011efb2b5b0f7fc3e754d21f600.tar.bz2
shiftos_thereturn-c3deaa23fffb7011efb2b5b0f7fc3e754d21f600.zip
Even more menu work.
Diffstat (limited to 'ShiftOS.WinForms/MainMenu')
-rw-r--r--ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs188
-rw-r--r--ShiftOS.WinForms/MainMenu/MainMenu.cs120
2 files changed, 306 insertions, 2 deletions
diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs
index 62db46d..a056866 100644
--- a/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs
+++ b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs
@@ -35,7 +35,24 @@
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.lbticker = new System.Windows.Forms.Label();
+ this.pnloptions = new System.Windows.Forms.Panel();
+ this.txtubase = new System.Windows.Forms.TextBox();
+ this.label3 = new System.Windows.Forms.Label();
+ this.txtdsport = new System.Windows.Forms.TextBox();
+ this.label2 = new System.Windows.Forms.Label();
+ this.txtdsaddress = new System.Windows.Forms.TextBox();
+ this.label1 = new System.Windows.Forms.Label();
+ this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
+ this.opt_btncancel = new System.Windows.Forms.Button();
+ this.btnsave = new System.Windows.Forms.Button();
+ this.flcampaign = new System.Windows.Forms.FlowLayoutPanel();
+ this.btnnewgame = new System.Windows.Forms.Button();
+ this.btncontinue = new System.Windows.Forms.Button();
+ this.button10 = new System.Windows.Forms.Button();
this.flmenu.SuspendLayout();
+ this.pnloptions.SuspendLayout();
+ this.flowLayoutPanel1.SuspendLayout();
+ this.flcampaign.SuspendLayout();
this.SuspendLayout();
//
// flmenu
@@ -48,7 +65,7 @@
this.flmenu.Controls.Add(this.button4);
this.flmenu.Controls.Add(this.button5);
this.flmenu.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
- this.flmenu.Location = new System.Drawing.Point(46, 218);
+ this.flmenu.Location = new System.Drawing.Point(49, 367);
this.flmenu.Name = "flmenu";
this.flmenu.Size = new System.Drawing.Size(187, 145);
this.flmenu.TabIndex = 0;
@@ -84,6 +101,7 @@
this.button3.TabIndex = 2;
this.button3.Text = "Settings";
this.button3.UseVisualStyleBackColor = true;
+ this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
@@ -116,12 +134,161 @@
this.lbticker.Tag = "header3";
this.lbticker.Text = "This is a tickerbar.";
//
+ // pnloptions
+ //
+ this.pnloptions.Controls.Add(this.txtubase);
+ this.pnloptions.Controls.Add(this.label3);
+ this.pnloptions.Controls.Add(this.txtdsport);
+ this.pnloptions.Controls.Add(this.label2);
+ this.pnloptions.Controls.Add(this.txtdsaddress);
+ this.pnloptions.Controls.Add(this.label1);
+ this.pnloptions.Controls.Add(this.flowLayoutPanel1);
+ this.pnloptions.Location = new System.Drawing.Point(49, 26);
+ this.pnloptions.Name = "pnloptions";
+ this.pnloptions.Size = new System.Drawing.Size(432, 290);
+ this.pnloptions.TabIndex = 2;
+ //
+ // txtubase
+ //
+ this.txtubase.Location = new System.Drawing.Point(146, 133);
+ this.txtubase.Name = "txtubase";
+ this.txtubase.Size = new System.Drawing.Size(225, 20);
+ this.txtubase.TabIndex = 6;
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Location = new System.Drawing.Point(22, 136);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(106, 13);
+ this.label3.TabIndex = 5;
+ this.label3.Text = "Unite API base URL:";
+ //
+ // txtdsport
+ //
+ this.txtdsport.Location = new System.Drawing.Point(146, 85);
+ this.txtdsport.Name = "txtdsport";
+ this.txtdsport.Size = new System.Drawing.Size(225, 20);
+ this.txtdsport.TabIndex = 4;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Location = new System.Drawing.Point(22, 88);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(99, 13);
+ this.label2.TabIndex = 3;
+ this.label2.Text = "Digital Society Port:";
+ //
+ // txtdsaddress
+ //
+ this.txtdsaddress.Location = new System.Drawing.Point(146, 54);
+ this.txtdsaddress.Name = "txtdsaddress";
+ this.txtdsaddress.Size = new System.Drawing.Size(225, 20);
+ this.txtdsaddress.TabIndex = 2;
+ //
+ // label1
+ //
+ this.label1.AutoSize = true;
+ this.label1.Location = new System.Drawing.Point(22, 57);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(118, 13);
+ this.label1.TabIndex = 1;
+ this.label1.Text = "Digital Society Address:";
+ //
+ // flowLayoutPanel1
+ //
+ this.flowLayoutPanel1.AutoSize = true;
+ this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.flowLayoutPanel1.Controls.Add(this.opt_btncancel);
+ this.flowLayoutPanel1.Controls.Add(this.btnsave);
+ this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom;
+ this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft;
+ this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 259);
+ this.flowLayoutPanel1.Name = "flowLayoutPanel1";
+ this.flowLayoutPanel1.Size = new System.Drawing.Size(432, 31);
+ this.flowLayoutPanel1.TabIndex = 0;
+ //
+ // opt_btncancel
+ //
+ this.opt_btncancel.AutoSize = true;
+ this.opt_btncancel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.opt_btncancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.opt_btncancel.Location = new System.Drawing.Point(377, 3);
+ this.opt_btncancel.Name = "opt_btncancel";
+ this.opt_btncancel.Size = new System.Drawing.Size(52, 25);
+ this.opt_btncancel.TabIndex = 0;
+ this.opt_btncancel.Text = "Cancel";
+ this.opt_btncancel.UseVisualStyleBackColor = true;
+ this.opt_btncancel.Click += new System.EventHandler(this.opt_btncancel_Click);
+ //
+ // btnsave
+ //
+ this.btnsave.AutoSize = true;
+ this.btnsave.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.btnsave.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnsave.Location = new System.Drawing.Point(327, 3);
+ this.btnsave.Name = "btnsave";
+ this.btnsave.Size = new System.Drawing.Size(44, 25);
+ this.btnsave.TabIndex = 1;
+ this.btnsave.Text = "Save";
+ this.btnsave.UseVisualStyleBackColor = true;
+ this.btnsave.Click += new System.EventHandler(this.btnsave_Click);
+ //
+ // flcampaign
+ //
+ this.flcampaign.AutoSize = true;
+ this.flcampaign.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
+ this.flcampaign.Controls.Add(this.btnnewgame);
+ this.flcampaign.Controls.Add(this.btncontinue);
+ this.flcampaign.Controls.Add(this.button10);
+ this.flcampaign.FlowDirection = System.Windows.Forms.FlowDirection.TopDown;
+ this.flcampaign.Location = new System.Drawing.Point(242, 364);
+ this.flcampaign.Name = "flcampaign";
+ this.flcampaign.Size = new System.Drawing.Size(187, 87);
+ this.flcampaign.TabIndex = 3;
+ //
+ // btnnewgame
+ //
+ this.btnnewgame.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btnnewgame.Location = new System.Drawing.Point(3, 3);
+ this.btnnewgame.Name = "btnnewgame";
+ this.btnnewgame.Size = new System.Drawing.Size(181, 23);
+ this.btnnewgame.TabIndex = 0;
+ this.btnnewgame.Text = "New Game";
+ this.btnnewgame.UseVisualStyleBackColor = true;
+ this.btnnewgame.Click += new System.EventHandler(this.btnnewgame_Click);
+ //
+ // btncontinue
+ //
+ this.btncontinue.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.btncontinue.Location = new System.Drawing.Point(3, 32);
+ this.btncontinue.Name = "btncontinue";
+ this.btncontinue.Size = new System.Drawing.Size(181, 23);
+ this.btncontinue.TabIndex = 1;
+ this.btncontinue.Text = "Continue";
+ this.btncontinue.UseVisualStyleBackColor = true;
+ this.btncontinue.Click += new System.EventHandler(this.btncontinue_Click);
+ //
+ // button10
+ //
+ this.button10.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.button10.Location = new System.Drawing.Point(3, 61);
+ this.button10.Name = "button10";
+ this.button10.Size = new System.Drawing.Size(181, 23);
+ this.button10.TabIndex = 4;
+ this.button10.Text = "Back";
+ this.button10.UseVisualStyleBackColor = true;
+ this.button10.Click += new System.EventHandler(this.button10_Click);
+ //
// MainMenu
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Black;
this.ClientSize = new System.Drawing.Size(1161, 566);
+ this.Controls.Add(this.flcampaign);
+ this.Controls.Add(this.pnloptions);
this.Controls.Add(this.lbticker);
this.Controls.Add(this.flmenu);
this.ForeColor = System.Drawing.Color.White;
@@ -129,6 +296,11 @@
this.Text = "MainMenu";
this.Load += new System.EventHandler(this.MainMenu_Load);
this.flmenu.ResumeLayout(false);
+ this.pnloptions.ResumeLayout(false);
+ this.pnloptions.PerformLayout();
+ this.flowLayoutPanel1.ResumeLayout(false);
+ this.flowLayoutPanel1.PerformLayout();
+ this.flcampaign.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -143,5 +315,19 @@
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Label lbticker;
+ private System.Windows.Forms.Panel pnloptions;
+ private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1;
+ private System.Windows.Forms.Button opt_btncancel;
+ private System.Windows.Forms.Button btnsave;
+ private System.Windows.Forms.TextBox txtubase;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.TextBox txtdsport;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.TextBox txtdsaddress;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.FlowLayoutPanel flcampaign;
+ private System.Windows.Forms.Button btnnewgame;
+ private System.Windows.Forms.Button btncontinue;
+ private System.Windows.Forms.Button button10;
}
} \ No newline at end of file
diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.cs b/ShiftOS.WinForms/MainMenu/MainMenu.cs
index 20cd4ec..4b510e2 100644
--- a/ShiftOS.WinForms/MainMenu/MainMenu.cs
+++ b/ShiftOS.WinForms/MainMenu/MainMenu.cs
@@ -47,11 +47,20 @@ namespace ShiftOS.WinForms.MainMenu
tickermove.Interval = 1;
tickerreset.Interval = 1000;
+ pnloptions.Hide();
+ flcampaign.Hide();
flmenu.CenterParent();
tickerreset.Start();
}
+ public void HideOptions()
+ {
+ pnloptions.Hide();
+ flmenu.BringToFront();
+ flmenu.CenterParent();
+ }
+
private void MainMenu_Load(object sender, EventArgs e)
{
Tools.ControlManager.SetupControls(this);
@@ -76,6 +85,12 @@ namespace ShiftOS.WinForms.MainMenu
return "Terminal too weird for ya? You can use the Format Editor to generate your own Terminal command parser. No coding knowledge needed!";
case 5:
return "Contests are a good way to earn heaps of Codepoints. Head on over to http://getshiftos.ml/Contests for info on current community contests.";
+ case 6:
+ return "There's no bugs in this game... But if you find some, please submit them to http://getshiftos.ml/Bugs.";
+ case 7:
+ return "SHIFTOS - PROPERTY OF MICHAEL VANOVERBEEK. FOR INTERNAL USE ONLY. Build number = sos_tr_133764 [Just kidding. ShiftOS is open-source. Find the code at http://github.com/shiftos-game/ShiftOS!]";
+ case 8:
+ return "Hold your Codepoints against the wall... when they take everything away. Hold your Codepoints against the wall...";
default:
return "Good God. We don't know what to put here.";
}
@@ -83,7 +98,18 @@ namespace ShiftOS.WinForms.MainMenu
private void button1_Click(object sender, EventArgs e)
{
- Desktop.CurrentDesktop.Show();
+ if(System.IO.File.Exists(System.IO.Path.Combine(Paths.SaveDirectory, "autosave.save")))
+ {
+ btncontinue.Show();
+ }
+ else
+ {
+ btncontinue.Hide();
+ }
+ flmenu.Hide();
+ flcampaign.Show();
+ flcampaign.BringToFront();
+ flcampaign.CenterParent();
}
private void button5_Click(object sender, EventArgs e)
@@ -96,5 +122,97 @@ namespace ShiftOS.WinForms.MainMenu
(Desktop.CurrentDesktop as WinformsDesktop).IsSandbox = true;
Desktop.CurrentDesktop.Show();
}
+
+ private void button3_Click(object sender, EventArgs e)
+ {
+ var conf = ShiftOS.Objects.UserConfig.Get();
+
+ txtubase.Text = conf.UniteUrl;
+ txtdsaddress.Text = conf.DigitalSocietyAddress;
+ txtdsport.Text = conf.DigitalSocietyPort.ToString();
+
+
+ pnloptions.Show();
+ pnloptions.BringToFront();
+ pnloptions.CenterParent();
+ }
+
+ private void opt_btncancel_Click(object sender, EventArgs e)
+ {
+ HideOptions();
+ }
+
+ private void btnsave_Click(object sender, EventArgs e)
+ {
+ var conf = ShiftOS.Objects.UserConfig.Get();
+
+ conf.DigitalSocietyAddress = txtdsaddress.Text;
+
+ int p = 0;
+
+ if(int.TryParse(txtdsport.Text, out p) == false)
+ {
+ Infobox.Show("Invalid port number", "The Digital Society Port must be a valid whole number between 0 and 65535.");
+ return;
+ }
+ else
+ {
+ if(p < 0 || p > 65535)
+ {
+ Infobox.Show("Invalid port number", "The Digital Society Port must be a valid whole number between 0 and 65535.");
+ return;
+ }
+ }
+
+ conf.DigitalSocietyPort = p;
+
+ string unite = txtubase.Text;
+ if (unite.EndsWith("/"))
+ {
+ int len = unite.Length;
+ int index = len - 1;
+ int end = 1;
+ unite = unite.Remove(index, end);
+ }
+ conf.UniteUrl = unite;
+
+ System.IO.File.WriteAllText("servers.json", Newtonsoft.Json.JsonConvert.SerializeObject(conf, Newtonsoft.Json.Formatting.Indented));
+
+ HideOptions();
+ }
+
+ private void button10_Click(object sender, EventArgs e)
+ {
+ flcampaign.Hide();
+ flmenu.Show();
+ flmenu.BringToFront();
+ flmenu.CenterParent();
+ }
+
+ private void btncontinue_Click(object sender, EventArgs e)
+ {
+ Desktop.CurrentDesktop.Show();
+
+ }
+
+ private void btnnewgame_Click(object sender, EventArgs e)
+ {
+ string path = System.IO.Path.Combine(Paths.SaveDirectory, "autosave.save");
+ if (System.IO.File.Exists(path))
+ {
+ Infobox.PromptYesNo("Campaign", "You are about to start a new game, which will erase any previous progress. Are you sure you want to do this?", (result) =>
+ {
+ if (result == true)
+ {
+ System.IO.File.Delete(path);
+ Desktop.CurrentDesktop.Show();
+ }
+ });
+ }
+ else
+ {
+ Desktop.CurrentDesktop.Show();
+ }
+ }
}
}