From 4fba2d86af9c960fb78b1c0a912b6371f21b487d Mon Sep 17 00:00:00 2001 From: lempamo Date: Sun, 26 Feb 2017 13:36:01 -0500 Subject: [PATCH] setting up minefield --- .../Applications/ShiftSweeper.Designer.cs | 64 +++++++++++++------ ShiftOS.WinForms/Applications/ShiftSweeper.cs | 27 +++++++- ShiftOS.WinForms/Resources/Shiftorium.txt | 6 ++ ShiftOS.WinForms/ShiftOS.WinForms.csproj | 27 ++++++-- 4 files changed, 98 insertions(+), 26 deletions(-) diff --git a/ShiftOS.WinForms/Applications/ShiftSweeper.Designer.cs b/ShiftOS.WinForms/Applications/ShiftSweeper.Designer.cs index 1b75d75..f5d7ddd 100644 --- a/ShiftOS.WinForms/Applications/ShiftSweeper.Designer.cs +++ b/ShiftOS.WinForms/Applications/ShiftSweeper.Designer.cs @@ -29,10 +29,11 @@ private void InitializeComponent() { this.pictureBox1 = new System.Windows.Forms.PictureBox(); - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.minefieldPanel = new System.Windows.Forms.TableLayoutPanel(); this.buttonE = new System.Windows.Forms.Button(); this.buttonM = new System.Windows.Forms.Button(); this.buttonH = new System.Windows.Forms.Button(); + this.lblmines = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.SuspendLayout(); // @@ -40,24 +41,38 @@ // this.pictureBox1.BackgroundImage = global::ShiftOS.WinForms.Properties.Resources.SweeperNormalFace; this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; - this.pictureBox1.Location = new System.Drawing.Point(110, 3); + this.pictureBox1.Location = new System.Drawing.Point(150, 3); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(32, 32); this.pictureBox1.TabIndex = 0; this.pictureBox1.TabStop = false; // - // tableLayoutPanel1 + // minefieldPanel // - this.tableLayoutPanel1.ColumnCount = 2; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.Location = new System.Drawing.Point(4, 39); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 2; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel1.Size = new System.Drawing.Size(244, 215); - this.tableLayoutPanel1.TabIndex = 1; + this.minefieldPanel.ColumnCount = 9; + this.minefieldPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.Location = new System.Drawing.Point(4, 40); + this.minefieldPanel.Name = "minefieldPanel"; + this.minefieldPanel.RowCount = 9; + this.minefieldPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 11.11111F)); + this.minefieldPanel.Size = new System.Drawing.Size(329, 215); + this.minefieldPanel.TabIndex = 1; // // buttonE // @@ -67,10 +82,11 @@ this.buttonE.TabIndex = 2; this.buttonE.Text = "Easy"; this.buttonE.UseVisualStyleBackColor = true; + this.buttonE.Click += new System.EventHandler(this.buttonE_Click); // // buttonM // - this.buttonM.Location = new System.Drawing.Point(86, 261); + this.buttonM.Location = new System.Drawing.Point(129, 261); this.buttonM.Name = "buttonM"; this.buttonM.Size = new System.Drawing.Size(75, 23); this.buttonM.TabIndex = 3; @@ -79,35 +95,47 @@ // // buttonH // - this.buttonH.Location = new System.Drawing.Point(168, 261); + this.buttonH.Location = new System.Drawing.Point(258, 261); this.buttonH.Name = "buttonH"; this.buttonH.Size = new System.Drawing.Size(75, 23); this.buttonH.TabIndex = 4; this.buttonH.Text = "Hard"; this.buttonH.UseVisualStyleBackColor = true; // + // lblmines + // + this.lblmines.AutoSize = true; + this.lblmines.Location = new System.Drawing.Point(188, 3); + this.lblmines.Name = "lblmines"; + this.lblmines.Size = new System.Drawing.Size(47, 13); + this.lblmines.TabIndex = 5; + this.lblmines.Text = "Mines: 0"; + // // ShiftSweeper // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.lblmines); this.Controls.Add(this.buttonH); this.Controls.Add(this.buttonM); this.Controls.Add(this.buttonE); - this.Controls.Add(this.tableLayoutPanel1); + this.Controls.Add(this.minefieldPanel); this.Controls.Add(this.pictureBox1); this.Name = "ShiftSweeper"; - this.Size = new System.Drawing.Size(275, 333); + this.Size = new System.Drawing.Size(366, 328); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.ResumeLayout(false); + this.PerformLayout(); } #endregion private System.Windows.Forms.PictureBox pictureBox1; - private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.TableLayoutPanel minefieldPanel; private System.Windows.Forms.Button buttonE; private System.Windows.Forms.Button buttonM; private System.Windows.Forms.Button buttonH; + private System.Windows.Forms.Label lblmines; } } diff --git a/ShiftOS.WinForms/Applications/ShiftSweeper.cs b/ShiftOS.WinForms/Applications/ShiftSweeper.cs index c61f3eb..d7c22b4 100644 --- a/ShiftOS.WinForms/Applications/ShiftSweeper.cs +++ b/ShiftOS.WinForms/Applications/ShiftSweeper.cs @@ -11,13 +11,14 @@ using ShiftOS.Engine; namespace ShiftOS.WinForms.Applications { - [Launcher("ShiftSweeper", false, null, "Games")] + [Launcher("ShiftSweeper", true, "shiftsweeper", "Games")] [RequiresUpgrade("shiftsweeper")] [WinOpen("shiftsweeper")] [DefaultIcon("iconShiftSweeper")] public partial class ShiftSweeper : UserControl, IShiftOSWindow { private bool gameplayed = false; + private int mineCount = 0; public ShiftSweeper() { @@ -26,7 +27,9 @@ namespace ShiftOS.WinForms.Applications public void OnLoad() { - + buttonE.Visible = true; + buttonM.Visible = ShiftoriumFrontend.UpgradeInstalled("shiftsweeper_medium"); + buttonH.Visible = ShiftoriumFrontend.UpgradeInstalled("shiftsweeper_hard"); } public void OnSkinLoad() { } @@ -37,5 +40,25 @@ namespace ShiftOS.WinForms.Applications { } + + private void buttonE_Click(object sender, EventArgs e) + { + startGame(0); + } + + private void startGame(int d) + { + switch (d) + { + case 0: + mineCount = 10; + minefieldPanel.ColumnCount = 9; + minefieldPanel.RowCount = 9; + break; + + default: + throw new NullReferenceException(); + } + } } } diff --git a/ShiftOS.WinForms/Resources/Shiftorium.txt b/ShiftOS.WinForms/Resources/Shiftorium.txt index 1c8ca17..dccbd9d 100644 --- a/ShiftOS.WinForms/Resources/Shiftorium.txt +++ b/ShiftOS.WinForms/Resources/Shiftorium.txt @@ -794,4 +794,10 @@ Dependencies: "shiftsweeper", Description: "ShiftSweeper getting too easy? Obviously, since you can only play Easy difficulty! However, with this Medium button, you can get a better challenge, and more codepoints!" }, + { + Name: "ShiftSweeper Hard", + Cost: 900, + Dependencies: "shiftsweeper_medium", + Description: "Is ShiftSweeper still too easy for you? Buy the Hard difficulty and you can try to find 99 mines! It may be extremely difficult, but the reward is massive!" + }, ] \ No newline at end of file diff --git a/ShiftOS.WinForms/ShiftOS.WinForms.csproj b/ShiftOS.WinForms/ShiftOS.WinForms.csproj index e458704..1802675 100644 --- a/ShiftOS.WinForms/ShiftOS.WinForms.csproj +++ b/ShiftOS.WinForms/ShiftOS.WinForms.csproj @@ -178,6 +178,12 @@ ShiftoriumFrontend.cs + + UserControl + + + ShiftSweeper.cs + UserControl @@ -239,6 +245,11 @@ Oobe.cs + + True + True + Resources.resx + @@ -322,6 +333,9 @@ ShiftoriumFrontend.cs + + ShiftSweeper.cs + ShopItemCreator.cs @@ -345,14 +359,9 @@ ResXFileCodeGenerator - Resources.Designer.cs Designer + Resources.Designer.cs - - True - Resources.resx - True - WindowBorder.cs @@ -528,6 +537,10 @@ + + + + @@ -551,8 +564,10 @@ + +