From ebe1b011db93d47b7a29b8b4d1e371b1a97bffce Mon Sep 17 00:00:00 2001 From: lempamo Date: Tue, 8 Aug 2017 10:42:48 -0400 Subject: custom minesweeper tables AND painted separators --- TimeHACK.Engine/Paintbrush.cs | 19 ++- .../MineSweeper/CustomMinefield.Designer.cs | 140 +++++++++++++++++++++ .../Win95/Win95Apps/MineSweeper/CustomMinefield.cs | 42 +++++++ .../Win95Apps/MineSweeper/CustomMinefield.resx | 120 ++++++++++++++++++ .../OS/Win95/Win95Apps/MineSweeper/Square.cs | 5 +- .../MineSweeper/WinClassicMinesweeper.Designer.cs | 66 ++++++---- .../Win95Apps/MineSweeper/WinClassicMinesweeper.cs | 25 +++- TimeHACK.Main/TimeHACK.Main.csproj | 9 ++ 8 files changed, 395 insertions(+), 31 deletions(-) create mode 100644 TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/CustomMinefield.Designer.cs create mode 100644 TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/CustomMinefield.cs create mode 100644 TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/CustomMinefield.resx diff --git a/TimeHACK.Engine/Paintbrush.cs b/TimeHACK.Engine/Paintbrush.cs index 087b87f..a8a6b54 100644 --- a/TimeHACK.Engine/Paintbrush.cs +++ b/TimeHACK.Engine/Paintbrush.cs @@ -10,7 +10,6 @@ namespace TimeHACK.Engine { public class Paintbrush { - public static void PaintClassicBorders(object sender, PaintEventArgs e, int borderwidth) { ControlPaint.DrawBorder(e.Graphics, ((Control)sender).ClientRectangle, @@ -28,5 +27,23 @@ namespace TimeHACK.Engine Color.White, borderwidth, ButtonBorderStyle.Solid, Color.White, borderwidth, ButtonBorderStyle.Solid); } + + public static void ExtendedToolStripSeparator_Paint(object sender, PaintEventArgs e) + { + // Get the separator's width and height. + ToolStripSeparator toolStripSeparator = (ToolStripSeparator)sender; + int width = toolStripSeparator.Width; + int height = toolStripSeparator.Height; + + // Choose the colors for drawing. + Color foreColor = Color.Gray; + Color backColor = Color.Silver; + + // Fill the background. + e.Graphics.FillRectangle(new SolidBrush(backColor), 0, 0, width, height); + + // Draw the line. + e.Graphics.DrawLine(new Pen(foreColor), 4, height / 2, width - 4, height / 2); + } } } diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/CustomMinefield.Designer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/CustomMinefield.Designer.cs new file mode 100644 index 0000000..5eaef09 --- /dev/null +++ b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/CustomMinefield.Designer.cs @@ -0,0 +1,140 @@ +namespace TimeHACK.OS.Win95.Win95Apps.MineSweeper +{ + partial class CustomMinefield + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Component Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.comboBox2 = new System.Windows.Forms.ComboBox(); + this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.comboBox3 = new System.Windows.Forms.ComboBox(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.button1 = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(13, 7); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(38, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Width:"; + // + // comboBox2 + // + this.comboBox2.BackColor = System.Drawing.Color.White; + this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.comboBox2.FormattingEnabled = true; + this.comboBox2.Location = new System.Drawing.Point(57, 31); + this.comboBox2.Name = "comboBox2"; + this.comboBox2.Size = new System.Drawing.Size(78, 21); + this.comboBox2.TabIndex = 2; + // + // comboBox1 + // + this.comboBox1.BackColor = System.Drawing.Color.White; + this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.comboBox1.FormattingEnabled = true; + this.comboBox1.Location = new System.Drawing.Point(57, 4); + this.comboBox1.Name = "comboBox1"; + this.comboBox1.Size = new System.Drawing.Size(78, 21); + this.comboBox1.TabIndex = 3; + // + // comboBox3 + // + this.comboBox3.BackColor = System.Drawing.Color.White; + this.comboBox3.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox3.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.comboBox3.FormattingEnabled = true; + this.comboBox3.Location = new System.Drawing.Point(57, 58); + this.comboBox3.Name = "comboBox3"; + this.comboBox3.Size = new System.Drawing.Size(78, 21); + this.comboBox3.TabIndex = 4; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(10, 34); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(41, 13); + this.label2.TabIndex = 5; + this.label2.Text = "Height:"; + // + // label3 + // + this.label3.AutoSize = true; + this.label3.Location = new System.Drawing.Point(13, 61); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(38, 13); + this.label3.TabIndex = 6; + this.label3.Text = "Mines:"; + // + // button1 + // + this.button1.BackColor = System.Drawing.Color.Silver; + this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.button1.Location = new System.Drawing.Point(153, 4); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(75, 23); + this.button1.TabIndex = 7; + this.button1.Text = "OK"; + this.button1.UseVisualStyleBackColor = false; + this.button1.Click += new System.EventHandler(this.button1_Click); + // + // CustomMinefield + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.button1); + this.Controls.Add(this.label3); + this.Controls.Add(this.label2); + this.Controls.Add(this.comboBox3); + this.Controls.Add(this.comboBox1); + this.Controls.Add(this.comboBox2); + this.Controls.Add(this.label1); + this.Name = "CustomMinefield"; + this.Size = new System.Drawing.Size(231, 89); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.ComboBox comboBox2; + private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.ComboBox comboBox3; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label3; + private System.Windows.Forms.Button button1; + } +} diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/CustomMinefield.cs b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/CustomMinefield.cs new file mode 100644 index 0000000..c87d0d1 --- /dev/null +++ b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/CustomMinefield.cs @@ -0,0 +1,42 @@ +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 TimeHACK.Engine; + +namespace TimeHACK.OS.Win95.Win95Apps.MineSweeper +{ + public partial class CustomMinefield : UserControl + { + private WinClassicMinesweeper _wcm; + private WindowManager wm; + + public CustomMinefield(WinClassicMinesweeper wcm) + { + InitializeComponent(); + _wcm = wcm; + wm = new WindowManager(); + for (int i = 8; i < 31; i++) comboBox1.Items.Add(i); + for (int i = 8; i < 25; i++) comboBox2.Items.Add(i); + for (int i = 10; i < 668; i++) comboBox3.Items.Add(i); + } + + private void button1_Click(object sender, EventArgs e) + { + if ((int)comboBox1.SelectedItem * (int)comboBox2.SelectedItem <= (int)comboBox3.SelectedItem) wm.StartInfobox95("Oops!", "Too many mines!", Engine.Template.InfoboxType.Warning, Engine.Template.InfoboxButtons.OK); + else + { + _wcm.customwidth = (int)comboBox1.SelectedItem; + _wcm.customheight = (int)comboBox2.SelectedItem; + _wcm.custommines = (int)comboBox3.SelectedItem; + _wcm.calculateFormSize((int)comboBox1.SelectedItem, (int)comboBox2.SelectedItem); + this.ParentForm.Close(); + } + } + } +} diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/CustomMinefield.resx b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/CustomMinefield.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/CustomMinefield.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Square.cs b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Square.cs index 1dea7e7..fc1e38f 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Square.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/Square.cs @@ -13,6 +13,7 @@ namespace TimeHACK.OS.Win95.Win95Apps.MineSweeper private Button _button; private bool _dismantled = false; + private bool _questioned = false; private Game _game; private bool _minded = false; private bool _opened = false; @@ -124,10 +125,12 @@ namespace TimeHACK.OS.Win95.Win95Apps.MineSweeper if (Dismantled) { _dismantled = false; + _questioned = true; Button.BackgroundImage = Properties.Resources.minesweepSquareQuestion; } - else if(Button.BackgroundImage == Properties.Resources.minesweepSquareQuestion) + else if(_questioned) { + _questioned = false; Button.BackgroundImage = Properties.Resources.minesweepSquare; return; } diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.Designer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.Designer.cs index d407d13..10beaaa 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.Designer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.Designer.cs @@ -131,12 +131,14 @@ this.gameToolStripMenuItem.Name = "gameToolStripMenuItem"; this.gameToolStripMenuItem.Size = new System.Drawing.Size(50, 20); this.gameToolStripMenuItem.Text = "Game"; + this.gameToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.Overlay; // // newToolStripMenuItem // + this.newToolStripMenuItem.BackColor = System.Drawing.Color.Silver; this.newToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.newToolStripMenuItem.Name = "newToolStripMenuItem"; - this.newToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.newToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.newToolStripMenuItem.Text = "New"; this.newToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.newToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; @@ -144,23 +146,25 @@ // toolStripSeparator1 // this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(138, 6); + this.toolStripSeparator1.Size = new System.Drawing.Size(149, 6); // // begginnerToolStripMenuItem // + this.begginnerToolStripMenuItem.BackColor = System.Drawing.Color.Silver; this.begginnerToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.begginnerToolStripMenuItem.Name = "begginnerToolStripMenuItem"; - this.begginnerToolStripMenuItem.Size = new System.Drawing.Size(141, 22); - this.begginnerToolStripMenuItem.Text = "Begginner"; + this.begginnerToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.begginnerToolStripMenuItem.Text = "Beginner"; this.begginnerToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.begginnerToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; this.begginnerToolStripMenuItem.Click += new System.EventHandler(this.begginnerToolStripMenuItem_Click); // // intermediateToolStripMenuItem // + this.intermediateToolStripMenuItem.BackColor = System.Drawing.Color.Silver; this.intermediateToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.intermediateToolStripMenuItem.Name = "intermediateToolStripMenuItem"; - this.intermediateToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.intermediateToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.intermediateToolStripMenuItem.Text = "Intermediate"; this.intermediateToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.intermediateToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; @@ -168,9 +172,10 @@ // // expertToolStripMenuItem // + this.expertToolStripMenuItem.BackColor = System.Drawing.Color.Silver; this.expertToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.expertToolStripMenuItem.Name = "expertToolStripMenuItem"; - this.expertToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.expertToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.expertToolStripMenuItem.Text = "Expert"; this.expertToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.expertToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; @@ -178,32 +183,36 @@ // // customToolStripMenuItem // + this.customToolStripMenuItem.BackColor = System.Drawing.Color.Silver; this.customToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.customToolStripMenuItem.Name = "customToolStripMenuItem"; - this.customToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.customToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.customToolStripMenuItem.Text = "Custom"; this.customToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.customToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; + this.customToolStripMenuItem.Click += new System.EventHandler(this.customToolStripMenuItem_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(138, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(149, 6); // // marksToolStripMenuItem // + this.marksToolStripMenuItem.BackColor = System.Drawing.Color.Silver; this.marksToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.marksToolStripMenuItem.Name = "marksToolStripMenuItem"; - this.marksToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.marksToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.marksToolStripMenuItem.Text = "Marks {?}"; this.marksToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.marksToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; // // colorToolStripMenuItem // + this.colorToolStripMenuItem.BackColor = System.Drawing.Color.Silver; this.colorToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.colorToolStripMenuItem.Name = "colorToolStripMenuItem"; - this.colorToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.colorToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.colorToolStripMenuItem.Text = "Color"; this.colorToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.colorToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; @@ -211,13 +220,14 @@ // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(138, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(149, 6); // // bestTimesToolStripMenuItem // + this.bestTimesToolStripMenuItem.BackColor = System.Drawing.Color.Silver; this.bestTimesToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.bestTimesToolStripMenuItem.Name = "bestTimesToolStripMenuItem"; - this.bestTimesToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.bestTimesToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.bestTimesToolStripMenuItem.Text = "Best Times"; this.bestTimesToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.bestTimesToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; @@ -226,13 +236,14 @@ // toolStripSeparator4 // this.toolStripSeparator4.Name = "toolStripSeparator4"; - this.toolStripSeparator4.Size = new System.Drawing.Size(138, 6); + this.toolStripSeparator4.Size = new System.Drawing.Size(149, 6); // // exitToolStripMenuItem // + this.exitToolStripMenuItem.BackColor = System.Drawing.Color.Silver; this.exitToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(141, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(152, 22); this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; this.exitToolStripMenuItem.TextImageRelation = System.Windows.Forms.TextImageRelation.TextBeforeImage; @@ -240,6 +251,7 @@ // // helpToolStripMenuItem // + this.helpToolStripMenuItem.BackgroundImage = global::TimeHACK.Properties.Resources.sliversilver; this.helpToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.helpToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.helpTopicsToolStripMenuItem, @@ -251,6 +263,7 @@ // // helpTopicsToolStripMenuItem // + this.helpTopicsToolStripMenuItem.BackColor = System.Drawing.Color.Silver; this.helpTopicsToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.helpTopicsToolStripMenuItem.Name = "helpTopicsToolStripMenuItem"; this.helpTopicsToolStripMenuItem.Size = new System.Drawing.Size(180, 22); @@ -263,6 +276,7 @@ // // aboutMinesweeperToolStripMenuItem // + this.aboutMinesweeperToolStripMenuItem.BackColor = System.Drawing.Color.Silver; this.aboutMinesweeperToolStripMenuItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; this.aboutMinesweeperToolStripMenuItem.Name = "aboutMinesweeperToolStripMenuItem"; this.aboutMinesweeperToolStripMenuItem.Size = new System.Drawing.Size(180, 22); @@ -340,27 +354,27 @@ private System.Windows.Forms.Panel panel1; private System.Windows.Forms.MenuStrip menuStrip1; private System.Windows.Forms.ToolStripMenuItem gameToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem helpTopicsToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem aboutMinesweeperToolStripMenuItem; + private System.Windows.Forms.Timer timer1; + private System.Windows.Forms.Panel panel2; + internal System.Windows.Forms.Button button1; + private System.Windows.Forms.Panel panel3; + private System.Windows.Forms.Panel panel4; private System.Windows.Forms.ToolStripMenuItem newToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; private System.Windows.Forms.ToolStripMenuItem begginnerToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem intermediateToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem expertToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem customToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripMenuItem marksToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem colorToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; private System.Windows.Forms.ToolStripMenuItem bestTimesToolStripMenuItem; - private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem; - private System.Windows.Forms.ToolStripMenuItem helpTopicsToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator4; private System.Windows.Forms.ToolStripSeparator toolStripSeparator5; - private System.Windows.Forms.ToolStripMenuItem aboutMinesweeperToolStripMenuItem; - private System.Windows.Forms.Timer timer1; - private System.Windows.Forms.Panel panel2; - internal System.Windows.Forms.Button button1; - private System.Windows.Forms.Panel panel3; - private System.Windows.Forms.Panel panel4; } } diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.cs b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.cs index ac627b3..d7f9d18 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/MineSweeper/WinClassicMinesweeper.cs @@ -10,6 +10,7 @@ using System.Windows.Forms; using TimeHACK.OS.Win95.Win95Apps.MineSweeper; using TimeHACK.Engine; using System.Threading; +using TimeHACK.Engine.Template; namespace TimeHACK.OS.Win95.Win95Apps { @@ -18,6 +19,9 @@ namespace TimeHACK.OS.Win95.Win95Apps private Game _game; public int currentface = 1; public string level = "easy"; + public int customwidth; + public int customheight; + public int custommines; public WinClassicMinesweeper() { InitializeComponent(); @@ -34,12 +38,16 @@ namespace TimeHACK.OS.Win95.Win95Apps item.BackgroundImageLayout = ImageLayout.Center; item.DisplayStyle = ToolStripItemDisplayStyle.Text; } + toolStripSeparator1.Paint += Paintbrush.ExtendedToolStripSeparator_Paint; + toolStripSeparator2.Paint += Paintbrush.ExtendedToolStripSeparator_Paint; + toolStripSeparator3.Paint += Paintbrush.ExtendedToolStripSeparator_Paint; + toolStripSeparator4.Paint += Paintbrush.ExtendedToolStripSeparator_Paint; + toolStripSeparator5.Paint += Paintbrush.ExtendedToolStripSeparator_Paint; } private void GameTick(object sender, EventArgs e) { labelTime.Text = _game.Time.ToString(); } - private void GameDismantledMinesChanged(object sender, EventArgs e) { labelBombs.Text = (_game.Mines - _game.DismantledMines).ToString(); @@ -63,7 +71,7 @@ namespace TimeHACK.OS.Win95.Win95Apps { level = "easy"; //button1.Location = new Point(70, 32); - calculateFormSize(8, 8); + calculateFormSize(9, 9); } private void intermediateToolStripMenuItem_Click(object sender, EventArgs e) { @@ -85,7 +93,7 @@ namespace TimeHACK.OS.Win95.Win95Apps { case ("easy"): Cursor.Current = Cursors.WaitCursor; - _game = new Game(this, panel1, 8, 8, 10); + _game = new Game(this, panel1, 9, 9, 10); break; case ("medium"): Cursor.Current = Cursors.WaitCursor; @@ -95,10 +103,15 @@ namespace TimeHACK.OS.Win95.Win95Apps Cursor.Current = Cursors.WaitCursor; _game = new Game(this, panel1, 30, 16, 99); break; + case ("custom"): + Cursor.Current = Cursors.WaitCursor; + _game = new Game(this, panel1, customwidth, customheight, custommines); + break; } _game.Tick += new EventHandler(GameTick); _game.DismantledMinesChanged += new EventHandler(GameDismantledMinesChanged); _game.Start(); + timer1.Start(); } private void WinClassicMinesweeper_Load(object sender, EventArgs e) @@ -148,5 +161,11 @@ namespace TimeHACK.OS.Win95.Win95Apps { this.ParentForm.Close(); } + + private void customToolStripMenuItem_Click(object sender, EventArgs e) + { + level = "custom"; + new WindowManager().StartWin95(new CustomMinefield(this), "Custom Field", null, false, false, true, false); + } } } diff --git a/TimeHACK.Main/TimeHACK.Main.csproj b/TimeHACK.Main/TimeHACK.Main.csproj index 623b3e7..2dfcdb9 100644 --- a/TimeHACK.Main/TimeHACK.Main.csproj +++ b/TimeHACK.Main/TimeHACK.Main.csproj @@ -168,6 +168,12 @@ IE4Start.cs + + UserControl + + + CustomMinefield.cs + UserControl @@ -372,6 +378,9 @@ IE4Start.cs + + CustomMinefield.cs + MineBestTimes.cs -- cgit v1.2.3