From d968d36f0d7715633185ae948368cc32e3c751ab Mon Sep 17 00:00:00 2001 From: lempamo Date: Wed, 5 Jul 2017 17:15:09 -0400 Subject: Theme wallpapers work! --- .../FRMWinClassicAddressBookNewContact.Designer.cs | 4 +- .../OS/Win95/Win95Apps/WebChat1998.Designer.cs | 4 +- .../Win95Apps/WinClassicFTPClient.Designer.cs | 6 +- .../Win95Apps/WinClassicThemePanel.Designer.cs | 48 ++++++++++++++- .../OS/Win95/Win95Apps/WinClassicThemePanel.cs | 68 ++++++++++++++++++++++ 5 files changed, 122 insertions(+), 8 deletions(-) (limited to 'TimeHACK.Main/OS/Win95/Win95Apps') diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/AddressBook/FRMWinClassicAddressBookNewContact.Designer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/AddressBook/FRMWinClassicAddressBookNewContact.Designer.cs index 4319d9e..7eb3196 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/AddressBook/FRMWinClassicAddressBookNewContact.Designer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/AddressBook/FRMWinClassicAddressBookNewContact.Designer.cs @@ -124,10 +124,10 @@ this.label4.TabIndex = 4; this.label4.Text = "Emails:"; // - // button2 + // cancelButton // this.button2.Location = new System.Drawing.Point(13, 114); - this.button2.Name = "button2"; + this.button2.Name = "cancelButton"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 5; this.button2.Text = "Add"; diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/WebChat1998.Designer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/WebChat1998.Designer.cs index 8fcc79c..b7f9de3 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/WebChat1998.Designer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/WebChat1998.Designer.cs @@ -230,12 +230,12 @@ this.label7.Text = "To speak, just type in the bottom textbox, then click the Speak button or press E" + "nter."; // - // button2 + // cancelButton // this.button2.BackColor = System.Drawing.Color.Silver; this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.button2.Location = new System.Drawing.Point(422, 415); - this.button2.Name = "button2"; + this.button2.Name = "cancelButton"; this.button2.Size = new System.Drawing.Size(71, 23); this.button2.TabIndex = 8; this.button2.Text = "Speak"; diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicFTPClient.Designer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicFTPClient.Designer.cs index 45203e1..485b982 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicFTPClient.Designer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicFTPClient.Designer.cs @@ -180,13 +180,13 @@ this.panel1.Size = new System.Drawing.Size(762, 30); this.panel1.TabIndex = 9; // - // button2 + // cancelButton // this.button2.Location = new System.Drawing.Point(3, 2); - this.button2.Name = "button2"; + this.button2.Name = "cancelButton"; this.button2.Size = new System.Drawing.Size(75, 23); this.button2.TabIndex = 0; - this.button2.Text = "button2"; + this.button2.Text = "cancelButton"; this.button2.UseVisualStyleBackColor = true; // // welcomeLabel diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicThemePanel.Designer.cs b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicThemePanel.Designer.cs index 9bef59e..e6bdda1 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicThemePanel.Designer.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicThemePanel.Designer.cs @@ -31,6 +31,9 @@ this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.pictureBox2 = new System.Windows.Forms.PictureBox(); + this.applyButton = new System.Windows.Forms.Button(); + this.cancelButton = new System.Windows.Forms.Button(); + this.okButton = new System.Windows.Forms.Button(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); this.SuspendLayout(); @@ -46,31 +49,71 @@ // // comboBox1 // + this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox1.FormattingEnabled = true; + this.comboBox1.Items.AddRange(new object[] { + "Default", + "Dangerous Creatures"}); this.comboBox1.Location = new System.Drawing.Point(15, 201); this.comboBox1.Name = "comboBox1"; this.comboBox1.Size = new System.Drawing.Size(269, 21); this.comboBox1.TabIndex = 1; + this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); // // pictureBox2 // this.pictureBox2.BackColor = System.Drawing.Color.Teal; + this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.pictureBox2.Location = new System.Drawing.Point(74, 32); this.pictureBox2.Name = "pictureBox2"; this.pictureBox2.Size = new System.Drawing.Size(152, 112); this.pictureBox2.TabIndex = 2; this.pictureBox2.TabStop = false; // + // applyButton + // + this.applyButton.Location = new System.Drawing.Point(209, 245); + this.applyButton.Name = "applyButton"; + this.applyButton.Size = new System.Drawing.Size(75, 23); + this.applyButton.TabIndex = 3; + this.applyButton.Text = "Apply"; + this.applyButton.UseVisualStyleBackColor = true; + this.applyButton.Click += new System.EventHandler(this.applyButton_Click); + // + // cancelButton + // + this.cancelButton.Location = new System.Drawing.Point(128, 245); + this.cancelButton.Name = "cancelButton"; + this.cancelButton.Size = new System.Drawing.Size(75, 23); + this.cancelButton.TabIndex = 4; + this.cancelButton.Text = "Cancel"; + this.cancelButton.UseVisualStyleBackColor = true; + this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click); + // + // okButton + // + this.okButton.Location = new System.Drawing.Point(47, 245); + this.okButton.Name = "okButton"; + this.okButton.Size = new System.Drawing.Size(75, 23); + this.okButton.TabIndex = 5; + this.okButton.Text = "OK"; + this.okButton.UseVisualStyleBackColor = true; + this.okButton.Click += new System.EventHandler(this.okButton_Click); + // // WinClassicThemePanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.BackColor = System.Drawing.Color.Silver; + this.Controls.Add(this.okButton); + this.Controls.Add(this.cancelButton); + this.Controls.Add(this.applyButton); this.Controls.Add(this.pictureBox2); this.Controls.Add(this.comboBox1); this.Controls.Add(this.pictureBox1); this.Name = "WinClassicThemePanel"; - this.Size = new System.Drawing.Size(301, 314); + this.Size = new System.Drawing.Size(301, 281); + this.Load += new System.EventHandler(this.WinClassicThemePanel_Load); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); this.ResumeLayout(false); @@ -82,5 +125,8 @@ private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.ComboBox comboBox1; private System.Windows.Forms.PictureBox pictureBox2; + private System.Windows.Forms.Button applyButton; + private System.Windows.Forms.Button cancelButton; + private System.Windows.Forms.Button okButton; } } diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicThemePanel.cs b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicThemePanel.cs index 5fc072e..e15bde5 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicThemePanel.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicThemePanel.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; +using TimeHACK.Engine; namespace TimeHACK.OS.Win95.Win95Apps { @@ -15,6 +16,73 @@ namespace TimeHACK.OS.Win95.Win95Apps public WinClassicThemePanel() { InitializeComponent(); + applyButton.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2); + cancelButton.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2); + okButton.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2); + } + + private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) + { + switch ((string)comboBox1.SelectedItem) + { + case "Default": + pictureBox2.BackgroundImage = null; + break; + case "Dangerous Creatures": + pictureBox2.BackgroundImage = Properties.Resources.DCTheme_BG; + break; + } + } + + private void WinClassicThemePanel_Load(object sender, EventArgs e) + { + switch (SaveSystem.CurrentSave.ThemeName) + { + case "default95": + comboBox1.SelectedItem = "Default"; + break; + case "dangeranimals": + comboBox1.SelectedItem = "Dangerous Creatures"; + break; + } + } + + private void cancelButton_Click(object sender, EventArgs e) + { + ParentForm.Close(); + } + + private void applyButton_Click(object sender, EventArgs e) + { + switch ((string)comboBox1.SelectedItem) + { + case "Default": + SaveSystem.currentTheme = new Default95Theme(); + TitleScreen.frm95.BackgroundImage = null; + break; + case "Dangerous Creatures": + SaveSystem.currentTheme = new DangerousCreaturesTheme(); + TitleScreen.frm95.BackgroundImage = Properties.Resources.DCTheme_BG; + break; + } + } + + private void okButton_Click(object sender, EventArgs e) + { + switch ((string)comboBox1.SelectedItem) + { + case "Default": + SaveSystem.currentTheme = new Default95Theme(); + TitleScreen.frm95.BackgroundImage = null; + TitleScreen.frm95.desktopicons.BackgroundImage = null; + break; + case "Dangerous Creatures": + SaveSystem.currentTheme = new DangerousCreaturesTheme(); + TitleScreen.frm95.BackgroundImage = Properties.Resources.DCTheme_BG; + TitleScreen.frm95.desktopicons.BackgroundImage = new Bitmap(Properties.Resources.DCTheme_BG, TitleScreen.frm95.desktopicons.Width, TitleScreen.frm95.desktopicons.Height); + break; + } + ParentForm.Close(); } } } -- cgit v1.2.3 From fa18e32a23d001d75afdc550742eeb89e1608328 Mon Sep 17 00:00:00 2001 From: lempamo Date: Wed, 5 Jul 2017 17:25:36 -0400 Subject: Theme sounds work! --- TimeHACK.Engine/SaveSystem.cs | 13 +++++++++++++ TimeHACK.Engine/Theme.cs | 1 + TimeHACK.Main/OS/Win95/Win95.cs | 7 +++++-- TimeHACK.Main/OS/Win95/Win95Apps/WinClassicThemePanel.cs | 4 ++++ TimeHACK.Main/Program.cs | 2 +- TimeHACK.Main/TitleScreen.cs | 1 + 6 files changed, 25 insertions(+), 3 deletions(-) (limited to 'TimeHACK.Main/OS/Win95/Win95Apps') diff --git a/TimeHACK.Engine/SaveSystem.cs b/TimeHACK.Engine/SaveSystem.cs index 7110995..5ea5831 100644 --- a/TimeHACK.Engine/SaveSystem.cs +++ b/TimeHACK.Engine/SaveSystem.cs @@ -220,6 +220,19 @@ namespace TimeHACK.Engine // CHANGE THE "JSON" TO "B64" ON A FINAL RELEASE! File.WriteAllText(Path.Combine(ProfileDirectory, ProfileFile), json); } + + public static void SetTheme() + { + switch (CurrentSave.ThemeName) + { + case "default95": + currentTheme = new Default95Theme(); + break; + case "dangeranimals": + currentTheme = new DangerousCreaturesTheme(); + break; + } + } } public class Save diff --git a/TimeHACK.Engine/Theme.cs b/TimeHACK.Engine/Theme.cs index cd82fac..804eb88 100644 --- a/TimeHACK.Engine/Theme.cs +++ b/TimeHACK.Engine/Theme.cs @@ -45,6 +45,7 @@ namespace TimeHACK.Engine public DangerousCreaturesTheme() { startSound = Properties.Resources.Win95PlusDangerousCreaturesStart; + stopSound = Properties.Resources.Win95PlusDangerousCreaturesStart; defaultWallpaper = Properties.Resources.Win95PlusDangerousCreaturesWallpaper; themeName = "dangeranimals"; diff --git a/TimeHACK.Main/OS/Win95/Win95.cs b/TimeHACK.Main/OS/Win95/Win95.cs index d83d45e..c6db739 100644 --- a/TimeHACK.Main/OS/Win95/Win95.cs +++ b/TimeHACK.Main/OS/Win95/Win95.cs @@ -47,6 +47,7 @@ namespace TimeHACK.OS.Win95 SettingsToolStripMenuItem.DropDown.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2); FindToolStripMenuItem.DropDown.Paint += (sender, args) => Engine.Paintbrush.PaintClassicBorders(sender, args, 2); SetStyle(ControlStyles.SupportsTransparentBackColor, true); + BackgroundImage = currentTheme.defaultWallpaper; foreach (ToolStripMenuItem item in startmenuitems.Items) { item.MouseEnter += new EventHandler(MenuItem_MouseEnter); @@ -72,6 +73,7 @@ namespace TimeHACK.OS.Win95 // When New Game is clicked in TitleScreen.cs private void Desktop_Load(object sender, EventArgs e) { + if (currentTheme.defaultWallpaper != null) desktopicons.BackgroundImage = new Bitmap(currentTheme.defaultWallpaper, desktopicons.Width, desktopicons.Height); //Start Menu Color - Commented until it works reliably //startmenuitems.Renderer = new MyRenderer(); //ProgramsToolStripMenuItem.DropDown.Renderer = new MyRenderer(); @@ -80,7 +82,7 @@ namespace TimeHACK.OS.Win95 fontLoad(); // Play Windows 95 Start Sound - Stream audio = Properties.Resources.Win95Start; + Stream audio = currentTheme.startSound; startsound = new SoundPlayer(audio); startsound.Play(); @@ -153,7 +155,8 @@ namespace TimeHACK.OS.Win95 // Shutdown button private void ShutdownToolStripMenuItem_Click(object sender, EventArgs e) { - Program.ShutdownApplication(Properties.Resources.tada); + SaveGame(); + Program.ShutdownApplication(currentTheme.stopSound); } #endregion //Region diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicThemePanel.cs b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicThemePanel.cs index e15bde5..984de72 100644 --- a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicThemePanel.cs +++ b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicThemePanel.cs @@ -57,10 +57,12 @@ namespace TimeHACK.OS.Win95.Win95Apps switch ((string)comboBox1.SelectedItem) { case "Default": + SaveSystem.CurrentSave.ThemeName = "default95"; SaveSystem.currentTheme = new Default95Theme(); TitleScreen.frm95.BackgroundImage = null; break; case "Dangerous Creatures": + SaveSystem.CurrentSave.ThemeName = "dangeranimals"; SaveSystem.currentTheme = new DangerousCreaturesTheme(); TitleScreen.frm95.BackgroundImage = Properties.Resources.DCTheme_BG; break; @@ -72,11 +74,13 @@ namespace TimeHACK.OS.Win95.Win95Apps switch ((string)comboBox1.SelectedItem) { case "Default": + SaveSystem.CurrentSave.ThemeName = "default95"; SaveSystem.currentTheme = new Default95Theme(); TitleScreen.frm95.BackgroundImage = null; TitleScreen.frm95.desktopicons.BackgroundImage = null; break; case "Dangerous Creatures": + SaveSystem.CurrentSave.ThemeName = "dangeranimals"; SaveSystem.currentTheme = new DangerousCreaturesTheme(); TitleScreen.frm95.BackgroundImage = Properties.Resources.DCTheme_BG; TitleScreen.frm95.desktopicons.BackgroundImage = new Bitmap(Properties.Resources.DCTheme_BG, TitleScreen.frm95.desktopicons.Width, TitleScreen.frm95.desktopicons.Height); diff --git a/TimeHACK.Main/Program.cs b/TimeHACK.Main/Program.cs index 5cc011a..e2a4be6 100644 --- a/TimeHACK.Main/Program.cs +++ b/TimeHACK.Main/Program.cs @@ -82,7 +82,7 @@ namespace TimeHACK } } - public static void ShutdownApplication(System.IO.UnmanagedMemoryStream audio) + public static void ShutdownApplication(System.IO.Stream audio) { System.Threading.Thread.Sleep(500); System.IO.Stream audioPlay = audio; diff --git a/TimeHACK.Main/TitleScreen.cs b/TimeHACK.Main/TitleScreen.cs index 6d11dc6..1b7d006 100644 --- a/TimeHACK.Main/TitleScreen.cs +++ b/TimeHACK.Main/TitleScreen.cs @@ -276,6 +276,7 @@ namespace TimeHACK if (loadGameBox.successful == true) { LoadSave(); + SetTheme(); StartGame(); } } -- cgit v1.2.3