diff options
Diffstat (limited to 'ShiftOS.WinForms/MainMenu')
| -rw-r--r-- | ShiftOS.WinForms/MainMenu/Loading.Designer.cs | 66 | ||||
| -rw-r--r-- | ShiftOS.WinForms/MainMenu/Loading.cs | 32 | ||||
| -rw-r--r-- | ShiftOS.WinForms/MainMenu/Loading.resx | 120 | ||||
| -rw-r--r-- | ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs | 352 | ||||
| -rw-r--r-- | ShiftOS.WinForms/MainMenu/MainMenu.cs | 230 | ||||
| -rw-r--r-- | ShiftOS.WinForms/MainMenu/MainMenu.resx | 120 |
6 files changed, 920 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/MainMenu/Loading.Designer.cs b/ShiftOS.WinForms/MainMenu/Loading.Designer.cs new file mode 100644 index 0000000..5cf42d6 --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/Loading.Designer.cs @@ -0,0 +1,66 @@ +namespace ShiftOS.WinForms.MainMenu +{ + partial class Loading + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.label = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label + // + this.label.Dock = System.Windows.Forms.DockStyle.Fill; + this.label.Font = new System.Drawing.Font("Tahoma", 72F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.label.ForeColor = System.Drawing.Color.White; + this.label.Location = new System.Drawing.Point(0, 0); + this.label.Name = "label"; + this.label.Size = new System.Drawing.Size(284, 262); + this.label.TabIndex = 0; + this.label.Text = "{GEN_LOADING}"; + this.label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // Loading + // + 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(284, 262); + this.Controls.Add(this.label); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; + this.Name = "Loading"; + this.Text = "Loading"; + this.WindowState = System.Windows.Forms.FormWindowState.Maximized; + this.Shown += new System.EventHandler(this.Loading_FormShown); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.Label label; + } +}
\ No newline at end of file diff --git a/ShiftOS.WinForms/MainMenu/Loading.cs b/ShiftOS.WinForms/MainMenu/Loading.cs new file mode 100644 index 0000000..c1c0ba0 --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/Loading.cs @@ -0,0 +1,32 @@ +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 ShiftOS.Engine; + +namespace ShiftOS.WinForms.MainMenu +{ + public partial class Loading : Form + { + public Loading() + { + InitializeComponent(); + label.Text = Localization.Parse(label.Text); + } + + private void Loading_FormShown(object sender, EventArgs e) + { + // This hideous timer thing is the most reliable way to make the form update + // before it starts doing stuff. + var callback = new Timer(); + callback.Tick += (o, a) => { Desktop.CurrentDesktop.Show(); Hide(); callback.Stop(); }; + callback.Interval = 1; + callback.Start(); + } + } +} diff --git a/ShiftOS.WinForms/MainMenu/Loading.resx b/ShiftOS.WinForms/MainMenu/Loading.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/Loading.resx @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs new file mode 100644 index 0000000..a9291d3 --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/MainMenu.Designer.cs @@ -0,0 +1,352 @@ +namespace ShiftOS.WinForms.MainMenu +{ + partial class MainMenu + { + /// <summary> + /// Required designer variable. + /// </summary> + private System.ComponentModel.IContainer components = null; + + /// <summary> + /// Clean up any resources being used. + /// </summary> + /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// <summary> + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// </summary> + private void InitializeComponent() + { + this.flmenu = new System.Windows.Forms.FlowLayoutPanel(); + this.button1 = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); + 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.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.lbcurrentui = new System.Windows.Forms.Label(); + this.shiftos = new System.Windows.Forms.PictureBox(); + this.lbbuilddetails = new System.Windows.Forms.Label(); + this.flmenu.SuspendLayout(); + this.pnloptions.SuspendLayout(); + this.flowLayoutPanel1.SuspendLayout(); + this.flcampaign.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.shiftos)).BeginInit(); + this.SuspendLayout(); + // + // flmenu + // + this.flmenu.AutoSize = true; + this.flmenu.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flmenu.Controls.Add(this.button1); + this.flmenu.Controls.Add(this.button2); + this.flmenu.Controls.Add(this.button3); + 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(49, 367); + this.flmenu.Name = "flmenu"; + this.flmenu.Size = new System.Drawing.Size(187, 145); + this.flmenu.TabIndex = 0; + // + // button1 + // + this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button1.Location = new System.Drawing.Point(3, 3); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(181, 23); + this.button1.TabIndex = 0; + this.button1.Text = "{MAINMENU_CAMPAIGN}"; + this.button1.UseVisualStyleBackColor = true; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // button2 + // + this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button2.Location = new System.Drawing.Point(3, 32); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(181, 23); + this.button2.TabIndex = 1; + this.button2.Text = "{MAINMENU_SANDBOX}"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); + // + // button3 + // + this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button3.Location = new System.Drawing.Point(3, 61); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(181, 23); + this.button3.TabIndex = 2; + this.button3.Text = "{GEN_SETTINGS}"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // + // button4 + // + this.button4.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button4.Location = new System.Drawing.Point(3, 90); + this.button4.Name = "button4"; + this.button4.Size = new System.Drawing.Size(181, 23); + this.button4.TabIndex = 3; + this.button4.Text = "{GEN_ABOUT}"; + this.button4.UseVisualStyleBackColor = true; + // + // button5 + // + this.button5.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button5.Location = new System.Drawing.Point(3, 119); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(181, 23); + this.button5.TabIndex = 4; + this.button5.Text = "{GEN_EXIT}"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.button5_Click); + // + // lbticker + // + this.lbticker.AutoSize = true; + this.lbticker.Location = new System.Drawing.Point(29, 515); + this.lbticker.Name = "lbticker"; + this.lbticker.Size = new System.Drawing.Size(93, 13); + this.lbticker.TabIndex = 1; + this.lbticker.Tag = "header3"; + this.lbticker.Text = "This is a tickerbar."; + // + // pnloptions + // + 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, 167); + this.pnloptions.TabIndex = 2; + // + // 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(125, 13); + this.label2.TabIndex = 3; + this.label2.Text = "{MAINMENU_DSPORT}"; + // + // 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(147, 13); + this.label1.TabIndex = 1; + this.label1.Text = "{MAINMENU_DSADDRESS}"; + // + // 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, 136); + 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(331, 3); + this.opt_btncancel.Name = "opt_btncancel"; + this.opt_btncancel.Size = new System.Drawing.Size(98, 25); + this.opt_btncancel.TabIndex = 0; + this.opt_btncancel.Text = "{GEN_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(241, 3); + this.btnsave.Name = "btnsave"; + this.btnsave.Size = new System.Drawing.Size(84, 25); + this.btnsave.TabIndex = 1; + this.btnsave.Text = "{GEN_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 = "{MAINMENU_NEWGAME}"; + 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 = "{GEN_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 = "{GEN_BACK}"; + this.button10.UseVisualStyleBackColor = true; + this.button10.Click += new System.EventHandler(this.button10_Click); + // + // lbcurrentui + // + this.lbcurrentui.AutoSize = true; + this.lbcurrentui.Location = new System.Drawing.Point(704, 259); + this.lbcurrentui.Name = "lbcurrentui"; + this.lbcurrentui.Size = new System.Drawing.Size(35, 13); + this.lbcurrentui.TabIndex = 4; + this.lbcurrentui.Tag = "header2"; + this.lbcurrentui.Text = "label4"; + // + // shiftos + // + this.shiftos.Image = global::ShiftOS.WinForms.Properties.Resources.ShiftOSFull; + this.shiftos.Location = new System.Drawing.Point(432, 381); + this.shiftos.Name = "shiftos"; + this.shiftos.Size = new System.Drawing.Size(468, 109); + this.shiftos.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.shiftos.TabIndex = 5; + this.shiftos.TabStop = false; + // + // lbbuilddetails + // + this.lbbuilddetails.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.lbbuilddetails.AutoSize = true; + this.lbbuilddetails.Location = new System.Drawing.Point(1, 553); + this.lbbuilddetails.Name = "lbbuilddetails"; + this.lbbuilddetails.Size = new System.Drawing.Size(35, 13); + this.lbbuilddetails.TabIndex = 6; + this.lbbuilddetails.Text = "label4"; + // + // 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.lbbuilddetails); + this.Controls.Add(this.shiftos); + this.Controls.Add(this.lbcurrentui); + 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; + this.Name = "MainMenu"; + 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); + ((System.ComponentModel.ISupportInitialize)(this.shiftos)).EndInit(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.FlowLayoutPanel flmenu; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + 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 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; + private System.Windows.Forms.Label lbcurrentui; + private System.Windows.Forms.PictureBox shiftos; + private System.Windows.Forms.Label lbbuilddetails; + } +}
\ No newline at end of file diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.cs b/ShiftOS.WinForms/MainMenu/MainMenu.cs new file mode 100644 index 0000000..f6bc833 --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/MainMenu.cs @@ -0,0 +1,230 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; +using ShiftOS.WinForms.Tools; + +namespace ShiftOS.WinForms.MainMenu +{ + public partial class MainMenu : Form + { + private void StartGame() + { + new Loading().Show(); + } + + public MainMenu(IDesktop desk) + { + InitializeComponent(); + (desk as WinformsDesktop).ParentMenu = this; + this.FormBorderStyle = FormBorderStyle.None; + this.WindowState = FormWindowState.Maximized; +#if DEBUG + var asm = Assembly.GetExecutingAssembly(); + + string asmName = asm.GetName().Name; + string vstring = ""; + var version = asm.GetCustomAttributes(true).FirstOrDefault(x => x is AssemblyVersionAttribute) as AssemblyVersionAttribute; + if (version != null) + vstring = version.Version; + lbbuilddetails.Text = $"{asmName} - version number: {vstring} - THIS IS AN UNSTABLE RELEASE."; + +#else + lbbuilddetails.Hide(); +#endif + } + + public void HideOptions() + { + pnloptions.Hide(); + flmenu.BringToFront(); + flmenu.CenterParent(); + currentMenu = flmenu; + CategoryText = Localization.Parse("{MAINMENU_TITLE}"); + } + + public string CategoryText + { + get + { + return lbcurrentui.Text; + } + set + { + lbcurrentui.Text = value; + lbcurrentui.CenterParent(); + lbcurrentui.Top = currentMenu.Top - (lbcurrentui.Height * 2); + } + } + + private Control currentMenu = null; + + private void MainMenu_Load(object sender, EventArgs e) + { + Tools.ControlManager.SetupControls(this); + shiftos.CenterParent(); + shiftos.Top = 35; + + + var tickermove = new Timer(); + var tickerreset = new Timer(); + tickermove.Tick += (o, a) => + { + if (lbticker.Left <= (0 - lbticker.Width)) + { + tickermove.Stop(); + tickerreset.Start(); + } + else + { + lbticker.Top = (this.ClientSize.Height - (lbticker.Height * 2)); + lbticker.Left -= 2; + } + }; + tickerreset.Tick += (o, a) => + { + lbticker.Visible = false; + lbticker.Text = GetTickerMessage(); + lbticker.Left = this.Width; + lbticker.Visible = true; + tickerreset.Stop(); + tickermove.Start(); + }; + + tickermove.Interval = 1; + tickerreset.Interval = 1000; + + pnloptions.Hide(); + flcampaign.Hide(); + flmenu.CenterParent(); + + tickerreset.Start(); + + currentMenu = flmenu; + CategoryText = Localization.Parse("{MAINMENU_TITLE}"); + + } + + private Random rnd = new Random(); + + private string GetTickerMessage() + { + return Localization.Parse("{MAINMENU_TIPTEXT_" + rnd.Next(10) + "}"); + } + + private void button1_Click(object sender, EventArgs e) + { + 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(); + currentMenu = flcampaign; + CategoryText = Localization.Parse("{MAINMENU_CAMPAIGN}"); + + } + + private void button5_Click(object sender, EventArgs e) + { + this.Close(); + } + + private void button2_Click(object sender, EventArgs e) + { + (Desktop.CurrentDesktop as WinformsDesktop).IsSandbox = true; + StartGame(); + } + + private void button3_Click(object sender, EventArgs e) + { + var conf = ShiftOS.Objects.UserConfig.Get(); + + txtdsaddress.Text = conf.DigitalSocietyAddress; + txtdsport.Text = conf.DigitalSocietyPort.ToString(); + + + pnloptions.Show(); + pnloptions.BringToFront(); + pnloptions.CenterParent(); + currentMenu = pnloptions; + CategoryText = Localization.Parse("{GEN_SETTINGS}"); + + } + + 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 || p < 0 || p > 65535) + { + Infobox.Show("{TITLE_INVALIDPORT}", "{PROMPT_INVALIDPORT}"); + return; + } + + conf.DigitalSocietyPort = p; + + 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(); + currentMenu = flmenu; + CategoryText = Localization.Parse("{MAINMENU_TITLE}"); + } + + private void btncontinue_Click(object sender, EventArgs e) + { + StartGame(); + + } + + 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); + StartGame(); + } + }); + } + else + { + StartGame(); + } + } + } +} diff --git a/ShiftOS.WinForms/MainMenu/MainMenu.resx b/ShiftOS.WinForms/MainMenu/MainMenu.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/MainMenu/MainMenu.resx @@ -0,0 +1,120 @@ +<?xml version="1.0" encoding="utf-8"?> +<root> + <!-- + Microsoft ResX Schema + + Version 2.0 + + The primary goals of this format is to allow a simple XML format + that is mostly human readable. The generation and parsing of the + various data types are done through the TypeConverter classes + associated with the data types. + + Example: + + ... ado.net/XML headers & schema ... + <resheader name="resmimetype">text/microsoft-resx</resheader> + <resheader name="version">2.0</resheader> + <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> + <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> + <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> + <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> + <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> + <value>[base64 mime encoded serialized .NET Framework object]</value> + </data> + <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> + <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> + <comment>This is a comment</comment> + </data> + + There are any number of "resheader" rows that contain simple + name/value pairs. + + Each data row contains a name, and value. The row also contains a + type or mimetype. Type corresponds to a .NET class that support + text/value conversion through the TypeConverter architecture. + Classes that don't support this are serialized and stored with the + mimetype set. + + The mimetype is used for serialized objects, and tells the + ResXResourceReader how to depersist the object. This is currently not + extensible. For a given mimetype the value must be set accordingly: + + Note - application/x-microsoft.net.object.binary.base64 is the format + that the ResXResourceWriter will generate, however the reader can + read any of the formats listed below. + + mimetype: application/x-microsoft.net.object.binary.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.soap.base64 + value : The object must be serialized with + : System.Runtime.Serialization.Formatters.Soap.SoapFormatter + : and then encoded with base64 encoding. + + mimetype: application/x-microsoft.net.object.bytearray.base64 + value : The object must be serialized into a byte array + : using a System.ComponentModel.TypeConverter + : and then encoded with base64 encoding. + --> + <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> + <xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> + <xsd:element name="root" msdata:IsDataSet="true"> + <xsd:complexType> + <xsd:choice maxOccurs="unbounded"> + <xsd:element name="metadata"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" /> + </xsd:sequence> + <xsd:attribute name="name" use="required" type="xsd:string" /> + <xsd:attribute name="type" type="xsd:string" /> + <xsd:attribute name="mimetype" type="xsd:string" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="assembly"> + <xsd:complexType> + <xsd:attribute name="alias" type="xsd:string" /> + <xsd:attribute name="name" type="xsd:string" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="data"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> + <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> + <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> + <xsd:attribute ref="xml:space" /> + </xsd:complexType> + </xsd:element> + <xsd:element name="resheader"> + <xsd:complexType> + <xsd:sequence> + <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> + </xsd:sequence> + <xsd:attribute name="name" type="xsd:string" use="required" /> + </xsd:complexType> + </xsd:element> + </xsd:choice> + </xsd:complexType> + </xsd:element> + </xsd:schema> + <resheader name="resmimetype"> + <value>text/microsoft-resx</value> + </resheader> + <resheader name="version"> + <value>2.0</value> + </resheader> + <resheader name="reader"> + <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> + <resheader name="writer"> + <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> + </resheader> +</root>
\ No newline at end of file |
