From 077fef3baf82e23a4a03bb3c73d83f8d8103fdb9 Mon Sep 17 00:00:00 2001 From: lempamo Date: Sun, 30 Jul 2017 00:10:22 -0400 Subject: better infoboxes --- TimeHACK.Engine/Properties/Resources.Designer.cs | 55 ++++++++++++++++ TimeHACK.Engine/Properties/Resources.resx | 18 +++++ .../Win95PlusDangerousCreaturesAsterisk.wav | Bin 0 -> 13782 bytes .../Win95PlusDangerousCreaturesCritStop.wav | Bin 0 -> 10732 bytes .../Win95PlusDangerousCreaturesExclamation.wav | Bin 0 -> 9298 bytes .../Win95PlusDangerousCreaturesProgError.wav | Bin 0 -> 18914 bytes .../Win95PlusDangerousCreaturesQuestion.wav | Bin 0 -> 15010 bytes .../Resources/WinClassic/Window/Win95Question.png | Bin 0 -> 430 bytes TimeHACK.Engine/SaveSystem.cs | 1 + TimeHACK.Engine/Template/Infobox95.Designer.cs | 73 +++++++++++++++------ TimeHACK.Engine/Template/Infobox95.cs | 66 ++++++++++++++++++- TimeHACK.Engine/Theme.cs | 13 +++- TimeHACK.Engine/TimeHACK.Engine.csproj | 6 ++ TimeHACK.Engine/WindowManager.cs | 8 +-- 14 files changed, 211 insertions(+), 29 deletions(-) create mode 100644 TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesAsterisk.wav create mode 100644 TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesCritStop.wav create mode 100644 TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesExclamation.wav create mode 100644 TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesProgError.wav create mode 100644 TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesQuestion.wav create mode 100644 TimeHACK.Engine/Resources/WinClassic/Window/Win95Question.png (limited to 'TimeHACK.Engine') diff --git a/TimeHACK.Engine/Properties/Resources.Designer.cs b/TimeHACK.Engine/Properties/Resources.Designer.cs index 9c17510..b2fabb2 100644 --- a/TimeHACK.Engine/Properties/Resources.Designer.cs +++ b/TimeHACK.Engine/Properties/Resources.Designer.cs @@ -199,6 +199,51 @@ namespace TimeHACK.Engine.Properties { } } + /// + /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. + /// + public static System.IO.UnmanagedMemoryStream Win95PlusDangerousCreaturesAsterisk { + get { + return ResourceManager.GetStream("Win95PlusDangerousCreaturesAsterisk", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. + /// + public static System.IO.UnmanagedMemoryStream Win95PlusDangerousCreaturesCritStop { + get { + return ResourceManager.GetStream("Win95PlusDangerousCreaturesCritStop", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. + /// + public static System.IO.UnmanagedMemoryStream Win95PlusDangerousCreaturesExclamation { + get { + return ResourceManager.GetStream("Win95PlusDangerousCreaturesExclamation", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. + /// + public static System.IO.UnmanagedMemoryStream Win95PlusDangerousCreaturesProgError { + get { + return ResourceManager.GetStream("Win95PlusDangerousCreaturesProgError", resourceCulture); + } + } + + /// + /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. + /// + public static System.IO.UnmanagedMemoryStream Win95PlusDangerousCreaturesQuestion { + get { + return ResourceManager.GetStream("Win95PlusDangerousCreaturesQuestion", resourceCulture); + } + } + /// /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. /// @@ -246,6 +291,16 @@ namespace TimeHACK.Engine.Properties { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap Win95Question { + get { + object obj = ResourceManager.GetObject("Win95Question", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.IO.UnmanagedMemoryStream similar to System.IO.MemoryStream. /// diff --git a/TimeHACK.Engine/Properties/Resources.resx b/TimeHACK.Engine/Properties/Resources.resx index 08e94f6..a17e929 100644 --- a/TimeHACK.Engine/Properties/Resources.resx +++ b/TimeHACK.Engine/Properties/Resources.resx @@ -208,4 +208,22 @@ ..\Resources\Win95PlusInsideComputerWallpaper.jpg;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\Win95PlusDangerousCreaturesAsterisk.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Win95PlusDangerousCreaturesCritStop.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Win95PlusDangerousCreaturesExclamation.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Win95PlusDangerousCreaturesProgError.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Win95PlusDangerousCreaturesQuestion.wav;System.IO.MemoryStream, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\WinClassic\Window\Win95Question.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesAsterisk.wav b/TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesAsterisk.wav new file mode 100644 index 0000000..2855ad5 Binary files /dev/null and b/TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesAsterisk.wav differ diff --git a/TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesCritStop.wav b/TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesCritStop.wav new file mode 100644 index 0000000..e436d74 Binary files /dev/null and b/TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesCritStop.wav differ diff --git a/TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesExclamation.wav b/TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesExclamation.wav new file mode 100644 index 0000000..bd72c1a Binary files /dev/null and b/TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesExclamation.wav differ diff --git a/TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesProgError.wav b/TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesProgError.wav new file mode 100644 index 0000000..eea2006 Binary files /dev/null and b/TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesProgError.wav differ diff --git a/TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesQuestion.wav b/TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesQuestion.wav new file mode 100644 index 0000000..18d5fbb Binary files /dev/null and b/TimeHACK.Engine/Resources/Win95PlusDangerousCreaturesQuestion.wav differ diff --git a/TimeHACK.Engine/Resources/WinClassic/Window/Win95Question.png b/TimeHACK.Engine/Resources/WinClassic/Window/Win95Question.png new file mode 100644 index 0000000..b8ff406 Binary files /dev/null and b/TimeHACK.Engine/Resources/WinClassic/Window/Win95Question.png differ diff --git a/TimeHACK.Engine/SaveSystem.cs b/TimeHACK.Engine/SaveSystem.cs index f08e637..21a301a 100644 --- a/TimeHACK.Engine/SaveSystem.cs +++ b/TimeHACK.Engine/SaveSystem.cs @@ -153,6 +153,7 @@ namespace TimeHACK.Engine public static void CheckFiles() { Directory.CreateDirectory(GameDirectory); + Directory.CreateDirectory(DataDirectory); Directory.CreateDirectory(AllProfilesDirectory); Directory.CreateDirectory(ProfileDirectory); Directory.CreateDirectory(ProfileFileSystemDirectory); diff --git a/TimeHACK.Engine/Template/Infobox95.Designer.cs b/TimeHACK.Engine/Template/Infobox95.Designer.cs index 5c88e92..3c05dbd 100644 --- a/TimeHACK.Engine/Template/Infobox95.Designer.cs +++ b/TimeHACK.Engine/Template/Infobox95.Designer.cs @@ -29,10 +29,12 @@ private void InitializeComponent() { this.programContent = new System.Windows.Forms.Panel(); + this.button1 = new System.Windows.Forms.Button(); + this.button3 = new System.Windows.Forms.Button(); this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.panel1 = new System.Windows.Forms.Panel(); this.infoText = new System.Windows.Forms.Label(); - this.ok = new System.Windows.Forms.Button(); + this.button2 = new System.Windows.Forms.Button(); this.programContent.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); this.panel1.SuspendLayout(); @@ -41,22 +43,51 @@ // programContent // this.programContent.BackColor = System.Drawing.Color.Silver; + this.programContent.Controls.Add(this.button1); + this.programContent.Controls.Add(this.button3); this.programContent.Controls.Add(this.pictureBox1); this.programContent.Controls.Add(this.panel1); - this.programContent.Controls.Add(this.ok); + this.programContent.Controls.Add(this.button2); this.programContent.Dock = System.Windows.Forms.DockStyle.Fill; this.programContent.Location = new System.Drawing.Point(0, 0); this.programContent.Name = "programContent"; - this.programContent.Size = new System.Drawing.Size(421, 164); + this.programContent.Size = new System.Drawing.Size(413, 138); this.programContent.TabIndex = 10; this.programContent.Tag = "gnoreFormOnTaskbar"; // + // button1 + // + this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.button1.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button1.Location = new System.Drawing.Point(150, 104); + this.button1.Name = "button1"; + this.button1.Size = new System.Drawing.Size(80, 23); + this.button1.TabIndex = 5; + this.button1.Text = "Yes"; + this.button1.UseVisualStyleBackColor = true; + // + // button3 + // + this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button3.Location = new System.Drawing.Point(323, 104); + this.button3.Name = "button3"; + this.button3.Size = new System.Drawing.Size(80, 23); + this.button3.TabIndex = 4; + this.button3.Text = "Cancel"; + this.button3.UseVisualStyleBackColor = true; + this.button3.Click += new System.EventHandler(this.button3_Click); + // // pictureBox1 // this.pictureBox1.ErrorImage = null; this.pictureBox1.Image = global::TimeHACK.Engine.Properties.Resources.Win95Warning; this.pictureBox1.InitialImage = null; - this.pictureBox1.Location = new System.Drawing.Point(8, 33); + this.pictureBox1.Location = new System.Drawing.Point(15, 16); this.pictureBox1.Name = "pictureBox1"; this.pictureBox1.Size = new System.Drawing.Size(32, 32); this.pictureBox1.TabIndex = 3; @@ -65,34 +96,33 @@ // panel1 // this.panel1.Controls.Add(this.infoText); - this.panel1.Location = new System.Drawing.Point(57, 33); + this.panel1.Location = new System.Drawing.Point(62, 16); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(337, 96); + this.panel1.Size = new System.Drawing.Size(341, 82); this.panel1.TabIndex = 2; // // infoText // - this.infoText.AutoSize = true; this.infoText.Dock = System.Windows.Forms.DockStyle.Fill; this.infoText.Location = new System.Drawing.Point(0, 0); this.infoText.Name = "infoText"; - this.infoText.Size = new System.Drawing.Size(35, 13); + this.infoText.Size = new System.Drawing.Size(341, 82); this.infoText.TabIndex = 0; this.infoText.Text = "label1"; // - // ok + // button2 // - this.ok.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.ok.FlatStyle = System.Windows.Forms.FlatStyle.Popup; - this.ok.Location = new System.Drawing.Point(169, 135); - this.ok.Name = "ok"; - this.ok.Size = new System.Drawing.Size(83, 23); - this.ok.TabIndex = 1; - this.ok.Text = "OK"; - this.ok.UseVisualStyleBackColor = true; - this.ok.Click += new System.EventHandler(this.ok_Click); + this.button2.FlatStyle = System.Windows.Forms.FlatStyle.Popup; + this.button2.Location = new System.Drawing.Point(236, 104); + this.button2.Name = "button2"; + this.button2.Size = new System.Drawing.Size(80, 23); + this.button2.TabIndex = 1; + this.button2.Text = "No"; + this.button2.UseVisualStyleBackColor = true; + this.button2.Click += new System.EventHandler(this.button2_Click); // // Infobox95 // @@ -100,11 +130,10 @@ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.programContent); this.Name = "Infobox95"; - this.Size = new System.Drawing.Size(421, 164); + this.Size = new System.Drawing.Size(413, 138); this.programContent.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); this.ResumeLayout(false); } @@ -115,6 +144,8 @@ private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.Panel panel1; public System.Windows.Forms.Label infoText; - private System.Windows.Forms.Button ok; + private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button button3; + private System.Windows.Forms.Button button1; } } \ No newline at end of file diff --git a/TimeHACK.Engine/Template/Infobox95.cs b/TimeHACK.Engine/Template/Infobox95.cs index e764e47..ea257b2 100644 --- a/TimeHACK.Engine/Template/Infobox95.cs +++ b/TimeHACK.Engine/Template/Infobox95.cs @@ -1,5 +1,6 @@ using System; using System.Drawing; +using System.Media; using System.Runtime.InteropServices; using System.Windows.Forms; @@ -7,14 +8,75 @@ namespace TimeHACK.Engine.Template { public partial class Infobox95 : UserControl { - public Infobox95() + int btnStatus = 0; + + public Infobox95(InfoboxType type, InfoboxButtons btns) { InitializeComponent(); + button1.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2); + button2.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2); + button3.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2); + + switch (type) + { + case InfoboxType.Info: + pictureBox1.Image = Properties.Resources.Win95Info; + SoundPlayer spa = new SoundPlayer(SaveSystem.currentTheme.asteriskSound); + spa.Play(); + break; + case InfoboxType.Question: + pictureBox1.Image = Properties.Resources.Win95Question; + SoundPlayer spq = new SoundPlayer(SaveSystem.currentTheme.questionSound); + spq.Play(); + break; + case InfoboxType.Warning: + pictureBox1.Image = Properties.Resources.Win95Warning; + SoundPlayer spw = new SoundPlayer(SaveSystem.currentTheme.exclamationSound); + spw.Play(); + break; + case InfoboxType.Error: + pictureBox1.Image = Properties.Resources.Win95Error; + SoundPlayer spe = new SoundPlayer(SaveSystem.currentTheme.critStopSound); + spe.Play(); + break; + } + + btnStatus = (int)btns; + switch (btns) + { + case InfoboxButtons.OK: + button1.Hide(); + button2.Hide(); + button3.Text = "OK"; + break; + } } - private void ok_Click(object sender, EventArgs e) + private void button2_Click(object sender, EventArgs e) { this.ParentForm.Close(); } + + private void button3_Click(object sender, EventArgs e) + { + if (btnStatus == 0) this.ParentForm.Close(); + } + } + + public enum InfoboxType + { + Info, + Question, + Warning, + Error + } + + public enum InfoboxButtons + { + OK, + OKCancel, + YesNo, + YesNoCancel, + AbortRetryFail } } diff --git a/TimeHACK.Engine/Theme.cs b/TimeHACK.Engine/Theme.cs index 2b22072..8e75756 100644 --- a/TimeHACK.Engine/Theme.cs +++ b/TimeHACK.Engine/Theme.cs @@ -15,6 +15,7 @@ namespace TimeHACK.Engine public Stream asteriskSound { get; set; } public Stream critStopSound { get; set; } + public Stream exclamationSound { get; set; } public Stream progErrorSound { get; set; } public Stream questionSound { get; set; } @@ -32,6 +33,7 @@ namespace TimeHACK.Engine asteriskSound = Properties.Resources.CHORD; critStopSound = Properties.Resources.CHORD; + exclamationSound = Properties.Resources.CHORD; progErrorSound = Properties.Resources.CHORD; questionSound = Properties.Resources.CHORD; @@ -44,11 +46,12 @@ namespace TimeHACK.Engine { public Default98Theme() { - startSound = Properties.Resources.Win95Start; - stopSound = Properties.Resources.Win95Stop; + startSound = Properties.Resources.Win98Start; + stopSound = Properties.Resources.Win98Stop; asteriskSound = Properties.Resources.CHORD; critStopSound = Properties.Resources.CHORD; + exclamationSound = Properties.Resources.CHORD; progErrorSound = Properties.Resources.CHORD; questionSound = Properties.Resources.CHORD; @@ -64,6 +67,12 @@ namespace TimeHACK.Engine startSound = Properties.Resources.Win95PlusDangerousCreaturesStart; stopSound = Properties.Resources.Win95PlusDangerousCreaturesStart; + asteriskSound = Properties.Resources.Win95PlusDangerousCreaturesAsterisk; + critStopSound = Properties.Resources.Win95PlusDangerousCreaturesCritStop; + exclamationSound = Properties.Resources.Win95PlusDangerousCreaturesExclamation; + progErrorSound = Properties.Resources.Win95PlusDangerousCreaturesProgError; + questionSound = Properties.Resources.Win95PlusDangerousCreaturesQuestion; + defaultWallpaper = Properties.Resources.Win95PlusDangerousCreaturesWallpaper; themeName = "dangeranimals"; } diff --git a/TimeHACK.Engine/TimeHACK.Engine.csproj b/TimeHACK.Engine/TimeHACK.Engine.csproj index dd6342c..a176c81 100644 --- a/TimeHACK.Engine/TimeHACK.Engine.csproj +++ b/TimeHACK.Engine/TimeHACK.Engine.csproj @@ -118,6 +118,11 @@ + + + + + @@ -130,6 +135,7 @@ + diff --git a/TimeHACK.Engine/WindowManager.cs b/TimeHACK.Engine/WindowManager.cs index 156da2f..4aa82d7 100644 --- a/TimeHACK.Engine/WindowManager.cs +++ b/TimeHACK.Engine/WindowManager.cs @@ -72,13 +72,13 @@ namespace TimeHACK.Engine return app; } - public WinClassic StartInfobox95(string title, string text, Image erroricon) + public WinClassic StartInfobox95(string title, string text, InfoboxType type, InfoboxButtons btns) { - Infobox95 app = new Infobox95(); + pfc.AddFontFile(SaveSystem.GameDirectory + "\\Data\\LeviWindows.ttf"); + Infobox95 app = new Infobox95(type, btns); app.infoText.Text = text; + app.infoText.Font = new Font(pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((0))); - SoundPlayer sp = new SoundPlayer(Properties.Resources.CHORD); - sp.Play(); return StartWin95(app, title, null, false, false); } -- cgit v1.2.3