diff options
Diffstat (limited to 'ShiftOS.WinForms/Applications')
| -rw-r--r-- | ShiftOS.WinForms/Applications/MindBlow.cs | 12 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/Pong.Designer.cs | 74 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/Pong.cs | 34 | ||||
| -rw-r--r-- | ShiftOS.WinForms/Applications/Pong.resx | 7 |
4 files changed, 75 insertions, 52 deletions
diff --git a/ShiftOS.WinForms/Applications/MindBlow.cs b/ShiftOS.WinForms/Applications/MindBlow.cs index 0f0df80..7cd2a8f 100644 --- a/ShiftOS.WinForms/Applications/MindBlow.cs +++ b/ShiftOS.WinForms/Applications/MindBlow.cs @@ -35,7 +35,17 @@ namespace ShiftOS.WinForms.Applications public override long Length => box.Text.Length; - public override long Position { get => Length; set => throw new NotImplementedException(); } + public override long Position + { + get + { + return Length; + } + set + { + //nothing + } + } public override void Flush() { diff --git a/ShiftOS.WinForms/Applications/Pong.Designer.cs b/ShiftOS.WinForms/Applications/Pong.Designer.cs index aee599b..fd82735 100644 --- a/ShiftOS.WinForms/Applications/Pong.Designer.cs +++ b/ShiftOS.WinForms/Applications/Pong.Designer.cs @@ -28,18 +28,17 @@ /// </summary> private void InitializeComponent() { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Pong)); this.pnlcanvas = new System.Windows.Forms.Panel(); this.pnllevelwon = new System.Windows.Forms.Panel(); - this.lbltitle = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); - this.btncashout = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); + this.btncashout = new System.Windows.Forms.Button(); + 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.button2 = new System.Windows.Forms.Button(); + this.btnplay = new System.Windows.Forms.Button(); this.label3 = new System.Windows.Forms.Label(); this.pnllevelwon.SuspendLayout(); this.panel1.SuspendLayout(); @@ -68,17 +67,6 @@ this.pnllevelwon.TabIndex = 0; this.pnllevelwon.Visible = false; // - // 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; - // // label1 // this.label1.Dock = System.Windows.Forms.DockStyle.Fill; @@ -86,8 +74,7 @@ this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(301, 139); this.label1.TabIndex = 1; - this.label1.Text = "You have survived this level of Pong. You now have a chance to cash out your Code" + - "points or play on for more."; + this.label1.Text = "{PONG_BEATLEVELDESC}"; this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // panel1 @@ -100,25 +87,36 @@ this.panel1.Size = new System.Drawing.Size(301, 32); this.panel1.TabIndex = 2; // + // button1 + // + this.button1.Location = new System.Drawing.Point(159, 6); + this.button1.Name = "button1"; + 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.button1_Click); + // // btncashout // this.btncashout.Location = new System.Drawing.Point(48, 6); this.btncashout.Name = "btncashout"; this.btncashout.Size = new System.Drawing.Size(93, 23); this.btncashout.TabIndex = 0; - this.btncashout.Text = "Cash out"; + this.btncashout.Text = "{PONG_CASHOUT}"; this.btncashout.UseVisualStyleBackColor = true; this.btncashout.Click += new System.EventHandler(this.btncashout_Click); // - // button1 + // lbltitle // - this.button1.Location = new System.Drawing.Point(159, 6); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(93, 23); - this.button1.TabIndex = 1; - this.button1.Text = "Play on"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); + 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 // @@ -138,27 +136,27 @@ this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(301, 206); this.label2.TabIndex = 1; - this.label2.Text = resources.GetString("label2.Text"); + this.label2.Text = "{PONG_DESC}"; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; // // panel3 // - this.panel3.Controls.Add(this.button2); + 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; // - // button2 + // btnplay // - this.button2.Location = new System.Drawing.Point(100, 6); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(116, 23); - this.button2.TabIndex = 1; - this.button2.Text = "Play some Pong!"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); + 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 // @@ -168,7 +166,7 @@ this.label3.Size = new System.Drawing.Size(301, 42); this.label3.TabIndex = 0; this.label3.Tag = "header2"; - this.label3.Text = "Welcome to Pong."; + this.label3.Text = "{PONG_WELCOME}"; this.label3.TextAlign = System.Drawing.ContentAlignment.TopCenter; // // Pong @@ -200,7 +198,7 @@ private System.Windows.Forms.Panel pnlgamestart; private System.Windows.Forms.Label label2; private System.Windows.Forms.Panel panel3; - private System.Windows.Forms.Button button2; + 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 c260ae3..d8f93f7 100644 --- a/ShiftOS.WinForms/Applications/Pong.cs +++ b/ShiftOS.WinForms/Applications/Pong.cs @@ -223,7 +223,7 @@ namespace ShiftOS.WinForms.Applications pnlgamestart.Show(); pnlgamestart.BringToFront(); pnlgamestart.CenterParent(); - Infobox.Show("You lose.", "You lost the game! Guess you should've cashed out..."); + Infobox.Show("{TITLE_PONG_YOULOSE}", "{PROMPT_PONGLOST}"); doAi = false; doBallCalc = false; } @@ -237,7 +237,10 @@ namespace ShiftOS.WinForms.Applications pnllevelwon.CenterParent(); pnllevelwon.Show(); pnllevelwon.BringToFront(); - lbltitle.Text = "You've reached level " + level + "!"; + lbltitle.Text = Localization.Parse("{PONG_LEVELREACHED}", new Dictionary<string, string> + { + ["%level"] = level.ToString() + }); lbltitle.Height = (int)CreateGraphics().MeasureString(lbltitle.Text, lbltitle.Font).Height; codepointsToEarn += CalculateAIBeatCP() * 2; speedFactor += speedFactor / level; @@ -251,8 +254,12 @@ namespace ShiftOS.WinForms.Applications public void Win() { - header = "You beat the AI! " + CalculateAIBeatCP() + " Codepoints!."; + header = Localization.Parse("{PONG_BEATAI}", new Dictionary<string, string> + { + ["%amount"] = CalculateAIBeatCP().ToString() + }); InitializeCoordinates(); + counterTimer.Stop(); new System.Threading.Thread(() => { doBallCalc = false; @@ -265,6 +272,10 @@ namespace ShiftOS.WinForms.Applications doBallCalc = true; header = ""; counter = ""; + Desktop.InvokeOnWorkerThread(() => + { + counterTimer.Start(); + }); }).Start(); } @@ -322,7 +333,10 @@ namespace ShiftOS.WinForms.Applications //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("{CODEPOINTS}: " + codepointsToEarn); + string cp_text = Localization.Parse("{PONG_STATUSCP}", new Dictionary<string, string> + { + ["%cp"] = codepointsToEarn.ToString() + }); var tSize = e.Graphics.MeasureString(cp_text, SkinEngine.LoadedSkin.Header3Font); @@ -346,7 +360,11 @@ namespace ShiftOS.WinForms.Applications ); e.Graphics.DrawString(header, SkinEngine.LoadedSkin.Header2Font, new SolidBrush(pnlcanvas.ForeColor), tLoc); - string l = Localization.Parse("{LEVEL}: " + level + " - " + secondsleft + " {SECONDS_LEFT}"); + 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, @@ -412,7 +430,11 @@ namespace ShiftOS.WinForms.Applications SaveSystem.CurrentSave.Codepoints += (ulong)codepointsToEarn; level = 1; speedFactor = 0.0125; - Infobox.Show("Codepoints transferred.", "Pong has transferred " + codepointsToEarn + " Codepoints to your system."); + Infobox.Show("{TITLE_CODEPOINTSTRANSFERRED}", Localization.Parse("{PROMPT_CODEPOINTSTRANSFERRED}", new Dictionary<string, string> + { + ["%transferrer"] = "Pong", + ["%amount"] = codepointsToEarn.ToString() + })); codepointsToEarn = 0; pnlgamestart.Show(); pnlgamestart.BringToFront(); diff --git a/ShiftOS.WinForms/Applications/Pong.resx b/ShiftOS.WinForms/Applications/Pong.resx index 685deff..1af7de1 100644 --- a/ShiftOS.WinForms/Applications/Pong.resx +++ b/ShiftOS.WinForms/Applications/Pong.resx @@ -117,11 +117,4 @@ <resheader name="writer"> <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> </resheader> - <data name="label2.Text" xml:space="preserve"> - <value>Pong is the modern-day recreation of the classic 70s game called, you guessed it, Pong. - -In Pong, you must try your best to keep the fast-moving ball from going past your side of the screen using your mouse to move your paddle in the way of the ball, while getting the ball to go past the opponent's paddle. - -Once you start Pong, you have 60 seconds to beat the opponent and survive as much as possible. The game will get faster as you play, and the more 60-second levels you play, the more Codepoints you'll earn. If you lose the level, you will start back at Level 1 with 0 Codepoints. At the end of the level, you may choose to cash out or play on.</value> - </data> </root>
\ No newline at end of file |
