mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-22 18:02:16 +00:00
UI changes
This commit is contained in:
parent
f9ef8e021c
commit
be544f77de
3 changed files with 201 additions and 4 deletions
147
ShiftOS.WinForms/Applications/Pong.Designer.cs
generated
147
ShiftOS.WinForms/Applications/Pong.Designer.cs
generated
|
@ -28,7 +28,23 @@
|
|||
/// </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.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.label3 = new System.Windows.Forms.Label();
|
||||
this.pnllevelwon.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.pnlgamestart.SuspendLayout();
|
||||
this.panel3.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// pnlcanvas
|
||||
|
@ -41,13 +57,133 @@
|
|||
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;
|
||||
//
|
||||
// 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;
|
||||
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 = "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.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;
|
||||
//
|
||||
// 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.UseVisualStyleBackColor = true;
|
||||
this.btncashout.Click += new System.EventHandler(this.btncashout_Click);
|
||||
//
|
||||
// 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 = "Play on";
|
||||
this.button1.UseVisualStyleBackColor = true;
|
||||
this.button1.Click += new System.EventHandler(this.button1_Click);
|
||||
//
|
||||
// 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 = resources.GetString("label2.Text");
|
||||
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// panel3
|
||||
//
|
||||
this.panel3.Controls.Add(this.button2);
|
||||
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
|
||||
//
|
||||
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);
|
||||
//
|
||||
// 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 = "Welcome to Pong.";
|
||||
this.label3.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// Pong
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.Controls.Add(this.pnlgamestart);
|
||||
this.Controls.Add(this.pnllevelwon);
|
||||
this.Controls.Add(this.pnlcanvas);
|
||||
this.Name = "Pong";
|
||||
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);
|
||||
|
||||
}
|
||||
|
@ -55,5 +191,16 @@
|
|||
#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 button2;
|
||||
private System.Windows.Forms.Label label3;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ using System.Text;
|
|||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ShiftOS.Engine;
|
||||
using ShiftOS.WinForms.Tools;
|
||||
|
||||
namespace ShiftOS.WinForms.Applications
|
||||
{
|
||||
|
@ -69,7 +70,7 @@ namespace ShiftOS.WinForms.Applications
|
|||
bool doAi = true;
|
||||
bool doBallCalc = true;
|
||||
|
||||
private string header = "Pong - Technology Demo";
|
||||
private string header = "";
|
||||
|
||||
private string counter = "";
|
||||
|
||||
|
@ -157,8 +158,7 @@ namespace ShiftOS.WinForms.Applications
|
|||
//Player paddle:
|
||||
if (ballRect.IntersectsWith(playerRect))
|
||||
{
|
||||
//check if the ball x is greater than the player paddle's middle coordinate
|
||||
if (ballRect.Left >= playerRect.Left)
|
||||
if (ballRect.Left <= playerRect.Right)
|
||||
{
|
||||
//reverse x velocity to send the ball the other way
|
||||
xVel = -xVel;
|
||||
|
@ -211,6 +211,15 @@ namespace ShiftOS.WinForms.Applications
|
|||
public void LevelComplete()
|
||||
{
|
||||
level++;
|
||||
doAi = false;
|
||||
doBallCalc = false;
|
||||
counterTimer.Stop();
|
||||
pnllevelwon.CenterParent();
|
||||
pnllevelwon.Show();
|
||||
pnllevelwon.BringToFront();
|
||||
lbltitle.Text = "You've reached level " + level + "!";
|
||||
lbltitle.Height = (int)CreateGraphics().MeasureString(lbltitle.Text, lbltitle.Font).Height;
|
||||
codepointsToEarn += CalculateAIBeatCP() * 2;
|
||||
speedFactor += speedFactor / level;
|
||||
secondsleft = 60;
|
||||
}
|
||||
|
@ -332,8 +341,12 @@ namespace ShiftOS.WinForms.Applications
|
|||
|
||||
public void OnLoad()
|
||||
{
|
||||
doAi = false;
|
||||
doBallCalc = false;
|
||||
pnlgamestart.Show();
|
||||
pnlgamestart.BringToFront();
|
||||
pnlgamestart.CenterParent();
|
||||
drawTimer.Start();
|
||||
counterTimer.Start();
|
||||
}
|
||||
|
||||
public void OnSkinLoad()
|
||||
|
@ -355,5 +368,35 @@ namespace ShiftOS.WinForms.Applications
|
|||
{
|
||||
playerY = linear(e.Y, 0, pnlcanvas.Height, -1, 1);
|
||||
}
|
||||
|
||||
private void button1_Click(object sender, EventArgs e)
|
||||
{
|
||||
pnllevelwon.Hide();
|
||||
doAi = true;
|
||||
doBallCalc = true;
|
||||
counterTimer.Start();
|
||||
}
|
||||
|
||||
private void btncashout_Click(object sender, EventArgs e)
|
||||
{
|
||||
pnllevelwon.Hide();
|
||||
SaveSystem.CurrentSave.Codepoints += (ulong)codepointsToEarn;
|
||||
level = 1;
|
||||
speedFactor = 0.0125;
|
||||
Infobox.Show("Codepoints transferred.", "Pong has transferred " + codepointsToEarn + " Codepoints to your system.");
|
||||
codepointsToEarn = 0;
|
||||
pnlgamestart.Show();
|
||||
pnlgamestart.BringToFront();
|
||||
pnlgamestart.CenterParent();
|
||||
|
||||
}
|
||||
|
||||
private void button2_Click(object sender, EventArgs e)
|
||||
{
|
||||
counterTimer.Start();
|
||||
doAi = true;
|
||||
doBallCalc = true;
|
||||
pnlgamestart.Hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,4 +117,11 @@
|
|||
<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>
|
Loading…
Reference in a new issue