1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
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.OS.Win95.Win95Apps.MineSweeper;
using TimeHACK.Engine;
namespace TimeHACK.OS.Win95.Win95Apps
{
public partial class WinClassicMinesweeper : UserControl
{
private Game _game;
public int currentface = 1;
public string level = "easy";
public WinClassicMinesweeper()
{
InitializeComponent();
labelBombs.Font = new Font(TitleScreen.pfc.Families[2], 15, GraphicsUnit.Point);
labelTime.Font = new Font(TitleScreen.pfc.Families[2], 15, GraphicsUnit.Point);
panel1.Paint += (sender, args) => Paintbrush.PaintClassicBordersIndented(sender, args, 3);
}
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();
}
public void calculateFormSize(int x, int y)
{
panel1.Size = new Size(x * 25, y * 25);
this.ParentForm.Size = new Size(x * 25 + 45, y * 25 + 100);
labelTime.Location = new Point(x * 25 - 38, button1.Location.Y);
button1.PerformClick();
}
private void begginnerToolStripMenuItem_Click(object sender, EventArgs e)
{
level = "easy";
button1.Location = new Point(108, 32);
calculateFormSize(8, 8);
}
private void intermediateToolStripMenuItem_Click(object sender, EventArgs e)
{
level = "medium";
button1.Location = new Point(208, 32);
calculateFormSize(16, 16);
}
private void expertToolStripMenuItem_Click(object sender, EventArgs e)
{
level = "hard";
button1.Location = new Point(381, 32);
calculateFormSize(30, 16);
}
private void button1_Click(object sender, EventArgs e)
{
labelTime.Text = "0";
switch (level)
{
case ("easy"):
Cursor.Current = Cursors.WaitCursor;
_game = new Game(this.panel1, 8, 8, 10);
break;
case ("medium"):
Cursor.Current = Cursors.WaitCursor;
_game = new Game(this.panel1, 16, 16, 40);
break;
case ("hard"):
Cursor.Current = Cursors.WaitCursor;
_game = new Game(this.panel1, 30, 16, 99);
break;
}
_game.Tick += new EventHandler(GameTick);
_game.DismantledMinesChanged += new EventHandler(GameDismantledMinesChanged);
_game.Start();
}
private void WinClassicMinesweeper_Load(object sender, EventArgs e)
{
begginnerToolStripMenuItem.PerformClick();
timer1.Start();
}
private void bestTimesToolStripMenuItem_Click(object sender, EventArgs e)
{
WindowManager wm = new WindowManager();
wm.StartWin95(new MineBestTimes(), "Best Times", null, false, false, true, false);
}
private void timer1_Tick(object sender, EventArgs e)
{
if (_game.win == true)
{
switch (level)
{
case ("easy"):
if (SaveSystem.CurrentSave.mineSweepE > _game.Time)
{
SaveSystem.CurrentSave.mineSweepE = _game.Time;
}
break;
case ("medium"):
if (SaveSystem.CurrentSave.mineSweepI > _game.Time)
{
SaveSystem.CurrentSave.mineSweepI = _game.Time;
}
break;
case ("hard"):
if (SaveSystem.CurrentSave.mineSweepH > _game.Time)
{
SaveSystem.CurrentSave.mineSweepH = _game.Time;
}
break;
}
SaveSystem.SaveGame();
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.ParentForm.Close();
}
}
}
|