diff --git a/3/3.cs b/3/3.cs index 0bd3cec..f7724eb 100644 --- a/3/3.cs +++ b/3/3.cs @@ -101,11 +101,17 @@ namespace LaptopSimulator2015.Levels Rect tr = new Rect(targ, new Vector2(power, power), true); for (int i = 0; i < targets.Count; i++) { - if (targets[i].distanceToRectSquared(tr) <= 400) + if (targets[i].distanceToRectSquared(tr) <= 676) targetsToRemove.Add(targets[i]); } - targets = targets.Except(targetsToRemove.Distinct()).Distinct().ToList(); + targets = targets.Except(targetsToRemove.Distinct()).Distinct().ToList(); g.DrawRectangle(tr, Color.White); + + g.DrawSizedString("TL", 10, tr.topLeftPoint.toPointF(), Brushes.Yellow); + g.DrawSizedString("TR", 10, tr.topRightPoint.toPointF(), Brushes.Yellow); + g.DrawSizedString("BL", 10, tr.bottomLeftPoint.toPointF(), Brushes.Yellow); + g.DrawSizedString("BR", 10, tr.bottomRightPoint.toPointF(), Brushes.Yellow); + g.DrawSizedString("CT", 10, tr.Location.toPointF(), Brushes.Blue); power = 10; } targ = new Vector2(center); @@ -153,14 +159,11 @@ namespace LaptopSimulator2015.Levels g.DrawLine(center, cannon, Color.Green, 5); for (int i = 0; i < targets.Count; i++) { - g.DrawRectangle(new Rect(targets[i], new Vector2(20, 20), true), Color.AliceBlue); - - g.g.DrawEllipse(new Pen(new SolidBrush(Color.Red), 6), new RectangleF(Misc.d2f(targets[i].X - 10), Misc.d2f(minigamePanel.Height - 10 - targets[i].Y), 20, 20)); - g.g.DrawEllipse(new Pen(new SolidBrush(Color.White), 6), new RectangleF(Misc.d2f(targets[i].X - 7), Misc.d2f(minigamePanel.Height - 7 - targets[i].Y), 14, 14)); - g.g.FillEllipse(new SolidBrush(Color.Red), new RectangleF(Misc.d2f(targets[i].X - 3), Misc.d2f(minigamePanel.Height - 3 - targets[i].Y), 6, 6)); - - g.DrawLine(new Vector2(targets[i].X - 13, targets[i].Y + 15), new Vector2(targets[i].X + 13, targets[i].Y + 15), Color.Gray, 3); - g.DrawLine(new Vector2(targets[i].X - 13, targets[i].Y + 15), new Vector2(targets[i].X + ((((double)targets[i].Tag) * 0.2) - 12.9) + 0.1, targets[i].Y + 15), Color.Red, 3); + g.DrawEllipse(new Rect(targets[i], new Vector2(26, 26), true), Color.Red); + g.DrawEllipse(new Rect(targets[i], new Vector2(13, 13), true), Color.White, false, 4.333f); + Vector2 mp = new Vector2(targets[i].X + ((((double)targets[i].Tag) * 0.2) - 12.9) + 0.1, targets[i].Y + 15); + g.DrawLine(mp, new Vector2(targets[i].X + 13, targets[i].Y + 15), Color.Gray, 3); + g.DrawLine(new Vector2(targets[i].X - 13, targets[i].Y + 15), mp, Color.Red, 3); } if (firing) { diff --git a/4/4.cs b/4/4.cs index 84865ec..7b818b4 100644 --- a/4/4.cs +++ b/4/4.cs @@ -188,9 +188,12 @@ namespace LaptopSimulator2015.Levels g.DrawRectangle(new Rect(player, new Vector2(10, 10), true), Color.Green); if (lazorTime >= 0 && lazorTime <= 80) { - g.DrawRectangle(new RectangleF((float)lazor, minigamePanel.Height / 2, 2, minigamePanel.Height), Color.DarkGray); float m = (float)Misc.map(0, 80, 0, minigamePanel.Height, lazorTime); - g.DrawRectangle(new RectangleF((float)lazor, minigamePanel.Height - m / 2, 2, m), Color.Red); + Vector2 mp = new Vector2(lazor, m); + g.DrawLine(mp, new Vector2(lazor, 0), Color.DarkGray, 2); + g.DrawLine(new Vector2(lazor, minigamePanel.Height), mp, Color.Red, 2); + //g.DrawRectangle(new RectangleF((float)lazor, minigamePanel.Height / 2, 2, minigamePanel.Height), Color.DarkGray); + //g.DrawRectangle(new RectangleF((float)lazor, minigamePanel.Height - m / 2, 2, m), Color.Red); } for (int i = 0; i < platforms.Count; i++) g.DrawRectangle(new Rect(platforms[i], new Vector2(100, 10), true), Color.White); diff --git a/Base/Drawing.cs b/Base/Drawing.cs index 5dd50be..de145e4 100644 --- a/Base/Drawing.cs +++ b/Base/Drawing.cs @@ -77,7 +77,7 @@ namespace Base /// Whether the rectangle should be drawn centered rather than down-left /// Whether the rectangle should be filled /// The size of the lines used when not filling - public void DrawRectangle(RectangleF rectangle, Color color, bool centered = true, bool transform = true, bool filled = true, int unfilledLineSize = 1) + public void DrawRectangle(RectangleF rectangle, Color color, bool centered = true, bool transform = true, bool filled = true, float unfilledLineSize = 1) { RectangleF r = rectangle; if (transform) @@ -100,7 +100,40 @@ namespace Base /// The color of the rectangle /// Whether the rectangle should be filled /// The size of the lines used when not filling - public void DrawRectangle(Rect rectangle, Color color, bool filled = true, int unfilledLineSize = 1) => DrawRectangle(rectangle.toRectangleF(), color, false, true, filled, unfilledLineSize); + public void DrawRectangle(Rect rectangle, Color color, bool filled = true, float unfilledLineSize = 1) => DrawRectangle(rectangle.toRectangleF(), color, false, true, filled, unfilledLineSize); + + /// + /// Draws an ellipse + /// + /// Use the PointF/SizeF Constructor as it is much more logical + /// The color of the ellipse + /// Whether the ellipse should be drawn centered rather than down-left + /// Whether the ellipse should be filled + /// The size of the lines used when not filling + public void DrawEllipse(RectangleF rectangle, Color color, bool centered = true, bool transform = true, bool filled = true, float unfilledLineSize = 1) + { + RectangleF r = rectangle; + if (transform) + r = w2s(r); + Brush b = new SolidBrush(color); + if (centered) + { + r = new RectangleF(new PointF(r.X - r.Width / 2, r.Y - r.Height / 2), r.Size); + } + if (filled) + g.FillEllipse(b, r); + else + g.DrawEllipse(new Pen(b, unfilledLineSize), new Rectangle(Misc.f2i(r.X), Misc.f2i(r.Y), Misc.f2i(r.Width), Misc.f2i(r.Height))); + } + + /// + /// Draws a ellipse + /// + /// The rectangle to draw the ellipse in + /// The color of the ellipse + /// Whether the ellipse should be filled + /// The size of the lines used when not filling + public void DrawEllipse(Rect rectangle, Color color, bool filled = true, float unfilledLineSize = 1) => DrawEllipse(rectangle.toRectangleF(), color, false, true, filled, unfilledLineSize); /// /// Draw a line connecting the vectors diff --git a/Base/Rect.cs b/Base/Rect.cs index 0ccb3cd..81a963b 100644 --- a/Base/Rect.cs +++ b/Base/Rect.cs @@ -3,12 +3,8 @@ using System.Drawing; namespace Base { - public class Rect + public struct Rect { - public Vector2 Location; - public Vector2 Size; - bool centered; - /// /// Create a rect from the provided data /// @@ -27,14 +23,14 @@ namespace Base /// Whether the Rect should be created top-right or around the Location public Rect(double X, double Y, double Width, double Height, bool centered = false) { - Location = new Vector2(X, Y); - Size = new Vector2(Width, Height); - this.centered = centered; - if (this.centered) + this.X = X; + this.Y = Y; + this.Width = Width; + this.Height = Height; + if (centered) { - //Location -= Size / 2; - Location.X -= Size.X / 2; - Location.Y += Size.Y / 2; + this.X -= Width / 2; + this.Y += Height / 2; } } @@ -44,71 +40,36 @@ namespace Base /// public Rect(Rect rect) { - Location = rect.Location; - Size = rect.Size; - centered = rect.centered; + X = rect.X; + Y = rect.Y; + Width = rect.Width; + Height = rect.Height; } /// /// Copies the Rect's data /// /// - public Rect(Rectangle rect) : this(rect.X, rect.Y, rect.Width, rect.Height, false) { } + public Rect(Rectangle rect, bool transform = false) : this(rect.X, rect.Y, rect.Width, rect.Height, false) { } /// /// Copies the Rect's data /// /// - public Rect(RectangleF rect) : this(rect.X, rect.Y, rect.Width, rect.Height, false) { } + public Rect(RectangleF rect, bool transform = false) : this(rect.X, rect.Y, rect.Width, rect.Height, false) { } - public double X - { - get => Location.X; - set => Location.X = value; - } - - public double Y - { - get => Location.Y; - set => Location.Y = value; - } - - public double Width - { - get => Size.X; - set { - if (centered) - { - double tmp = Size.X - value; - Size.X = value; - Location.X += tmp / 2; - } - else - Size.X = value; - } - } - - public double Height - { - get => Size.Y; - set { - if (centered) - { - double tmp = Size.Y - value; - Size.Y = value; - Location.Y += tmp / 2; - } - else - Size.Y = value; - } - } - - public double Bottom => Location.Y; - public double Top => Location.Y + Size.Y; - public double Left => Location.X; - public double Right => Location.X + Size.X; - public Vector2 bottomLeftPoint => new Vector2(Location); - public Vector2 bottomRightPoint => new Vector2(Location.X, Location.Y + Size.Y); - public Vector2 topLeftPoint => new Vector2(Location.X + Size.X, Location.Y); - public Vector2 topRightPoint => Location + Size; + public double X; + public double Y; + public double Width; + public double Height; + public Vector2 Location => new Vector2(X, Y); + public Vector2 Size => new Vector2(Width, Height); + public double Bottom => Y; + public double Top => Y + Height; + public double Left => X; + public double Right => X + Width; + public Vector2 bottomLeftPoint => new Vector2(Left, Bottom); + public Vector2 topLeftPoint => new Vector2(Left, Top); + public Vector2 bottomRightPoint => new Vector2(Right, Bottom); + public Vector2 topRightPoint => new Vector2(Right, Top); public bool doOverlap(Rect other) => (Left <= other.Right && other.Left <= Right) || (Left >= other.Right && other.Left >= Right); public Rectangle toRectangle() => new Rectangle(Misc.d2i(X), Misc.d2i(Y), Misc.d2i(Width), Misc.d2i(Height)); public RectangleF toRectangleF() => new RectangleF(Misc.d2f(X), Misc.d2f(Y), Misc.d2f(Width), Misc.d2f(Height)); diff --git a/LaptopSimulator2015/FakeDesktop.Designer.cs b/LaptopSimulator2015/FakeDesktop.Designer.cs index 16c84ba..1ea1c04 100644 --- a/LaptopSimulator2015/FakeDesktop.Designer.cs +++ b/LaptopSimulator2015/FakeDesktop.Designer.cs @@ -97,6 +97,8 @@ namespace LaptopSimulator2015 this.devWindowHeaderExit = new System.Windows.Forms.Label(); this.devWindowIcon = new System.Windows.Forms.Panel(); this.devWindowTitle = new System.Windows.Forms.Label(); + this.optionsWindowQualityLabel = new System.Windows.Forms.Label(); + this.optionsWindowQualityBox = new System.Windows.Forms.ComboBox(); this.winMenuPanel.SuspendLayout(); this.winTaskbar.SuspendLayout(); this.winDesktop.SuspendLayout(); @@ -327,10 +329,10 @@ namespace LaptopSimulator2015 this.levelWindow2.Controls.Add(this.captchaBox); this.levelWindow2.Controls.Add(this.captchaPanel); this.levelWindow2.Controls.Add(this.levelWindowText2); - this.levelWindow2.Location = new System.Drawing.Point(4, 25); + this.levelWindow2.Location = new System.Drawing.Point(4, 14); this.levelWindow2.Name = "levelWindow2"; this.levelWindow2.Padding = new System.Windows.Forms.Padding(3); - this.levelWindow2.Size = new System.Drawing.Size(494, 219); + this.levelWindow2.Size = new System.Drawing.Size(494, 230); this.levelWindow2.TabIndex = 1; this.levelWindow2.UseVisualStyleBackColor = true; // @@ -368,9 +370,9 @@ namespace LaptopSimulator2015 // this.levelWindow3.Controls.Add(this.levelWindowProgress); this.levelWindow3.Controls.Add(this.levelWindowText3); - this.levelWindow3.Location = new System.Drawing.Point(4, 25); + this.levelWindow3.Location = new System.Drawing.Point(4, 14); this.levelWindow3.Name = "levelWindow3"; - this.levelWindow3.Size = new System.Drawing.Size(494, 219); + this.levelWindow3.Size = new System.Drawing.Size(494, 230); this.levelWindow3.TabIndex = 2; this.levelWindow3.UseVisualStyleBackColor = true; // @@ -486,6 +488,8 @@ namespace LaptopSimulator2015 // optionsWindow // this.optionsWindow.BackColor = System.Drawing.SystemColors.Window; + this.optionsWindow.Controls.Add(this.optionsWindowQualityBox); + this.optionsWindow.Controls.Add(this.optionsWindowQualityLabel); this.optionsWindow.Controls.Add(this.optionsWindowCredit); this.optionsWindow.Controls.Add(this.devWindowOpen); this.optionsWindow.Controls.Add(this.optionsWindowReset); @@ -597,7 +601,7 @@ namespace LaptopSimulator2015 // this.optionsWindowWam.Location = new System.Drawing.Point(108, 26); this.optionsWindowWam.Name = "optionsWindowWam"; - this.optionsWindowWam.Size = new System.Drawing.Size(380, 45); + this.optionsWindowWam.Size = new System.Drawing.Size(271, 45); this.optionsWindowWam.TabIndex = 1; this.optionsWindowWam.TabStop = false; this.optionsWindowWam.Scroll += new System.EventHandler(this.OptionsWindowWam_Scroll); @@ -792,6 +796,30 @@ namespace LaptopSimulator2015 this.devWindowTitle.MouseMove += new System.Windows.Forms.MouseEventHandler(this.DevWindowHeader_MouseMove); this.devWindowTitle.MouseUp += new System.Windows.Forms.MouseEventHandler(this.DevWindowHeader_MouseUp); // + // optionsWindowQualityLabel + // + this.optionsWindowQualityLabel.AutoSize = true; + this.optionsWindowQualityLabel.Location = new System.Drawing.Point(385, 23); + this.optionsWindowQualityLabel.Name = "optionsWindowQualityLabel"; + this.optionsWindowQualityLabel.Size = new System.Drawing.Size(42, 13); + this.optionsWindowQualityLabel.TabIndex = 10; + this.optionsWindowQualityLabel.Text = "Quality:"; + // + // optionsWindowQualityBox + // + this.optionsWindowQualityBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.optionsWindowQualityBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.optionsWindowQualityBox.FormattingEnabled = true; + this.optionsWindowQualityBox.Items.AddRange(new object[] { + "Sh*t", + "Default", + "Good"}); + this.optionsWindowQualityBox.Location = new System.Drawing.Point(385, 36); + this.optionsWindowQualityBox.Name = "optionsWindowQualityBox"; + this.optionsWindowQualityBox.Size = new System.Drawing.Size(103, 21); + this.optionsWindowQualityBox.TabIndex = 11; + this.optionsWindowQualityBox.TabStop = false; + // // FakeDesktop // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -905,5 +933,7 @@ namespace LaptopSimulator2015 private System.Windows.Forms.Button devWindowSkip; private System.Windows.Forms.Button optionsWindowCredit; private System.Windows.Forms.Button devWindowOverlay; + private System.Windows.Forms.Label optionsWindowQualityLabel; + private System.Windows.Forms.ComboBox optionsWindowQualityBox; } } \ No newline at end of file diff --git a/LaptopSimulator2015/FakeDesktop.cs b/LaptopSimulator2015/FakeDesktop.cs index 9351eaf..d3e37ec 100644 --- a/LaptopSimulator2015/FakeDesktop.cs +++ b/LaptopSimulator2015/FakeDesktop.cs @@ -47,6 +47,12 @@ namespace LaptopSimulator2015 optionsWindowWamLabel.Text = strings.optionsWindowWam; optionsWindowReset.Text = strings.optionsWindowReset; optionsWindowSubs.Text = strings.optionsWindowSubs; + optionsWindowQualityBox.Items[0] = strings.optionsWindowQuality1; + optionsWindowQualityBox.Items[1] = strings.optionsWindowQuality2; + optionsWindowQualityBox.Items[2] = strings.optionsWindowQuality3; + Text = strings.fakeDesktopTitle; + winMenuStart.Text = strings.start; + winMenuText.Text = strings.winMenuText; levelWindow.Visible = false; minigamePanel.Visible = false; optionsWindow.Visible = false; @@ -90,10 +96,7 @@ namespace LaptopSimulator2015 tmpoptionslsdcanchange = Settings.lsd; optionsWindowLSD.Checked = Settings.lsd; optionsWindowSubs.Checked = Settings.subs; - Text = strings.fakeDesktopTitle; - winMenuExit.Text = strings.exit; - winMenuStart.Text = strings.start; - winMenuText.Text = strings.winMenuText; + optionsWindowQualityBox.SelectedIndex = Settings.quality; levelWindowTitle.Text = ""; winTimeLabel.Text = DateTime.Now.ToString("hh:mm:ss", Settings.lang); fans = new SoundPlayer(Resources.fans); @@ -538,6 +541,7 @@ namespace LaptopSimulator2015 Settings.wam = optionsWindowWam.Value; Settings.lsd = optionsWindowLSD.Checked; Settings.subs = optionsWindowSubs.Checked; + Settings.quality = optionsWindowQualityBox.SelectedIndex; int NewVolume = ((ushort.MaxValue / 10) * Settings.wam); uint NewVolumeAllChannels = ((uint)NewVolume & 0x0000ffff) | ((uint)NewVolume << 16); waveOutSetVolume(IntPtr.Zero, NewVolumeAllChannels); diff --git a/LaptopSimulator2015/Settings.cs b/LaptopSimulator2015/Settings.cs index a7e06bd..4a618b5 100644 --- a/LaptopSimulator2015/Settings.cs +++ b/LaptopSimulator2015/Settings.cs @@ -13,6 +13,7 @@ namespace LaptopSimulator2015 { xmldoc_temp.Add(new XElement("lsd", lsd)); xmldoc_temp.Add(new XElement("subs", subs)); xmldoc_temp.Add(new XElement("level", level)); + xmldoc_temp.Add(new XElement("quality", quality)); xmldoc_temp.Add(new XElement("lang", lang)); xmldoc_temp.Save(_xmlfile); } @@ -25,6 +26,7 @@ namespace LaptopSimulator2015 { xmldoc_temp.Add(new XElement("lsd", false)); xmldoc_temp.Add(new XElement("subs", true)); xmldoc_temp.Add(new XElement("level", -1)); + xmldoc_temp.Add(new XElement("quality", 1)); xmldoc_temp.Add(new XElement("lang", CultureInfo.CurrentCulture)); xmldoc_temp.Save(_xmlfile); } @@ -33,12 +35,14 @@ namespace LaptopSimulator2015 { lsd = bool.Parse(xmldoc.Element("lsd").Value); subs = bool.Parse(xmldoc.Element("subs").Value); level = int.Parse(xmldoc.Element("level").Value); + quality = int.Parse(xmldoc.Element("quality").Value); lang = CultureInfo.GetCultureInfo(xmldoc.Element("lang").Value); } public static int wam; public static bool lsd; public static bool subs; public static int level; + public static int quality; public static CultureInfo lang; } } \ No newline at end of file diff --git a/LaptopSimulator2015/strings.Designer.cs b/LaptopSimulator2015/strings.Designer.cs index c6c0ea2..9550c37 100644 --- a/LaptopSimulator2015/strings.Designer.cs +++ b/LaptopSimulator2015/strings.Designer.cs @@ -195,6 +195,33 @@ namespace LaptopSimulator2015 { } } + /// + /// Looks up a localized string similar to Sh*t. + /// + internal static string optionsWindowQuality1 { + get { + return ResourceManager.GetString("optionsWindowQuality1", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Default. + /// + internal static string optionsWindowQuality2 { + get { + return ResourceManager.GetString("optionsWindowQuality2", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Good. + /// + internal static string optionsWindowQuality3 { + get { + return ResourceManager.GetString("optionsWindowQuality3", resourceCulture); + } + } + /// /// Looks up a localized string similar to Reset. /// diff --git a/LaptopSimulator2015/strings.de.resx b/LaptopSimulator2015/strings.de.resx index 1b052db..6a1a077 100644 --- a/LaptopSimulator2015/strings.de.resx +++ b/LaptopSimulator2015/strings.de.resx @@ -162,6 +162,15 @@ Bist du dir sicher? (ALLES wird verbuggt werden!) + + Müll + + + Standard + + + Supremo + Zurücksetzen diff --git a/LaptopSimulator2015/strings.resx b/LaptopSimulator2015/strings.resx index 87e1e89..ed4af74 100644 --- a/LaptopSimulator2015/strings.resx +++ b/LaptopSimulator2015/strings.resx @@ -162,6 +162,15 @@ Are you SURE?\r\n(This will break EVERYTHING!) + + Sh*t + + + Default + + + Good + Reset diff --git a/LevelTest/MainForm.Designer.cs b/LevelTest/MainForm.Designer.cs index 3de4cb6..ef23468 100644 --- a/LevelTest/MainForm.Designer.cs +++ b/LevelTest/MainForm.Designer.cs @@ -57,11 +57,12 @@ this.Controls.Add(this.minigamePanel); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; - this.MinimizeBox = false; this.Name = "MainForm"; this.ShowIcon = false; this.Text = "Form1"; this.TopMost = true; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); + this.Resize += new System.EventHandler(this.MainForm_Resize); this.ResumeLayout(false); } diff --git a/LevelTest/MainForm.cs b/LevelTest/MainForm.cs index 32724c2..d0fdf13 100644 --- a/LevelTest/MainForm.cs +++ b/LevelTest/MainForm.cs @@ -46,5 +46,21 @@ namespace LevelTest } } } + + bool isFClose = true; + private void MainForm_Resize(object sender, EventArgs e) + { + if (WindowState == FormWindowState.Minimized) + { + isFClose = false; + Close(); + } + } + + private void MainForm_FormClosing(object sender, FormClosingEventArgs e) + { + if (isFClose) + Environment.Exit(0); + } } } diff --git a/LevelTest/Program.cs b/LevelTest/Program.cs index fa0b50c..430bc74 100644 --- a/LevelTest/Program.cs +++ b/LevelTest/Program.cs @@ -42,26 +42,30 @@ namespace LevelTest throw new Exception("Please select a folder"); } } - Minigame[] levels = Directory.EnumerateFiles(Directory.GetCurrentDirectory(), "*.dll", SearchOption.AllDirectories).Where(s => Path.GetFileName(s) != "Base.dll" && Path.GetFileName(s) != "CC-Functions.W32.dll") - .Select(s => Assembly.LoadFrom(s)).SelectMany(s => s.GetTypes()).Distinct() - .Where(p => typeof(Minigame).IsAssignableFrom(p)).Distinct().Except(new Type[] { typeof(Minigame), typeof(Level), typeof(Goal) }) - .Select(s => (Minigame)Activator.CreateInstance(s)).OrderBy(lv => lv.availableAfter).ToArray(); - Minigame level; - if (levels.Length == 0) - throw new Exception("No Levels found!"); - else if (levels.Length == 1) - level = levels[0]; - else + Minigame[] levels = Directory.EnumerateFiles(Directory.GetCurrentDirectory(), "*.dll", SearchOption.AllDirectories) + .Where(s => Path.GetFileName(s) != "Base.dll" && Path.GetFileName(s) != "CC-Functions.W32.dll").Select(s => File.ReadAllBytes(s)) + .Distinct().Select(s => Assembly.Load(s)).Distinct().SelectMany(s => s.GetTypes()).Distinct().Where(p => typeof(Minigame).IsAssignableFrom(p)) + .Distinct().Except(new Type[] { typeof(Minigame), typeof(Level), typeof(Goal) }).Select(s => (Minigame)Activator.CreateInstance(s)) + .Distinct(new comp()).OrderBy(lv => lv.availableAfter).ToArray(); + while (true) { - using (ArrayDialog dialog = new ArrayDialog(levels.Select(s => s.name).ToArray(), "Select a Minigame")) + Minigame level; + if (levels.Length == 0) + throw new Exception("No Levels found!"); + else if (levels.Length == 1) + level = levels[0]; + else { - if (dialog.ShowDialog() == DialogResult.OK) - level = levels[dialog.returnIndex]; - else - throw new Exception("Please select a folder"); + using (ArrayDialog dialog = new ArrayDialog(levels.Select(s => s.name).ToArray(), "Select a Minigame")) + { + if (dialog.ShowDialog() == DialogResult.OK) + level = levels[dialog.returnIndex]; + else + throw new Exception("Please select a folder"); + } } + Application.Run(new MainForm(level)); } - Application.Run(new MainForm(level)); } catch (Exception e) { @@ -69,4 +73,13 @@ namespace LevelTest } } } + + class comp : IEqualityComparer + { + public bool Equals(Minigame x, Minigame y) => x.name == y.name; + + public int GetHashCode(Minigame x) => x.name.GetHashCode(); + + } } + \ No newline at end of file diff --git a/ToDo.txt b/ToDo.txt index 99b69a0..17fb1bf 100644 --- a/ToDo.txt +++ b/ToDo.txt @@ -1,2 +1,14 @@ -Implement drawing ellipses (Level 3) -Fix Physics weirdness in Level 3 \ No newline at end of file +Fix Physics weirdness in Level 3 +Fix Physics weirdness in Level 4 (dropping through ground) + +Ideas for content: +- Goals: + - MS Word = Sentenz + - Powerpoint = WeakClic + - Minecraft = InfiniMined + - The "you win"-button +- Minigames: + - Bullet-Hell + - Mouse-based games? +- Other: + - Possibly secrets and alternate paths? \ No newline at end of file diff --git a/tmp1/3g.dll b/tmp1/3g.dll deleted file mode 100644 index e5f5667..0000000 Binary files a/tmp1/3g.dll and /dev/null differ diff --git a/tmp3/LevelTest.exe b/tmp3/LevelTest.exe deleted file mode 100644 index 4eeafb2..0000000 Binary files a/tmp3/LevelTest.exe and /dev/null differ