cleanup here and there

This commit is contained in:
Unknown 2019-04-06 17:55:27 -04:00
parent 2c7c9a685b
commit b642d3736e
6 changed files with 50 additions and 91 deletions

View file

@ -12,17 +12,13 @@
namespace Histacom2 namespace Histacom2
{ {
public partial class AchievementBox : Form public partial class AchievementBox : Form {
{
private bool stayOnScreen = false; private bool stayOnScreen = false;
public AchievementBox(int type) public AchievementBox(int type) {
{
InitializeComponent(); InitializeComponent();
this.BringToFront(); BringToFront();
this.Show(); switch (type) {
switch (type)
{
case 0: //Piracy Ending case 0: //Piracy Ending
BackgroundImage = Properties.Resources.EndingPiracy; BackgroundImage = Properties.Resources.EndingPiracy;
stayOnScreen = true; stayOnScreen = true;
@ -37,25 +33,22 @@ public AchievementBox(int type)
break; break;
} }
Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - 202, -102); Location = new Point(Screen.PrimaryScreen.WorkingArea.Width - 202, -102);
while (this.Location.Y != 0) Show();
{ while (Location.Y != 0) {
Thread.Sleep(5); Thread.Sleep(5);
Location = new Point(Location.X, Location.Y + 1); Location = new Point(Location.X, Location.Y + 1);
} }
if (!stayOnScreen) if (!stayOnScreen) {
{
Thread.Sleep(3000); Thread.Sleep(3000);
while (this.Location.Y != -102) while (Location.Y != -102) {
{
Thread.Sleep(5); Thread.Sleep(5);
Location = new Point(Location.X, Location.Y - 1); Location = new Point(Location.X, Location.Y - 1);
} }
this.Close(); Close();
} }
} }
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e) {
{
Program.title.Show(); Program.title.Show();
SaveSystem.CurrentSave = null; SaveSystem.CurrentSave = null;
SaveSystem.currentTheme = null; SaveSystem.currentTheme = null;

View file

@ -11,24 +11,19 @@
namespace Histacom2 namespace Histacom2
{ {
public partial class AchievementScreen : Form public partial class AchievementScreen : Form {
{ public AchievementScreen() {
public AchievementScreen()
{
InitializeComponent(); InitializeComponent();
} }
private void AchievementScreen_Load(object sender, EventArgs e) private void AchievementScreen_Load(object sender, EventArgs e) {
{
byte[] achieved = SaveSystem.GetAchievements(); byte[] achieved = SaveSystem.GetAchievements();
if (achieved[0] == 1) if (achieved[0] == 1) {
{
listView1.Items[0].ImageIndex = 0; listView1.Items[0].ImageIndex = 0;
listView1.Items[0].Text = "Piracy Ending"; listView1.Items[0].Text = "Piracy Ending";
} }
if (achieved[1] == 1) if (achieved[1] == 1) {
{
listView1.Items[1].ImageIndex = 0; listView1.Items[1].ImageIndex = 0;
listView1.Items[1].Text = "Destruction Ending"; listView1.Items[1].Text = "Destruction Ending";
} }
@ -36,9 +31,8 @@ private void AchievementScreen_Load(object sender, EventArgs e)
// if (achieved[21] == 1) listView2.Items[1].ImageIndex = 0; // if (achieved[21] == 1) listView2.Items[1].ImageIndex = 0;
} }
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e) {
{ Close();
this.Close();
} }
} }
} }

View file

@ -78,8 +78,7 @@ public static async void StartObjective()
public static async void VirusDestruction(WinClassicIE6Bad ie) public static async void VirusDestruction(WinClassicIE6Bad ie)
{ {
LabelMaker(); LabelMaker();
if (Console.ParentForm != null) if (Console.ParentForm != null) {
{
Console.ParentForm.Close(); Console.ParentForm.Close();
} }
await Task.Delay(10000); ((WinXP)ie.ParentForm).maximizebutton.Image = ((WinXP)ie.ParentForm).closebutton.Image; await Task.Delay(10000); ((WinXP)ie.ParentForm).maximizebutton.Image = ((WinXP)ie.ParentForm).closebutton.Image;

View file

@ -13,15 +13,12 @@ namespace Histacom2
{ {
public partial class SeizureWarning : UserControl public partial class SeizureWarning : UserControl
{ {
public SeizureWarning() public SeizureWarning() {
{
InitializeComponent(); InitializeComponent();
} }
private void button1_Click(object sender, EventArgs e) private void button1_Click(object sender, EventArgs e) {
{ Hide();
File.WriteAllText(Path.Combine(Engine.SaveSystem.DataDirectory, "o.k"), ".");
this.Hide();
} }
} }
} }

View file

@ -136,6 +136,8 @@ private void InitializeComponent()
this.startbutton.TabIndex = 12; this.startbutton.TabIndex = 12;
this.startbutton.TabStop = false; this.startbutton.TabStop = false;
this.startbutton.Click += new System.EventHandler(this.startbutton_Click); this.startbutton.Click += new System.EventHandler(this.startbutton_Click);
this.startbutton.MouseLeave += new System.EventHandler(this.gameversion_MouseLeave);
this.startbutton.MouseHover += new System.EventHandler(this.gameversion_MouseHover);
// //
// startmenu // startmenu
// //
@ -165,7 +167,7 @@ private void InitializeComponent()
this.startmenuitems.Name = "startmenuitems"; this.startmenuitems.Name = "startmenuitems";
this.startmenuitems.Padding = new System.Windows.Forms.Padding(1, 2, 0, 0); this.startmenuitems.Padding = new System.Windows.Forms.Padding(1, 2, 0, 0);
this.startmenuitems.RenderMode = System.Windows.Forms.ToolStripRenderMode.System; this.startmenuitems.RenderMode = System.Windows.Forms.ToolStripRenderMode.System;
this.startmenuitems.Size = new System.Drawing.Size(140, 239); this.startmenuitems.Size = new System.Drawing.Size(140, 220);
this.startmenuitems.TabIndex = 0; this.startmenuitems.TabIndex = 0;
this.startmenuitems.Text = "StartMenu"; this.startmenuitems.Text = "StartMenu";
// //

View file

@ -43,21 +43,16 @@ public static extern int SendMessage(IntPtr hWnd,
public static extern bool ReleaseCapture(); public static extern bool ReleaseCapture();
public TitleScreen() public TitleScreen() {
{
InitializeComponent(); InitializeComponent();
this.startmenu.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2); this.startmenu.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2);
if (!File.Exists(Path.Combine(DataDirectory, "o.k")))
{
SeizureWarning sw = new SeizureWarning(); SeizureWarning sw = new SeizureWarning();
sw.Size = programContent.Size; sw.Size = programContent.Size;
programContent.Controls.Add(sw); programContent.Controls.Add(sw);
sw.BringToFront(); sw.BringToFront();
} }
}
public void StartGame() public void StartGame() {
{
// Time to decide which OS to start up! // Time to decide which OS to start up!
switch (CurrentSave.CurrentOS) switch (CurrentSave.CurrentOS)
@ -115,8 +110,7 @@ public void StartGame()
} }
} }
private void VM_WidthHeight_KeyPress(object sender, KeyPressEventArgs e) private void VM_WidthHeight_KeyPress(object sender, KeyPressEventArgs e) {
{
if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && (e.KeyChar != '.')) e.Handled = true; if (!char.IsControl(e.KeyChar) && !char.IsDigit(e.KeyChar) && (e.KeyChar != '.')) e.Handled = true;
// only allow one decimal point // only allow one decimal point
@ -124,8 +118,7 @@ private void VM_WidthHeight_KeyPress(object sender, KeyPressEventArgs e)
} }
// When the TitleScreen Loads // When the TitleScreen Loads
private void TitleScreen_Load(object sender, EventArgs e) private void TitleScreen_Load(object sender, EventArgs e) {
{
Directory.CreateDirectory(GameDirectory); Directory.CreateDirectory(GameDirectory);
Directory.CreateDirectory(DataDirectory); Directory.CreateDirectory(DataDirectory);
Directory.CreateDirectory(AllProfilesDirectory); Directory.CreateDirectory(AllProfilesDirectory);
@ -155,27 +148,22 @@ private void TitleScreen_Load(object sender, EventArgs e)
#region NewGame #region NewGame
// When NewGame is Clicked // When NewGame is Clicked
private void NewGame_Click(object sender, EventArgs e) private void NewGame_Click(object sender, EventArgs e) {
{
newGameBox = new NewGameDialog(); newGameBox = new NewGameDialog();
newGameBox.ShowDialog(); newGameBox.ShowDialog();
if (newGameBox.Successful) if (newGameBox.Successful) {
{
NewGame(); NewGame();
StartGame(); StartGame();
} }
} }
public void BSODRewind(object sender, EventArgs e) public void BSODRewind(object sender, EventArgs e) {
{ if (progress == "95") {
if (progress == "95")
{
frm95.Close(); frm95.Close();
frm95 = null; frm95 = null;
try try {
{
// Time to close all the game applications // Time to close all the game applications
foreach (Form frm in Application.OpenForms) if (frm.Tag.ToString() != "ignoreFormOnTaskbar") frm.Close(); foreach (Form frm in Application.OpenForms) if (frm.Tag.ToString() != "ignoreFormOnTaskbar") frm.Close();
} catch { } catch {
@ -194,13 +182,11 @@ public void BSODRewind(object sender, EventArgs e)
#endregion #endregion
#region LoadGame #region LoadGame
private void LoadGame_Click(object sender, EventArgs e) private void LoadGame_Click(object sender, EventArgs e) {
{
loadGameBox = new LoadGameDialog(); loadGameBox = new LoadGameDialog();
loadGameBox.ShowDialog(); loadGameBox.ShowDialog();
if (loadGameBox.successful) if (loadGameBox.successful) {
{
LoadSave(); LoadSave();
SetTheme(); SetTheme();
StartGame(); StartGame();
@ -209,66 +195,54 @@ private void LoadGame_Click(object sender, EventArgs e)
#endregion #endregion
#region ExitButton #region ExitButton
private void Exit_Click(object sender, EventArgs e) private void Exit_Click(object sender, EventArgs e) {
{
Application.Exit(); Application.Exit();
} }
#endregion #endregion
#region HelpButton #region HelpButton
private void helpItemClick(object sender, EventArgs e) private void helpItemClick(object sender, EventArgs e) {
{
System.Diagnostics.Process.Start("https://github.com/TheRandomMelon/Histacom2/wiki"); System.Diagnostics.Process.Start("https://github.com/TheRandomMelon/Histacom2/wiki");
} }
#endregion #endregion
#endregion #endregion
private void gameversion_MouseHover(object sender, EventArgs e) private void gameversion_MouseHover(object sender, EventArgs e) {
{
gameversion.Text = "There are no easter eggs here!"; gameversion.Text = "There are no easter eggs here!";
} }
private void gameversion_MouseLeave(object sender, EventArgs e) private void gameversion_MouseLeave(object sender, EventArgs e) {
{
gameversion.Text = gameVersion; gameversion.Text = gameVersion;
} }
private void startbutton_Click(object sender, EventArgs e) private void startbutton_Click(object sender, EventArgs e) {
{ if (DevMode) {
if (DevMode)
{
DevMode = false; DevMode = false;
gameversion.Text = "Developer Mode Deactivated"; gameversion.Text = "Developer Mode Deactivated";
} else { } else {
DevMode = true; DevMode = true;
gameversion.Text = "Developer Mode Activated"; gameversion.Text = "Developer Mode Activated";
} }
} }
private void closebutton_Click_1(object sender, EventArgs e) private void closebutton_Click_1(object sender, EventArgs e) {
{
Application.Exit(); Application.Exit();
} }
private void updateText_Tick(object sender, EventArgs e) private void updateText_Tick(object sender, EventArgs e) {
{ if (gameversion.Text != gameVersion) {
if (gameversion.Text != gameVersion)
{
gameversion.Text = gameVersion; gameversion.Text = gameVersion;
updateText.Stop(); updateText.Stop();
} }
} }
private void achievementsToolStripMenuItem_Click(object sender, EventArgs e) private void achievementsToolStripMenuItem_Click(object sender, EventArgs e) {
{
AchievementScreen achievelist = new AchievementScreen(); AchievementScreen achievelist = new AchievementScreen();
achievelist.ShowDialog(); achievelist.ShowDialog();
} }
private void helpMenu(object sender, EventArgs e) private void helpMenu(object sender, EventArgs e) {
{
System.Diagnostics.Process.Start("https://github.com/TheRandomMelon/Histacom2/wiki"); System.Diagnostics.Process.Start("https://github.com/TheRandomMelon/Histacom2/wiki");
} }
} }