diff --git a/1/1.cs b/1/1.cs index cb48e33..4a8213f 100644 --- a/1/1.cs +++ b/1/1.cs @@ -53,7 +53,7 @@ namespace LaptopSimulator2015.Levels } } - public int levelNumber => 1; + public int availableAfter => 1; public int gameClock => 17; diff --git a/2/2.cs b/2/2.cs index a2257fb..d276fda 100644 --- a/2/2.cs +++ b/2/2.cs @@ -54,7 +54,7 @@ namespace LaptopSimulator2015.Levels } } - public int levelNumber => 2; + public int availableAfter => 2; public int gameClock => 17; diff --git a/3/3.cs b/3/3.cs index d981b69..b536fcc 100644 --- a/3/3.cs +++ b/3/3.cs @@ -54,7 +54,7 @@ namespace LaptopSimulator2015.Levels } } - public int levelNumber => 3; + public int availableAfter => 3; public int gameClock => 17; diff --git a/3g/3.cs b/3g/3.cs index 6c9c36a..100aa22 100644 --- a/3g/3.cs +++ b/3g/3.cs @@ -32,7 +32,7 @@ namespace LaptopSimulator2015.Goals } } - public int levelNumber => 0; + public int availableAfter => 0; public int gameClock => 300; diff --git a/4/4.cs b/4/4.cs index f3bccba..1871991 100644 --- a/4/4.cs +++ b/4/4.cs @@ -51,7 +51,7 @@ namespace LaptopSimulator2015.Levels } } - public int levelNumber => 4; + public int availableAfter => 4; public int gameClock => 17; public Panel desktopIcon { get; set; } public int installerProgressSteps => 500; diff --git a/Base/Base.csproj b/Base/Base.csproj index 63b6c73..54e9950 100644 --- a/Base/Base.csproj +++ b/Base/Base.csproj @@ -44,6 +44,7 @@ + diff --git a/Base/Drawing.cs b/Base/Drawing.cs index c07bf66..73a391d 100644 --- a/Base/Drawing.cs +++ b/Base/Drawing.cs @@ -10,6 +10,15 @@ namespace Base { public static class Drawing { + /// + /// Draw a string with the given size + /// + /// The graphics object to draw the string on + /// The string to draw + /// The font size of the string + /// The location to draw the string at + /// The brush to draw the string with + /// Set to true if you want to draw the string around instead of left-down from the location public static void DrawSizedString(Graphics g, string s, int size, PointF location, Brush brush, bool isLocationCentered = false) { SmoothingMode tmpS = g.SmoothingMode; diff --git a/Base/Glitch.cs b/Base/Glitch.cs new file mode 100644 index 0000000..b82a9ae --- /dev/null +++ b/Base/Glitch.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Base +{ + public interface CaptchaGlitch + { + /// + /// The chance of the Glitch being called, must be bewteen 0 and 1. Set this to zero if it should not be called (select based on currentLevel) + /// + double chance { get; } + /// + /// The current level, intended for modifying the intensity of the Glitch + /// + int currentLevel { get; set; } + /// + /// Called with the selected chance after the player inputs a char to the Captcha-box + /// + /// The character the player typed + /// The string to be added to the Captcha-box, modified by previous CaptchaGlitch instances + /// The characters which can be added to the CaptchaBox + void apply(char inputChar, ref string inputString, char[] captchaChars); + } +} diff --git a/Base/Input.cs b/Base/Input.cs index 86f77c9..bc1df33 100644 --- a/Base/Input.cs +++ b/Base/Input.cs @@ -13,8 +13,11 @@ namespace Base { [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] private static extern short GetKeyState(int keyCode); - - //public static bool IsKeyDown(Key key) => Keyboard.IsKeyDown(key); + /// + /// Check whether the Key is pressed + /// + /// Key to check + /// Whether the key is pressed public static bool IsKeyDown(Keys key) { try @@ -32,16 +35,27 @@ namespace Base Console.WriteLine("Invader: IsKeyDown failed:\r\n" + e1.ToString()); return false; } - /*Enum.TryParse(key.ToString(), out Key k); - if (k == Key.None) - return false; - return IsKeyDown(k);*/ } + /// + /// Unified input for going up + /// public static bool Up => IsKeyDown(Keys.Up) || IsKeyDown(Keys.W); + /// + /// Unified input for going left + /// public static bool Left => IsKeyDown(Keys.Left) || IsKeyDown(Keys.A); + /// + /// Unified input for going down + /// public static bool Down => IsKeyDown(Keys.Down) || IsKeyDown(Keys.S); + /// + /// Unified input for going right + /// public static bool Right => IsKeyDown(Keys.Right) || IsKeyDown(Keys.D); + /// + /// Unified input for doing something + /// public static bool Action => IsKeyDown(Keys.Space) || IsKeyDown(Keys.Q) || IsKeyDown(Keys.E); } } diff --git a/Base/Minigame.cs b/Base/Minigame.cs index f1b5e5e..ab8060c 100644 --- a/Base/Minigame.cs +++ b/Base/Minigame.cs @@ -10,24 +10,70 @@ namespace LaptopSimulator2015 { public interface Minigame { + /// + /// The minigames displayed name, found in installers title and tooltips + /// string name { get; } + /// + /// The minigames icon, found in installers and on desktop + /// Image icon { get; } - int levelNumber { get; } + /// + /// Level on which the Minigame becomes visible + /// + int availableAfter { get; } + /// + /// Defines the delay between frames + /// int gameClock { get; } + /// + /// DO NOT CHANGE! INTERNAL USE ONLY! + /// Panel desktopIcon { get; set; } + /// + /// Called before each time before gameTick, to be used for resetting/initializing variables + /// + /// A temporary Graphics object, should not be used + /// The panel on which the minigame is displayed + /// The timer used for scheduling frames void initGame(Graphics g, Panel minigamePanel, Timer minigameTimer); + /// + /// Called each frame + /// + /// Graphics object, to be used for drawing the scene + /// The panel on which the minigame is displayed + /// The timer used for scheduling frames + /// The amount of total displayed frames void gameTick(Graphics g, Panel minigamePanel, Timer minigameTimer, uint minigameTime); } public interface Level : Minigame { + /// + /// Description shown on the installers first page + /// string installerText { get; } + /// + /// Amount of seconds the minigame is to be played times ten + /// int installerProgressSteps { get; } } public interface Goal : Minigame { + /// + /// The level on which the Goal is reached + /// int playableAfter { get; } + /// + /// The text displayed after the Minigame becomes visible + /// string[] availableText { get; } + /// + /// The text displayed after finding out about the fact the Goal is not reached + /// string[] incompleteText { get; } + /// + /// The text displayed after Goal is reached (NOT after the goals minigame is played) + /// string[] completeText { get; } } } diff --git a/Base/Misc.cs b/Base/Misc.cs index fe437f5..35f18e4 100644 --- a/Base/Misc.cs +++ b/Base/Misc.cs @@ -10,7 +10,15 @@ namespace Base { public static class Misc { + /// + /// Call to signal that the player failed + /// public static Action closeGameWindow; + /// + /// Convert a double to a float + /// + /// Value to be converted + /// Converted value public static float d2f(double input) { float result = Convert.ToSingle(input); @@ -21,13 +29,57 @@ namespace Base return result; } + /// + /// Convert a float to an int + /// + /// Value to be converted + /// Converted value public static int f2i(float input) => (int)Math.Round(input); + /// + /// Convert a double to an int + /// + /// Value to be converted + /// Converted value public static int d2i(double input) => f2i(d2f(input)); + /// + /// Convert an int to a float + /// + /// Value to be converted + /// Converted value public static float i2f(int input) => input; + /// + /// Convert an int to a double + /// + /// Value to be converted + /// Converted value public static double i2d(int input) => input; + /// + /// Convert a float to a double + /// + /// Value to be converted + /// Converted value public static double f2d(float input) => input; + /// + /// Convert a value in radians to a value in degrees + /// + /// Value to be converted + /// Converted value public static double rad2deg(double input) => (360 * input) / (2 * Math.PI); + /// + /// Convert a value in degrees to a value in radians + /// + /// Value to be converted + /// Converted value public static double deg2rad(double input) => ((2 * Math.PI) * input) / 360; + /// + /// Maps a number from one range of numbers to another + /// + /// Start of the range the original number is in + /// End of the range the original number is in + /// Start of the range the new number is in + /// End of the range the new number is in + /// Value to be mapped + /// Mapped value public static double map(double originalStart, double originalEnd, double newStart, double newEnd, double value) { double scale = (newEnd - newStart) / (originalEnd - originalStart); diff --git a/Base/Vector2.cs b/Base/Vector2.cs index d988b60..680f004 100644 --- a/Base/Vector2.cs +++ b/Base/Vector2.cs @@ -7,9 +7,14 @@ using System.Threading.Tasks; namespace Base { + /// + /// Class for a 2-Dimensional Vector + /// public class Vector2 { - + /// + /// A new Vector with a value of zero + /// public static readonly Vector2 Zero = new Vector2(Point.Empty); double x_unchecked = 0; double y_unchecked = 0; @@ -56,6 +61,9 @@ namespace Base } } } + /// + /// X-Coordinate of the Vector + /// public double X { get { @@ -67,6 +75,9 @@ namespace Base check(); } } + /// + /// Y-Coordinate of the Vector + /// public double Y { get { @@ -78,26 +89,50 @@ namespace Base check(); } } + /// + /// Bounds of the Vector, set both values for a axis to zero to ignore it + /// public Rectangle bounds; + /// + /// Set to true if you want the Vector to wrap instead of 'cutting' when reaching the bound + /// public bool bounds_wrap = false; + /// + /// Create a new Vector + /// + /// X coordinate + /// Y coordinate public Vector2(double x = 0, double y = 0) { X = x; Y = y; } + /// + /// Create a new Vector + /// + /// Point to copy data from public Vector2(Point from) { X = from.X; Y = from.Y; } + /// + /// Create a new Vector + /// + /// Point to copy data from public Vector2(PointF from) { X = from.X; Y = from.Y; } + /// + /// Copy data from the Vector to a new one + /// + /// Vector to copy data from + /// Set to true to copy bounds etc public Vector2(Vector2 from, bool useProperties = false) { X = from.X; @@ -110,20 +145,60 @@ namespace Base } } - public Point toPoint() => new Point((int)Math.Round(X), (int)Math.Round(Y)); + /// + /// Copy the Vectors axis to a point + /// + /// The new Point + public Point toPoint() => new Point(Misc.d2i(X), Misc.d2i(Y)); + /// + /// Copy the Vectors axis to a point + /// + /// The new Point public PointF toPointF() => new PointF(Misc.d2f(X), Misc.d2f(Y)); + /// + /// Get the squared distance between this Vector and the other + /// + /// The other Vector + /// Distance public double distanceFromSquared(Vector2 other) => Math.Pow(X - other.X, 2) + Math.Pow(Y - other.Y, 2); + /// + /// Get the distance between this Vector and the other + /// + /// The other Vector + /// Distance public double distanceFrom(Vector2 other) => Math.Sqrt(distanceFromSquared(other)); + /// + /// Provided for compatibility with some methods for other Vector implementations + /// public double magnitude { get { return distanceFrom(Zero); } } + /// + /// Provided for compatibility with some methods for other Vector implementations + /// public double sqrMagnitude { get { return distanceFromSquared(Zero); } } + /// + /// Move the Vector in the direction + /// + /// The angle in radians + /// Distance to move the Vector public void moveInDirection(double radians = 0, double distance = 1) { X += Math.Cos(radians) * distance; Y += Math.Sin(radians) * distance; } + /// + /// Get the angle inbetween the X-Axis and a line between two poins + /// + /// The other point for the line + /// Angle in Radians public double getDirection(Vector2 other) => Math.Atan((other.X - X) / (other.Y - Y)); + /// + /// Move the Vector towards the other Vector + /// + /// The other Vector + /// The distance to move + /// Whether to stop at the target or to go through it public void moveTowards(Vector2 other, double distance = 1, bool stopAtTarget = true) { double dist = distanceFrom(other); @@ -142,18 +217,19 @@ namespace Base } } - public Vector2 addTag(object Tag) { this.Tag = Tag; return this; } - public Vector2 addBounds(Rectangle bounds) { this.bounds = bounds; return this; } - public Vector2 addBoundsW(bool bounds_wrap) { this.bounds_wrap = bounds_wrap; return this; } + Vector2 addTag(object Tag) { this.Tag = Tag; return this; } + Vector2 addBounds(Rectangle bounds) { this.bounds = bounds; return this; } + Vector2 addBoundsW(bool bounds_wrap) { this.bounds_wrap = bounds_wrap; return this; } + Vector2 addData(object Tag, Rectangle bounds, bool bounds_wrap) => addTag(Tag).addBounds(bounds).addBoundsW(bounds_wrap); public override string ToString() => "{X=" + X.ToString() + ", Y=" + Y.ToString() + "}"; - public static Vector2 operator +(Vector2 left, Vector2 right) => new Vector2(left.X + right.X, left.Y + right.Y).addTag(left.Tag).addBounds(left.bounds).addBoundsW(left.bounds_wrap); - public static Vector2 operator +(Vector2 left, Point right) => new Vector2(left.X + right.X, left.Y + right.Y).addTag(left.Tag).addBounds(left.bounds).addBoundsW(left.bounds_wrap); - public static Vector2 operator +(Vector2 left, PointF right) => new Vector2(left.X + right.X, left.Y + right.Y).addTag(left.Tag).addBounds(left.bounds).addBoundsW(left.bounds_wrap); - public static Vector2 operator -(Vector2 left, Vector2 right) => new Vector2(left.X - right.X, left.Y - right.Y).addTag(left.Tag).addBounds(left.bounds).addBoundsW(left.bounds_wrap); - public static Vector2 operator -(Vector2 left, Point right) => new Vector2(left.X - right.X, left.Y - right.Y).addTag(left.Tag).addBounds(left.bounds).addBoundsW(left.bounds_wrap); - public static Vector2 operator -(Vector2 left, PointF right) => new Vector2(left.X - right.X, left.Y - right.Y).addTag(left.Tag).addBounds(left.bounds).addBoundsW(left.bounds_wrap); - public static Vector2 operator *(Vector2 left, Vector2 right) => new Vector2(left.X * right.X, left.Y * right.Y).addTag(left.Tag).addBounds(left.bounds).addBoundsW(left.bounds_wrap); + public static Vector2 operator +(Vector2 left, Vector2 right) => new Vector2(left.X + right.X, left.Y + right.Y).addData(left.Tag, left.bounds, left.bounds_wrap); + public static Vector2 operator +(Vector2 left, Point right) => new Vector2(left.X + right.X, left.Y + right.Y).addData(left.Tag, left.bounds, left.bounds_wrap); + public static Vector2 operator +(Vector2 left, PointF right) => new Vector2(left.X + right.X, left.Y + right.Y).addData(left.Tag, left.bounds, left.bounds_wrap); + public static Vector2 operator -(Vector2 left, Vector2 right) => new Vector2(left.X - right.X, left.Y - right.Y).addData(left.Tag, left.bounds, left.bounds_wrap); + public static Vector2 operator -(Vector2 left, Point right) => new Vector2(left.X - right.X, left.Y - right.Y).addData(left.Tag, left.bounds, left.bounds_wrap); + public static Vector2 operator -(Vector2 left, PointF right) => new Vector2(left.X - right.X, left.Y - right.Y).addData(left.Tag, left.bounds, left.bounds_wrap); + public static Vector2 operator *(Vector2 left, Vector2 right) => new Vector2(left.X * right.X, left.Y * right.Y).addData(left.Tag, left.bounds, left.bounds_wrap); public static Vector2 operator *(Vector2 left, Point right) => new Vector2(left.X * right.X, left.Y * right.Y); public static Vector2 operator *(Vector2 left, PointF right) => new Vector2(left.X * right.X, left.Y * right.Y); public static Vector2 operator /(Vector2 left, Vector2 right) => new Vector2(left.X / right.X, left.Y / right.Y); diff --git a/CaptchaGlitch_Double/CaptchaGlitch_Double.csproj b/CaptchaGlitch_Double/CaptchaGlitch_Double.csproj new file mode 100644 index 0000000..8681e47 --- /dev/null +++ b/CaptchaGlitch_Double/CaptchaGlitch_Double.csproj @@ -0,0 +1,58 @@ + + + + + Debug + AnyCPU + {B97A24F8-8027-471A-B688-8BC5D49B21D7} + Library + Properties + CaptchaGlitch_Double + CaptchaGlitch_Double + v4.7.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + {9a9561a7-dd5f-43a5-a3f5-a95f35da204d} + Base + + + + + if not exist "$(SolutionDir)tmp2" mkdir "$(SolutionDir)tmp2" +copy "$(TargetPath)" "$(SolutionDir)tmp2" + + \ No newline at end of file diff --git a/CaptchaGlitch_Double/Double.cs b/CaptchaGlitch_Double/Double.cs new file mode 100644 index 0000000..946348e --- /dev/null +++ b/CaptchaGlitch_Double/Double.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Base; + +namespace LaptopSimulator2015.Glitches +{ + public class Double : CaptchaGlitch + { + public double chance { get { if (currentLevel < 1) return 0; return Math.Min(currentLevel / 8d, 0.8); } } + public int currentLevel { get; set; } + public void apply(char inputChar, ref string inputString, char[] captchaChars) => inputString += inputChar; + } +} diff --git a/CaptchaGlitch_Double/Properties/AssemblyInfo.cs b/CaptchaGlitch_Double/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..3a81107 --- /dev/null +++ b/CaptchaGlitch_Double/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CaptchaGlitch_Double")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CaptchaGlitch_Double")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("b97a24f8-8027-471a-b688-8bc5d49b21d7")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CaptchaGlitch_Rand/CaptchaGlitch_Rand.csproj b/CaptchaGlitch_Rand/CaptchaGlitch_Rand.csproj new file mode 100644 index 0000000..b916503 --- /dev/null +++ b/CaptchaGlitch_Rand/CaptchaGlitch_Rand.csproj @@ -0,0 +1,58 @@ + + + + + Debug + AnyCPU + {72BBB6B8-5DA3-4FF1-8FA6-75256637F931} + Library + Properties + CaptchaGlitch_Rand + CaptchaGlitch_Rand + v4.7.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + {9a9561a7-dd5f-43a5-a3f5-a95f35da204d} + Base + + + + + if not exist "$(SolutionDir)tmp2" mkdir "$(SolutionDir)tmp2" +copy "$(TargetPath)" "$(SolutionDir)tmp2" + + \ No newline at end of file diff --git a/CaptchaGlitch_Rand/Properties/AssemblyInfo.cs b/CaptchaGlitch_Rand/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f57b713 --- /dev/null +++ b/CaptchaGlitch_Rand/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CaptchaGlitch_Rand")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CaptchaGlitch_Rand")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("72bbb6b8-5da3-4ff1-8fa6-75256637f931")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/CaptchaGlitch_Rand/Rand.cs b/CaptchaGlitch_Rand/Rand.cs new file mode 100644 index 0000000..f8b2c10 --- /dev/null +++ b/CaptchaGlitch_Rand/Rand.cs @@ -0,0 +1,16 @@ +using Base; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace LaptopSimulator2015.Glitches +{ + public class Rand : CaptchaGlitch + { + public double chance { get { if (currentLevel < 2) return 0; return Math.Min((currentLevel - 1) / 16d, 0.8); } } + public int currentLevel { get; set; } + public void apply(char inputChar, ref string inputString, char[] captchaChars) => inputString += captchaChars[new Random().Next(captchaChars.Length - 1)]; + } +} diff --git a/LaptopSimulator2015.sln b/LaptopSimulator2015.sln index 2323e25..952add1 100644 --- a/LaptopSimulator2015.sln +++ b/LaptopSimulator2015.sln @@ -8,8 +8,12 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LaptopSimulator2015", "Lapt {0965C803-49B2-4311-B62F-1E60DBD9185F} = {0965C803-49B2-4311-B62F-1E60DBD9185F} {8109040E-9D8D-43E7-A461-83475B2939C9} = {8109040E-9D8D-43E7-A461-83475B2939C9} {4AA1EF48-BC5E-4FE4-9B7D-BAE6D6AB9529} = {4AA1EF48-BC5E-4FE4-9B7D-BAE6D6AB9529} + {048BCC52-64BA-452B-A3F6-3683F9049AFD} = {048BCC52-64BA-452B-A3F6-3683F9049AFD} {E61E2797-62B4-471C-ACBF-31EAB7C746CF} = {E61E2797-62B4-471C-ACBF-31EAB7C746CF} {DFA2FB97-D676-4B0D-B281-2685F85781EE} = {DFA2FB97-D676-4B0D-B281-2685F85781EE} + {72BBB6B8-5DA3-4FF1-8FA6-75256637F931} = {72BBB6B8-5DA3-4FF1-8FA6-75256637F931} + {5E10F1D0-0114-444A-B80E-975B5DC40D9F} = {5E10F1D0-0114-444A-B80E-975B5DC40D9F} + {B97A24F8-8027-471A-B688-8BC5D49B21D7} = {B97A24F8-8027-471A-B688-8BC5D49B21D7} EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Minigame Tests", "Minigame Tests", "{69DC5824-3F89-4B47-BF1A-F25942094195}" @@ -47,6 +51,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "3g", "3g\3g.csproj", "{E61E EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "lv3g_t", "lv3g_t\lv3g_t.csproj", "{E6BF80E0-8848-4A6F-B114-FEC5055E1D9E}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Glitches", "Glitches", "{A8CDDCD3-43FC-46AE-9132-24DE27808D96}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptchaGlitch_Rand", "CaptchaGlitch_Rand\CaptchaGlitch_Rand.csproj", "{72BBB6B8-5DA3-4FF1-8FA6-75256637F931}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "zz_CaptchaGlitch_Empty", "zz_CaptchaGlitch_Empty\zz_CaptchaGlitch_Empty.csproj", "{048BCC52-64BA-452B-A3F6-3683F9049AFD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CaptchaGlitch_Double", "CaptchaGlitch_Double\CaptchaGlitch_Double.csproj", "{B97A24F8-8027-471A-B688-8BC5D49B21D7}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "zzz_ShuffleChars", "zzz_ShuffleChars\zzz_ShuffleChars.csproj", "{5E10F1D0-0114-444A-B80E-975B5DC40D9F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -105,6 +119,22 @@ Global {E6BF80E0-8848-4A6F-B114-FEC5055E1D9E}.Debug|Any CPU.Build.0 = Debug|Any CPU {E6BF80E0-8848-4A6F-B114-FEC5055E1D9E}.Release|Any CPU.ActiveCfg = Release|Any CPU {E6BF80E0-8848-4A6F-B114-FEC5055E1D9E}.Release|Any CPU.Build.0 = Release|Any CPU + {72BBB6B8-5DA3-4FF1-8FA6-75256637F931}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {72BBB6B8-5DA3-4FF1-8FA6-75256637F931}.Debug|Any CPU.Build.0 = Debug|Any CPU + {72BBB6B8-5DA3-4FF1-8FA6-75256637F931}.Release|Any CPU.ActiveCfg = Release|Any CPU + {72BBB6B8-5DA3-4FF1-8FA6-75256637F931}.Release|Any CPU.Build.0 = Release|Any CPU + {048BCC52-64BA-452B-A3F6-3683F9049AFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {048BCC52-64BA-452B-A3F6-3683F9049AFD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {048BCC52-64BA-452B-A3F6-3683F9049AFD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {048BCC52-64BA-452B-A3F6-3683F9049AFD}.Release|Any CPU.Build.0 = Release|Any CPU + {B97A24F8-8027-471A-B688-8BC5D49B21D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B97A24F8-8027-471A-B688-8BC5D49B21D7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B97A24F8-8027-471A-B688-8BC5D49B21D7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B97A24F8-8027-471A-B688-8BC5D49B21D7}.Release|Any CPU.Build.0 = Release|Any CPU + {5E10F1D0-0114-444A-B80E-975B5DC40D9F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5E10F1D0-0114-444A-B80E-975B5DC40D9F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5E10F1D0-0114-444A-B80E-975B5DC40D9F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5E10F1D0-0114-444A-B80E-975B5DC40D9F}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -121,6 +151,10 @@ Global {4AA1EF48-BC5E-4FE4-9B7D-BAE6D6AB9529} = {83BF22F9-3A2D-42A3-9DB0-C1E2AA1DD218} {E61E2797-62B4-471C-ACBF-31EAB7C746CF} = {7D9F2BFD-61B6-4C6C-97CC-D9AD51A04959} {E6BF80E0-8848-4A6F-B114-FEC5055E1D9E} = {69DC5824-3F89-4B47-BF1A-F25942094195} + {72BBB6B8-5DA3-4FF1-8FA6-75256637F931} = {A8CDDCD3-43FC-46AE-9132-24DE27808D96} + {048BCC52-64BA-452B-A3F6-3683F9049AFD} = {A8CDDCD3-43FC-46AE-9132-24DE27808D96} + {B97A24F8-8027-471A-B688-8BC5D49B21D7} = {A8CDDCD3-43FC-46AE-9132-24DE27808D96} + {5E10F1D0-0114-444A-B80E-975B5DC40D9F} = {A8CDDCD3-43FC-46AE-9132-24DE27808D96} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {9631F8FF-AFC1-4583-9D27-6C2D97D3A2E9} diff --git a/LaptopSimulator2015/FakeDesktop.cs b/LaptopSimulator2015/FakeDesktop.cs index 431ac0a..74c5d56 100644 --- a/LaptopSimulator2015/FakeDesktop.cs +++ b/LaptopSimulator2015/FakeDesktop.cs @@ -19,6 +19,7 @@ namespace LaptopSimulator2015 { #region Base List levels = new List(); + List captchaGlitches = new List(); SoundPlayer fans; bool winShouldClose = false; @@ -101,9 +102,12 @@ namespace LaptopSimulator2015 Control[] controls = getControls(ignore: new List { minigamePanel }).ToArray(); for (int i = 0; i < controls.Length; i++) controls[i].Paint += Control_Paint; - levels = Directory.GetFiles("Levels").Concat(Directory.GetFiles("Goals")).Where(s => Path.GetExtension(s) == ".dll").Select(s => Assembly.LoadFrom(s)) - .SelectMany(s => s.GetTypes()).Where(p => typeof(Minigame).IsAssignableFrom(p) && p != typeof(Minigame) && p != typeof(Level) && p != typeof(Goal)).Distinct() - .Select(s => (Minigame)Activator.CreateInstance(s)).OrderBy(lv => lv.levelNumber).ToList(); + IEnumerable tmp_types = Directory.GetFiles("Levels").Concat(Directory.GetFiles("Goals")).Concat(Directory.GetFiles("Glitches")).Where(s => Path.GetExtension(s) == ".dll").Select(s => Assembly.LoadFrom(s)) + .SelectMany(s => s.GetTypes()); + levels = tmp_types.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).ToList(); + captchaGlitches = tmp_types.Where(p => typeof(CaptchaGlitch).IsAssignableFrom(p)).Distinct().Except(new Type[] { typeof(CaptchaGlitch) }) + .Select(s => (CaptchaGlitch)Activator.CreateInstance(s)).ToList(); for (int i = 0; i < levels.Count; i++) { levels[i].desktopIcon = new Panel(); @@ -112,7 +116,7 @@ namespace LaptopSimulator2015 levels[i].desktopIcon.Size = new Size(50, 50); levels[i].desktopIcon.BackColor = Color.FromArgb(128, 128, 255); levels[i].desktopIcon.Name = "lvl" + i.ToString() + "_1"; - levels[i].desktopIcon.Visible = levels[i].levelNumber <= Settings.level; + levels[i].desktopIcon.Visible = levels[i].availableAfter <= Settings.level; tmp1.BackColor = Color.Blue; tmp1.BackgroundImageLayout = ImageLayout.Stretch; @@ -176,7 +180,7 @@ namespace LaptopSimulator2015 else { base.BackColor = Color.FromArgb(100, 0, 255); - if (levels[levelInd].levelNumber == Settings.level) + if (levels[levelInd].availableAfter == Settings.level) { playDialog(goal.incompleteText); incrementLevel(); @@ -206,7 +210,7 @@ namespace LaptopSimulator2015 { for (int i = 0; i < levels.Count; i++) { - if ((!ignoreSub) && ((typeof(Goal).IsAssignableFrom(levels[i].GetType()) && levels[i].desktopIcon.Visible != levels[i].levelNumber <= Settings.level) || (levels[i].levelNumber == 0 && Settings.level == 0))) + if ((!ignoreSub) && ((typeof(Goal).IsAssignableFrom(levels[i].GetType()) && levels[i].desktopIcon.Visible != levels[i].availableAfter <= Settings.level) || (levels[i].availableAfter == 0 && Settings.level == 0))) { string[] at = ((Goal)levels[i]).availableText; new Thread(() => @@ -220,7 +224,7 @@ namespace LaptopSimulator2015 }); }).Start(); } - levels[i].desktopIcon.Visible = levels[i].levelNumber <= Settings.level; + levels[i].desktopIcon.Visible = levels[i].availableAfter <= Settings.level; } } @@ -243,8 +247,8 @@ namespace LaptopSimulator2015 { int closest = int.MaxValue; for (int i = 0; i < levels.Count; i++) - if (levels[i].levelNumber < closest & levels[i].levelNumber > levels[levelInd].levelNumber) - closest = levels[i].levelNumber; + if (levels[i].availableAfter < closest & levels[i].availableAfter > levels[levelInd].availableAfter) + closest = levels[i].availableAfter; if (closest != int.MaxValue) Settings.level = closest; Settings.Save(); @@ -378,7 +382,7 @@ namespace LaptopSimulator2015 break; case 2: LevelWindowHeaderExit_Click(sender, e); - if (levels[levelInd].levelNumber >= Settings.level) + if (levels[levelInd].availableAfter >= Settings.level) { incrementLevel(); mode = Mode.game; @@ -400,8 +404,20 @@ namespace LaptopSimulator2015 LevelWindowC1_Click(sender, new EventArgs()); break; default: - if (strings.captchaLetters.ToCharArray().Contains(char.Parse(e.KeyChar.ToString().ToUpper()))) - captchaBox.Text += e.KeyChar.ToString().ToUpper(); + char tmp1 = char.ToUpper(e.KeyChar); + if (strings.captchaLetters.ToUpper().ToCharArray().Contains(tmp1)) + { + string tmp2 = tmp1.ToString().ToUpper(); + for (int i = 0; i < captchaGlitches.Count; i++) + { + captchaGlitches[i].currentLevel = Settings.level; + if (new Random().NextDouble() < captchaGlitches[i].chance) + { + captchaGlitches[i].apply(tmp1, ref tmp2, strings.captchaLetters.ToUpper().ToCharArray()); + } + } + captchaBox.Text += tmp2; + } break; } } diff --git a/LaptopSimulator2015/LaptopSimulator2015.csproj b/LaptopSimulator2015/LaptopSimulator2015.csproj index 569543e..2685660 100644 --- a/LaptopSimulator2015/LaptopSimulator2015.csproj +++ b/LaptopSimulator2015/LaptopSimulator2015.csproj @@ -140,6 +140,10 @@ if not exist "$(TargetDir)Goals" mkdir "$(TargetDir)Goals" if exist "$(SolutionDir)tmp1" copy $(SolutionDir)tmp1\* "$(TargetDir)Goals" rmdir /s /q "$(SolutionDir)tmp1" +if not exist "$(TargetDir)Glitches" mkdir "$(TargetDir)Glitches" +if exist "$(SolutionDir)tmp2" copy $(SolutionDir)tmp2\* "$(TargetDir)Glitches" +rmdir /s /q "$(SolutionDir)tmp2" + del /q "$(TargetDir)save.xml" diff --git a/zz_CaptchaGlitch_Empty/Empty.cs b/zz_CaptchaGlitch_Empty/Empty.cs new file mode 100644 index 0000000..32a8c45 --- /dev/null +++ b/zz_CaptchaGlitch_Empty/Empty.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Base; + +namespace LaptopSimulator2015.Glitches +{ + public class Empty : CaptchaGlitch + { + public double chance { get { if (currentLevel < 1) return 0; return Math.Min(currentLevel / 8d, 0.8); } } + public int currentLevel { get; set; } + public void apply(char inputChar, ref string inputString, char[] captchaChars) => inputString.Remove(0, 1); + } +} diff --git a/zz_CaptchaGlitch_Empty/Properties/AssemblyInfo.cs b/zz_CaptchaGlitch_Empty/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..01cbc26 --- /dev/null +++ b/zz_CaptchaGlitch_Empty/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("zz_CaptchaGlitch_Empty")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("zz_CaptchaGlitch_Empty")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("048bcc52-64ba-452b-a3f6-3683f9049afd")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/zz_CaptchaGlitch_Empty/zz_CaptchaGlitch_Empty.csproj b/zz_CaptchaGlitch_Empty/zz_CaptchaGlitch_Empty.csproj new file mode 100644 index 0000000..6d90ed0 --- /dev/null +++ b/zz_CaptchaGlitch_Empty/zz_CaptchaGlitch_Empty.csproj @@ -0,0 +1,58 @@ + + + + + Debug + AnyCPU + {048BCC52-64BA-452B-A3F6-3683F9049AFD} + Library + Properties + zz_CaptchaGlitch_Empty + zz_CaptchaGlitch_Empty + v4.7.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + {9a9561a7-dd5f-43a5-a3f5-a95f35da204d} + Base + + + + + if not exist "$(SolutionDir)tmp2" mkdir "$(SolutionDir)tmp2" +copy "$(TargetPath)" "$(SolutionDir)tmp2" + + \ No newline at end of file diff --git a/zzz_ShuffleChars/Properties/AssemblyInfo.cs b/zzz_ShuffleChars/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8462e79 --- /dev/null +++ b/zzz_ShuffleChars/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("zzz_ShuffleChars")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("zzz_ShuffleChars")] +[assembly: AssemblyCopyright("Copyright © 2019")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("5e10f1d0-0114-444a-b80e-975b5dc40d9f")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/zzz_ShuffleChars/ShuffleChars.cs b/zzz_ShuffleChars/ShuffleChars.cs new file mode 100644 index 0000000..43055fc --- /dev/null +++ b/zzz_ShuffleChars/ShuffleChars.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Base; + +namespace LaptopSimulator2015.Glitches +{ + public class ShuffleChars : CaptchaGlitch + { + public double chance { get { if (currentLevel < 1) return 0; return Math.Min(currentLevel / 8d, 0.8); } } + public int currentLevel { get; set; } + Random rnd = new Random(); + public void apply(char inputChar, ref string inputString, char[] captchaChars) => inputString = string.Join("", inputString.ToCharArray().OrderBy(x => rnd.Next())); + } +} diff --git a/zzz_ShuffleChars/zzz_ShuffleChars.csproj b/zzz_ShuffleChars/zzz_ShuffleChars.csproj new file mode 100644 index 0000000..35b7ea4 --- /dev/null +++ b/zzz_ShuffleChars/zzz_ShuffleChars.csproj @@ -0,0 +1,58 @@ + + + + + Debug + AnyCPU + {5E10F1D0-0114-444A-B80E-975B5DC40D9F} + Library + Properties + zzz_ShuffleChars + zzz_ShuffleChars + v4.7.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + {9a9561a7-dd5f-43a5-a3f5-a95f35da204d} + Base + + + + + if not exist "$(SolutionDir)tmp2" mkdir "$(SolutionDir)tmp2" +copy "$(TargetPath)" "$(SolutionDir)tmp2" + + \ No newline at end of file