diff options
| author | william341 <[email protected]> | 2017-06-18 16:43:30 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2017-06-18 16:43:30 -0700 |
| commit | ba80dcf3f80018cbb041b62ad8a40268427d1311 (patch) | |
| tree | f0bd18b2355d34c07c744c3cd82a4725a799eecd /ShiftOS.WinForms/Applications | |
| parent | 771c20cfb3a703e0f1550fdcf9eb07b78298c944 (diff) | |
| parent | 12acff8742f4c64976bfabee1b70dc515190fc7c (diff) | |
| download | shiftos_thereturn-ba80dcf3f80018cbb041b62ad8a40268427d1311.tar.gz shiftos_thereturn-ba80dcf3f80018cbb041b62ad8a40268427d1311.tar.bz2 shiftos_thereturn-ba80dcf3f80018cbb041b62ad8a40268427d1311.zip | |
Merge pull request #2 from shiftos-game/master
wew
Diffstat (limited to 'ShiftOS.WinForms/Applications')
26 files changed, 1909 insertions, 2297 deletions
diff --git a/ShiftOS.WinForms/Applications/Artpad.Designer.cs b/ShiftOS.WinForms/Applications/Artpad.Designer.cs index 2955a1c..7b94c34 100644 --- a/ShiftOS.WinForms/Applications/Artpad.Designer.cs +++ b/ShiftOS.WinForms/Applications/Artpad.Designer.cs @@ -72,6 +72,7 @@ namespace ShiftOS.WinForms.Applications this.picdrawingdisplay = new System.Windows.Forms.PictureBox(); this.pnlbottompanel = new System.Windows.Forms.Panel(); this.pnlpallet = new System.Windows.Forms.Panel(); + this.label44 = new System.Windows.Forms.Label(); this.flowcolours = new System.Windows.Forms.FlowLayoutPanel(); this.colourpallet1 = new System.Windows.Forms.Panel(); this.colourpallet2 = new System.Windows.Forms.Panel(); @@ -310,7 +311,6 @@ namespace ShiftOS.WinForms.Applications this.pullbottom = new System.Windows.Forms.Timer(this.components); this.pullside = new System.Windows.Forms.Timer(this.components); this.tmrsetupui = new System.Windows.Forms.Timer(this.components); - this.label44 = new System.Windows.Forms.Label(); this.pgcontents.SuspendLayout(); this.pnldrawingbackground.SuspendLayout(); this.pnlinitialcanvassettings.SuspendLayout(); @@ -621,6 +621,16 @@ namespace ShiftOS.WinForms.Applications this.pnlpallet.Size = new System.Drawing.Size(225, 124); this.pnlpallet.TabIndex = 0; // + // label44 + // + this.label44.Dock = System.Windows.Forms.DockStyle.Fill; + this.label44.Location = new System.Drawing.Point(0, 24); + this.label44.Name = "label44"; + this.label44.Size = new System.Drawing.Size(225, 27); + this.label44.TabIndex = 13; + this.label44.Text = "Left click to select, right click to change color"; + this.label44.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // // flowcolours // this.flowcolours.Controls.Add(this.colourpallet1); @@ -2960,6 +2970,7 @@ namespace ShiftOS.WinForms.Applications this.btnpixelsetter.Name = "btnpixelsetter"; this.btnpixelsetter.Size = new System.Drawing.Size(50, 50); this.btnpixelsetter.TabIndex = 2; + this.btnpixelsetter.Tag = "nobuttonskin"; this.btnpixelsetter.UseVisualStyleBackColor = true; this.btnpixelsetter.Click += new System.EventHandler(this.btnpixelsetter_Click); // @@ -2974,6 +2985,7 @@ namespace ShiftOS.WinForms.Applications this.btnpixelplacer.Name = "btnpixelplacer"; this.btnpixelplacer.Size = new System.Drawing.Size(50, 50); this.btnpixelplacer.TabIndex = 4; + this.btnpixelplacer.Tag = "nobuttonskin"; this.btnpixelplacer.UseVisualStyleBackColor = true; this.btnpixelplacer.Click += new System.EventHandler(this.btnpixelplacer_Click); // @@ -2988,6 +3000,7 @@ namespace ShiftOS.WinForms.Applications this.btnpencil.Name = "btnpencil"; this.btnpencil.Size = new System.Drawing.Size(50, 50); this.btnpencil.TabIndex = 7; + this.btnpencil.Tag = "nobuttonskin"; this.btnpencil.Text = " "; this.btnpencil.UseVisualStyleBackColor = true; this.btnpencil.Click += new System.EventHandler(this.btnpencil_Click); @@ -3003,6 +3016,7 @@ namespace ShiftOS.WinForms.Applications this.btnfloodfill.Name = "btnfloodfill"; this.btnfloodfill.Size = new System.Drawing.Size(50, 50); this.btnfloodfill.TabIndex = 11; + this.btnfloodfill.Tag = "nobuttonskin"; this.btnfloodfill.UseVisualStyleBackColor = true; this.btnfloodfill.Click += new System.EventHandler(this.btnfill_Click); // @@ -3017,6 +3031,7 @@ namespace ShiftOS.WinForms.Applications this.btnoval.Name = "btnoval"; this.btnoval.Size = new System.Drawing.Size(50, 50); this.btnoval.TabIndex = 13; + this.btnoval.Tag = "nobuttonskin"; this.btnoval.Text = " "; this.btnoval.UseVisualStyleBackColor = true; this.btnoval.Click += new System.EventHandler(this.btnoval_Click); @@ -3032,6 +3047,7 @@ namespace ShiftOS.WinForms.Applications this.btnsquare.Name = "btnsquare"; this.btnsquare.Size = new System.Drawing.Size(50, 50); this.btnsquare.TabIndex = 12; + this.btnsquare.Tag = "nobuttonskin"; this.btnsquare.Text = " "; this.btnsquare.UseVisualStyleBackColor = true; this.btnsquare.Click += new System.EventHandler(this.btnsquare_Click); @@ -3047,6 +3063,7 @@ namespace ShiftOS.WinForms.Applications this.btnlinetool.Name = "btnlinetool"; this.btnlinetool.Size = new System.Drawing.Size(50, 50); this.btnlinetool.TabIndex = 15; + this.btnlinetool.Tag = "nobuttonskin"; this.btnlinetool.Text = " "; this.btnlinetool.UseVisualStyleBackColor = true; this.btnlinetool.Click += new System.EventHandler(this.btnlinetool_Click); @@ -3062,6 +3079,7 @@ namespace ShiftOS.WinForms.Applications this.btnpaintbrush.Name = "btnpaintbrush"; this.btnpaintbrush.Size = new System.Drawing.Size(50, 50); this.btnpaintbrush.TabIndex = 17; + this.btnpaintbrush.Tag = "nobuttonskin"; this.btnpaintbrush.Text = " "; this.btnpaintbrush.UseVisualStyleBackColor = true; this.btnpaintbrush.Click += new System.EventHandler(this.btnpaintbrush_Click); @@ -3077,6 +3095,7 @@ namespace ShiftOS.WinForms.Applications this.btntexttool.Name = "btntexttool"; this.btntexttool.Size = new System.Drawing.Size(50, 50); this.btntexttool.TabIndex = 16; + this.btntexttool.Tag = "nobuttonskin"; this.btntexttool.Text = " "; this.btntexttool.UseVisualStyleBackColor = true; this.btntexttool.Click += new System.EventHandler(this.btntexttool_Click); @@ -3092,6 +3111,7 @@ namespace ShiftOS.WinForms.Applications this.btneracer.Name = "btneracer"; this.btneracer.Size = new System.Drawing.Size(50, 50); this.btneracer.TabIndex = 14; + this.btneracer.Tag = "nobuttonskin"; this.btneracer.Text = " "; this.btneracer.UseVisualStyleBackColor = true; this.btneracer.Click += new System.EventHandler(this.btneracer_Click); @@ -3107,6 +3127,7 @@ namespace ShiftOS.WinForms.Applications this.btnnew.Name = "btnnew"; this.btnnew.Size = new System.Drawing.Size(50, 50); this.btnnew.TabIndex = 6; + this.btnnew.Tag = "nobuttonskin"; this.btnnew.Text = " "; this.btnnew.UseVisualStyleBackColor = true; this.btnnew.Click += new System.EventHandler(this.btnnew_Click); @@ -3122,6 +3143,7 @@ namespace ShiftOS.WinForms.Applications this.btnmagnify.Name = "btnmagnify"; this.btnmagnify.Size = new System.Drawing.Size(50, 50); this.btnmagnify.TabIndex = 3; + this.btnmagnify.Tag = "nobuttonskin"; this.btnmagnify.Text = " "; this.btnmagnify.UseVisualStyleBackColor = true; this.btnmagnify.Click += new System.EventHandler(this.btnmagnify_Click); @@ -3137,6 +3159,7 @@ namespace ShiftOS.WinForms.Applications this.btnopen.Name = "btnopen"; this.btnopen.Size = new System.Drawing.Size(50, 50); this.btnopen.TabIndex = 10; + this.btnopen.Tag = "nobuttonskin"; this.btnopen.Text = " "; this.btnopen.UseVisualStyleBackColor = true; this.btnopen.Click += new System.EventHandler(this.btnopen_Click); @@ -3152,6 +3175,7 @@ namespace ShiftOS.WinForms.Applications this.btnsave.Name = "btnsave"; this.btnsave.Size = new System.Drawing.Size(50, 50); this.btnsave.TabIndex = 5; + this.btnsave.Tag = "nobuttonskin"; this.btnsave.Text = " "; this.btnsave.UseVisualStyleBackColor = true; this.btnsave.Click += new System.EventHandler(this.btnsave_Click); @@ -3167,6 +3191,7 @@ namespace ShiftOS.WinForms.Applications this.btnundo.Name = "btnundo"; this.btnundo.Size = new System.Drawing.Size(50, 50); this.btnundo.TabIndex = 8; + this.btnundo.Tag = "nobuttonskin"; this.btnundo.Text = " "; this.btnundo.UseVisualStyleBackColor = true; this.btnundo.Click += new System.EventHandler(this.btnundo_Click); @@ -3182,6 +3207,7 @@ namespace ShiftOS.WinForms.Applications this.btnredo.Name = "btnredo"; this.btnredo.Size = new System.Drawing.Size(50, 50); this.btnredo.TabIndex = 9; + this.btnredo.Tag = "nobuttonskin"; this.btnredo.Text = " "; this.btnredo.UseVisualStyleBackColor = true; this.btnredo.Click += new System.EventHandler(this.btnredo_Click); @@ -3279,16 +3305,6 @@ namespace ShiftOS.WinForms.Applications // this.tmrsetupui.Tick += new System.EventHandler(this.tmrsetupui_Tick); // - // label44 - // - this.label44.Dock = System.Windows.Forms.DockStyle.Fill; - this.label44.Location = new System.Drawing.Point(0, 24); - this.label44.Name = "label44"; - this.label44.Size = new System.Drawing.Size(225, 27); - this.label44.TabIndex = 13; - this.label44.Text = "Left click to select, right click to change color"; - this.label44.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // // Artpad // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -3297,6 +3313,7 @@ namespace ShiftOS.WinForms.Applications this.MinimumSize = new System.Drawing.Size(502, 398); this.Name = "Artpad"; this.Size = new System.Drawing.Size(802, 598); + this.Tag = "nobuttonskin"; this.Load += new System.EventHandler(this.Template_Load); this.pgcontents.ResumeLayout(false); this.pnldrawingbackground.ResumeLayout(false); diff --git a/ShiftOS.WinForms/Applications/Chat.Designer.cs b/ShiftOS.WinForms/Applications/Chat.Designer.cs index d51b732..7bfa4dd 100644 --- a/ShiftOS.WinForms/Applications/Chat.Designer.cs +++ b/ShiftOS.WinForms/Applications/Chat.Designer.cs @@ -54,6 +54,13 @@ namespace ShiftOS.WinForms.Applications { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Chat)); this.panel1 = new System.Windows.Forms.Panel(); + this.pnlstart = new System.Windows.Forms.Panel(); + this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.txtchatid = new System.Windows.Forms.TextBox(); + this.btnjoin = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); this.rtbchat = new System.Windows.Forms.RichTextBox(); this.toolStrip1 = new System.Windows.Forms.ToolStrip(); this.tschatid = new System.Windows.Forms.ToolStripLabel(); @@ -61,18 +68,11 @@ namespace ShiftOS.WinForms.Applications this.tsbottombar = new System.Windows.Forms.ToolStrip(); this.txtuserinput = new System.Windows.Forms.ToolStripTextBox(); this.btnsend = new System.Windows.Forms.ToolStripButton(); - this.pnlstart = new System.Windows.Forms.Panel(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.txtchatid = new System.Windows.Forms.TextBox(); - this.btnjoin = new System.Windows.Forms.Button(); this.panel1.SuspendLayout(); - this.toolStrip1.SuspendLayout(); - this.tsbottombar.SuspendLayout(); this.pnlstart.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); + this.toolStrip1.SuspendLayout(); + this.tsbottombar.SuspendLayout(); this.SuspendLayout(); // // panel1 @@ -87,6 +87,82 @@ namespace ShiftOS.WinForms.Applications this.panel1.Size = new System.Drawing.Size(633, 318); this.panel1.TabIndex = 0; // + // pnlstart + // + this.pnlstart.Controls.Add(this.flowLayoutPanel1); + this.pnlstart.Controls.Add(this.label3); + this.pnlstart.Controls.Add(this.label2); + this.pnlstart.Controls.Add(this.label1); + this.pnlstart.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlstart.Location = new System.Drawing.Point(0, 25); + this.pnlstart.Name = "pnlstart"; + this.pnlstart.Size = new System.Drawing.Size(633, 268); + this.pnlstart.TabIndex = 4; + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.AutoSize = true; + this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel1.Controls.Add(this.txtchatid); + this.flowLayoutPanel1.Controls.Add(this.btnjoin); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 118); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(633, 29); + this.flowLayoutPanel1.TabIndex = 3; + // + // txtchatid + // + this.txtchatid.Location = new System.Drawing.Point(3, 3); + this.txtchatid.Name = "txtchatid"; + this.txtchatid.Size = new System.Drawing.Size(192, 20); + this.txtchatid.TabIndex = 0; + // + // btnjoin + // + this.btnjoin.Location = new System.Drawing.Point(201, 3); + this.btnjoin.Name = "btnjoin"; + this.btnjoin.Size = new System.Drawing.Size(75, 23); + this.btnjoin.TabIndex = 1; + this.btnjoin.Text = "Join"; + this.btnjoin.UseVisualStyleBackColor = true; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Dock = System.Windows.Forms.DockStyle.Top; + this.label3.Location = new System.Drawing.Point(0, 85); + this.label3.Name = "label3"; + this.label3.Padding = new System.Windows.Forms.Padding(10); + this.label3.Size = new System.Drawing.Size(79, 33); + this.label3.TabIndex = 2; + this.label3.Tag = "header3"; + this.label3.Text = "Join a chat"; + // + // label2 + // + this.label2.Dock = System.Windows.Forms.DockStyle.Top; + this.label2.Location = new System.Drawing.Point(0, 33); + this.label2.Name = "label2"; + this.label2.Padding = new System.Windows.Forms.Padding(10); + this.label2.Size = new System.Drawing.Size(633, 52); + this.label2.TabIndex = 1; + this.label2.Text = "SimpleSRC is a simple chat program that utilises the ShiftOS Relay Chat protocol." + + " All you have to do is enter a chat code or system name, and SimpleSRC will try " + + "to initiate a chat for you."; + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Dock = System.Windows.Forms.DockStyle.Top; + this.label1.Location = new System.Drawing.Point(0, 0); + this.label1.Name = "label1"; + this.label1.Padding = new System.Windows.Forms.Padding(10); + this.label1.Size = new System.Drawing.Size(143, 33); + this.label1.TabIndex = 0; + this.label1.Tag = "header1"; + this.label1.Text = "Welcome to SimpleSRC!"; + // // rtbchat // this.rtbchat.Dock = System.Windows.Forms.DockStyle.Fill; @@ -151,82 +227,6 @@ namespace ShiftOS.WinForms.Applications this.btnsend.Text = "Send"; this.btnsend.Click += new System.EventHandler(this.btnsend_Click); // - // pnlstart - // - this.pnlstart.Controls.Add(this.flowLayoutPanel1); - this.pnlstart.Controls.Add(this.label3); - this.pnlstart.Controls.Add(this.label2); - this.pnlstart.Controls.Add(this.label1); - this.pnlstart.Dock = System.Windows.Forms.DockStyle.Fill; - this.pnlstart.Location = new System.Drawing.Point(0, 25); - this.pnlstart.Name = "pnlstart"; - this.pnlstart.Size = new System.Drawing.Size(633, 268); - this.pnlstart.TabIndex = 4; - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Dock = System.Windows.Forms.DockStyle.Top; - this.label1.Location = new System.Drawing.Point(0, 0); - this.label1.Name = "label1"; - this.label1.Padding = new System.Windows.Forms.Padding(10); - this.label1.Size = new System.Drawing.Size(143, 33); - this.label1.TabIndex = 0; - this.label1.Tag = "header1"; - this.label1.Text = "Welcome to SimpleSRC!"; - // - // label2 - // - this.label2.Dock = System.Windows.Forms.DockStyle.Top; - this.label2.Location = new System.Drawing.Point(0, 33); - this.label2.Name = "label2"; - this.label2.Padding = new System.Windows.Forms.Padding(10); - this.label2.Size = new System.Drawing.Size(633, 52); - this.label2.TabIndex = 1; - this.label2.Text = "SimpleSRC is a simple chat program that utilises the ShiftOS Relay Chat protocol." + - " All you have to do is enter a chat code or system name, and SimpleSRC will try " + - "to initiate a chat for you."; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Dock = System.Windows.Forms.DockStyle.Top; - this.label3.Location = new System.Drawing.Point(0, 85); - this.label3.Name = "label3"; - this.label3.Padding = new System.Windows.Forms.Padding(10); - this.label3.Size = new System.Drawing.Size(79, 33); - this.label3.TabIndex = 2; - this.label3.Tag = "header3"; - this.label3.Text = "Join a chat"; - // - // flowLayoutPanel1 - // - this.flowLayoutPanel1.AutoSize = true; - this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.flowLayoutPanel1.Controls.Add(this.txtchatid); - this.flowLayoutPanel1.Controls.Add(this.btnjoin); - this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Top; - this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 118); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(633, 29); - this.flowLayoutPanel1.TabIndex = 3; - // - // txtchatid - // - this.txtchatid.Location = new System.Drawing.Point(3, 3); - this.txtchatid.Name = "txtchatid"; - this.txtchatid.Size = new System.Drawing.Size(192, 20); - this.txtchatid.TabIndex = 0; - // - // btnjoin - // - this.btnjoin.Location = new System.Drawing.Point(201, 3); - this.btnjoin.Name = "btnjoin"; - this.btnjoin.Size = new System.Drawing.Size(75, 23); - this.btnjoin.TabIndex = 1; - this.btnjoin.Text = "Join"; - this.btnjoin.UseVisualStyleBackColor = true; - // // Chat // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -236,14 +236,14 @@ namespace ShiftOS.WinForms.Applications this.Size = new System.Drawing.Size(633, 318); this.panel1.ResumeLayout(false); this.panel1.PerformLayout(); - this.toolStrip1.ResumeLayout(false); - this.toolStrip1.PerformLayout(); - this.tsbottombar.ResumeLayout(false); - this.tsbottombar.PerformLayout(); this.pnlstart.ResumeLayout(false); this.pnlstart.PerformLayout(); this.flowLayoutPanel1.ResumeLayout(false); this.flowLayoutPanel1.PerformLayout(); + this.toolStrip1.ResumeLayout(false); + this.toolStrip1.PerformLayout(); + this.tsbottombar.ResumeLayout(false); + this.tsbottombar.PerformLayout(); this.ResumeLayout(false); } diff --git a/ShiftOS.WinForms/Applications/Chat.resx b/ShiftOS.WinForms/Applications/Chat.resx index a7b2b93..e4a35ad 100644 --- a/ShiftOS.WinForms/Applications/Chat.resx +++ b/ShiftOS.WinForms/Applications/Chat.resx @@ -123,6 +123,12 @@ <metadata name="tsbottombar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <value>122, 17</value> </metadata> + <metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>17, 17</value> + </metadata> + <metadata name="tsbottombar.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> + <value>122, 17</value> + </metadata> <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" /> <data name="btnsend.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <value> diff --git a/ShiftOS.WinForms/Applications/CoherenceOverlay.Designer.cs b/ShiftOS.WinForms/Applications/CoherenceOverlay.Designer.cs deleted file mode 100644 index 0764059..0000000 --- a/ShiftOS.WinForms/Applications/CoherenceOverlay.Designer.cs +++ /dev/null @@ -1,61 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -namespace ShiftOS.WinForms.Applications -{ - partial class CoherenceOverlay - { - /// <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 Component 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() - { - components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - } - - #endregion - } -} diff --git a/ShiftOS.WinForms/Applications/CoherenceOverlay.cs b/ShiftOS.WinForms/Applications/CoherenceOverlay.cs deleted file mode 100644 index 1bfc8e8..0000000 --- a/ShiftOS.WinForms/Applications/CoherenceOverlay.cs +++ /dev/null @@ -1,123 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; -using ShiftOS.Engine; -using System.Threading; - -namespace ShiftOS.WinForms.Applications -{ - public partial class CoherenceOverlay : UserControl, IShiftOSWindow - { - public CoherenceOverlay(IntPtr handle, CoherenceCommands.RECT rect) - { - InitializeComponent(); - this.Load += (o, a) => - { - try - { - int left = this.ParentForm.Left; - int top = this.ParentForm.Top; - int oldwidth = this.ParentForm.Width; - int oldheight = this.ParentForm.Height; - - var t = new Thread(new ThreadStart(() => - { - while (CoherenceCommands.GetWindowRect(handle, ref rect)) - { - - if (left != rect.Left - SkinEngine.LoadedSkin.LeftBorderWidth) - { - this.Invoke(new Action(() => - { - this.ParentForm.Left = rect.Left - SkinEngine.LoadedSkin.LeftBorderWidth; - left = rect.Left - SkinEngine.LoadedSkin.LeftBorderWidth; - })); - } - if (top != rect.Top - SkinEngine.LoadedSkin.TitlebarHeight) - { - this.Invoke(new Action(() => - { - - this.ParentForm.Top = rect.Top - SkinEngine.LoadedSkin.TitlebarHeight; - top = rect.Top - SkinEngine.LoadedSkin.TitlebarHeight; - })); - } - int width = (rect.Right - rect.Left) + 1; - int height = (rect.Bottom - rect.Top) + 1; - - if (oldheight != SkinEngine.LoadedSkin.TitlebarHeight + height + SkinEngine.LoadedSkin.BottomBorderWidth) - { - this.Invoke(new Action(() => - { - this.ParentForm.Height = SkinEngine.LoadedSkin.TitlebarHeight + height + SkinEngine.LoadedSkin.BottomBorderWidth; - oldheight = SkinEngine.LoadedSkin.TitlebarHeight + height + SkinEngine.LoadedSkin.BottomBorderWidth; - })); - } - if (oldwidth != SkinEngine.LoadedSkin.LeftBorderWidth + width + SkinEngine.LoadedSkin.RightBorderWidth) - { - this.Invoke(new Action(() => - { - this.ParentForm.Width = SkinEngine.LoadedSkin.LeftBorderWidth + width + SkinEngine.LoadedSkin.RightBorderWidth; - oldwidth = SkinEngine.LoadedSkin.LeftBorderWidth + width + SkinEngine.LoadedSkin.RightBorderWidth; - })); - } - } - })); - t.IsBackground = true; - t.Start(); - } - catch - { - - } - }; - } - - public void OnLoad() - { - } - - public void OnSkinLoad() - { - } - - public bool OnUnload() - { - return true; - } - - public void OnUpgrade() - { - } - } -} diff --git a/ShiftOS.WinForms/Applications/Downloader.cs b/ShiftOS.WinForms/Applications/Downloader.cs index b3d2cea..bcad56a 100644 --- a/ShiftOS.WinForms/Applications/Downloader.cs +++ b/ShiftOS.WinForms/Applications/Downloader.cs @@ -216,7 +216,6 @@ namespace ShiftOS.WinForms.Applications public int Progress { get; set; } } - [Namespace("dev")] public static class DownloaderDebugCommands { [Command("setsubscription", description ="Use to set the current shiftnet subscription.", usage ="{value:int32}")] diff --git a/ShiftOS.WinForms/Applications/GraphicPicker.Designer.cs b/ShiftOS.WinForms/Applications/GraphicPicker.Designer.cs index 988acbd..889c8aa 100644 --- a/ShiftOS.WinForms/Applications/GraphicPicker.Designer.cs +++ b/ShiftOS.WinForms/Applications/GraphicPicker.Designer.cs @@ -86,12 +86,12 @@ namespace ShiftOS.WinForms.Applications this.pgcontents.Dock = System.Windows.Forms.DockStyle.Fill; this.pgcontents.Location = new System.Drawing.Point(0, 0); this.pgcontents.Name = "pgcontents"; - this.pgcontents.Size = new System.Drawing.Size(390, 383); + this.pgcontents.Size = new System.Drawing.Size(487, 383); this.pgcontents.TabIndex = 20; // // btncancel // - this.btncancel.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.btncancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.btncancel.Location = new System.Drawing.Point(21, 335); this.btncancel.Name = "btncancel"; this.btncancel.Size = new System.Drawing.Size(109, 32); @@ -102,10 +102,11 @@ namespace ShiftOS.WinForms.Applications // // btnreset // - this.btnreset.Anchor = System.Windows.Forms.AnchorStyles.Bottom; + this.btnreset.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.btnreset.Location = new System.Drawing.Point(136, 335); this.btnreset.Name = "btnreset"; - this.btnreset.Size = new System.Drawing.Size(109, 32); + this.btnreset.Size = new System.Drawing.Size(206, 32); this.btnreset.TabIndex = 22; this.btnreset.Text = "Reset"; this.btnreset.UseVisualStyleBackColor = true; @@ -113,8 +114,8 @@ namespace ShiftOS.WinForms.Applications // // btnapply // - this.btnapply.Anchor = System.Windows.Forms.AnchorStyles.Bottom; - this.btnapply.Location = new System.Drawing.Point(251, 335); + this.btnapply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnapply.Location = new System.Drawing.Point(348, 335); this.btnapply.Name = "btnapply"; this.btnapply.Size = new System.Drawing.Size(118, 32); this.btnapply.TabIndex = 21; @@ -124,19 +125,21 @@ namespace ShiftOS.WinForms.Applications // // Label2 // - this.Label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.Label2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.Label2.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Label2.Location = new System.Drawing.Point(125, 260); this.Label2.Name = "Label2"; - this.Label2.Size = new System.Drawing.Size(163, 28); + this.Label2.Size = new System.Drawing.Size(260, 28); this.Label2.TabIndex = 12; + this.Label2.Tag = "header3"; this.Label2.Text = "Idle"; this.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // btnidlebrowse // - this.btnidlebrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.btnidlebrowse.Location = new System.Drawing.Point(295, 260); + this.btnidlebrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.btnidlebrowse.Location = new System.Drawing.Point(392, 260); this.btnidlebrowse.Name = "btnidlebrowse"; this.btnidlebrowse.Size = new System.Drawing.Size(73, 60); this.btnidlebrowse.TabIndex = 10; @@ -146,14 +149,15 @@ namespace ShiftOS.WinForms.Applications // // txtidlefile // - this.txtidlefile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.txtidlefile.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.txtidlefile.BackColor = System.Drawing.Color.White; this.txtidlefile.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.txtidlefile.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.txtidlefile.Location = new System.Drawing.Point(125, 291); this.txtidlefile.Multiline = true; this.txtidlefile.Name = "txtidlefile"; - this.txtidlefile.Size = new System.Drawing.Size(163, 29); + this.txtidlefile.Size = new System.Drawing.Size(260, 29); this.txtidlefile.TabIndex = 9; this.txtidlefile.Text = "None"; this.txtidlefile.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; @@ -172,9 +176,10 @@ namespace ShiftOS.WinForms.Applications // // btnzoom // + this.btnzoom.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnzoom.FlatAppearance.BorderColor = System.Drawing.Color.Black; this.btnzoom.FlatAppearance.BorderSize = 0; - this.btnzoom.Location = new System.Drawing.Point(286, 144); + this.btnzoom.Location = new System.Drawing.Point(383, 144); this.btnzoom.Name = "btnzoom"; this.btnzoom.Size = new System.Drawing.Size(82, 65); this.btnzoom.TabIndex = 7; @@ -184,9 +189,10 @@ namespace ShiftOS.WinForms.Applications // // btnstretch // + this.btnstretch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnstretch.FlatAppearance.BorderColor = System.Drawing.Color.Black; this.btnstretch.FlatAppearance.BorderSize = 0; - this.btnstretch.Location = new System.Drawing.Point(197, 144); + this.btnstretch.Location = new System.Drawing.Point(294, 144); this.btnstretch.Name = "btnstretch"; this.btnstretch.Size = new System.Drawing.Size(82, 65); this.btnstretch.TabIndex = 6; @@ -228,6 +234,9 @@ namespace ShiftOS.WinForms.Applications // // picgraphic // + this.picgraphic.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.picgraphic.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center; this.picgraphic.Location = new System.Drawing.Point(0, 0); this.picgraphic.Name = "picgraphic"; @@ -237,11 +246,14 @@ namespace ShiftOS.WinForms.Applications // // lblobjecttoskin // + this.lblobjecttoskin.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.lblobjecttoskin.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lblobjecttoskin.Location = new System.Drawing.Point(19, 9); this.lblobjecttoskin.Name = "lblobjecttoskin"; - this.lblobjecttoskin.Size = new System.Drawing.Size(350, 23); + this.lblobjecttoskin.Size = new System.Drawing.Size(447, 23); this.lblobjecttoskin.TabIndex = 2; + this.lblobjecttoskin.Tag = "header1"; this.lblobjecttoskin.Text = "Close Button"; this.lblobjecttoskin.TextAlign = System.Drawing.ContentAlignment.TopCenter; // @@ -249,10 +261,9 @@ namespace ShiftOS.WinForms.Applications // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(390, 383); this.Controls.Add(this.pgcontents); this.Name = "GraphicPicker"; - this.Text = "{GRAPHIC_PICKER_NAME}"; + this.Size = new System.Drawing.Size(487, 383); this.Load += new System.EventHandler(this.Graphic_Picker_Load); this.pgcontents.ResumeLayout(false); this.pgcontents.PerformLayout(); diff --git a/ShiftOS.WinForms/Applications/GraphicPicker.cs b/ShiftOS.WinForms/Applications/GraphicPicker.cs index 85f95bd..2a31815 100644 --- a/ShiftOS.WinForms/Applications/GraphicPicker.cs +++ b/ShiftOS.WinForms/Applications/GraphicPicker.cs @@ -45,6 +45,15 @@ namespace ShiftOS.WinForms.Applications { InitializeComponent(); SelectedLayout = layout; + Image = old; + if (Image != null) + { + using (var ms = new System.IO.MemoryStream()) + { + Image.Save(ms, System.Drawing.Imaging.ImageFormat.Png); + ImageAsBinary = ms.ToArray(); + } + } Callback = cb; lblobjecttoskin.Text = name; @@ -123,10 +132,12 @@ namespace ShiftOS.WinForms.Applications public void OnLoad() { + Setup(); } public void OnSkinLoad() { + Setup(); } public bool OnUnload() @@ -136,6 +147,7 @@ namespace ShiftOS.WinForms.Applications public void OnUpgrade() { + Setup(); } } } diff --git a/ShiftOS.WinForms/Applications/IconManager.Designer.cs b/ShiftOS.WinForms/Applications/IconManager.Designer.cs new file mode 100644 index 0000000..25bcee4 --- /dev/null +++ b/ShiftOS.WinForms/Applications/IconManager.Designer.cs @@ -0,0 +1,163 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class IconManager + { + /// <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 Component 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.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.btnclose = new System.Windows.Forms.Button(); + this.btnreset = new System.Windows.Forms.Button(); + this.btnapply = new System.Windows.Forms.Button(); + this.flbody = new System.Windows.Forms.FlowLayoutPanel(); + this.lbcurrentpage = new System.Windows.Forms.Label(); + this.btnprev = new System.Windows.Forms.Button(); + this.btnnext = new System.Windows.Forms.Button(); + this.flowLayoutPanel1.SuspendLayout(); + this.SuspendLayout(); + // + // flowLayoutPanel1 + // + this.flowLayoutPanel1.AutoSize = true; + this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.flowLayoutPanel1.Controls.Add(this.btnclose); + this.flowLayoutPanel1.Controls.Add(this.btnreset); + this.flowLayoutPanel1.Controls.Add(this.btnapply); + this.flowLayoutPanel1.Controls.Add(this.lbcurrentpage); + this.flowLayoutPanel1.Controls.Add(this.btnprev); + this.flowLayoutPanel1.Controls.Add(this.btnnext); + this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 416); + this.flowLayoutPanel1.Name = "flowLayoutPanel1"; + this.flowLayoutPanel1.Size = new System.Drawing.Size(393, 29); + this.flowLayoutPanel1.TabIndex = 0; + // + // btnclose + // + this.btnclose.AutoSize = true; + this.btnclose.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnclose.Location = new System.Drawing.Point(3, 3); + this.btnclose.Name = "btnclose"; + this.btnclose.Size = new System.Drawing.Size(43, 23); + this.btnclose.TabIndex = 0; + this.btnclose.Text = "Close"; + this.btnclose.UseVisualStyleBackColor = true; + this.btnclose.Click += new System.EventHandler(this.btnclose_Click); + // + // btnreset + // + this.btnreset.AutoSize = true; + this.btnreset.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnreset.Location = new System.Drawing.Point(52, 3); + this.btnreset.Name = "btnreset"; + this.btnreset.Size = new System.Drawing.Size(45, 23); + this.btnreset.TabIndex = 1; + this.btnreset.Text = "Reset"; + this.btnreset.UseVisualStyleBackColor = true; + this.btnreset.Click += new System.EventHandler(this.btnreset_Click); + // + // btnapply + // + this.btnapply.AutoSize = true; + this.btnapply.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnapply.Location = new System.Drawing.Point(103, 3); + this.btnapply.Name = "btnapply"; + this.btnapply.Size = new System.Drawing.Size(43, 23); + this.btnapply.TabIndex = 2; + this.btnapply.Text = "Apply"; + this.btnapply.UseVisualStyleBackColor = true; + this.btnapply.Click += new System.EventHandler(this.btnapply_Click); + // + // flbody + // + this.flbody.Dock = System.Windows.Forms.DockStyle.Fill; + this.flbody.FlowDirection = System.Windows.Forms.FlowDirection.TopDown; + this.flbody.Location = new System.Drawing.Point(0, 0); + this.flbody.Name = "flbody"; + this.flbody.Size = new System.Drawing.Size(393, 416); + this.flbody.TabIndex = 1; + this.flbody.WrapContents = false; + // + // lbcurrentpage + // + this.lbcurrentpage.AutoSize = true; + this.lbcurrentpage.Location = new System.Drawing.Point(152, 0); + this.lbcurrentpage.Name = "lbcurrentpage"; + this.lbcurrentpage.Size = new System.Drawing.Size(71, 13); + this.lbcurrentpage.TabIndex = 3; + this.lbcurrentpage.Text = "Current page:"; + // + // btnprev + // + this.btnprev.AutoSize = true; + this.btnprev.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnprev.Location = new System.Drawing.Point(229, 3); + this.btnprev.Name = "btnprev"; + this.btnprev.Size = new System.Drawing.Size(51, 23); + this.btnprev.TabIndex = 4; + this.btnprev.Text = " < Prev"; + this.btnprev.UseVisualStyleBackColor = true; + this.btnprev.Click += new System.EventHandler(this.btnprev_Click); + // + // btnnext + // + this.btnnext.AutoSize = true; + this.btnnext.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.btnnext.Location = new System.Drawing.Point(286, 3); + this.btnnext.Name = "btnnext"; + this.btnnext.Size = new System.Drawing.Size(48, 23); + this.btnnext.TabIndex = 5; + this.btnnext.Text = "Next >"; + this.btnnext.UseVisualStyleBackColor = true; + this.btnnext.Click += new System.EventHandler(this.btnnext_Click); + // + // IconManager + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.flbody); + this.Controls.Add(this.flowLayoutPanel1); + this.Name = "IconManager"; + this.Size = new System.Drawing.Size(393, 445); + this.flowLayoutPanel1.ResumeLayout(false); + this.flowLayoutPanel1.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; + private System.Windows.Forms.Button btnclose; + private System.Windows.Forms.Button btnreset; + private System.Windows.Forms.Button btnapply; + private System.Windows.Forms.FlowLayoutPanel flbody; + private System.Windows.Forms.Label lbcurrentpage; + private System.Windows.Forms.Button btnprev; + private System.Windows.Forms.Button btnnext; + } +} diff --git a/ShiftOS.WinForms/Applications/IconManager.cs b/ShiftOS.WinForms/Applications/IconManager.cs new file mode 100644 index 0000000..7bbeb34 --- /dev/null +++ b/ShiftOS.WinForms/Applications/IconManager.cs @@ -0,0 +1,225 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; +using System.Reflection; +using ShiftOS.WinForms.Tools; +using Newtonsoft.Json; + +namespace ShiftOS.WinForms.Applications +{ + [RequiresUpgrade("icon_manager")] + [Launcher("Icon Manager", true, "al_icon_manager", "Customization")] + [DefaultTitle("Icon Manager")] + [DefaultIcon("iconIconManager")] + public partial class IconManager : UserControl, IShiftOSWindow + { + public IconManager() + { + InitializeComponent(); + } + + public void OnLoad() + { + LoadIconsFromEngine(); + SetupUI(); + } + + public void OnSkinLoad() + { + LoadIconsFromEngine(); + SetupUI(); + } + + public bool OnUnload() + { + Icons = null; + return true; + } + + private Dictionary<string, byte[]> Icons = null; + + private const int pageSize = 10; + private int currentPage = 0; + private int pageCount = 0; + + public Image GetIcon(string id) + { + if (!Icons.ContainsKey(id)) + Icons.Add(id, null); + + if (Icons[id] == null) + { + var img = SkinEngine.GetDefaultIcon(id); + using (var mstr = new System.IO.MemoryStream()) + { + img.Save(mstr, System.Drawing.Imaging.ImageFormat.Png); + Icons[id] = mstr.ToArray(); + } + return img; + } + else + { + using (var sr = new System.IO.MemoryStream(Icons[id])) + { + return Image.FromStream(sr); + } + } + } + + public void SetIcon(string key, byte[] raw) + { + if (!Icons.ContainsKey(key)) + Icons.Add(key, raw); + Icons[key] = raw; + } + + public void LoadIconsFromEngine() + { + //We have to serialize the engine icon list to JSON to break references with the data. + string json = JsonConvert.SerializeObject(SkinEngine.LoadedSkin.AppIcons); + //And deserialize to the local instance...essentially making a clone. + Icons = JsonConvert.DeserializeObject<Dictionary<string, byte[]>>(json); + } + + public void SetupUI() + { + flbody.Controls.Clear(); //Clear the icon list. + + Type[] types = Array.FindAll(ReflectMan.Types, x => x.GetCustomAttributes(false).FirstOrDefault(y => y is DefaultIconAttribute) != null); + + pageCount = types.GetPageCount(pageSize); + + foreach (var type in Array.FindAll(types.GetItemsOnPage(currentPage, pageSize), t => Shiftorium.UpgradeAttributesUnlocked(t))) + { + var pnl = new Panel(); + pnl.Height = 30; + pnl.Width = flbody.Width - 15; + flbody.Controls.Add(pnl); + pnl.Show(); + var pic = new PictureBox(); + pic.SizeMode = PictureBoxSizeMode.StretchImage; + pic.Size = new Size(24, 24); + pic.Image = GetIcon(type.Name); + pnl.Controls.Add(pic); + pic.Left = 5; + pic.Top = (pnl.Height - pic.Height) / 2; + pic.Show(); + var lbl = new Label(); + lbl.Tag = "header3"; + lbl.AutoSize = true; + lbl.Text = NameChangerBackend.GetNameRaw(type); + ControlManager.SetupControl(lbl); + pnl.Controls.Add(lbl); + lbl.CenterParent(); + lbl.Show(); + var btn = new Button(); + btn.Text = "Change..."; + btn.AutoSize = true; + btn.AutoSizeMode = AutoSizeMode.GrowAndShrink; + pnl.Controls.Add(btn); + btn.Left = (pnl.Width - btn.Width) - 5; + btn.Top = (pnl.Height - btn.Height) / 2; + btn.Click += (o, a) => + { + var gfp = new GraphicPicker(pic.Image, lbl.Text + " icon", ImageLayout.Stretch, (raw, img, layout) => + { + pic.Image = img; + SetIcon(type.Name, raw); + }); + AppearanceManager.SetupDialog(gfp); + }; + btn.Show(); + ControlManager.SetupControls(pnl); + } + + btnnext.Visible = (currentPage < pageCount - 1); + btnprev.Visible = (currentPage > 0); + + lbcurrentpage.Text = "Page " + (currentPage + 1).ToString() + " of " + pageCount.ToString(); + } + + public void OnUpgrade() + { + LoadIconsFromEngine(); + SetupUI(); + } + + private void btnprev_Click(object sender, EventArgs e) + { + currentPage--; + SetupUI(); + } + + public void ResetToDefaults() + { + currentPage = 0; + foreach (var key in Icons.Keys) + { + var img = SkinEngine.GetDefaultIcon(key); + using(var ms = new System.IO.MemoryStream()) + { + img.Save(ms, System.Drawing.Imaging.ImageFormat.Png); + Icons[key] = ms.ToArray(); + } + } + SetupUI(); + } + + private void btnnext_Click(object sender, EventArgs e) + { + currentPage++; + SetupUI(); + } + + private void btnclose_Click(object sender, EventArgs e) + { + AppearanceManager.Close(this); + } + + private void btnreset_Click(object sender, EventArgs e) + { + ResetToDefaults(); + } + + private void btnapply_Click(object sender, EventArgs e) + { + SkinEngine.LoadedSkin.AppIcons = Icons; + SkinEngine.SaveSkin(); + SkinEngine.LoadSkin(); + Infobox.Show("Icons applied!", "The new icons have been applied to ShiftOS successfully!"); + } + } + + public static class PaginationExtensions + { + public static int GetPageCount<T>(this IEnumerable<T> collection, int pageSize) + { + return (collection.Count() + pageSize - 1) / pageSize; + } + + public static T[] GetItemsOnPage<T>(this T[] collection, int page, int pageSize) + { + List<T> obj = new List<T>(); + + for (int i = pageSize * page; i <= pageSize + (pageSize * page) && i < collection.Count(); i++) + { + try + { + obj.Add(collection[i]); + } + catch + { + } + } + return obj.ToArray(); + } + } + +} diff --git a/ShiftOS.WinForms/Applications/IconManager.resx b/ShiftOS.WinForms/Applications/IconManager.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/Applications/IconManager.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/Applications/MindBlow.Designer.cs b/ShiftOS.WinForms/Applications/MindBlow.Designer.cs new file mode 100644 index 0000000..da269f6 --- /dev/null +++ b/ShiftOS.WinForms/Applications/MindBlow.Designer.cs @@ -0,0 +1,209 @@ +namespace ShiftOS.WinForms.Applications +{ + partial class MindBlow + { + /// <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 Component 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.tabs = new System.Windows.Forms.TabControl(); + this.console = new System.Windows.Forms.TabPage(); + this.program = new System.Windows.Forms.TabPage(); + this.monitor = new System.Windows.Forms.TabPage(); + this.consoleout = new System.Windows.Forms.TextBox(); + this.programinput = new System.Windows.Forms.TextBox(); + this.load = new System.Windows.Forms.Button(); + this.save = new System.Windows.Forms.Button(); + this.memptr = new System.Windows.Forms.Label(); + this.instptr = new System.Windows.Forms.Label(); + this.memlist = new System.Windows.Forms.ListBox(); + this.run = new System.Windows.Forms.Button(); + this.tabs.SuspendLayout(); + this.console.SuspendLayout(); + this.program.SuspendLayout(); + this.monitor.SuspendLayout(); + this.SuspendLayout(); + // + // tabs + // + this.tabs.Controls.Add(this.console); + this.tabs.Controls.Add(this.program); + this.tabs.Controls.Add(this.monitor); + this.tabs.Dock = System.Windows.Forms.DockStyle.Fill; + this.tabs.Location = new System.Drawing.Point(0, 0); + this.tabs.Name = "tabs"; + this.tabs.SelectedIndex = 0; + this.tabs.Size = new System.Drawing.Size(392, 269); + this.tabs.TabIndex = 0; + this.tabs.Selected += new System.Windows.Forms.TabControlEventHandler(this.tabs_Selected); + // + // console + // + this.console.Controls.Add(this.consoleout); + this.console.Location = new System.Drawing.Point(4, 22); + this.console.Name = "console"; + this.console.Padding = new System.Windows.Forms.Padding(3); + this.console.Size = new System.Drawing.Size(384, 243); + this.console.TabIndex = 0; + this.console.Text = "Console"; + this.console.UseVisualStyleBackColor = true; + // + // program + // + this.program.Controls.Add(this.run); + this.program.Controls.Add(this.save); + this.program.Controls.Add(this.load); + this.program.Controls.Add(this.programinput); + this.program.Location = new System.Drawing.Point(4, 22); + this.program.Name = "program"; + this.program.Padding = new System.Windows.Forms.Padding(3); + this.program.Size = new System.Drawing.Size(384, 243); + this.program.TabIndex = 1; + this.program.Text = "Program"; + this.program.UseVisualStyleBackColor = true; + // + // monitor + // + this.monitor.Controls.Add(this.memlist); + this.monitor.Controls.Add(this.instptr); + this.monitor.Controls.Add(this.memptr); + this.monitor.Location = new System.Drawing.Point(4, 22); + this.monitor.Name = "monitor"; + this.monitor.Size = new System.Drawing.Size(384, 243); + this.monitor.TabIndex = 2; + this.monitor.Text = "Monitor"; + this.monitor.UseVisualStyleBackColor = true; + // + // consoleout + // + this.consoleout.Dock = System.Windows.Forms.DockStyle.Fill; + this.consoleout.Location = new System.Drawing.Point(3, 3); + this.consoleout.Multiline = true; + this.consoleout.Name = "consoleout"; + this.consoleout.ReadOnly = true; + this.consoleout.Size = new System.Drawing.Size(378, 237); + this.consoleout.TabIndex = 0; + // + // programinput + // + this.programinput.Location = new System.Drawing.Point(3, 0); + this.programinput.Multiline = true; + this.programinput.Name = "programinput"; + this.programinput.Size = new System.Drawing.Size(378, 218); + this.programinput.TabIndex = 0; + // + // load + // + this.load.Location = new System.Drawing.Point(6, 217); + this.load.Name = "load"; + this.load.Size = new System.Drawing.Size(115, 23); + this.load.TabIndex = 1; + this.load.Text = "Load"; + this.load.UseVisualStyleBackColor = true; + this.load.Click += new System.EventHandler(this.load_Click); + // + // save + // + this.save.Location = new System.Drawing.Point(127, 217); + this.save.Name = "save"; + this.save.Size = new System.Drawing.Size(114, 23); + this.save.TabIndex = 2; + this.save.Text = "Save"; + this.save.UseVisualStyleBackColor = true; + this.save.Click += new System.EventHandler(this.save_Click); + // + // memptr + // + this.memptr.AutoSize = true; + this.memptr.Location = new System.Drawing.Point(8, 8); + this.memptr.Name = "memptr"; + this.memptr.Size = new System.Drawing.Size(56, 13); + this.memptr.TabIndex = 0; + this.memptr.Text = "Memory: 0"; + // + // instptr + // + this.instptr.AutoSize = true; + this.instptr.Location = new System.Drawing.Point(8, 21); + this.instptr.Name = "instptr"; + this.instptr.Size = new System.Drawing.Size(68, 13); + this.instptr.TabIndex = 1; + this.instptr.Text = "Instruction: 0"; + // + // memlist + // + this.memlist.FormattingEnabled = true; + this.memlist.Location = new System.Drawing.Point(11, 37); + this.memlist.Name = "memlist"; + this.memlist.ScrollAlwaysVisible = true; + this.memlist.SelectionMode = System.Windows.Forms.SelectionMode.None; + this.memlist.Size = new System.Drawing.Size(370, 199); + this.memlist.TabIndex = 2; + // + // run + // + this.run.Location = new System.Drawing.Point(247, 217); + this.run.Name = "run"; + this.run.Size = new System.Drawing.Size(131, 23); + this.run.TabIndex = 3; + this.run.Text = "Run"; + this.run.UseVisualStyleBackColor = true; + this.run.Click += new System.EventHandler(this.run_Click); + // + // MindBlow + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.tabs); + this.Name = "MindBlow"; + this.Size = new System.Drawing.Size(392, 269); + this.Resize += new System.EventHandler(this.MindBlow_Resize); + this.tabs.ResumeLayout(false); + this.console.ResumeLayout(false); + this.console.PerformLayout(); + this.program.ResumeLayout(false); + this.program.PerformLayout(); + this.monitor.ResumeLayout(false); + this.monitor.PerformLayout(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.TabControl tabs; + private System.Windows.Forms.TabPage console; + private System.Windows.Forms.TabPage program; + private System.Windows.Forms.TabPage monitor; + private System.Windows.Forms.TextBox consoleout; + private System.Windows.Forms.TextBox programinput; + private System.Windows.Forms.Button load; + private System.Windows.Forms.Button save; + private System.Windows.Forms.Label instptr; + private System.Windows.Forms.Label memptr; + private System.Windows.Forms.ListBox memlist; + private System.Windows.Forms.Button run; + } +} diff --git a/ShiftOS.WinForms/Applications/MindBlow.cs b/ShiftOS.WinForms/Applications/MindBlow.cs new file mode 100644 index 0000000..1fec9e6 --- /dev/null +++ b/ShiftOS.WinForms/Applications/MindBlow.cs @@ -0,0 +1,200 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Forms; +using ShiftOS.Engine; +using System.IO; +using System.Threading; + +namespace ShiftOS.WinForms.Applications +{ + [WinOpen("mindblow")] + [Launcher("MindBlow", false, null, "Utilities")] + [RequiresUpgrade("mindblow")] + public partial class MindBlow : UserControl, IShiftOSWindow, IBFListener + { + private class TextBoxStream : Stream + { + private TextBox box; + private KeysConverter kc; + public TextBoxStream(TextBox mybox) + { + kc = new KeysConverter(); + box = mybox; + } + public override bool CanRead { get { return true; } } + + public override bool CanSeek { get { return false; } } + + public override bool CanWrite { get { return true; } } + + public override long Length { get { return box.Text.Length; } } + + public override long Position + { + get + { + return Length; + } + set + { + //nothing + } + } + + public override void Flush() + { + } + + public override int Read(byte[] buffer, int offset, int count) + { + object lck = new object(); + int ptr = offset; + KeyPressEventHandler handler = (o, a) => + { + lock (lck) + { + buffer[ptr] = (byte)a.KeyChar; + ptr++; + } + }; + Desktop.InvokeOnWorkerThread(() => box.KeyPress += handler); + while (true) + { + lock (lck) + if (ptr >= offset + count) + break; + } + Desktop.InvokeOnWorkerThread(() => box.KeyPress -= handler); + return count; + } + + public override long Seek(long offset, SeekOrigin origin) + { + throw new NotImplementedException(); + } + + public override void SetLength(long value) + { + throw new NotImplementedException(); + } + + public override void Write(byte[] buffer, int offset, int count) + { + string output = ""; + foreach (byte b in buffer.Skip(offset).Take(count)) + output += Convert.ToChar(b); + Desktop.InvokeOnWorkerThread(() => box.Text += output); + } + } + private static string[] DefaultMem; + private BFInterpreter Interpreter; + + private void DoLayout() + { + memlist.Left = 0; + memlist.Width = monitor.Width; + memlist.Height = monitor.Height - memlist.Top; + program.Top = 0; + program.Left = 0; + programinput.Width = program.Width; + programinput.Height = program.Height - load.Height; + load.Top = save.Top = run.Top = programinput.Height; + load.Width = save.Width = run.Width = save.Left = program.Width / 3; + run.Left = save.Left * 2; + } + + public MindBlow() + { + InitializeComponent(); + DefaultMem = new string[30000]; + for (ushort i = 0; i < 30000; i++) + DefaultMem[i] = "0"; + memlist.Items.AddRange(DefaultMem); + Interpreter = new BFInterpreter(new TextBoxStream(consoleout), this); + } + + public void IPtrMoved(int newval) + { + Desktop.InvokeOnWorkerThread(() => instptr.Text = "Instruction: " + newval.ToString()); + } + + public void MemChanged(ushort pos, byte newval) + { + Desktop.InvokeOnWorkerThread(() => memlist.Items[pos] = newval.ToString()); + } + + public void MemReset() + { + Desktop.InvokeOnWorkerThread(() => + { + memlist.Items.Clear(); + memlist.Items.AddRange(DefaultMem); + }); + } + + public void OnLoad() + { + DoLayout(); + } + + public void OnSkinLoad() + { + } + + public bool OnUnload() + { + return true; + } + + public void OnUpgrade() + { + } + + public void PointerMoved(ushort newval) + { + Desktop.InvokeOnWorkerThread(() => memptr.Text = "Memory: " + newval.ToString()); + } + + private void MindBlow_Resize(object sender, EventArgs e) + { + DoLayout(); + } + + private void run_Click(object sender, EventArgs e) + { + new Thread(() => + { + try + { + Interpreter.Reset(); + Interpreter.Execute(programinput.Text); + } + catch (Exception ex) + { + Desktop.InvokeOnWorkerThread(() => Infobox.Show("Program Error", "An error occurred while executing your program: " + ex.GetType().ToString())); + } + }).Start(); + } + + private void tabs_Selected(object sender, TabControlEventArgs e) + { + DoLayout(); + } + + private void load_Click(object sender, EventArgs e) + { + AppearanceManager.SetupDialog(new FileDialog(new string[] { ".bf" }, FileOpenerStyle.Open, new Action<string>((file) => programinput.Text = Objects.ShiftFS.Utils.ReadAllText(file)))); + } + + private void save_Click(object sender, EventArgs e) + { + AppearanceManager.SetupDialog(new FileDialog(new string[] { ".bf" }, FileOpenerStyle.Save, new Action<string>((file) => Objects.ShiftFS.Utils.WriteAllText(file, programinput.Text)))); + } + } +} diff --git a/ShiftOS.WinForms/Applications/MindBlow.resx b/ShiftOS.WinForms/Applications/MindBlow.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS.WinForms/Applications/MindBlow.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/Applications/Pong.Designer.cs b/ShiftOS.WinForms/Applications/Pong.Designer.cs index 0254e94..fd82735 100644 --- a/ShiftOS.WinForms/Applications/Pong.Designer.cs +++ b/ShiftOS.WinForms/Applications/Pong.Designer.cs @@ -1,64 +1,13 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - - -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using ShiftOS.WinForms.Controls; - -namespace ShiftOS.WinForms.Applications +namespace ShiftOS.WinForms.Applications { partial class Pong { - /// <summary> + /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; - /// <summary> + /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> @@ -71,741 +20,185 @@ namespace ShiftOS.WinForms.Applications base.Dispose(disposing); } + #region Component 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.components = new System.ComponentModel.Container(); - this.gameTimer = new System.Windows.Forms.Timer(this.components); - this.counter = new System.Windows.Forms.Timer(this.components); - this.tmrcountdown = new System.Windows.Forms.Timer(this.components); - this.tmrstoryline = new System.Windows.Forms.Timer(this.components); - this.pgcontents = new ShiftOS.WinForms.Controls.Canvas(); - this.pnlmultiplayerhandshake = new System.Windows.Forms.Panel(); - this.lvotherplayers = new System.Windows.Forms.ListView(); - this.lbmpstatus = new System.Windows.Forms.Label(); - this.pnlintro = new System.Windows.Forms.Panel(); - this.btnmatchmake = new System.Windows.Forms.Button(); - this.Label6 = new System.Windows.Forms.Label(); - this.btnstartgame = new System.Windows.Forms.Button(); - this.Label8 = new System.Windows.Forms.Label(); - this.pnlhighscore = new System.Windows.Forms.Panel(); - this.lbhighscore = new System.Windows.Forms.ListView(); - this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); - this.button2 = new System.Windows.Forms.Button(); - this.label10 = new System.Windows.Forms.Label(); - this.pnlgamestats = new System.Windows.Forms.Panel(); + this.pnlcanvas = new System.Windows.Forms.Panel(); + this.pnllevelwon = new System.Windows.Forms.Panel(); + this.label1 = new System.Windows.Forms.Label(); + this.panel1 = new System.Windows.Forms.Panel(); this.button1 = new System.Windows.Forms.Button(); - this.label12 = new System.Windows.Forms.Label(); - this.lblnextstats = new System.Windows.Forms.Label(); - this.Label7 = new System.Windows.Forms.Label(); - this.lblpreviousstats = new System.Windows.Forms.Label(); - this.Label4 = new System.Windows.Forms.Label(); - this.btnplayon = new System.Windows.Forms.Button(); - this.Label3 = new System.Windows.Forms.Label(); this.btncashout = new System.Windows.Forms.Button(); - this.Label2 = new System.Windows.Forms.Label(); - this.lbllevelreached = new System.Windows.Forms.Label(); - this.pnlfinalstats = new System.Windows.Forms.Panel(); - this.btnplayagain = new System.Windows.Forms.Button(); - this.lblfinalcodepoints = new System.Windows.Forms.Label(); - this.Label11 = new System.Windows.Forms.Label(); - this.lblfinalcomputerreward = new System.Windows.Forms.Label(); - this.Label9 = new System.Windows.Forms.Label(); - this.lblfinallevelreward = new System.Windows.Forms.Label(); - this.lblfinallevelreached = new System.Windows.Forms.Label(); - this.lblfinalcodepointswithtext = new System.Windows.Forms.Label(); - this.pnllose = new System.Windows.Forms.Panel(); - this.lblmissedout = new System.Windows.Forms.Label(); - this.lblbutyougained = new System.Windows.Forms.Label(); - this.btnlosetryagain = new System.Windows.Forms.Button(); - this.Label5 = new System.Windows.Forms.Label(); - this.Label1 = new System.Windows.Forms.Label(); - this.lblbeatai = new System.Windows.Forms.Label(); - this.lblcountdown = new System.Windows.Forms.Label(); - this.ball = new ShiftOS.WinForms.Controls.Canvas(); - this.paddleHuman = new System.Windows.Forms.PictureBox(); - this.paddleComputer = new System.Windows.Forms.Panel(); - this.lbllevelandtime = new System.Windows.Forms.Label(); - this.lblstatscodepoints = new System.Windows.Forms.Label(); - this.lblstatsY = new System.Windows.Forms.Label(); - this.lblstatsX = new System.Windows.Forms.Label(); - this.pgcontents.SuspendLayout(); - this.pnlmultiplayerhandshake.SuspendLayout(); - this.pnlintro.SuspendLayout(); - this.pnlhighscore.SuspendLayout(); - this.flowLayoutPanel1.SuspendLayout(); - this.pnlgamestats.SuspendLayout(); - this.pnlfinalstats.SuspendLayout(); - this.pnllose.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.paddleHuman)).BeginInit(); + this.lbltitle = new System.Windows.Forms.Label(); + this.pnlgamestart = new System.Windows.Forms.Panel(); + this.label2 = new System.Windows.Forms.Label(); + this.panel3 = new System.Windows.Forms.Panel(); + this.btnplay = new System.Windows.Forms.Button(); + this.label3 = new System.Windows.Forms.Label(); + this.pnllevelwon.SuspendLayout(); + this.panel1.SuspendLayout(); + this.pnlgamestart.SuspendLayout(); + this.panel3.SuspendLayout(); this.SuspendLayout(); // - // gameTimer - // - this.gameTimer.Interval = 30; - this.gameTimer.Tick += new System.EventHandler(this.gameTimer_Tick); - // - // counter - // - this.counter.Interval = 1000; - this.counter.Tick += new System.EventHandler(this.counter_Tick); - // - // tmrcountdown - // - this.tmrcountdown.Interval = 1000; - this.tmrcountdown.Tick += new System.EventHandler(this.countdown_Tick); - // - // tmrstoryline - // - this.tmrstoryline.Interval = 1000; - this.tmrstoryline.Tick += new System.EventHandler(this.tmrstoryline_Tick); - // - // pgcontents - // - this.pgcontents.BackColor = System.Drawing.Color.White; - this.pgcontents.Controls.Add(this.pnlmultiplayerhandshake); - this.pgcontents.Controls.Add(this.pnlintro); - this.pgcontents.Controls.Add(this.pnlhighscore); - this.pgcontents.Controls.Add(this.pnlgamestats); - this.pgcontents.Controls.Add(this.pnlfinalstats); - this.pgcontents.Controls.Add(this.pnllose); - this.pgcontents.Controls.Add(this.lblbeatai); - this.pgcontents.Controls.Add(this.lblcountdown); - this.pgcontents.Controls.Add(this.ball); - this.pgcontents.Controls.Add(this.paddleHuman); - this.pgcontents.Controls.Add(this.paddleComputer); - this.pgcontents.Controls.Add(this.lbllevelandtime); - this.pgcontents.Controls.Add(this.lblstatscodepoints); - this.pgcontents.Controls.Add(this.lblstatsY); - this.pgcontents.Controls.Add(this.lblstatsX); - this.pgcontents.Dock = System.Windows.Forms.DockStyle.Fill; - this.pgcontents.Location = new System.Drawing.Point(0, 0); - this.pgcontents.Name = "pgcontents"; - this.pgcontents.Size = new System.Drawing.Size(912, 504); - this.pgcontents.TabIndex = 20; - this.pgcontents.Paint += new System.Windows.Forms.PaintEventHandler(this.pgcontents_Paint); - this.pgcontents.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pongMain_MouseMove); - // - // pnlmultiplayerhandshake - // - this.pnlmultiplayerhandshake.Controls.Add(this.lvotherplayers); - this.pnlmultiplayerhandshake.Controls.Add(this.lbmpstatus); - this.pnlmultiplayerhandshake.Location = new System.Drawing.Point(446, 88); - this.pnlmultiplayerhandshake.Name = "pnlmultiplayerhandshake"; - this.pnlmultiplayerhandshake.Size = new System.Drawing.Size(396, 231); - this.pnlmultiplayerhandshake.TabIndex = 15; - this.pnlmultiplayerhandshake.Visible = false; - // - // lvotherplayers - // - this.lvotherplayers.Dock = System.Windows.Forms.DockStyle.Fill; - this.lvotherplayers.Location = new System.Drawing.Point(0, 45); - this.lvotherplayers.MultiSelect = false; - this.lvotherplayers.Name = "lvotherplayers"; - this.lvotherplayers.Size = new System.Drawing.Size(396, 186); - this.lvotherplayers.TabIndex = 1; - this.lvotherplayers.UseCompatibleStateImageBehavior = false; - this.lvotherplayers.View = System.Windows.Forms.View.Details; - this.lvotherplayers.DoubleClick += new System.EventHandler(this.lvotherplayers_DoubleClick); - // - // lbmpstatus - // - this.lbmpstatus.Dock = System.Windows.Forms.DockStyle.Top; - this.lbmpstatus.Location = new System.Drawing.Point(0, 0); - this.lbmpstatus.Name = "lbmpstatus"; - this.lbmpstatus.Size = new System.Drawing.Size(396, 45); - this.lbmpstatus.TabIndex = 0; - this.lbmpstatus.Tag = "header2"; - this.lbmpstatus.Text = "Waiting for other players..."; - this.lbmpstatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // pnlintro - // - this.pnlintro.Controls.Add(this.btnmatchmake); - this.pnlintro.Controls.Add(this.Label6); - this.pnlintro.Controls.Add(this.btnstartgame); - this.pnlintro.Controls.Add(this.Label8); - this.pnlintro.Location = new System.Drawing.Point(0, 0); - this.pnlintro.Name = "pnlintro"; - this.pnlintro.Size = new System.Drawing.Size(595, 303); - this.pnlintro.TabIndex = 13; - this.pnlintro.Tag = "header2"; - // - // btnmatchmake - // - this.btnmatchmake.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnmatchmake.Location = new System.Drawing.Point(188, 253); - this.btnmatchmake.Name = "btnmatchmake"; - this.btnmatchmake.Size = new System.Drawing.Size(242, 28); - this.btnmatchmake.TabIndex = 16; - this.btnmatchmake.Text = "Or, play against another Shifter!"; - this.btnmatchmake.UseVisualStyleBackColor = true; - this.btnmatchmake.Click += new System.EventHandler(this.btnmatchmake_Click); - // - // Label6 - // - this.Label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label6.Location = new System.Drawing.Point(3, 39); - this.Label6.Name = "Label6"; - this.Label6.Size = new System.Drawing.Size(589, 159); - this.Label6.TabIndex = 15; - this.Label6.Text = "{PONG_DESC}"; - this.Label6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.Label6.Click += new System.EventHandler(this.Label6_Click); - // - // btnstartgame - // - this.btnstartgame.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnstartgame.Location = new System.Drawing.Point(188, 215); - this.btnstartgame.Name = "btnstartgame"; - this.btnstartgame.Size = new System.Drawing.Size(242, 28); - this.btnstartgame.TabIndex = 15; - this.btnstartgame.Text = "{PLAY}"; - this.btnstartgame.UseVisualStyleBackColor = true; - this.btnstartgame.Click += new System.EventHandler(this.btnstartgame_Click); - // - // Label8 - // - this.Label8.AutoSize = true; - this.Label8.Font = new System.Drawing.Font("Microsoft Sans Serif", 20.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label8.ForeColor = System.Drawing.Color.Black; - this.Label8.Location = new System.Drawing.Point(250, 5); - this.Label8.Name = "Label8"; - this.Label8.Size = new System.Drawing.Size(280, 31); - this.Label8.TabIndex = 14; - this.Label8.Text = "{PONG_WELCOME}"; - this.Label8.Click += new System.EventHandler(this.Label8_Click); - // - // pnlhighscore - // - this.pnlhighscore.Controls.Add(this.lbhighscore); - this.pnlhighscore.Controls.Add(this.flowLayoutPanel1); - this.pnlhighscore.Controls.Add(this.label10); - this.pnlhighscore.Location = new System.Drawing.Point(688, 302); - this.pnlhighscore.Name = "pnlhighscore"; - this.pnlhighscore.Size = new System.Drawing.Size(539, 311); - this.pnlhighscore.TabIndex = 14; - this.pnlhighscore.Visible = false; - // - // lbhighscore - // - this.lbhighscore.Dock = System.Windows.Forms.DockStyle.Fill; - this.lbhighscore.Location = new System.Drawing.Point(0, 36); - this.lbhighscore.Name = "lbhighscore"; - this.lbhighscore.Size = new System.Drawing.Size(539, 246); - this.lbhighscore.TabIndex = 1; - this.lbhighscore.UseCompatibleStateImageBehavior = false; - // - // flowLayoutPanel1 - // - this.flowLayoutPanel1.AutoSize = true; - this.flowLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.flowLayoutPanel1.Controls.Add(this.button2); - this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Bottom; - this.flowLayoutPanel1.FlowDirection = System.Windows.Forms.FlowDirection.RightToLeft; - this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 282); - this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(539, 29); - this.flowLayoutPanel1.TabIndex = 2; - // - // button2 - // - this.button2.AutoSize = true; - this.button2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.button2.Location = new System.Drawing.Point(476, 3); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(60, 23); - this.button2.TabIndex = 0; - this.button2.Text = "{CLOSE}"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); - // - // label10 - // - this.label10.Dock = System.Windows.Forms.DockStyle.Top; - this.label10.Location = new System.Drawing.Point(0, 0); - this.label10.Name = "label10"; - this.label10.Size = new System.Drawing.Size(539, 36); - this.label10.TabIndex = 0; - this.label10.Text = "{HIGH_SCORES}"; - this.label10.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // pnlgamestats - // - this.pnlgamestats.Controls.Add(this.button1); - this.pnlgamestats.Controls.Add(this.label12); - this.pnlgamestats.Controls.Add(this.lblnextstats); - this.pnlgamestats.Controls.Add(this.Label7); - this.pnlgamestats.Controls.Add(this.lblpreviousstats); - this.pnlgamestats.Controls.Add(this.Label4); - this.pnlgamestats.Controls.Add(this.btnplayon); - this.pnlgamestats.Controls.Add(this.Label3); - this.pnlgamestats.Controls.Add(this.btncashout); - this.pnlgamestats.Controls.Add(this.Label2); - this.pnlgamestats.Controls.Add(this.lbllevelreached); - this.pnlgamestats.Location = new System.Drawing.Point(104, 375); - this.pnlgamestats.Name = "pnlgamestats"; - this.pnlgamestats.Size = new System.Drawing.Size(466, 284); - this.pnlgamestats.TabIndex = 6; - this.pnlgamestats.Visible = false; + // pnlcanvas + // + this.pnlcanvas.Dock = System.Windows.Forms.DockStyle.Fill; + this.pnlcanvas.Location = new System.Drawing.Point(0, 0); + this.pnlcanvas.Name = "pnlcanvas"; + this.pnlcanvas.Size = new System.Drawing.Size(879, 450); + this.pnlcanvas.TabIndex = 0; + this.pnlcanvas.Paint += new System.Windows.Forms.PaintEventHandler(this.pnlcanvas_Paint); + this.pnlcanvas.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pnlcanvas_MouseMove); + // + // pnllevelwon + // + this.pnllevelwon.Controls.Add(this.label1); + this.pnllevelwon.Controls.Add(this.panel1); + this.pnllevelwon.Controls.Add(this.lbltitle); + this.pnllevelwon.Location = new System.Drawing.Point(57, 75); + this.pnllevelwon.Name = "pnllevelwon"; + this.pnllevelwon.Size = new System.Drawing.Size(301, 184); + this.pnllevelwon.TabIndex = 0; + this.pnllevelwon.Visible = false; + // + // label1 + // + this.label1.Dock = System.Windows.Forms.DockStyle.Fill; + this.label1.Location = new System.Drawing.Point(0, 13); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(301, 139); + this.label1.TabIndex = 1; + this.label1.Text = "{PONG_BEATLEVELDESC}"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // panel1 + // + this.panel1.Controls.Add(this.button1); + this.panel1.Controls.Add(this.btncashout); + this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panel1.Location = new System.Drawing.Point(0, 152); + this.panel1.Name = "panel1"; + this.panel1.Size = new System.Drawing.Size(301, 32); + this.panel1.TabIndex = 2; // // button1 // - this.button1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.button1.Location = new System.Drawing.Point(32, 223); + this.button1.Location = new System.Drawing.Point(159, 6); this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(191, 35); - this.button1.TabIndex = 10; - this.button1.Text = "{PONG_VIEW_HIGHSCORES}"; + this.button1.Size = new System.Drawing.Size(93, 23); + this.button1.TabIndex = 1; + this.button1.Text = "{PONG_PLAYON}"; this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.btnhighscore_Click); - // - // label12 - // - this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.label12.Location = new System.Drawing.Point(8, 187); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(245, 33); - this.label12.TabIndex = 9; - this.label12.Text = "{PONG_HIGHSCORE_EXP}"; - this.label12.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // lblnextstats - // - this.lblnextstats.AutoSize = true; - this.lblnextstats.Location = new System.Drawing.Point(278, 136); - this.lblnextstats.Name = "lblnextstats"; - this.lblnextstats.Size = new System.Drawing.Size(0, 13); - this.lblnextstats.TabIndex = 8; - // - // Label7 - // - this.Label7.AutoSize = true; - this.Label7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label7.Location = new System.Drawing.Point(278, 119); - this.Label7.Name = "Label7"; - this.Label7.Size = new System.Drawing.Size(124, 16); - this.Label7.TabIndex = 7; - this.Label7.Text = "Next Level Stats:"; - // - // lblpreviousstats - // - this.lblpreviousstats.AutoSize = true; - this.lblpreviousstats.Location = new System.Drawing.Point(278, 54); - this.lblpreviousstats.Name = "lblpreviousstats"; - this.lblpreviousstats.Size = new System.Drawing.Size(0, 13); - this.lblpreviousstats.TabIndex = 6; - // - // Label4 - // - this.Label4.AutoSize = true; - this.Label4.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label4.Location = new System.Drawing.Point(278, 37); - this.Label4.Name = "Label4"; - this.Label4.Size = new System.Drawing.Size(154, 16); - this.Label4.TabIndex = 5; - this.Label4.Text = "Previous Level Stats:"; - // - // btnplayon - // - this.btnplayon.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnplayon.Location = new System.Drawing.Point(32, 147); - this.btnplayon.Name = "btnplayon"; - this.btnplayon.Size = new System.Drawing.Size(191, 35); - this.btnplayon.TabIndex = 4; - this.btnplayon.Text = "Play on for 3 codepoints!"; - this.btnplayon.UseVisualStyleBackColor = true; - this.btnplayon.Click += new System.EventHandler(this.btnplayon_Click); - // - // Label3 - // - this.Label3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label3.Location = new System.Drawing.Point(8, 111); - this.Label3.Name = "Label3"; - this.Label3.Size = new System.Drawing.Size(245, 33); - this.Label3.TabIndex = 3; - this.Label3.Text = "{PONG_PLAYON_DESC}"; - this.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + this.button1.Click += new System.EventHandler(this.button1_Click); // // btncashout // - this.btncashout.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btncashout.Location = new System.Drawing.Point(32, 73); + this.btncashout.Location = new System.Drawing.Point(48, 6); this.btncashout.Name = "btncashout"; - this.btncashout.Size = new System.Drawing.Size(191, 35); - this.btncashout.TabIndex = 2; - this.btncashout.Text = "Cash out with 1 codepoint!"; + this.btncashout.Size = new System.Drawing.Size(93, 23); + this.btncashout.TabIndex = 0; + this.btncashout.Text = "{PONG_CASHOUT}"; this.btncashout.UseVisualStyleBackColor = true; this.btncashout.Click += new System.EventHandler(this.btncashout_Click); // - // Label2 - // - this.Label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label2.Location = new System.Drawing.Point(8, 37); - this.Label2.Name = "Label2"; - this.Label2.Size = new System.Drawing.Size(245, 33); - this.Label2.TabIndex = 1; - this.Label2.Text = "{PONG_CASHOUT_DESC}"; - this.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // lbllevelreached - // - this.lbllevelreached.AutoSize = true; - this.lbllevelreached.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbllevelreached.Location = new System.Drawing.Point(149, 6); - this.lbllevelreached.Name = "lbllevelreached"; - this.lbllevelreached.Size = new System.Drawing.Size(185, 20); - this.lbllevelreached.TabIndex = 0; - this.lbllevelreached.Text = "You Reached Level 2!"; - // - // pnlfinalstats - // - this.pnlfinalstats.Controls.Add(this.btnplayagain); - this.pnlfinalstats.Controls.Add(this.lblfinalcodepoints); - this.pnlfinalstats.Controls.Add(this.Label11); - this.pnlfinalstats.Controls.Add(this.lblfinalcomputerreward); - this.pnlfinalstats.Controls.Add(this.Label9); - this.pnlfinalstats.Controls.Add(this.lblfinallevelreward); - this.pnlfinalstats.Controls.Add(this.lblfinallevelreached); - this.pnlfinalstats.Controls.Add(this.lblfinalcodepointswithtext); - this.pnlfinalstats.Location = new System.Drawing.Point(172, 74); - this.pnlfinalstats.Name = "pnlfinalstats"; - this.pnlfinalstats.Size = new System.Drawing.Size(362, 226); - this.pnlfinalstats.TabIndex = 9; - this.pnlfinalstats.Visible = false; - // - // btnplayagain - // - this.btnplayagain.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnplayagain.Location = new System.Drawing.Point(5, 194); - this.btnplayagain.Name = "btnplayagain"; - this.btnplayagain.Size = new System.Drawing.Size(352, 29); - this.btnplayagain.TabIndex = 16; - this.btnplayagain.Text = "{PLAY}"; - this.btnplayagain.UseVisualStyleBackColor = true; - this.btnplayagain.Click += new System.EventHandler(this.btnplayagain_Click); - // - // lblfinalcodepoints - // - this.lblfinalcodepoints.Font = new System.Drawing.Font("Microsoft Sans Serif", 48F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblfinalcodepoints.Location = new System.Drawing.Point(3, 124); - this.lblfinalcodepoints.Name = "lblfinalcodepoints"; - this.lblfinalcodepoints.Size = new System.Drawing.Size(356, 73); - this.lblfinalcodepoints.TabIndex = 15; - this.lblfinalcodepoints.Tag = "header1"; - this.lblfinalcodepoints.Text = "134 CP"; - this.lblfinalcodepoints.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // Label11 - // - this.Label11.AutoSize = true; - this.Label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label11.Location = new System.Drawing.Point(162, 82); - this.Label11.Name = "Label11"; - this.Label11.Size = new System.Drawing.Size(33, 33); - this.Label11.TabIndex = 14; - this.Label11.Tag = "header2"; - this.Label11.Text = "+"; - this.Label11.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // lblfinalcomputerreward - // - this.lblfinalcomputerreward.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblfinalcomputerreward.Location = new System.Drawing.Point(193, 72); - this.lblfinalcomputerreward.Name = "lblfinalcomputerreward"; - this.lblfinalcomputerreward.Size = new System.Drawing.Size(151, 52); - this.lblfinalcomputerreward.TabIndex = 12; - this.lblfinalcomputerreward.Tag = "header2"; - this.lblfinalcomputerreward.Text = "34"; - this.lblfinalcomputerreward.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // Label9 - // - this.Label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label9.Location = new System.Drawing.Point(179, 31); - this.Label9.Name = "Label9"; - this.Label9.Size = new System.Drawing.Size(180, 49); - this.Label9.TabIndex = 11; - this.Label9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // lblfinallevelreward - // - this.lblfinallevelreward.Font = new System.Drawing.Font("Microsoft Sans Serif", 27.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblfinallevelreward.Location = new System.Drawing.Point(12, 72); - this.lblfinallevelreward.Name = "lblfinallevelreward"; - this.lblfinallevelreward.Size = new System.Drawing.Size(151, 52); - this.lblfinallevelreward.TabIndex = 10; - this.lblfinallevelreward.Tag = "header2"; - this.lblfinallevelreward.Text = "100"; - this.lblfinallevelreward.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // lblfinallevelreached - // - this.lblfinallevelreached.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblfinallevelreached.Location = new System.Drawing.Point(3, 31); - this.lblfinallevelreached.Name = "lblfinallevelreached"; - this.lblfinallevelreached.Size = new System.Drawing.Size(170, 49); - this.lblfinallevelreached.TabIndex = 9; - this.lblfinallevelreached.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // lblfinalcodepointswithtext - // - this.lblfinalcodepointswithtext.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblfinalcodepointswithtext.Location = new System.Drawing.Point(3, 2); - this.lblfinalcodepointswithtext.Name = "lblfinalcodepointswithtext"; - this.lblfinalcodepointswithtext.Size = new System.Drawing.Size(356, 26); - this.lblfinalcodepointswithtext.TabIndex = 1; - this.lblfinalcodepointswithtext.Tag = "header2"; - this.lblfinalcodepointswithtext.Text = "You cashed out with 134 codepoints!"; - this.lblfinalcodepointswithtext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // pnllose - // - this.pnllose.Controls.Add(this.lblmissedout); - this.pnllose.Controls.Add(this.lblbutyougained); - this.pnllose.Controls.Add(this.btnlosetryagain); - this.pnllose.Controls.Add(this.Label5); - this.pnllose.Controls.Add(this.Label1); - this.pnllose.Location = new System.Drawing.Point(209, 71); - this.pnllose.Name = "pnllose"; - this.pnllose.Size = new System.Drawing.Size(266, 214); - this.pnllose.TabIndex = 10; - this.pnllose.Visible = false; - // - // lblmissedout - // - this.lblmissedout.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblmissedout.Location = new System.Drawing.Point(3, 175); - this.lblmissedout.Name = "lblmissedout"; - this.lblmissedout.Size = new System.Drawing.Size(146, 35); - this.lblmissedout.TabIndex = 3; - this.lblmissedout.Text = "You Missed Out On: 500 Codepoints"; - this.lblmissedout.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // lblbutyougained - // - this.lblbutyougained.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblbutyougained.Location = new System.Drawing.Point(3, 125); - this.lblbutyougained.Name = "lblbutyougained"; - this.lblbutyougained.Size = new System.Drawing.Size(146, 35); - this.lblbutyougained.TabIndex = 3; - this.lblbutyougained.Text = "But you gained 5 Codepoints"; - this.lblbutyougained.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // btnlosetryagain - // - this.btnlosetryagain.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.btnlosetryagain.Location = new System.Drawing.Point(155, 176); - this.btnlosetryagain.Name = "btnlosetryagain"; - this.btnlosetryagain.Size = new System.Drawing.Size(106, 35); - this.btnlosetryagain.TabIndex = 2; - this.btnlosetryagain.Text = "Try Again"; - this.btnlosetryagain.UseVisualStyleBackColor = true; - this.btnlosetryagain.Click += new System.EventHandler(this.btnlosetryagain_Click); - // - // Label5 - // - this.Label5.Location = new System.Drawing.Point(7, 26); - this.Label5.Name = "Label5"; - this.Label5.Size = new System.Drawing.Size(260, 163); - this.Label5.TabIndex = 1; - // - // Label1 - // - this.Label1.Dock = System.Windows.Forms.DockStyle.Top; - this.Label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.Label1.Location = new System.Drawing.Point(0, 0); - this.Label1.Name = "Label1"; - this.Label1.Size = new System.Drawing.Size(266, 16); - this.Label1.TabIndex = 0; - this.Label1.Text = "You lose!"; - this.Label1.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // - // lblbeatai - // - this.lblbeatai.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblbeatai.Location = new System.Drawing.Point(47, 41); - this.lblbeatai.Name = "lblbeatai"; - this.lblbeatai.Size = new System.Drawing.Size(600, 30); - this.lblbeatai.TabIndex = 8; - this.lblbeatai.Tag = "header2"; - this.lblbeatai.Text = "You got 2 codepoints for beating the Computer!"; - this.lblbeatai.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.lblbeatai.Visible = false; - // - // lblcountdown - // - this.lblcountdown.Font = new System.Drawing.Font("Microsoft Sans Serif", 24F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblcountdown.Location = new System.Drawing.Point(182, 152); - this.lblcountdown.Name = "lblcountdown"; - this.lblcountdown.Size = new System.Drawing.Size(315, 49); - this.lblcountdown.TabIndex = 7; - this.lblcountdown.Text = "3"; - this.lblcountdown.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.lblcountdown.Visible = false; - // - // ball - // - this.ball.BackColor = System.Drawing.Color.Black; - this.ball.Location = new System.Drawing.Point(300, 152); - this.ball.Name = "ball"; - this.ball.Size = new System.Drawing.Size(20, 20); - this.ball.TabIndex = 2; - this.ball.MouseEnter += new System.EventHandler(this.ball_MouseEnter); - this.ball.MouseLeave += new System.EventHandler(this.ball_MouseLeave); - // - // paddleHuman - // - this.paddleHuman.BackColor = System.Drawing.Color.Black; - this.paddleHuman.Location = new System.Drawing.Point(10, 134); - this.paddleHuman.Name = "paddleHuman"; - this.paddleHuman.Size = new System.Drawing.Size(20, 100); - this.paddleHuman.TabIndex = 3; - this.paddleHuman.TabStop = false; - // - // paddleComputer - // - this.paddleComputer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.paddleComputer.BackColor = System.Drawing.Color.Black; - this.paddleComputer.Location = new System.Drawing.Point(878, 134); - this.paddleComputer.MaximumSize = new System.Drawing.Size(20, 150); - this.paddleComputer.Name = "paddleComputer"; - this.paddleComputer.Size = new System.Drawing.Size(20, 100); - this.paddleComputer.TabIndex = 1; - // - // lbllevelandtime - // - this.lbllevelandtime.Dock = System.Windows.Forms.DockStyle.Top; - this.lbllevelandtime.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lbllevelandtime.Location = new System.Drawing.Point(0, 0); - this.lbllevelandtime.Name = "lbllevelandtime"; - this.lbllevelandtime.Size = new System.Drawing.Size(912, 22); - this.lbllevelandtime.TabIndex = 4; - this.lbllevelandtime.Tag = "header1"; - this.lbllevelandtime.Text = "Level: 1 - 58 Seconds Left"; - this.lbllevelandtime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // lblstatscodepoints - // - this.lblstatscodepoints.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.lblstatscodepoints.AutoSize = true; - this.lblstatscodepoints.Font = new System.Drawing.Font("Georgia", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblstatscodepoints.Location = new System.Drawing.Point(239, 460); - this.lblstatscodepoints.Name = "lblstatscodepoints"; - this.lblstatscodepoints.Size = new System.Drawing.Size(116, 23); - this.lblstatscodepoints.TabIndex = 12; - this.lblstatscodepoints.Tag = "header2"; - this.lblstatscodepoints.Text = "Codepoints: "; - this.lblstatscodepoints.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // lblstatsY - // - this.lblstatsY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.lblstatsY.AutoSize = true; - this.lblstatsY.Font = new System.Drawing.Font("Georgia", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblstatsY.Location = new System.Drawing.Point(440, 460); - this.lblstatsY.Name = "lblstatsY"; - this.lblstatsY.Size = new System.Drawing.Size(76, 23); - this.lblstatsY.TabIndex = 11; - this.lblstatsY.Tag = "header2"; - this.lblstatsY.Text = "Yspeed:"; - this.lblstatsY.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - // - // lblstatsX - // - this.lblstatsX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.lblstatsX.AutoSize = true; - this.lblstatsX.Font = new System.Drawing.Font("Georgia", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.lblstatsX.Location = new System.Drawing.Point(3, 460); - this.lblstatsX.Name = "lblstatsX"; - this.lblstatsX.Size = new System.Drawing.Size(83, 23); - this.lblstatsX.TabIndex = 5; - this.lblstatsX.Tag = "header2"; - this.lblstatsX.Text = "Xspeed: "; - this.lblstatsX.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // lbltitle + // + this.lbltitle.Dock = System.Windows.Forms.DockStyle.Top; + this.lbltitle.Location = new System.Drawing.Point(0, 0); + this.lbltitle.Name = "lbltitle"; + this.lbltitle.Size = new System.Drawing.Size(301, 13); + this.lbltitle.TabIndex = 0; + this.lbltitle.Tag = "header2"; + this.lbltitle.Text = "You\'ve reached level 2!"; + this.lbltitle.TextAlign = System.Drawing.ContentAlignment.TopCenter; + // + // pnlgamestart + // + this.pnlgamestart.Controls.Add(this.label2); + this.pnlgamestart.Controls.Add(this.panel3); + this.pnlgamestart.Controls.Add(this.label3); + this.pnlgamestart.Location = new System.Drawing.Point(289, 133); + this.pnlgamestart.Name = "pnlgamestart"; + this.pnlgamestart.Size = new System.Drawing.Size(301, 280); + this.pnlgamestart.TabIndex = 1; + this.pnlgamestart.Visible = false; + // + // label2 + // + this.label2.Dock = System.Windows.Forms.DockStyle.Fill; + this.label2.Location = new System.Drawing.Point(0, 42); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(301, 206); + this.label2.TabIndex = 1; + this.label2.Text = "{PONG_DESC}"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; + // + // panel3 + // + this.panel3.Controls.Add(this.btnplay); + this.panel3.Dock = System.Windows.Forms.DockStyle.Bottom; + this.panel3.Location = new System.Drawing.Point(0, 248); + this.panel3.Name = "panel3"; + this.panel3.Size = new System.Drawing.Size(301, 32); + this.panel3.TabIndex = 2; + // + // btnplay + // + this.btnplay.Location = new System.Drawing.Point(100, 6); + this.btnplay.Name = "btnplay"; + this.btnplay.Size = new System.Drawing.Size(116, 23); + this.btnplay.TabIndex = 1; + this.btnplay.Text = "{PONG_PLAY}"; + this.btnplay.UseVisualStyleBackColor = true; + this.btnplay.Click += new System.EventHandler(this.button2_Click); + // + // label3 + // + this.label3.Dock = System.Windows.Forms.DockStyle.Top; + this.label3.Location = new System.Drawing.Point(0, 0); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(301, 42); + this.label3.TabIndex = 0; + this.label3.Tag = "header2"; + this.label3.Text = "{PONG_WELCOME}"; + this.label3.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // Pong // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.BackColor = System.Drawing.Color.White; - this.Controls.Add(this.pgcontents); - this.DoubleBuffered = true; + this.Controls.Add(this.pnlgamestart); + this.Controls.Add(this.pnllevelwon); + this.Controls.Add(this.pnlcanvas); this.Name = "Pong"; - this.Size = new System.Drawing.Size(912, 504); - this.Load += new System.EventHandler(this.Pong_Load); - this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pongMain_MouseMove); - this.pgcontents.ResumeLayout(false); - this.pgcontents.PerformLayout(); - this.pnlmultiplayerhandshake.ResumeLayout(false); - this.pnlintro.ResumeLayout(false); - this.pnlintro.PerformLayout(); - this.pnlhighscore.ResumeLayout(false); - this.pnlhighscore.PerformLayout(); - this.flowLayoutPanel1.ResumeLayout(false); - this.flowLayoutPanel1.PerformLayout(); - this.pnlgamestats.ResumeLayout(false); - this.pnlgamestats.PerformLayout(); - this.pnlfinalstats.ResumeLayout(false); - this.pnlfinalstats.PerformLayout(); - this.pnllose.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)(this.paddleHuman)).EndInit(); + this.Size = new System.Drawing.Size(879, 450); + this.pnllevelwon.ResumeLayout(false); + this.panel1.ResumeLayout(false); + this.pnlgamestart.ResumeLayout(false); + this.panel3.ResumeLayout(false); this.ResumeLayout(false); } - internal System.Windows.Forms.Panel paddleComputer; - internal System.Windows.Forms.Timer gameTimer; - internal System.Windows.Forms.PictureBox paddleHuman; - internal System.Windows.Forms.Label lbllevelandtime; - internal System.Windows.Forms.Label lblstatsX; - internal System.Windows.Forms.Timer counter; - internal System.Windows.Forms.Panel pnlgamestats; - internal System.Windows.Forms.Label lblnextstats; - internal System.Windows.Forms.Label Label7; - internal System.Windows.Forms.Label lblpreviousstats; - internal System.Windows.Forms.Label Label4; - internal System.Windows.Forms.Button btnplayon; - internal System.Windows.Forms.Label Label3; - internal System.Windows.Forms.Button btncashout; - internal System.Windows.Forms.Label Label2; - internal System.Windows.Forms.Label lbllevelreached; - internal System.Windows.Forms.Label lblcountdown; - internal System.Windows.Forms.Timer tmrcountdown; - internal System.Windows.Forms.Label lblbeatai; - internal System.Windows.Forms.Panel pnlfinalstats; - internal System.Windows.Forms.Button btnplayagain; - internal System.Windows.Forms.Label lblfinalcodepoints; - internal System.Windows.Forms.Label Label11; - internal System.Windows.Forms.Label lblfinalcomputerreward; - internal System.Windows.Forms.Label Label9; - internal System.Windows.Forms.Label lblfinallevelreward; - internal System.Windows.Forms.Label lblfinallevelreached; - internal System.Windows.Forms.Label lblfinalcodepointswithtext; - internal System.Windows.Forms.Panel pnllose; - internal System.Windows.Forms.Label lblmissedout; - internal System.Windows.Forms.Label lblbutyougained; - internal System.Windows.Forms.Button btnlosetryagain; - internal System.Windows.Forms.Label Label5; - internal System.Windows.Forms.Label Label1; - internal System.Windows.Forms.Label lblstatscodepoints; - internal System.Windows.Forms.Label lblstatsY; - internal System.Windows.Forms.Panel pnlintro; - internal System.Windows.Forms.Label Label6; - internal System.Windows.Forms.Button btnstartgame; - internal System.Windows.Forms.Label Label8; - internal System.Windows.Forms.Timer tmrstoryline; - private System.Windows.Forms.Panel pnlhighscore; - private System.Windows.Forms.ListView lbhighscore; - private System.Windows.Forms.Label label10; - internal Canvas pgcontents; - internal Canvas ball; - internal System.Windows.Forms.Button button1; - internal System.Windows.Forms.Label label12; - private System.Windows.Forms.FlowLayoutPanel flowLayoutPanel1; - private System.Windows.Forms.Button button2; - internal System.Windows.Forms.Button btnmatchmake; - private System.Windows.Forms.Panel pnlmultiplayerhandshake; - private System.Windows.Forms.ListView lvotherplayers; - private System.Windows.Forms.Label lbmpstatus; + + #endregion + + private System.Windows.Forms.Panel pnlcanvas; + private System.Windows.Forms.Panel pnllevelwon; + private System.Windows.Forms.Label lbltitle; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Panel panel1; + private System.Windows.Forms.Button button1; + private System.Windows.Forms.Button btncashout; + private System.Windows.Forms.Panel pnlgamestart; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Button btnplay; + private System.Windows.Forms.Label label3; } } diff --git a/ShiftOS.WinForms/Applications/Pong.cs b/ShiftOS.WinForms/Applications/Pong.cs index 84177b7..53d410e 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -1,1143 +1,467 @@ -/* - * MIT License - * - * Copyright (c) 2017 Michael VanOverbeek and ShiftOS devs - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ - -using System; +using System; using System.Collections.Generic; using System.ComponentModel; -using System.Data; using System.Drawing; +using System.Data; using System.Linq; using System.Text; -using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; -using Newtonsoft.Json; using ShiftOS.Engine; -using ShiftOS.Objects; using ShiftOS.WinForms.Tools; namespace ShiftOS.WinForms.Applications { - [MultiplayerOnly] [Launcher("Pong", true, "al_pong", "Games")] [WinOpen("pong")] + [DefaultTitle("Pong")] [DefaultIcon("iconPong")] public partial class Pong : UserControl, IShiftOSWindow { - //I can assure you guaranteed that there is an acorn somewhere, in this place, and the sailors are looking for it - int xVel = 7; - int yVel = 8; - int computerspeed = 8; - int level = 1; - int secondsleft = 60; - int casualposition; - double xveldec = 3.0; - double yveldec = 3.0; - double incrementx = 0.4; - double incrementy = 0.2; - int levelxspeed = 3; - int levelyspeed = 3; - int beatairewardtotal; - int beataireward = 1; - int[] levelrewards = new int[50]; - int totalreward; - int countdown = 3; - - bool aiShouldIsbeEnabled = true; - public Pong() { InitializeComponent(); - } - - private void Pong_Load(object sender, EventArgs e) - { - setuplevelrewards(); - } - - - - // Move the paddle according to the mouse position. - private void pongMain_MouseMove(object sender, MouseEventArgs e) - { - var loc = this.PointToClient(MousePosition); - if (IsMultiplayerSession) + paddleWidth = pnlcanvas.Width / 30; + drawTimer = new Timer(); + drawTimer.Interval = 1; + drawTimer.Tick += (o, a) => + { + UpdateBall(); + pnlcanvas.Refresh(); + }; + counterTimer = new Timer(); + counterTimer.Interval = 1000; + counterTimer.Tick += (o, a) => { - if (IsLeader) + if(secondsleft > 0) { - paddleHuman.Location = new Point(paddleHuman.Location.X, (loc.Y) - (paddleHuman.Height / 2)); - ServerManager.Forward(OpponentGUID, "pong_mp_setopponenty", paddleHuman.Top.ToString()); + secondsleft--; } else { - paddleComputer.Location = new Point(paddleComputer.Location.X, (loc.Y) - (paddleComputer.Height / 2)); - ServerManager.Forward(OpponentGUID, "pong_mp_setopponenty", paddleComputer.Top.ToString()); + LevelComplete(); } - } - else + }; +#if DEBUG + this.KeyDown += (o, a) => { - paddleHuman.Location = new Point(paddleHuman.Location.X, (loc.Y) - (paddleHuman.Height / 2)); - } - } - - private void CenterPanels() - { - pnlfinalstats.CenterParent(); - pnlgamestats.CenterParent(); - pnlhighscore.CenterParent(); - pnlintro.CenterParent(); - pnllose.CenterParent(); - lblcountdown.CenterParent(); - lblbeatai.Left = (this.Width - lblbeatai.Width) / 2; - SetupStats(); - } - - public void SetupStats() - { - lblstatsX.Location = new Point(5, this.Height - lblstatsX.Height - 5); - lblstatsY.Location = new Point(this.Width - lblstatsY.Width - 5, this.Height - lblstatsY.Height - 5); - lblstatscodepoints.Top = this.Height - lblstatscodepoints.Height - 5; - lblstatscodepoints.Left = (this.Width - lblstatscodepoints.Width) / 2; + if(a.KeyCode == Keys.D) + { + drawAiBall = !drawAiBall; + } + }; +#endif } - int OpponentY = 0; + private double ballX = 0.0f; + private double ballY = 0.0f; - bool IsLeader = true; - - int LeaderX = 0; - int LeaderY = 0; - - // ERROR: Handles clauses are not supported in C# - private void gameTimer_Tick(object sender, EventArgs e) - { - if (this.Left < Screen.PrimaryScreen.Bounds.Width) - { - ball.BackColor = SkinEngine.LoadedSkin.ControlTextColor; - paddleComputer.BackColor = SkinEngine.LoadedSkin.ControlTextColor; - paddleHuman.BackColor = SkinEngine.LoadedSkin.ControlTextColor; - - //Check if paddle upgrade has been bought and change paddles accordingly - //if (ShiftoriumFrontend.UpgradeInstalled("pong_increased_paddle_size")) - //{ - // paddleHuman.Height = 150; - // paddleComputer.Height = 150; - //} - //I don't know the point of this but I'm fucking 86ing it. - Michael - - //Set the computer player to move according to the ball's position. - if (IsMultiplayerSession == true) - { - //If we're multiplayer, then we want to set the computer Y to the opponent's Y. - //If we're the leader, we set the AI paddle, else we set the player paddle. - if (IsLeader) - paddleComputer.Top = OpponentY; - else - paddleHuman.Top = OpponentY; - } - else - { - if (aiShouldIsbeEnabled) - if (ball.Location.X > (this.Width - (this.Width / 3)) - xVel * 10 && xVel > 0) - { - if (ball.Location.Y > paddleComputer.Location.Y + 50) - { - paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y + computerspeed); - } - if (ball.Location.Y < paddleComputer.Location.Y + 50) - { - paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y - computerspeed); - } - casualposition = rand.Next(-150, 201); - } - else - { - //used to be me.location.y - except it's fucking C# and this comment is misleading as fuck. OH WAIT! I didn't write it! And none of the current devs did either! - Michael - if (paddleComputer.Location.Y > this.Size.Height / 2 - paddleComputer.Height + casualposition) - { - paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y - computerspeed); - } - //Rylan is hot. Used to be //used to be me.location.y - if (paddleComputer.Location.Y < this.Size.Height / 2 - paddleComputer.Height + casualposition) - { - paddleComputer.Location = new Point(paddleComputer.Location.X, paddleComputer.Location.Y + computerspeed); - } - } - } - //Set Xvel and Yvel speeds from decimal - if (xVel > 0) - xVel = (int)Math.Round(xveldec); - if (xVel < 0) - xVel = (int)-Math.Round(xveldec); - if (yVel > 0) - yVel = (int)Math.Round(yveldec); - if (yVel < 0) - yVel = (int)-Math.Round(yveldec); - - bool BallPhysics = true; - - if (IsMultiplayerSession) - { - //Logic for moving the ball in Multiplayer. - if (IsLeader) - { - ball.Location = new Point(ball.Location.X + xVel, ball.Location.Y + yVel); - } - else - { - //Move it to the leader's ball position. - ball.Location = new Point(LeaderX, LeaderY); - BallPhysics = false; - } - } - else - {// Move the game ball. - ball.Location = new Point(ball.Location.X + xVel, ball.Location.Y + yVel); - } - if (BallPhysics) - { - // Check for top wall. - if (ball.Location.Y < 0) - { - ball.Location = new Point(ball.Location.X, 0); - yVel = -yVel; - ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound); - } + private double aiBallX = 0.0f; + private double aiBallY = 0.0f; - // Check for bottom wall. - if (ball.Location.Y > pgcontents.Height - ball.Height) - { - ball.Location = new Point(ball.Location.X, pgcontents.Height - ball.Size.Height); - yVel = -yVel; - ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound); - } + private double speedFactor = 0.0125; - // Check for player paddle. - if (ball.Bounds.IntersectsWith(paddleHuman.Bounds)) - { - ball.Location = new Point(paddleHuman.Location.X + ball.Size.Width + 1, ball.Location.Y); - //randomly increase x or y speed of ball - switch (rand.Next(1, 3)) - { - case 1: - xveldec = xveldec + incrementx; - break; - case 2: - if (yveldec > 0) - yveldec = yveldec + incrementy; - if (yveldec < 0) - yveldec = yveldec - incrementy; - break; - } - xVel = -xVel; - ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.writesound); + private double xVel = 1; + private double yVel = 1; - } + private double aiXVel = 1; + private double aiYVel = 1; - // Check for computer paddle. - if (ball.Bounds.IntersectsWith(paddleComputer.Bounds)) - { - ball.Location = new Point(paddleComputer.Location.X - paddleComputer.Size.Width - 1, ball.Location.Y); - xveldec = xveldec + incrementx; - xVel = -xVel; - ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.writesound); - } - } + private int paddleWidth; + Timer counterTimer = null; - // Check for left wall. - if (ball.Location.X < -100) - { - //If we are in multiplayer, and not the leader, we won. - if (IsMultiplayerSession) - { - if (IsLeader) - { - //We lost. - NotifyLoseToTarget(); - } - else - { - //We won. - NotifyWinToTarget(); - Win(); - } - } - else - { - ball.Location = new Point(this.Size.Width / 2 + 200, this.Size.Height / 2); - paddleComputer.Location = new Point(paddleComputer.Location.X, ball.Location.Y); - if (xVel > 0) - xVel = -xVel; - pnllose.Show(); - gameTimer.Stop(); - counter.Stop(); - lblmissedout.Text = Localization.Parse("{YOU_MISSED_OUT_ON}:") + Environment.NewLine + lblstatscodepoints.Text.Replace(Localization.Parse("{CODEPOINTS}: "), "") + Localization.Parse(" {CODEPOINTS}"); - if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade_2")) - { - totalreward = levelrewards[level - 1] + beatairewardtotal; - double onePercent = (totalreward / 100); - lblbutyougained.Show(); - lblbutyougained.Text = Localization.Parse("{BUT_YOU_GAINED}:") + Environment.NewLine + onePercent.ToString("") + (Localization.Parse(" {CODEPOINTS}")); - SaveSystem.TransferCodepointsFrom("pong", (totalreward / 100)); - } - else - { - lblbutyougained.Hide(); - } - } - } + private long codepointsToEarn = 0; + private int level = 1; - // Check for right wall. - if (ball.Location.X > this.Width - ball.Size.Width - paddleComputer.Width + 100) - { - if (IsMultiplayerSession) - { - //If we are the leader we won. - if (IsLeader) - { - NotifyWinToTarget(); - Win(); - } - else - { - NotifyLoseToTarget(); - } - } - else - { - Win(); - } - } - if (IsMultiplayerSession) - { - if (IsLeader) - { - ServerManager.Forward(OpponentGUID, "pong_mp_setballpos", JsonConvert.SerializeObject(ball.Location)); - } - } + private double playerY = 0.0; + private double opponentY = 0.0; + private int secondsleft = 60; + bool doAi = true; + bool doBallCalc = true; - if (IsLeader) - { - //lblstats.Text = "Xspeed: " & Math.Abs(xVel) & " Yspeed: " & Math.Abs(yVel) & " Human Location: " & paddleHuman.Location.ToString & " Computer Location: " & paddleComputer.Location.ToString & Environment.NewLine & " Ball Location: " & ball.Location.ToString & " Xdec: " & xveldec & " Ydec: " & yveldec & " Xinc: " & incrementx & " Yinc: " & incrementy - lblstatsX.Text = "X vel: " + xveldec; - lblstatsY.Text = "Y vel: " + yveldec; - lblstatscodepoints.Text = "Codepoints: " + (levelrewards[level - 1] + beatairewardtotal).ToString(); - lbllevelandtime.Text = "Level: " + level + " - " + secondsleft + " seconds left"; + private string header = ""; - if (xVel > 20 || xVel < -20) - { - paddleHuman.Width = Math.Abs(xVel); - paddleComputer.Width = Math.Abs(xVel); - } - else - { - paddleHuman.Width = 20; - paddleComputer.Width = 20; - } - } - if (!IsMultiplayerSession) - { - computerspeed = Math.Abs(yVel); - } - } - } + private string counter = ""; - public void ServerMessageReceivedHandler(ServerMessage msg) + private void Bounce(Rectangle ball, Rectangle paddle) { - if (IsMultiplayerSession) - { - if (msg.Name == "pong_mp_setballpos") - { - var pt = JsonConvert.DeserializeObject<Point>(msg.Contents); - LeaderX = pt.X; - LeaderY = pt.Y; - } - else if (msg.Name == "pong_mp_left") - { - this.Invoke(new Action(() => - { - AppearanceManager.Close(this); - })); - Infobox.Show("Opponent has closed Pong.", "The opponent has closed Pong, therefore the connection between you two has dropped."); - } - else if (msg.Name == "pong_mp_youlose") - { - this.Invoke(new Action(LoseMP)); - } - else if (msg.Name == "pong_mp_setopponenty") - { - int y = Convert.ToInt32(msg.Contents); - OpponentY = y; - } - else if (msg.Name == "pong_handshake_matchmake") - { - if (!PossibleMatchmakes.Contains(msg.Contents)) - PossibleMatchmakes.Add(msg.Contents); - this.Invoke(new Action(ListMatchmakes)); - } - else if (msg.Name == "pong_handshake_resendid") - { - ServerManager.Forward("all", "pong_handshake_matchmake", YouGUID); - } - else if (msg.Name == "pong_handshake_complete") - { - IsLeader = true; + // reverse x velocity to send the ball the other way + xVel = -xVel; - OpponentGUID = msg.Contents; - LeaveMatchmake(); - this.Invoke(new Action(() => - { - pnlmultiplayerhandshake.Hide(); - StartLevel(); - })); - } - else if(msg.Name == "pong_mp_levelcompleted") - { - level = Convert.ToInt32(msg.Contents) + 1; - this.Invoke(new Action(CompleteLevel)); - } - else if (msg.Name == "pong_handshake_chosen") - { - IsLeader = false; - LeaveMatchmake(); - OpponentGUID = msg.Contents; - YouGUID = ServerManager.thisGuid.ToString(); - //Start the timers. - counter.Start(); - SendFollowerGUID(); - this.Invoke(new Action(() => - { - pnlmultiplayerhandshake.Hide(); - })); - } - else if(msg.Name == "pong_mp_cashedout") - { - this.Invoke(new Action(() => - { - btncashout_Click(this, EventArgs.Empty); - })); - Infobox.Show("Cashed out.", "The other player has cashed out their Codepoints. Therefore, we have automatically cashed yours out."); - } - else if(msg.Name == "pong_mp_startlevel") - { - OpponentAgrees = true; - if(YouAgree == false) - { - Infobox.PromptYesNo("Play another level?", "The opponent wants to play another level. Would you like to as well?", (answer)=> - { - YouAgree = answer; - ServerManager.Forward(OpponentGUID, "pong_mp_level_callback", YouAgree.ToString()); - }); - } - } - else if(msg.Name == "pong_mp_level_callback") - { - bool agreed = bool.Parse(msg.Contents); - OpponentAgrees = agreed; - if (OpponentAgrees) - { - if (IsLeader) - { - //this.Invoke(new Action(())) - } - } - } - else if (msg.Name == "pong_handshake_left") - { - if (this.PossibleMatchmakes.Contains(msg.Contents)) - this.PossibleMatchmakes.Remove(msg.Contents); - this.Invoke(new Action(ListMatchmakes)); - } - else if(msg.Name == "pong_mp_clockupdate") - { - secondsleft = Convert.ToInt32(msg.Contents); - } - else if (msg.Name == "pong_mp_youwin") - { - this.Invoke(new Action(Win)); - } - } + // adjust y velocity based on where the ball hit the paddle + yVel = linear((ball.Top + (ball.Height / 2)), paddle.Top, paddle.Bottom, -1, 1); } - bool OpponentAgrees = false; - bool YouAgree = false; - - public void ListMatchmakes() + public void UpdateBall() { - lvotherplayers.Items.Clear(); - var c = new ColumnHeader(); - c.Width = lvotherplayers.Width; - c.Text = "Player"; - lvotherplayers.Columns.Clear(); - lvotherplayers.Columns.Add(c); - - lvotherplayers.FullRowSelect = true; - foreach (var itm in PossibleMatchmakes) + if (doBallCalc) { - if (itm != YouGUID) - { - var l = new ListViewItem(); - l.Text = itm; - lvotherplayers.Items.Add(l); - } - } + double ballXLocal = linear(ballX, -1.0, 1.0, 0, pnlcanvas.Width); + double ballYLocal = linear(ballY, -1.0, 1.0, 0, pnlcanvas.Height); - if (PossibleMatchmakes.Count > 0) - { - lbmpstatus.Text = "Select a player."; - } - else - { - lbmpstatus.Text = "Waiting for players..."; - } - } + ballXLocal -= ((double)paddleWidth / 2); + ballYLocal -= ((double)paddleWidth / 2); - public void NotifyLoseToTarget() - { - ServerManager.Forward(OpponentGUID, "pong_mp_youwin", null); - } + double aiBallXLocal = linear(aiBallX, -1.0, 1.0, 0, pnlcanvas.Width); + double aiBallYLocal = linear(aiBallY, -1.0, 1.0, 0, pnlcanvas.Height); - public void NotifyWinToTarget() - { - ServerManager.Forward(OpponentGUID, "pong_mp_youlose", null); - } + aiBallXLocal -= ((double)paddleWidth / 2); + aiBallYLocal -= ((double)paddleWidth / 2); - public void LeaveMatchmake() - { - ServerManager.Forward("all", "pong_handshake_left", YouGUID); - } - - List<string> PossibleMatchmakes = new List<string>(); - - public void SendLeaderGUID(string target) - { - ServerManager.Forward(target, "pong_handshake_chosen", YouGUID); - } + double playerYLocal = linear(playerY, -1.0, 1.0, 0, pnlcanvas.Height); + double opponentYLocal = linear(opponentY, -1.0, 1.0, 0, pnlcanvas.Height); - public void StartMultiplayer() - { - IsMultiplayerSession = true; - YouGUID = ServerManager.thisGuid.ToString(); - ServerManager.SendMessage("pong_handshake_matchmake", YouGUID); - StartMatchmake(); - } + int paddleHeight = pnlcanvas.Height / 5; - public void StartMatchmake() - { - pnlmultiplayerhandshake.Show(); - pnlmultiplayerhandshake.CenterParent(); - pnlmultiplayerhandshake.BringToFront(); - ServerManager.Forward("all", "pong_handshake_resendid", null); + Rectangle ballRect = new Rectangle((int)ballXLocal, (int)ballYLocal, paddleWidth, paddleWidth); - } + Rectangle aiBallRect = new Rectangle((int)aiBallXLocal, (int)aiBallYLocal, paddleWidth, paddleWidth); - public void SendFollowerGUID() - { - ServerManager.Forward(OpponentGUID, "pong_handshake_complete", YouGUID); - } + Rectangle playerRect = new Rectangle((int)paddleWidth, (int)(playerYLocal - (int)(paddleHeight / 2)), (int)paddleWidth, (int)paddleHeight); + Rectangle opponentRect = new Rectangle((int)(pnlcanvas.Width - (paddleWidth * 2)), (int)(opponentYLocal - (int)(paddleHeight / 2)), (int)paddleWidth, (int)paddleHeight); - public void LoseMP() - { - ball.Location = new Point(this.Size.Width / 2 + 200, this.Size.Height / 2); - if(IsLeader) - if (xVel > 0) - xVel = -xVel; - lblbeatai.Show(); - lblbeatai.Text = "The opponent has beaten you!"; - tmrcountdown.Start(); - gameTimer.Stop(); - counter.Stop(); + //Top and bottom walls: + if (ballRect.Top <= 0 || ballRect.Bottom >= pnlcanvas.Height) + yVel = -yVel; //reverse the Y velocity - } + //top and bottom walls - ai + if (aiBallRect.Top <= 0 || aiBallRect.Bottom >= pnlcanvas.Height) + aiYVel = -aiYVel; //reverse the Y velocity - public void Win() - { - ball.Location = new Point(this.Size.Width / 2 + 200, this.Size.Height / 2); - paddleComputer.Location = new Point(paddleComputer.Location.X, ball.Location.Y); - if (xVel > 0) - xVel = -xVel; - beatairewardtotal = beatairewardtotal + beataireward; - lblbeatai.Show(); - lblbeatai.Text = Localization.Parse($"{{PONG_BEAT_AI_REWARD_SECONDARY}}: {beataireward}"); - tmrcountdown.Start(); - gameTimer.Stop(); - counter.Stop(); - } + //Left wall + if (ballRect.Left <= 0) + { + //You lose. + codepointsToEarn = 0; + Lose(); + } - public void CompleteLevel() - { - if (SaveSystem.CurrentSave.UniteAuthToken != null) - { - try + //Right wall + if (ballRect.Right >= pnlcanvas.Width) { - var unite = new ShiftOS.Unite.UniteClient("http://getshiftos.ml", SaveSystem.CurrentSave.UniteAuthToken); - if (unite.GetPongLevel() < level) - unite.SetPongLevel(level); + //You win. + codepointsToEarn += CalculateAIBeatCP(); + Win(); } - catch { } - } - //Only set these stats if the user is the leader. - if (IsLeader) - { - secondsleft = 60; - level = level + 1; - generatenextlevel(); - } - pnlgamestats.Show(); - pnlgamestats.BringToFront(); - pnlgamestats.Location = new Point((pgcontents.Width / 2) - (pnlgamestats.Width / 2), (pgcontents.Height / 2) - (pnlgamestats.Height / 2)); + //Enemy paddle: + if (ballRect.IntersectsWith(opponentRect)) + { + //check if the ball x is greater than the player paddle's middle coordinate + if (ballRect.Right >= opponentRect.Left) + { + Bounce(ballRect, opponentRect); + aiXVel = xVel; + aiYVel = yVel; + doAi = false; + } - counter.Stop(); - gameTimer.Stop(); + } - } - // ERROR: Handles clauses are not supported in C# - private void counter_Tick(object sender, EventArgs e) - { - if (IsLeader) - { - if (this.Left < Screen.PrimaryScreen.Bounds.Width) + //Enemy paddle - AI: + if (aiBallRect.IntersectsWith(opponentRect)) { - secondsleft = secondsleft - 1; - if (secondsleft == 0) + //check if the ball x is greater than the player paddle's middle coordinate + if (aiBallRect.Right >= opponentRect.Left) { - CompleteLevel(); + doAi = false; } - lblstatscodepoints.Text = "Codepoints: " + (levelrewards[level - 1] + beatairewardtotal).ToString(); } - } - SetupStats(); - } - [Obsolete("This method does nothing. Use UniteClient for highscore queries.")] - public void SendHighscores() - { - } - // ERROR: Handles clauses are not supported in C# - private void btnplayon_Click(object sender, EventArgs e) - { - xveldec = levelxspeed; - yveldec = levelyspeed; - - secondsleft = 60; + //Player paddle: + if (ballRect.IntersectsWith(playerRect)) + { + if (ballRect.Left <= playerRect.Right) + { + Bounce(ballRect, playerRect); + aiXVel = xVel; + aiYVel = yVel; + + //reset the ai location + aiBallX = ballX; + aiBallY = ballY; + doAi = true; + } - tmrcountdown.Start(); - lblbeatai.Text = Localization.Parse($"{{PONG_BEAT_AI_REWARD}}: {beataireward}"); - pnlgamestats.Hide(); - lblbeatai.Show(); - ball.Location = new Point(paddleHuman.Location.X + paddleHuman.Width + 50, paddleHuman.Location.Y + paddleHuman.Height / 2); - if (xVel < 0) - xVel = Math.Abs(xVel); - lbllevelandtime.Text = Localization.Parse("{LEVEL}: " + level + " - " + secondsleft + " {SECONDS_LEFT}"); - } + } - //Increase the ball speed stats for the next level - private void generatenextlevel() - { - lbllevelreached.Text = Localization.Parse("{YOU_REACHED_LEVEL} " + level + "!"); - lblpreviousstats.Text = Localization.Parse("{INITIAL_H_VEL}: " + levelxspeed + Environment.NewLine + "{INITIAL_V_VEL}: " + levelyspeed + Environment.NewLine + "{INC_H_VEL}: " + incrementx + Environment.NewLine + "{INC_V_VEL}: " + incrementy); - switch (rand.Next(1, 3)) - { - case 1: - levelxspeed = levelxspeed + 1; - break; - case 2: - levelxspeed = levelxspeed + 2; - break; - } - switch (rand.Next(1, 3)) - { - case 1: - levelyspeed = levelyspeed + 1; - break; - case 2: - levelyspeed = levelyspeed + 2; - break; - } - switch (rand.Next(1, 6)) - { - case 1: - incrementx = incrementx + 0.1; - break; - case 2: - incrementx = incrementx + 0.2; - break; - case 3: - incrementy = incrementy + 0.1; - break; - case 4: - incrementy = incrementy + 0.2; - break; - case 5: - incrementy = incrementy + 0.3; - break; - } + ballX += xVel * speedFactor; + ballY += yVel * speedFactor; - lblnextstats.Text = Localization.Parse("{INITIAL_H_VEL}: " + levelxspeed + Environment.NewLine + "{INITIAL_V_VEL}: " + levelyspeed + Environment.NewLine + "{INC_H_VEL}: " + incrementx + Environment.NewLine + "{INC_V_VEL}: " + incrementy); + aiBallX += aiXVel * (speedFactor * 1.5); + aiBallY += aiYVel * (speedFactor * 1.5); - if (level < 15) - { - if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) - { - beataireward = level * 10; - } else - { - beataireward = level * 5; - } - } - else - { - if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) - { - double br = levelrewards[level - 1] / 10; - beataireward = (int)Math.Round(br) * 10; - } else + if (doAi == true) { - double br = levelrewards[level - 1] / 10; - beataireward = (int)Math.Round(br) * 5; + if (opponentY != aiBallY) + { + if (opponentY < aiBallY) + { + if (opponentY < 0.9) + opponentY += speedFactor * level; + } + else + { + if (opponentY > -0.9) + opponentY -= speedFactor * level; + } + } } } - - totalreward = levelrewards[level - 1] + beatairewardtotal; - - btncashout.Text = Localization.Parse("{CASH_OUT_WITH_CODEPOINTS}"); - btnplayon.Text = Localization.Parse("{PONG_PLAY_ON_FOR_MORE}"); } - private void setuplevelrewards() + public void Lose() { - if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) - { - levelrewards[0] = 0; - levelrewards[1] = 40; - levelrewards[2] = 120; - levelrewards[3] = 280; - levelrewards[4] = 580; - levelrewards[5] = 800; - levelrewards[6] = 1200; - levelrewards[7] = 1800; - levelrewards[8] = 2400; - levelrewards[9] = 3200; - levelrewards[10] = 4000; - levelrewards[11] = 5000; - levelrewards[12] = 6000; - levelrewards[13] = 8000; - levelrewards[14] = 10000; - levelrewards[15] = 12000; - levelrewards[16] = 16000; - levelrewards[17] = 20000; - levelrewards[18] = 26000; - levelrewards[19] = 32000; - levelrewards[20] = 40000; - levelrewards[21] = 50000; - levelrewards[22] = 64000; - levelrewards[23] = 80000; - levelrewards[24] = 100000; - levelrewards[25] = 120000; - levelrewards[26] = 150000; - levelrewards[27] = 180000; - levelrewards[28] = 220000; - levelrewards[29] = 280000; - levelrewards[30] = 360000; - levelrewards[31] = 440000; - levelrewards[32] = 540000; - levelrewards[33] = 640000; - levelrewards[34] = 800000; - levelrewards[35] = 1000000; - levelrewards[36] = 1280000; - levelrewards[37] = 1600000; - levelrewards[38] = 2000000; - levelrewards[39] = 3000000; - levelrewards[40] = 4000000; - } else + InitializeCoordinates(); + counterTimer.Stop(); + secondsleft = 60; + level = 1; + speedFactor = 0.0125; + pnlgamestart.Show(); + pnlgamestart.BringToFront(); + pnlgamestart.CenterParent(); + Infobox.Show("{TITLE_PONG_YOULOSE}", "{PROMPT_PONGLOST}"); + doAi = false; + doBallCalc = false; + } + + public void LevelComplete() + { + level++; + doAi = false; + doBallCalc = false; + counterTimer.Stop(); + pnllevelwon.CenterParent(); + pnllevelwon.Show(); + pnllevelwon.BringToFront(); + lbltitle.Text = Localization.Parse("{PONG_LEVELREACHED}", new Dictionary<string, string> { - levelrewards[0] = 0; - levelrewards[1] = 20; - levelrewards[2] = 60; - levelrewards[3] = 140; - levelrewards[4] = 290; - levelrewards[5] = 400; - levelrewards[6] = 600; - levelrewards[7] = 900; - levelrewards[8] = 1200; - levelrewards[9] = 1600; - levelrewards[10] = 2000; - levelrewards[11] = 2500; - levelrewards[12] = 3000; - levelrewards[13] = 4000; - levelrewards[14] = 5000; - levelrewards[15] = 6000; - levelrewards[16] = 8000; - levelrewards[17] = 10000; - levelrewards[18] = 13000; - levelrewards[19] = 16000; - levelrewards[20] = 20000; - levelrewards[21] = 25000; - levelrewards[22] = 32000; - levelrewards[23] = 40000; - levelrewards[24] = 50000; - levelrewards[25] = 60000; - levelrewards[26] = 75000; - levelrewards[27] = 90000; - levelrewards[28] = 110000; - levelrewards[29] = 140000; - levelrewards[30] = 180000; - levelrewards[31] = 220000; - levelrewards[32] = 270000; - levelrewards[33] = 320000; - levelrewards[34] = 400000; - levelrewards[35] = 500000; - levelrewards[36] = 640000; - levelrewards[37] = 800000; - levelrewards[38] = 1000000; - levelrewards[39] = 1500000; - levelrewards[40] = 2000000; - } + ["%level"] = level.ToString() + }); + lbltitle.Height = (int)CreateGraphics().MeasureString(lbltitle.Text, lbltitle.Font).Height; + codepointsToEarn += CalculateAIBeatCP() * 2; + speedFactor += speedFactor / level; + secondsleft = 60; } - // ERROR: Handles clauses are not supported in C# - private void countdown_Tick(object sender, EventArgs e) + public long CalculateAIBeatCP() { - if (this.Left < Screen.PrimaryScreen.Bounds.Width) - { - switch (countdown) - { - case 0: - countdown = 3; - lblcountdown.Hide(); - lblbeatai.Hide(); - gameTimer.Start(); - counter.Start(); - tmrcountdown.Stop(); - break; - case 1: - lblcountdown.Text = "1"; - countdown = countdown - 1; - ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound); - break; - case 2: - lblcountdown.Text = "2"; - countdown = countdown - 1; - ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound); - break; - case 3: - lblcountdown.Text = "3"; - countdown = countdown - 1; - lblcountdown.Show(); - ShiftOS.Engine.AudioManager.PlayStream(Properties.Resources.typesound); - break; - } - - } + return 2 * (10 * level); } - // ERROR: Handles clauses are not supported in C# - private void btncashout_Click(object sender, EventArgs e) + public void Win() { - pnlgamestats.Hide(); - pnlfinalstats.Show(); - lblfinalcodepointswithtext.Text = Localization.Parse("{YOU_WON} " + totalreward + " {CODEPOINTS}!"); - lblfinallevelreached.Text = Localization.Parse("{CODEPOINTS_FOR_BEATING_LEVEL}: ") + (level - 1).ToString(); - lblfinallevelreward.Text = levelrewards[level - 1].ToString(); - lblfinalcomputerreward.Text = beatairewardtotal.ToString(); - lblfinalcodepoints.Text = totalreward + Localization.Parse(" {CODEPOINTS_SHORT}"); - SaveSystem.TransferCodepointsFrom("pong", totalreward); - if (!string.IsNullOrWhiteSpace(SaveSystem.CurrentSave.UniteAuthToken)) + header = Localization.Parse("{PONG_BEATAI}", new Dictionary<string, string> { - var unite = new ShiftOS.Unite.UniteClient("http://getshiftos.ml", SaveSystem.CurrentSave.UniteAuthToken); - if (unite.GetPongCP() < totalreward) - { - unite.SetPongCP(totalreward); - } - } - if (IsMultiplayerSession) + ["%amount"] = CalculateAIBeatCP().ToString() + }); + InitializeCoordinates(); + counterTimer.Stop(); + new System.Threading.Thread(() => { - ServerManager.Forward(OpponentGUID, "pong_mp_cashedout", null); - StopMultiplayerSession(); - } + doBallCalc = false; + for (int i = 3; i > 0; i--) + { + counter = i.ToString(); + Engine.AudioManager.PlayStream(Properties.Resources.writesound); + System.Threading.Thread.Sleep(1000); + } + doBallCalc = true; + header = ""; + counter = ""; + Desktop.InvokeOnWorkerThread(() => + { + counterTimer.Start(); + }); + }).Start(); } - public void StopMultiplayerSession() + public void InitializeCoordinates() { - IsMultiplayerSession = false; - IsLeader = true; - OpponentGUID = ""; - YouGUID = ""; + ballX = 0; + ballY = 0; + opponentY = 0; + xVel = 1; + aiBallX = 0; + aiBallY = 0; + aiXVel = xVel; + aiYVel = yVel; + doAi = true; } - private void newgame() + private bool drawAiBall = true; + + private void pnlcanvas_Paint(object sender, PaintEventArgs e) { - pnlfinalstats.Hide(); - pnllose.Hide(); - pnlintro.Hide(); - level = 1; - totalreward = 0; - if (ShiftoriumFrontend.UpgradeInstalled("pong_upgrade")) - { - beataireward = 10; - } else - { - beataireward = 5; - } - beatairewardtotal = 0; - secondsleft = 60; - lblstatscodepoints.Text = Localization.Parse("{CODEPOINTS}: "); - //reset stats text - lblstatsX.Text = Localization.Parse("{H_VEL}: "); - lblstatsY.Text = Localization.Parse("{V_VEL}: "); - - levelxspeed = 3; - levelyspeed = 3; - - incrementx = 0.4; - incrementy = 0.2; - - xveldec = levelxspeed; - yveldec = levelyspeed; - - tmrcountdown.Start(); - lblbeatai.Text = Localization.Parse($"{{PONG_BEAT_AI_REWARD}}: {beataireward}"); - pnlgamestats.Hide(); - lblbeatai.Show(); - ball.Location = new Point(paddleHuman.Location.X + paddleHuman.Width + 50, (paddleHuman.Location.Y + paddleHuman.Height) / 2); - if (xVel < 0) - xVel = Math.Abs(xVel); - lbllevelandtime.Text = Localization.Parse("{{LEVEL}}: " + level + " - " + secondsleft + " {SECONDS_LEFT}"); - } + paddleWidth = pnlcanvas.Width / 30; + double ballXLocal = linear(ballX, -1.0, 1.0, 0, pnlcanvas.Width); + double ballYLocal = linear(ballY, -1.0, 1.0, 0, pnlcanvas.Height); - public void btnhighscore_Click(object s, EventArgs a) - { - pnlhighscore.BringToFront(); - SetupHighScores(); - } + ballXLocal -= ((double)paddleWidth / 2); + ballYLocal -= ((double)paddleWidth / 2); - bool IsMultiplayerSession = false; + double aiballXLocal = linear(aiBallX, -1.0, 1.0, 0, pnlcanvas.Width); + double aiballYLocal = linear(aiBallY, -1.0, 1.0, 0, pnlcanvas.Height); - string YouGUID = ""; - string OpponentGUID = ""; + aiballXLocal -= ((double)paddleWidth / 2); + aiballYLocal -= ((double)paddleWidth / 2); - public void SetupHighScores() - { - lbhighscore.Items.Clear(); - lbhighscore.View = View.Details; - lbhighscore.FullRowSelect = true; - lbhighscore.Columns.Clear(); - var n = new ColumnHeader(); - n.Text = "Player"; - n.Width = lbhighscore.Width / 3; - var l = new ColumnHeader(); - l.Text = "Level"; - l.Width = n.Width; - var c = new ColumnHeader(); - c.Text = "Codepoints"; - c.Width = n.Width; - lbhighscore.Columns.Add(n); - lbhighscore.Columns.Add(l); - lbhighscore.Columns.Add(c); - - var t = new Thread(() => - { - try - { - var unite = new ShiftOS.Unite.UniteClient("http://getshiftos.ml", SaveSystem.CurrentSave.UniteAuthToken); - var hs = unite.GetPongHighscores(); - foreach (var score in hs.Highscores) - { - if(this.ParentForm.Visible == false) - { - Thread.CurrentThread.Abort(); - } - string username = unite.GetDisplayNameId(score.UserId); - this.Invoke(new Action(() => - { - var name_item = new ListViewItem(); - name_item.Text = username; - lbhighscore.Items.Add(name_item); - name_item.SubItems.Add(score.Level.ToString()); - name_item.SubItems.Add(score.CodepointsCashout.ToString()); - })); - } - } - catch - { - try - { - if (this.ParentForm.Visible == true) - { - Infobox.Show("Service unavailable.", "The Pong Highscore service is unavailable at this time."); - this.Invoke(new Action(pnlgamestats.BringToFront)); - } - } - catch { } //JUST. ABORT. THE. FUCKING. THREAD. - return; - } - }); - t.Start(); - pnlhighscore.Show(); - } + e.Graphics.Clear(pnlcanvas.BackColor); - // ERROR: Handles clauses are not supported in C# - private void btnplayagain_Click(object sender, EventArgs e) - { - newgame(); - } + //draw the ai ball + if (drawAiBall) + e.Graphics.FillEllipse(new SolidBrush(Color.Gray), new RectangleF((float)aiballXLocal, (float)aiballYLocal, (float)paddleWidth, (float)paddleWidth)); - // ERROR: Handles clauses are not supported in C# - private void btnlosetryagain_Click(object sender, EventArgs e) - { - newgame(); - } - public void StartLevel() - { - newgame(); - } - - // ERROR: Handles clauses are not supported in C# - private void btnstartgame_Click(object sender, EventArgs e) - { - newgame(); - } + //draw the ball + if (doBallCalc) + e.Graphics.FillEllipse(new SolidBrush(pnlcanvas.ForeColor), new RectangleF((float)ballXLocal, (float)ballYLocal, (float)paddleWidth, (float)paddleWidth)); - Random rand = new Random(); - // ERROR: Handles clauses are not supported in C# - private void tmrstoryline_Tick(object sender, EventArgs e) - { - // Random chance of showing getshiftnet storyline - int i = rand.Next(0, 100); + double playerYLocal = linear(playerY, -1.0, 1.0, 0, pnlcanvas.Height); + double opponentYLocal = linear(opponentY, -1.0, 1.0, 0, pnlcanvas.Height); + + int paddleHeight = pnlcanvas.Height / 5; + + int paddleStart = paddleWidth; - if (i >= 25 && i <= 50) + //draw player paddle + e.Graphics.FillRectangle(new SolidBrush(pnlcanvas.ForeColor), new RectangleF((float)paddleWidth, (float)(playerYLocal - (float)(paddleHeight / 2)), (float)paddleWidth, (float)paddleHeight)); + + //draw opponent + e.Graphics.FillRectangle(new SolidBrush(pnlcanvas.ForeColor), new RectangleF((float)(pnlcanvas.Width - (paddleWidth*2)), (float)(opponentYLocal - (float)(paddleHeight / 2)), (float)paddleWidth, (float)paddleHeight)); + + string cp_text = Localization.Parse("{PONG_STATUSCP}", new Dictionary<string, string> { - tmrstoryline.Stop(); - } + ["%cp"] = codepointsToEarn.ToString() + }); - } + var tSize = e.Graphics.MeasureString(cp_text, SkinEngine.LoadedSkin.Header3Font); - // ERROR: Handles clauses are not supported in C# - private void me_closing(object sender, FormClosingEventArgs e) - { - tmrstoryline.Stop(); - } + var tLoc = new PointF((pnlcanvas.Width - (int)tSize.Width) / 2, + (pnlcanvas.Height - (int)tSize.Height) + + ); + e.Graphics.DrawString(cp_text, SkinEngine.LoadedSkin.Header3Font, new SolidBrush(pnlcanvas.ForeColor), tLoc); + tSize = e.Graphics.MeasureString(counter, SkinEngine.LoadedSkin.Header2Font); - private void Label6_Click(object sender, EventArgs e) - { + tLoc = new PointF((pnlcanvas.Width - (int)tSize.Width) / 2, + (pnlcanvas.Height - (int)tSize.Height) / 2 - } + ); + e.Graphics.DrawString(counter, SkinEngine.LoadedSkin.Header2Font, new SolidBrush(pnlcanvas.ForeColor), tLoc); + tSize = e.Graphics.MeasureString(header, SkinEngine.LoadedSkin.Header2Font); - private void Label8_Click(object sender, EventArgs e) - { + tLoc = new PointF((pnlcanvas.Width - (int)tSize.Width) / 2, + (pnlcanvas.Height - (int)tSize.Height) / 4 - } + ); + e.Graphics.DrawString(header, SkinEngine.LoadedSkin.Header2Font, new SolidBrush(pnlcanvas.ForeColor), tLoc); - private void pgcontents_Paint(object sender, PaintEventArgs e) { + string l = Localization.Parse("{PONG_STATUSLEVEL}", new Dictionary<string, string> + { + ["%level"] = level.ToString(), + ["%time"] = secondsleft.ToString() + }); + tSize = e.Graphics.MeasureString(l, SkinEngine.LoadedSkin.Header3Font); + + tLoc = new PointF((pnlcanvas.Width - (int)tSize.Width) / 2, + (tSize.Height) + ); + e.Graphics.DrawString(l, SkinEngine.LoadedSkin.Header3Font, new SolidBrush(pnlcanvas.ForeColor), tLoc); - } - private void ball_MouseEnter(object sender, EventArgs e) { - aiShouldIsbeEnabled = false; } - private void ball_MouseLeave(object sender, EventArgs e) { - aiShouldIsbeEnabled = true; + static public double linear(double x, double x0, double x1, double y0, double y1) + { + if ((x1 - x0) == 0) + { + return (y0 + y1) / 2; + } + return y0 + (x - x0) * (y1 - y0) / (x1 - x0); } + Timer drawTimer = null; + public void OnLoad() { - pnlintro.BringToFront(); - pnlintro.Show(); - pnlhighscore.Hide(); - pnlgamestats.Hide(); - pnlfinalstats.Hide(); - CenterPanels(); - lblbeatai.Hide(); - ServerManager.MessageReceived += this.ServerMessageReceivedHandler; + doAi = false; + doBallCalc = false; + pnlgamestart.Show(); + pnlgamestart.BringToFront(); + pnlgamestart.CenterParent(); + drawTimer.Start(); } public void OnSkinLoad() { - CenterPanels(); - this.SizeChanged += (o, a) => - { - CenterPanels(); - }; } public bool OnUnload() { - if(IsMultiplayerSession == true) - { - if(!string.IsNullOrWhiteSpace(OpponentGUID)) - ServerManager.Forward(OpponentGUID, "pong_mp_left", null); - LeaveMatchmake(); - } - ServerManager.MessageReceived -= this.ServerMessageReceivedHandler; - + drawTimer.Stop(); + counterTimer.Stop(); return true; } public void OnUpgrade() { - CenterPanels(); } - private void button2_Click(object sender, EventArgs e) + private void pnlcanvas_MouseMove(object sender, MouseEventArgs e) { - pnlhighscore.Hide(); + playerY = linear(e.Y, 0, pnlcanvas.Height, -1, 1); } - private void btnmatchmake_Click(object sender, EventArgs e) + private void button1_Click(object sender, EventArgs e) { - this.StartMultiplayer(); - pnlintro.Hide(); - lblbeatai.Text = "Beat the other player to earn Codepoints."; - lblcountdown.Text = "Waiting for another player..."; - lblcountdown.Left = (this.Width - lblcountdown.Width) / 2; + pnllevelwon.Hide(); + doAi = true; + doBallCalc = true; + counterTimer.Start(); } - private void lvotherplayers_DoubleClick(object sender, EventArgs e) + private void btncashout_Click(object sender, EventArgs e) { - if(lvotherplayers.SelectedItems.Count > 0) + pnllevelwon.Hide(); + SaveSystem.CurrentSave.Codepoints += (ulong)codepointsToEarn; + level = 1; + speedFactor = 0.0125; + Infobox.Show("{TITLE_CODEPOINTSTRANSFERRED}", Localization.Parse("{PROMPT_CODEPOINTSTRANSFERRED}", new Dictionary<string, string> { - SendLeaderGUID(lvotherplayers.SelectedItems[0].Text); - } + ["%transferrer"] = "Pong", + ["%amount"] = codepointsToEarn.ToString() + })); + codepointsToEarn = 0; + pnlgamestart.Show(); + pnlgamestart.BringToFront(); + pnlgamestart.CenterParent(); + + } + + private void button2_Click(object sender, EventArgs e) + { + counterTimer.Start(); + doAi = true; + doBallCalc = true; + pnlgamestart.Hide(); } } } diff --git a/ShiftOS.WinForms/Applications/Pong.resx b/ShiftOS.WinForms/Applications/Pong.resx index 3b5619d..1af7de1 100644 --- a/ShiftOS.WinForms/Applications/Pong.resx +++ b/ShiftOS.WinForms/Applications/Pong.resx @@ -117,16 +117,4 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> - <metadata name="gameTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>227, 17</value> - </metadata> - <metadata name="counter.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>134, 17</value> - </metadata> - <metadata name="tmrcountdown.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>340, 17</value> - </metadata> - <metadata name="tmrstoryline.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> - <value>17, 17</value> - </metadata> </root>
\ No newline at end of file diff --git a/ShiftOS.WinForms/Applications/ShiftLetters.cs b/ShiftOS.WinForms/Applications/ShiftLetters.cs index 42e19f8..0e9f74a 100644 --- a/ShiftOS.WinForms/Applications/ShiftLetters.cs +++ b/ShiftOS.WinForms/Applications/ShiftLetters.cs @@ -217,7 +217,7 @@ namespace ShiftOS.WinForms.Applications if (!lblword.Text.Contains("_")) { int oldlives = lives; - int cp = (word.Length * oldlives) * 2; //drunky michael made this 5x... + ulong cp = (ulong)(word.Length * oldlives) * 2; //drunky michael made this 5x... SaveSystem.TransferCodepointsFrom("shiftletters", cp); StartGame(); } diff --git a/ShiftOS.WinForms/Applications/ShiftLotto.cs b/ShiftOS.WinForms/Applications/ShiftLotto.cs index 5ab8154..03d051b 100644 --- a/ShiftOS.WinForms/Applications/ShiftLotto.cs +++ b/ShiftOS.WinForms/Applications/ShiftLotto.cs @@ -50,11 +50,11 @@ namespace ShiftOS.WinForms.Applications { timer1.Start(); } - + public void OnSkinLoad() { - + } public bool OnUnload() @@ -64,7 +64,7 @@ namespace ShiftOS.WinForms.Applications public void OnUpgrade() { - + } // The Dynamic Display @@ -82,13 +82,13 @@ namespace ShiftOS.WinForms.Applications int codePoints = Convert.ToInt32(Math.Round(cpUpDown.Value, 0)); int difficulty = Convert.ToInt32(Math.Round(difUpDown.Value, 0)); - if (SaveSystem.CurrentSave.Codepoints <= 9) + if (SaveSystem.CurrentSave.Codepoints < 10) { Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to use ShiftLotto!"); } else { - if (SaveSystem.CurrentSave.Codepoints - (codePoints * difficulty) <= 0) + if (SaveSystem.CurrentSave.Codepoints < (ulong)(codePoints * difficulty)) { Infobox.Show("Not enough Codepoints", "You do not have enough Codepoints to gamble this amount!"); } @@ -102,7 +102,7 @@ namespace ShiftOS.WinForms.Applications int winningNumber = rnd.Next(0, difficulty); // Multiply CodePoints * Difficulty - int jackpot = codePoints * difficulty; + ulong jackpot = (ulong)(codePoints * difficulty); // Test the random ints if (guessedNumber == winningNumber) @@ -110,7 +110,7 @@ namespace ShiftOS.WinForms.Applications // If you win // Add Codepoints - SaveSystem.TransferCodepointsFrom("shiftlotto", jackpot); + SaveSystem.TransferCodepointsFrom("shiftlotto", (ulong)(codePoints * difficulty)); // Infobox Infobox.Show("YOU WON!", "Good Job! " + jackpot.ToString() + " CP has been added to your account. "); @@ -122,13 +122,13 @@ namespace ShiftOS.WinForms.Applications // Remove Codepoints SaveSystem.TransferCodepointsToVoid(jackpot); - + // Infobox Infobox.Show("YOU FAILED!", "Sorry! " + jackpot.ToString() + " CP has been removed from your account."); } - } - } + } + } } } }
\ No newline at end of file diff --git a/ShiftOS.WinForms/Applications/ShiftSweeper.cs b/ShiftOS.WinForms/Applications/ShiftSweeper.cs index f23ed73..772ec26 100644 --- a/ShiftOS.WinForms/Applications/ShiftSweeper.cs +++ b/ShiftOS.WinForms/Applications/ShiftSweeper.cs @@ -300,12 +300,12 @@ namespace ShiftOS.WinForms.Applications { } public void winGame() { - int cp = 0; - int origminecount = gameBombCount * 10; + ulong cp = 0; + ulong origminecount = (ulong)(gameBombCount * 10); if (minetimer < 31) cp = (origminecount * 3); - else if (minetimer < 61) cp = (Int32)(origminecount * 2.5); + else if (minetimer < 61) cp = (ulong)(origminecount * 2.5); else if (minetimer < 91) cp = (origminecount * 2); - else if (minetimer < 121) cp = (Int32)(origminecount * 1.5); + else if (minetimer < 121) cp = (ulong)(origminecount * 1.5); else if (minetimer > 120) cp = (origminecount * 1); SaveSystem.TransferCodepointsFrom("shiftsweeper", cp); panelGameStatus.Image = Properties.Resources.SweeperWinFace; diff --git a/ShiftOS.WinForms/Applications/Shifter.cs b/ShiftOS.WinForms/Applications/Shifter.cs index 1a59c80..3b3a4f1 100644 --- a/ShiftOS.WinForms/Applications/Shifter.cs +++ b/ShiftOS.WinForms/Applications/Shifter.cs @@ -391,7 +391,7 @@ namespace ShiftOS.WinForms.Applications } - public int CodepointValue = 0; + public uint CodepointValue = 0; public List<ShifterSetting> settings = new List<ShifterSetting>(); public Skin LoadedSkin = null; diff --git a/ShiftOS.WinForms/Applications/Shiftnet.cs b/ShiftOS.WinForms/Applications/Shiftnet.cs index 7f5d3c1..136f680 100644 --- a/ShiftOS.WinForms/Applications/Shiftnet.cs +++ b/ShiftOS.WinForms/Applications/Shiftnet.cs @@ -80,6 +80,7 @@ namespace ShiftOS.WinForms.Applications txturl.Location = new Point(btnforward.Left + btnforward.Width + 2, 2); txturl.Width = flcontrols.Width - btnback.Width - 2 - btnforward.Width - 2 - (btngo.Width*2) - 2; btngo.Location = new Point(flcontrols.Width - btngo.Width - 2, 2); + flcontrols.BackColor = SkinEngine.LoadedSkin.TitleBackgroundColor; } public bool OnUnload() @@ -147,79 +148,62 @@ namespace ShiftOS.WinForms.Applications public void NavigateToUrl(string url) { + txturl.Text = url; - foreach(var exe in Directory.GetFiles(Environment.CurrentDirectory)) + try { - if(exe.EndsWith(".exe") || exe.EndsWith(".dll")) + foreach (var type in Array.FindAll(ReflectMan.Types, t => t.GetInterfaces().Contains(typeof(IShiftnetSite)) && t.BaseType == typeof(UserControl) && Shiftorium.UpgradeAttributesUnlocked(t))) { - try + var attribute = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute && (x as ShiftnetSiteAttribute).Url == url) as ShiftnetSiteAttribute; + if (attribute != null) { - var asm = Assembly.LoadFile(exe); - foreach (var type in asm.GetTypes()) - { - if (type.GetInterfaces().Contains(typeof(IShiftnetSite))) + var obj = (IShiftnetSite)Activator.CreateInstance(type, null); + obj.GoToUrl += (u) => { - if (type.BaseType == typeof(UserControl)) - { - var attribute = type.GetCustomAttributes(false).FirstOrDefault(x => x is ShiftnetSiteAttribute) as ShiftnetSiteAttribute; - if (attribute != null) - { - if (attribute.Url == url) - { - if (Shiftorium.UpgradeAttributesUnlocked(type)) - { - var obj = (IShiftnetSite)Activator.CreateInstance(type, null); - obj.GoToUrl += (u) => - { - History.Push(u); - NavigateToUrl(u); - }; - obj.GoBack += () => - { - string u = History.Pop(); - Future.Push(u); - NavigateToUrl(u); - }; - CurrentPage = obj; - this.pnlcanvas.Controls.Clear(); - this.pnlcanvas.Controls.Add((UserControl)obj); - ((UserControl)obj).Show(); - ((UserControl)obj).Dock = DockStyle.Fill; - obj.OnUpgrade(); - obj.OnSkinLoad(); - obj.Setup(); - return; - } - } - } - } - } - } - } - catch (Exception ex) - { - pnlcanvas.Controls.Clear(); - var tlbl = new Label(); - tlbl.Text = "Server error in \"" + url + "\" application."; - tlbl.Tag = "header1"; - tlbl.AutoSize = true; - tlbl.Location = new Point(10, 10); - tlbl.Dock = DockStyle.Top; - pnlcanvas.Controls.Add(tlbl); - tlbl.Show(); - - var crash = new Label(); - crash.Dock = DockStyle.Fill; - crash.AutoSize = false; - crash.Text = ex.ToString(); - pnlcanvas.Controls.Add(crash); - crash.Show(); - crash.BringToFront(); - ControlManager.SetupControls(pnlcanvas); - return; + History.Push(CurrentUrl); + NavigateToUrl(u); + }; + obj.GoBack += () => + { + string u = History.Pop(); + Future.Push(u); + NavigateToUrl(u); + }; + CurrentPage = obj; + this.pnlcanvas.Controls.Clear(); + this.pnlcanvas.Controls.Add((UserControl)obj); + ((UserControl)obj).Show(); + ((UserControl)obj).Dock = DockStyle.Fill; + obj.OnUpgrade(); + obj.OnSkinLoad(); + obj.Setup(); + AppearanceManager.SetWindowTitle(this, attribute.Name + " - Shiftnet"); + return; } } } + catch (Exception ex) + { + pnlcanvas.Controls.Clear(); + var tlbl = new Label(); + tlbl.Text = "Server error in \"" + url + "\" application."; + tlbl.Tag = "header1"; + tlbl.AutoSize = true; + tlbl.Location = new Point(10, 10); + tlbl.Dock = DockStyle.Top; + pnlcanvas.Controls.Add(tlbl); + tlbl.Show(); + + var crash = new Label(); + crash.Dock = DockStyle.Fill; + crash.AutoSize = false; + crash.Text = ex.ToString(); + pnlcanvas.Controls.Add(crash); + crash.Show(); + crash.BringToFront(); + ControlManager.SetupControls(pnlcanvas); + return; + } pnlcanvas.Controls.Clear(); var lbl = new Label(); lbl.Text = "Page not found!"; diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs index dc107c4..e4e493e 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.Designer.cs @@ -189,7 +189,6 @@ namespace ShiftOS.WinForms.Applications this.lblcategorytext.TabIndex = 2; this.lblcategorytext.Text = "No Upgrades"; this.lblcategorytext.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.lblcategorytext.Click += new System.EventHandler(this.lblcategorytext_Click); // // btncat_forward // @@ -226,7 +225,6 @@ namespace ShiftOS.WinForms.Applications this.lbcodepoints.Size = new System.Drawing.Size(135, 13); this.lbcodepoints.TabIndex = 3; this.lbcodepoints.Text = "You have: %cp Codepoints"; - this.lbcodepoints.Click += new System.EventHandler(this.lbcodepoints_Click); // // label1 // @@ -280,7 +278,6 @@ namespace ShiftOS.WinForms.Applications this.ForeColor = System.Drawing.Color.LightGreen; this.Name = "ShiftoriumFrontend"; this.Size = new System.Drawing.Size(782, 427); - this.Load += new System.EventHandler(this.Shiftorium_Load); this.panel1.ResumeLayout(false); this.panel2.ResumeLayout(false); this.pnlupgradeactions.ResumeLayout(false); diff --git a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs index 08e6c8f..6886d98 100644 --- a/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs +++ b/ShiftOS.WinForms/Applications/ShiftoriumFrontend.cs @@ -47,19 +47,21 @@ namespace ShiftOS.WinForms.Applications public partial class ShiftoriumFrontend : UserControl, IShiftOSWindow { public int CategoryId = 0; - public static System.Timers.Timer timer100; + private string[] cats; + private ShiftoriumUpgrade[] avail; + public void updatecounter() + { + Desktop.InvokeOnWorkerThread(() => { lbcodepoints.Text = $"You have {SaveSystem.CurrentSave.Codepoints} Codepoints."; }); + } + public ShiftoriumFrontend() { - cp_update = new System.Windows.Forms.Timer(); - cp_update.Tick += (o, a) => - { - lbcodepoints.Text = $"You have {SaveSystem.CurrentSave.Codepoints} Codepoints."; - }; - cp_update.Interval = 100; InitializeComponent(); - PopulateShiftorium(); + updatecounter(); + Populate(); + SetList(); lbupgrades.SelectedIndexChanged += (o, a) => { try @@ -82,84 +84,62 @@ namespace ShiftOS.WinForms.Applications public void SelectUpgrade(string name) { btnbuy.Show(); - var upg = upgrades[name]; + var upg = upgrades[CategoryId][name]; lbupgradetitle.Text = Localization.Parse(upg.Name); lbupgradedesc.Text = Localization.Parse(upg.Description); } - Dictionary<string, ShiftoriumUpgrade> upgrades = new Dictionary<string, ShiftoriumUpgrade>(); - - public void PopulateShiftorium() + Dictionary<string, ShiftoriumUpgrade>[] upgrades; + + private void Populate() { - var t = new Thread(() => + cats = Shiftorium.GetCategories(); + upgrades = new Dictionary<string, ShiftoriumUpgrade>[cats.Length]; + int numComplete = 0; + avail = backend.GetAvailable(); + foreach (var it in cats.Select((catName, catId) => new { catName, catId })) { - try + var upl = new Dictionary<string, ShiftoriumUpgrade>(); + upgrades[it.catId] = upl; + var t = new Thread((tupobj) => { - Desktop.InvokeOnWorkerThread(() => - { - lbnoupgrades.Hide(); - lbupgrades.Items.Clear(); - upgrades.Clear(); - Timer(); - }); - - foreach (var upg in backend.GetAvailable().Where(x => x.Category == backend.GetCategories()[CategoryId])) - { - string name = Localization.Parse(upg.Name) + " - " + upg.Cost.ToString() + "CP"; - upgrades.Add(name, upg); - Desktop.InvokeOnWorkerThread(() => - { - lbupgrades.Items.Add(name); - }); - } - - if (lbupgrades.Items.Count == 0) - { - Desktop.InvokeOnWorkerThread(() => - { - lbnoupgrades.Show(); - lbnoupgrades.Location = new Point( - (lbupgrades.Width - lbnoupgrades.Width) / 2, - lbupgrades.Top + (lbupgrades.Height - lbnoupgrades.Height) / 2 - ); - }); - } - else - { - Desktop.InvokeOnWorkerThread(() => - { - lbnoupgrades.Hide(); - }); - } - - Desktop.InvokeOnWorkerThread(() => - { - try - { - lblcategorytext.Text = Shiftorium.GetCategories()[CategoryId]; - btncat_back.Visible = (CategoryId > 0); - btncat_forward.Visible = (CategoryId < backend.GetCategories().Length - 1); - } - catch - { + foreach (var upg in avail.Where(x => x.Category == it.catName)) + upl.Add(Localization.Parse(upg.Name) + " - " + upg.Cost.ToString() + "CP", upg); + numComplete++; + }); + t.Start(); + } + while (numComplete < cats.Length) { } // wait for all threads to finish their job + } - } - }); - } - catch - { - Desktop.InvokeOnWorkerThread(() => - { - lbnoupgrades.Show(); - lbnoupgrades.Location = new Point( - (lbupgrades.Width - lbnoupgrades.Width) / 2, - lbupgrades.Top + (lbupgrades.Height - lbnoupgrades.Height) / 2 - ); - }); - } - }); - t.IsBackground = true; - t.Start(); + private void SetList() + { + lbupgrades.Items.Clear(); + if (upgrades.Length == 0) + return; + lbnoupgrades.Hide(); + if (CategoryId > upgrades.Length) + CategoryId = 0; + try + { + lbupgrades.Items.AddRange(upgrades[CategoryId].Keys.ToArray()); + } + catch + { + Engine.Infobox.Show("Shiftorium Machine Broke", "Category ID " + CategoryId.ToString() + " is invalid, modulo is broken, and the world is doomed. Please tell Declan about this."); + return; + } + if (lbupgrades.Items.Count == 0) + { + lbnoupgrades.Show(); + lbnoupgrades.Location = new Point( + (lbupgrades.Width - lbnoupgrades.Width) / 2, + lbupgrades.Top + (lbupgrades.Height - lbnoupgrades.Height) / 2 + ); + } + else + lbnoupgrades.Hide(); + lblcategorytext.Text = cats[CategoryId]; } public static bool UpgradeInstalled(string upg) @@ -213,13 +193,14 @@ namespace ShiftOS.WinForms.Applications private void btnbuy_Click(object sender, EventArgs e) { - long cpCost = 0; + ulong cpCost = 0; backend.Silent = true; - Dictionary<string, long> UpgradesToBuy = new Dictionary<string, long>(); + Dictionary<string, ulong> UpgradesToBuy = new Dictionary<string, ulong>(); foreach (var itm in lbupgrades.SelectedItems) { - cpCost += upgrades[itm.ToString()].Cost; - UpgradesToBuy.Add(upgrades[itm.ToString()].ID, upgrades[itm.ToString()].Cost); + var upg = upgrades[CategoryId][itm.ToString()]; + cpCost += upg.Cost; + UpgradesToBuy.Add(upg.ID, upg.Cost); } if (SaveSystem.CurrentSave.Codepoints < cpCost) { @@ -230,7 +211,6 @@ namespace ShiftOS.WinForms.Applications { foreach(var upg in UpgradesToBuy) { - SaveSystem.CurrentSave.Codepoints -= upg.Value; if (SaveSystem.CurrentSave.Upgrades.ContainsKey(upg.Key)) { SaveSystem.CurrentSave.Upgrades[upg.Key] = true; @@ -242,20 +222,15 @@ namespace ShiftOS.WinForms.Applications SaveSystem.SaveGame(); backend.InvokeUpgradeInstalled(); } + SaveSystem.CurrentSave.Codepoints -= cpCost; } backend.Silent = false; - PopulateShiftorium(); btnbuy.Hide(); } - private void Shiftorium_Load(object sender, EventArgs e) { - - } - public void OnLoad() { - cp_update.Start(); lbnoupgrades.Hide(); } @@ -264,12 +239,8 @@ namespace ShiftOS.WinForms.Applications } - System.Windows.Forms.Timer cp_update = new System.Windows.Forms.Timer(); - public bool OnUnload() { - cp_update.Stop(); - cp_update = null; return true; } @@ -277,44 +248,27 @@ namespace ShiftOS.WinForms.Applications { lbupgrades.SelectionMode = (UpgradeInstalled("shiftorium_gui_bulk_buy") == true) ? SelectionMode.MultiExtended : SelectionMode.One; lbcodepoints.Visible = Shiftorium.UpgradeInstalled("shiftorium_gui_codepoints_display"); + Populate(); + SetList(); } - private void lbcodepoints_Click(object sender, EventArgs e) + private void moveCat(short direction) // direction is -1 to move backwards or 1 to move forwards { - - } - - void Timer() - { - timer100 = new System.Timers.Timer(); - timer100.Interval = 2000; - //CLARIFICATION: What is this supposed to do? - Michael - //timer100.Elapsed += ???; - timer100.AutoReset = true; - timer100.Enabled = true; + if (cats.Length == 0) return; + CategoryId += direction; + CategoryId %= cats.Length; + if (CategoryId < 0) CategoryId += cats.Length; // fix modulo on negatives + SetList(); } private void btncat_back_Click(object sender, EventArgs e) { - if(CategoryId > 0) - { - CategoryId--; - PopulateShiftorium(); - } + moveCat(-1); } private void btncat_forward_Click(object sender, EventArgs e) { - if(CategoryId < backend.GetCategories().Length - 1) - { - CategoryId++; - PopulateShiftorium(); - } - } - - private void lblcategorytext_Click(object sender, EventArgs e) - { - + moveCat(1); } } } diff --git a/ShiftOS.WinForms/Applications/ShopItemCreator.cs b/ShiftOS.WinForms/Applications/ShopItemCreator.cs index 61e7491..d2836ee 100644 --- a/ShiftOS.WinForms/Applications/ShopItemCreator.cs +++ b/ShiftOS.WinForms/Applications/ShopItemCreator.cs @@ -73,7 +73,7 @@ namespace ShiftOS.WinForms.Applications Infobox.Show("No file chosen.", "Please select a file to sell."); return; } - Item.Cost = Convert.ToInt32(txtcost.Text); + Item.Cost = Convert.ToUInt64(txtcost.Text); Item.Description = txtdescription.Text; Item.Name = txtitemname.Text; Callback?.Invoke(Item); @@ -101,7 +101,7 @@ namespace ShiftOS.WinForms.Applications { try { - Item.Cost = Convert.ToInt32(txtcost.Text); + Item.Cost = Convert.ToUInt64(txtcost.Text); } catch { diff --git a/ShiftOS.WinForms/Applications/Terminal.cs b/ShiftOS.WinForms/Applications/Terminal.cs index de4888b..54329df 100644 --- a/ShiftOS.WinForms/Applications/Terminal.cs +++ b/ShiftOS.WinForms/Applications/Terminal.cs @@ -232,7 +232,7 @@ namespace ShiftOS.WinForms.Applications var text = txt.Lines.ToArray(); var text2 = text[text.Length - 1]; var text3 = ""; - Console.WriteLine(); + txt.AppendText(Environment.NewLine); var text4 = Regex.Replace(text2, @"\t|\n|\r", ""); if (IsInRemoteSystem == true) @@ -260,23 +260,17 @@ namespace ShiftOS.WinForms.Applications } else { - if (CurrentCommandParser.parser == null) + var result = SkinEngine.LoadedSkin.CurrentParser.ParseCommand(text3); + + if (result.Equals(default(KeyValuePair<string, Dictionary<string, string>>))) { - TerminalBackend.InvokeCommand(text3); + Console.WriteLine("{ERR_SYNTAXERROR}"); } else { - var result = CurrentCommandParser.parser.ParseCommand(text3); - - if (result.Equals(default(KeyValuePair<KeyValuePair<string, string>, Dictionary<string, string>>))) - { - Console.WriteLine("Syntax Error: Syntax Error"); - } - else - { - TerminalBackend.InvokeCommand(result.Key.Key, result.Key.Value, result.Value); - } + TerminalBackend.InvokeCommand(result.Key, result.Value); } + } } if (TerminalBackend.PrefixEnabled) @@ -313,21 +307,24 @@ namespace ShiftOS.WinForms.Applications } else if (a.KeyCode == Keys.Left) { - var getstring = txt.Lines[txt.Lines.Length - 1]; - var stringlen = getstring.Length + 1; - var header = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; - var headerlen = header.Length + 1; - var selstart = txt.SelectionStart; - var remstrlen = txt.TextLength - stringlen; - var finalnum = selstart - remstrlen; - - if (finalnum != headerlen) + if (SaveSystem.CurrentSave != null) { - AppearanceManager.CurrentPosition--; - } - else - { - a.SuppressKeyPress = true; + var getstring = txt.Lines[txt.Lines.Length - 1]; + var stringlen = getstring.Length + 1; + var header = $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ "; + var headerlen = header.Length + 1; + var selstart = txt.SelectionStart; + var remstrlen = txt.TextLength - stringlen; + var finalnum = selstart - remstrlen; + + if (finalnum != headerlen) + { + AppearanceManager.CurrentPosition--; + } + else + { + a.SuppressKeyPress = true; + } } } else if (a.KeyCode == Keys.Up) @@ -335,6 +332,7 @@ namespace ShiftOS.WinForms.Applications var tostring3 = txt.Lines[txt.Lines.Length - 1]; if (tostring3 == $"{SaveSystem.CurrentUser.Username}@{SaveSystem.CurrentSave.SystemName}:~$ ") Console.Write(TerminalBackend.LastCommand); + ConsoleEx.OnFlush?.Invoke(); a.SuppressKeyPress = true; } @@ -406,8 +404,6 @@ namespace ShiftOS.WinForms.Applications public static void FirstSteps() { TerminalBackend.PrefixEnabled = false; - new Thread(() => - { TerminalBackend.InStory = true; Console.WriteLine("Hey there, and welcome to ShiftOS."); Thread.Sleep(2000); @@ -517,8 +513,86 @@ namespace ShiftOS.WinForms.Applications TerminalBackend.InStory = false; SaveSystem.SaveGame(); Thread.Sleep(1000); + + Story.Context.AutoComplete = false; + + Console.WriteLine(@"Welcome to the ShiftOS Newbie's Guide. + +This tutorial will guide you through the more intermediate features of ShiftOS, +such as earning Codepoints, buying Shiftoorium Upgrades, and using the objectives system. + +Every now and then, you'll get a notification in your terminal of a ""NEW OBJECTIVE"". +This means that someone has instructed you to do something inside ShiftOS. At any moment +you may type ""sos.status"" in your Terminal to see your current objectives. + +This command is very useful as not only does it allow you to see your current objectives +but you can also see the amount of Codepoints you have as well as the upgrades you've +installed and how many upgrades are available. + +Now, onto your first objective! All you need to do is earn 200 Codepoints using any +program on your system."); + + Story.PushObjective("First Steps: Your First Codepoints", "Play a few rounds of Pong, or use another program to earn 200 Codepoints.", () => + { + return SaveSystem.CurrentSave.Codepoints >= 200; + }, () => + { + Desktop.InvokeOnWorkerThread(() => + { + AppearanceManager.SetupWindow(new Terminal()); + }); + Console.WriteLine("Good job! You've earned " + SaveSystem.CurrentSave.Codepoints + @" Codepoints! You can use these inside the +Shiftorium to buy new upgrades inside ShiftOS. + +These upgrades can give ShiftOS more features, fixes and programs, +which can make the operating system easier to use and navigate around +and also make it easier for you to earn more Codepoints and thus upgrade +te system further. + +Be cautious though! Only certain upgrades offer the ability to earn more +Codepoints. These upgrades are typically in the form of new programs. + +So, try to get as many new programs as possible for your computer, and save +the system feature upgrades for later unless you absolutely need them. + +The worst thing that could happen is you end up stuck with very little Codepoints +and only a few small programs to use to earn very little amounts of Codepoints. + +Now, let's get you your first Shiftorium upgrade!"); + + Story.PushObjective("First Steps: The Shiftorium", "Buy your first Shiftorium upgrade with your new Codepoints using shiftorium.list, shiftorium.info and shiftorium.buy.", + () => + { + return SaveSystem.CurrentSave.CountUpgrades() > 0; + }, () => + { + Console.WriteLine("This concludes the ShiftOS Newbie's Guide! Now, go, and shift it your way!"); + Console.WriteLine(@" +Your goal: Earn 1,000 Codepoints."); + Story.Context.MarkComplete(); + Story.Start("first_steps_transition"); + }); TerminalBackend.PrintPrompt(); - }).Start(); + }); + + TerminalBackend.PrintPrompt(); + } + + + [Story("first_steps_transition")] + public static void FirstStepsTransition() + { + Story.PushObjective("Earn 1000 Codepoints", "You now know the basics of ShiftOS. Let's get your system up and running with a few upgrades, and get a decent amount of Codepoints.", () => + { + return SaveSystem.CurrentSave.Codepoints >= 1000; + }, + () => + { + Story.Context.MarkComplete(); + Story.Start("victortran_shiftnet"); + }); + + Story.Context.AutoComplete = false; } public void OnSkinLoad() @@ -544,7 +618,7 @@ namespace ShiftOS.WinForms.Applications { if (AppearanceManager.OpenForms.Count <= 1) { - Console.WriteLine(""); + //Console.WriteLine(""); Console.WriteLine("{WIN_CANTCLOSETERMINAL}"); try { |
