diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 7fabfd36..707b2d58 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,4 +1,13 @@ SneakyTactician + [Version 0.0.0.3] + ### Features + *End turn button is now rendered + #### API + *Support for creature movement + ### Tweaks + *Changed many data structures under the hood + ### Bugs + * [Version 0.0.0.2] ### Features @@ -7,22 +16,10 @@ #### API *Living creatures are now supported - ### Tweaks - * - - ### Bugs - * - [Version 0.0.0.1] ### Features *The world displays when told to generate a new world #### API - *World generates properly - - ### Tweaks - * - - ### Bugs - * \ No newline at end of file + *World generates properly \ No newline at end of file diff --git a/Credit.txt b/Credit.txt new file mode 100644 index 00000000..9ec11e28 --- /dev/null +++ b/Credit.txt @@ -0,0 +1,4 @@ +Credit for things I used that I didn't make: + +Libraries: +https://github.com/agabani/DijkstraAlgorithm optimal pathfinding algorithm \ No newline at end of file diff --git a/EarthWithMagic.sln b/EarthWithMagic.sln index 75c48d30..f74e32b3 100644 --- a/EarthWithMagic.sln +++ b/EarthWithMagic.sln @@ -6,6 +6,7 @@ MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{09293283-6E6D-4652-A633-5B70452244DA}" ProjectSection(SolutionItems) = preProject CHANGELOG.txt = CHANGELOG.txt + Credit.txt = Credit.txt EndProjectSection EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagicalLifeAPI", "MagicalLifeAPI\MagicalLifeAPI.csproj", "{FE8400A7-9DC8-4AB4-8C54-AC5F36BF7639}" @@ -14,6 +15,13 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagicalLifeGUI", "MagicalLi EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagicalLifeRenderEngine", "MagicalLifeRenderEngine\MagicalLifeRenderEngine.csproj", "{C1553F02-E940-4F5E-8C8C-DD6184922D86}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Snippets", "Snippets", "{EE5F9F76-E1DE-4746-BEC3-4D63543E0F68}" + ProjectSection(SolutionItems) = preProject + TilesEnumeration.snippet = TilesEnumeration.snippet + EndProjectSection +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MagicalLifeSettings", "MagicalLifeSettings\MagicalLifeSettings.csproj", "{76B12B63-DF5D-40FD-8E90-03395095DD71}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -32,6 +40,10 @@ Global {C1553F02-E940-4F5E-8C8C-DD6184922D86}.Debug|Any CPU.Build.0 = Debug|Any CPU {C1553F02-E940-4F5E-8C8C-DD6184922D86}.Release|Any CPU.ActiveCfg = Release|Any CPU {C1553F02-E940-4F5E-8C8C-DD6184922D86}.Release|Any CPU.Build.0 = Release|Any CPU + {76B12B63-DF5D-40FD-8E90-03395095DD71}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {76B12B63-DF5D-40FD-8E90-03395095DD71}.Debug|Any CPU.Build.0 = Debug|Any CPU + {76B12B63-DF5D-40FD-8E90-03395095DD71}.Release|Any CPU.ActiveCfg = Release|Any CPU + {76B12B63-DF5D-40FD-8E90-03395095DD71}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Libs/DijkstraAlgorithm.dll b/Libs/DijkstraAlgorithm.dll new file mode 100644 index 00000000..ef08b716 Binary files /dev/null and b/Libs/DijkstraAlgorithm.dll differ diff --git a/MagicalLifeAPI/DataTypes/Point3D.cs b/MagicalLifeAPI/DataTypes/Point3D.cs new file mode 100644 index 00000000..5cd291ae --- /dev/null +++ b/MagicalLifeAPI/DataTypes/Point3D.cs @@ -0,0 +1,49 @@ +using System.Drawing; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MagicalLifeAPI.DataTypes +{ + /// + /// A 3 dimensional point class. + /// + public class Point3D : Object + { + public int X { get; set; } + public int Y { get; set; } + public int Z { get; set; } + + public Point3D(int x, int y, int z) + { + this.X = x; + this.Y = y; + this.Z = z; + } + + public Point3D(string str) + { + string[] delimiter = new string[] { ", " }; + string[] numbers = str.Split(delimiter, 3, StringSplitOptions.RemoveEmptyEntries); + + int x; + int y; + int z; + + int.TryParse(numbers[0], out x); + int.TryParse(numbers[1], out y); + int.TryParse(numbers[2], out z); + + this.X = x; + this.Y = y; + this.Z = z; + } + + public override string ToString() + { + return this.X.ToString() + ", " + this.Y.ToString() + ", " + this.Z.ToString(); + } + } +} diff --git a/MagicalLifeAPI/Entities/Living.cs b/MagicalLifeAPI/Entities/Living.cs index 4873731a..302e96b7 100644 --- a/MagicalLifeAPI/Entities/Living.cs +++ b/MagicalLifeAPI/Entities/Living.cs @@ -1,4 +1,8 @@ -using MagicalLifeAPI.Entities.Util; +using System.Collections.Generic; +using DijkstraAlgorithm.Pathing; +using System.Collections.Concurrent; +using System.Collections; +using MagicalLifeAPI.Entities.Util; using MagicalLifeAPI.Universal; namespace MagicalLifeAPI.Entities @@ -8,6 +12,11 @@ namespace MagicalLifeAPI.Entities /// public abstract class Living : Unique { + /// + /// A queue that holds the queued movement steps up for this living creature. + /// + public Queue QueuedMovement { get; set; } = new Queue(); + /// /// How many hit points this creature has. /// diff --git a/MagicalLifeAPI/Entities/Movement/EntityWorldMovement.cs b/MagicalLifeAPI/Entities/Movement/EntityWorldMovement.cs new file mode 100644 index 00000000..a30fd904 --- /dev/null +++ b/MagicalLifeAPI/Entities/Movement/EntityWorldMovement.cs @@ -0,0 +1,57 @@ +using System.Security.Cryptography; +using DijkstraAlgorithm.Pathing; +using MagicalLifeAPI.World; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using MagicalLifeAPI.Entities.Util.Modifier_Remove_Conditions; + +namespace MagicalLifeAPI.Entities.Movement +{ + /// + /// Used to move entities. + /// + public static class EntityWorldMovement + { + /// + /// Moves an entity from it's current position to as close to it's target destination as it can get. This will appear like teleporting. + /// + /// + public static void MoveEntity(ref Living entity) + { + Queue path = entity.QueuedMovement; + while (entity.MovementSpeed.GetValue() > 0 && path.Count > 0) + { + PathSegment destination = path.Dequeue(); + Tile sourceTile = WorldUtil.GetTileByID(World.World.mainWorld.Tiles, destination.Origin.Id); + Tile destinationTile = WorldUtil.GetTileByID(World.World.mainWorld.Tiles, destination.Destination.Id); + string modifierReason = "Moved onto a " + destinationTile.GetName() + " tile"; + entity.MovementSpeed.AddModifier(new Tuple(-1 * destinationTile.MovementCost, new TimeRemoveCondition(1), modifierReason)); + World.World.mainWorld.Tiles[sourceTile.Location.X, sourceTile.Location.Y, sourceTile.Location.Z].Living.RemoveAt(EntityWorldMovement.GetIndexOfEntity(sourceTile.Living, entity)); + World.World.mainWorld.Tiles[destinationTile.Location.X, destinationTile.Location.Y, destinationTile.Location.Z].Living.Add(entity); + } + } + + /// + /// Finds the index of the living creature in the list. Returns -1 if it doesn't exist anymore. + /// + /// + /// + /// + private static int GetIndexOfEntity(List living, Living target) + { + int length = living.Count; + for (int i = 0; i < length; i++) + { + if (living[i].ID == target.ID) + { + return i; + } + } + + return -1; + } + } +} diff --git a/MagicalLifeAPI/Entities/Movement/StandardPathFinder.cs b/MagicalLifeAPI/Entities/Movement/StandardPathFinder.cs new file mode 100644 index 00000000..3eeeb2b9 --- /dev/null +++ b/MagicalLifeAPI/Entities/Movement/StandardPathFinder.cs @@ -0,0 +1,177 @@ +using DijkstraAlgorithm.Graphing; +using DijkstraAlgorithm.Pathing; +using MagicalLifeAPI.World; +using System.Linq; + +namespace MagicalLifeAPI.Entities.Movement +{ + /// + /// A class that handles the construction of the graph used to do optimal pathfinding. + /// + public static class StandardPathFinder + { + /// + /// Holds data that describes which tiles connect to which tiles. + /// This graph contains data used to pathfind for the standard movement. + /// + private static GraphBuilder tileConnectionGraph = new GraphBuilder(); + + private static Graph builtGraph; + + /// + /// Used to determine the fastest route between two points. + /// + private static PathFinder pathFinder; + + /// + /// Returns the fastest route between the source and destination tiles. + /// + /// + /// + /// + public static Path GetFastestPath(Tile source, Tile destination) + { + Path path = pathFinder.FindShortestPath( + StandardPathFinder.builtGraph.Nodes.Single(node => node.Id == source.Location.ToString()), + StandardPathFinder.builtGraph.Nodes.Single(node => node.Id == destination.Location.ToString())); + return path; + } + + /// + /// Populates the with data. + /// This should be called once after the world is generated. + /// + /// + public static void BuildPathGraph(World.World world) + { + StandardPathFinder.AddNodes(world); + StandardPathFinder.AddLinkes(world); + StandardPathFinder.builtGraph = StandardPathFinder.tileConnectionGraph.Build(); + StandardPathFinder.pathFinder = new PathFinder(StandardPathFinder.builtGraph); + } + + /// + /// Creates connections between tiles in the . + /// + /// + private static void AddLinkes(World.World world) + { + Tile[,,] tiles = world.Tiles; + int xSize = tiles.GetLength(0); + int ySize = tiles.GetLength(1); + int zSize = tiles.GetLength(2); + + int x = 0; + int y = 0; + int z = 0; + + //Iterate over each row. + for (int i = 0; i < xSize; i++) + { + //Iterate over each column + for (int ii = 0; ii < ySize; ii++) + { + //Iterate over the depth of each tile in the z axis. + for (int iii = 0; iii < zSize; iii++) + { + //Each tile can be accessed by the xyz coordinates from this inner loop properly. + StandardPathFinder.AddNeighborLink(1, 0, 0, tiles, tiles[x, y, z]); + StandardPathFinder.AddNeighborLink(-1, 0, 0, tiles, tiles[x, y, z]); + StandardPathFinder.AddNeighborLink(0, 1, 0, tiles, tiles[x, y, z]); + StandardPathFinder.AddNeighborLink(0, -1, 0, tiles, tiles[x, y, z]); + StandardPathFinder.AddNeighborLink(1, 1, 0, tiles, tiles[x, y, z]); + StandardPathFinder.AddNeighborLink(1, -1, 0, tiles, tiles[x, y, z]); + StandardPathFinder.AddNeighborLink(-1, 1, 0, tiles, tiles[x, y, z]); + StandardPathFinder.AddNeighborLink(-1, -1, 0, tiles, tiles[x, y, z]); + z++; + } + y++; + z = 0; + } + y = 0; + x++; + } + } + + /// + /// Adds a link to a neighboring tile if the tile exists/is in bounds. + /// + /// + /// + /// + private static void AddNeighborLink(int xChange, int yChange, int zChange, Tile[,,] tiles, Tile source) + { + int x = (int)source.Location.X; + int y = (int)source.Location.Y; + int z = (int)source.Location.Z; + + if (x + xChange > -1 && x + xChange < tiles.GetLength(0)) + { + x += xChange; + } + else + { + //The neighboring tile didn't exist. + return; + } + + if (y + yChange > -1 && y + yChange < tiles.GetLength(1)) + { + y += yChange; + } + else + { + //The neighboring tile didn't exist. + return; + } + + if (z + zChange > -1 && z + zChange < tiles.GetLength(2)) + { + z += zChange; + } + else + { + //The neighboring tile didn't exist. + return; + } + + StandardPathFinder.tileConnectionGraph.AddLink(source.Location.ToString(), tiles[x, y, z].Location.ToString(), 101 - tiles[x, y, z].MovementCost); + } + + /// + /// Adds tiles as nodes into the . + /// + /// + private static void AddNodes(World.World world) + { + Tile[,,] tiles = world.Tiles; + int xSize = tiles.GetLength(0); + int ySize = tiles.GetLength(1); + int zSize = tiles.GetLength(2); + + int x = 0; + int y = 0; + int z = 0; + + //Iterate over each row. + for (int i = 0; i < xSize; i++) + { + //Iterate over each column + for (int ii = 0; ii < ySize; ii++) + { + //Iterate over the depth of each tile in the z axis. + for (int iii = 0; iii < zSize; iii++) + { + //Each tile can be accessed by the xyz coordinates from this inner loop properly. + StandardPathFinder.tileConnectionGraph.AddNode(tiles[x, y, z].Location.ToString()); + z++; + } + y++; + z = 0; + } + y = 0; + x++; + } + } + } +} \ No newline at end of file diff --git a/MagicalLifeAPI/Entities/Util/Attribute.cs b/MagicalLifeAPI/Entities/Util/Attribute.cs index 001cff74..0dc11f6d 100644 --- a/MagicalLifeAPI/Entities/Util/Attribute.cs +++ b/MagicalLifeAPI/Entities/Util/Attribute.cs @@ -1,4 +1,4 @@ -using MagicalLifeAPI.Entities.Util.IModifierRemoveConditions; +using MagicalLifeAPI.Entities.Util.Modifier_Remove_Conditions; using MagicalLifeAPI.Universal; using System; using System.Collections.Generic; @@ -9,15 +9,10 @@ public class Attribute { public Attribute() { - MajorEvents.TurnEnd += this.MajorEvents_TurnEnd; + World.World.TurnEnd += this.World_TurnEnd; } - public Attribute(int value) : this() - { - this.AddModifier(new Tuple(value, new NeverRemoveCondition(), "Base value")); - } - - private void MajorEvents_TurnEnd(object sender, EventArgs e) + private void World_TurnEnd(object sender, World.WorldEventArgs e) { List> remove = new List>(); foreach (Tuple item in this.Modifiers) @@ -34,6 +29,11 @@ private void MajorEvents_TurnEnd(object sender, EventArgs e) } } + public Attribute(int value) : this() + { + this.AddModifier(new Tuple(value, new NeverRemoveCondition(), "Base value")); + } + public Int64 GetValue() { Int64 ret = 0; diff --git a/MagicalLifeAPI/Entities/Util/IModifierRemoveCondition.cs b/MagicalLifeAPI/Entities/Util/Modifier Remove Conditions/IModifierRemoveCondition.cs similarity index 85% rename from MagicalLifeAPI/Entities/Util/IModifierRemoveCondition.cs rename to MagicalLifeAPI/Entities/Util/Modifier Remove Conditions/IModifierRemoveCondition.cs index 7e65471b..5b8854dd 100644 --- a/MagicalLifeAPI/Entities/Util/IModifierRemoveCondition.cs +++ b/MagicalLifeAPI/Entities/Util/Modifier Remove Conditions/IModifierRemoveCondition.cs @@ -1,4 +1,4 @@ -namespace MagicalLifeAPI.Entities.Util +namespace MagicalLifeAPI.Entities.Util.Modifier_Remove_Conditions { /// /// Utilized to allow for custom events/circumstances to be used to determine when a modifier wears off. diff --git a/MagicalLifeAPI/Entities/Util/IModifierRemoveConditions/NeverRemoveCondition.cs b/MagicalLifeAPI/Entities/Util/Modifier Remove Conditions/NeverRemoveCondition.cs similarity index 77% rename from MagicalLifeAPI/Entities/Util/IModifierRemoveConditions/NeverRemoveCondition.cs rename to MagicalLifeAPI/Entities/Util/Modifier Remove Conditions/NeverRemoveCondition.cs index 32bf2744..22160dc5 100644 --- a/MagicalLifeAPI/Entities/Util/IModifierRemoveConditions/NeverRemoveCondition.cs +++ b/MagicalLifeAPI/Entities/Util/Modifier Remove Conditions/NeverRemoveCondition.cs @@ -1,4 +1,4 @@ -namespace MagicalLifeAPI.Entities.Util.IModifierRemoveConditions +namespace MagicalLifeAPI.Entities.Util.Modifier_Remove_Conditions { /// /// We shall never remove this modifier. diff --git a/MagicalLifeAPI/Entities/Util/Modifier Remove Conditions/TimeRemoveCondition.cs b/MagicalLifeAPI/Entities/Util/Modifier Remove Conditions/TimeRemoveCondition.cs new file mode 100644 index 00000000..ec213c0d --- /dev/null +++ b/MagicalLifeAPI/Entities/Util/Modifier Remove Conditions/TimeRemoveCondition.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MagicalLifeAPI.Entities.Util.Modifier_Remove_Conditions +{ + /// + /// This modifier condition allows remove of the modifier after a certain number of turns. + /// + public class TimeRemoveCondition : IModifierRemoveCondition + { + private int Turns; + /// The number of turns until the modifier is allowed to expire. + public TimeRemoveCondition(int turns) + { + this.Turns = turns; + } + + public bool WearOff() + { + this.Turns--; + + return this.Turns == 0; + } + } +} diff --git a/MagicalLifeAPI/MagicalLifeAPI.csproj b/MagicalLifeAPI/MagicalLifeAPI.csproj index 433b03b9..5d82f150 100644 --- a/MagicalLifeAPI/MagicalLifeAPI.csproj +++ b/MagicalLifeAPI/MagicalLifeAPI.csproj @@ -31,6 +31,9 @@ 4 + + ..\Libs\DijkstraAlgorithm.dll + @@ -43,29 +46,37 @@ + + - - + + + + + + + + diff --git a/MagicalLifeAPI/Universal/MajorEvents.cs b/MagicalLifeAPI/Universal/MajorEvents.cs index b82fe78d..71b689e0 100644 --- a/MagicalLifeAPI/Universal/MajorEvents.cs +++ b/MagicalLifeAPI/Universal/MajorEvents.cs @@ -1,5 +1,5 @@ -using System; - +using MagicalLifeAPI.World; +using System; namespace MagicalLifeAPI.Universal { /// @@ -8,15 +8,5 @@ namespace MagicalLifeAPI.Universal public static class MajorEvents { //https://www.codeproject.com/Articles/11541/The-Simplest-C-Events-Example-Imaginable - - /// - /// Raised at the start of each turn. - /// - public static event EventHandler TurnStart; - - /// - /// Raised at the end of each turn. - /// - public static event EventHandler TurnEnd; } } \ No newline at end of file diff --git a/MagicalLifeAPI/Util/Extensions.cs b/MagicalLifeAPI/Util/Extensions.cs new file mode 100644 index 00000000..371b2f9a --- /dev/null +++ b/MagicalLifeAPI/Util/Extensions.cs @@ -0,0 +1,21 @@ +using DijkstraAlgorithm.Pathing; +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MagicalLifeAPI.Util +{ + public static class Extensions + { + public static void EnqueueCollection(System.Collections.Generic.Queue queue, IReadOnlyList segments) + { + foreach (PathSegment item in segments) + { + queue.Enqueue(item); + } + } + } +} diff --git a/MagicalLifeAPI/Util/MathUtil.cs b/MagicalLifeAPI/Util/MathUtil.cs index 7907ce42..64a6a8c4 100644 --- a/MagicalLifeAPI/Util/MathUtil.cs +++ b/MagicalLifeAPI/Util/MathUtil.cs @@ -1,4 +1,5 @@ using System; +using System.Drawing; namespace MagicalLifeAPI.Util { @@ -16,5 +17,16 @@ public static int Round(double value) { return (int)Math.Round(value); } + + /// + /// Returns the distance between point a and point b. + /// + /// + /// + /// + public static int GetDistance(Point a, Point b) + { + return (int)Math.Sqrt(Math.Pow(b.X - a.X, 2) + Math.Pow(b.Y - a.Y, 2)); + } } } \ No newline at end of file diff --git a/MagicalLifeAPI/World/Base/Tile.cs b/MagicalLifeAPI/World/Base/Tile.cs index 521c8de8..3e6f5ad6 100644 --- a/MagicalLifeAPI/World/Base/Tile.cs +++ b/MagicalLifeAPI/World/Base/Tile.cs @@ -1,9 +1,9 @@ -using MagicalLifeAPI.Entities; +using MagicalLifeAPI.DataTypes; +using MagicalLifeAPI.Entities; using MagicalLifeAPI.Universal; using MagicalLifeAPI.World.Base; using System.Collections.Generic; using System.Drawing; -using System.Web.UI.DataVisualization.Charting; namespace MagicalLifeAPI.World { @@ -13,9 +13,11 @@ public abstract class Tile : Unique /// Initializes a new tile object. /// /// The 3D location of this tile in the map. - public Tile(Point3D location) + /// This value is the movement cost of walking on this tile. It should be between 1 and 100 + public Tile(Point3D location, int movementCost) { this.Location = location; + this.MovementCost = movementCost; } /// @@ -23,6 +25,12 @@ public Tile(Point3D location) /// public string BiomeName { get; } + /// + /// Returns the movement cost of this tile. + /// Should be between 1-100. + /// + public int MovementCost { get; protected set; } + /// /// The size, in pixels of how big each tile is. /// @@ -59,6 +67,6 @@ public static Size GetTileSize() /// /// A list containing all living entities on this tile. /// - public Queue Living { get; set; } = new Queue(); + public List Living { get; set; } = new List(); } } \ No newline at end of file diff --git a/MagicalLifeAPI/World/Tiles/Dirt.cs b/MagicalLifeAPI/World/Tiles/Dirt.cs index 42fc1e46..9cbbb537 100644 --- a/MagicalLifeAPI/World/Tiles/Dirt.cs +++ b/MagicalLifeAPI/World/Tiles/Dirt.cs @@ -1,4 +1,4 @@ -using System.Web.UI.DataVisualization.Charting; +using MagicalLifeAPI.DataTypes; namespace MagicalLifeAPI.World.Tiles { @@ -7,7 +7,7 @@ namespace MagicalLifeAPI.World.Tiles /// public class Dirt : Tile { - public Dirt(Point3D location) : base(location) + public Dirt(Point3D location) : base(location, 10) { //this.AdditionalMovementCost = 0; } @@ -20,6 +20,7 @@ public override string GetName() public override string GetTextureName() { return "DirtTile.png"; + //return "TestTile.png"; } } } \ No newline at end of file diff --git a/MagicalLifeAPI/World/World Generation/Generators/Dirtland.cs b/MagicalLifeAPI/World/World Generation/Generators/Dirtland.cs index 13ede7de..32a91b32 100644 --- a/MagicalLifeAPI/World/World Generation/Generators/Dirtland.cs +++ b/MagicalLifeAPI/World/World Generation/Generators/Dirtland.cs @@ -1,7 +1,7 @@ -using MagicalLifeAPI.Entities.Entity_Factory; +using MagicalLifeAPI.DataTypes; +using MagicalLifeAPI.Entities.Entity_Factory; using MagicalLifeAPI.Util; using MagicalLifeAPI.World.Tiles; -using System.Web.UI.DataVisualization.Charting; namespace MagicalLifeAPI.World.World_Generation.Generators { @@ -54,7 +54,7 @@ public class Dirtland : WorldGenerator int z = zSize - 1; HumanFactory hFactory = new HumanFactory(); - map[x, y, z].Living.Enqueue(hFactory.GenerateHuman()); + map[x, y, z].Living.Add(hFactory.GenerateHuman()); return map; } diff --git a/MagicalLifeAPI/World/World.cs b/MagicalLifeAPI/World/World.cs index 90fb091c..985d472f 100644 --- a/MagicalLifeAPI/World/World.cs +++ b/MagicalLifeAPI/World/World.cs @@ -1,4 +1,14 @@ -using MagicalLifeAPI.Universal; +using MagicalLifeAPI.DataTypes; +using MagicalLifeAPI.Util; +using System.Collections.Generic; +using System.Collections; +using System.Runtime.CompilerServices; +using DijkstraAlgorithm.Pathing; +using MagicalLifeAPI.Entities; +using MagicalLifeAPI.Entities.Movement; +using MagicalLifeAPI.Entities.Util; +using MagicalLifeAPI.Universal; +using System; namespace MagicalLifeAPI.World { @@ -10,18 +20,97 @@ public class World : Unique /// /// A 3D array that holds every tile in the current world. /// - public Tile[,,] Tiles { get; } + public Tile[,,] Tiles { get; private set; } + + /// + /// Raised when the world is finished generating for the first time. + /// + public event EventHandler WorldGenerated; + + /// + /// Raised at the start of each turn. + /// + public static event EventHandler TurnStart; + + /// + /// Raised at the end of each turn. + /// + public static event EventHandler TurnEnd; + + public static World mainWorld { get; protected set; } + + /// + /// If true, it is the player's turn. If not, AI logic and other logic should be running. + /// + public static bool IsPlayersTurn { get; private set; } = false; + + public World() + { + } /// /// Generates a new world with the specified height, width, depth, and world generator. /// - /// - /// - /// - /// - public World(int width, int height, int depth, WorldGenerator generator) + public static void Initialize(int width, int height, int depth, WorldGenerator generator) + { + mainWorld = new World(); + mainWorld.Tiles = mainWorld.GenerateWorld(height, width, depth, generator); + + WorldEventArgs worldEventArgs = new WorldEventArgs(mainWorld); + mainWorld.WorldGeneratedHandler(worldEventArgs); + StandardPathFinder.BuildPathGraph(mainWorld); + + World.TurnStartHandler(new WorldEventArgs(mainWorld)); + } + + private static void TestMove() { - this.Tiles = this.GenerateWorld(height, width, depth, generator); + Living found = TestFindEntity(mainWorld.Tiles).Living[0]; + Tile start = TestFindEntity(mainWorld.Tiles); + + Point3D des = new Point3D(10, 2, 1); + if (start.Location != des && found.QueuedMovement.Count == 0) + { + Path pth = StandardPathFinder.GetFastestPath(start, mainWorld.Tiles[10, 2, 1]); + + Extensions.EnqueueCollection(found.QueuedMovement, pth.Segments); + EntityWorldMovement.MoveEntity(ref found); + } + } + + private static Tile TestFindEntity(Tile[,,] tiles) + { + int xSize = tiles.GetLength(0); + int ySize = tiles.GetLength(1); + int zSize = tiles.GetLength(2); + + int x = 0; + int y = 0; + int z = 0; + + //Iterate over each row. + for (int i = 0; i < xSize; i++) + { + //Iterate over each column + for (int ii = 0; ii < ySize; ii++) + { + //Iterate over the depth of each tile in the z axis. + for (int iii = 0; iii < zSize; iii++) + { + //Each tile can be accessed by the xyz coordinates from this inner loop properly. + if (tiles[x, y, z].Living.Count > 0) + { + return tiles[x, y, z]; + } + z++; + } + y++; + z = 0; + } + y = 0; + x++; + } + return null; } /// @@ -44,5 +133,53 @@ public World(int width, int height, int depth, WorldGenerator generator) return stage2; } + + public static void EndTurn() + { + TestMove(); + TurnEndHandler(new WorldEventArgs(mainWorld)); + TurnStartHandler(new WorldEventArgs(mainWorld)); + } + + /// + /// Raises the world generated event. + /// + /// + protected virtual void WorldGeneratedHandler(WorldEventArgs e) + { + EventHandler handler = WorldGenerated; + if (handler != null) + { + handler(this, e); + } + } + + /// + /// Raises the world generated event. + /// + /// + public static void TurnStartHandler(WorldEventArgs e) + { + EventHandler handler = TurnStart; + if (handler != null) + { + World.IsPlayersTurn = true; + handler(World.mainWorld, e); + } + } + + /// + /// Raises the world generated event. + /// + /// + public static void TurnEndHandler(WorldEventArgs e) + { + EventHandler handler = TurnEnd; + if (handler != null) + { + World.IsPlayersTurn = false; + handler(World.mainWorld, e); + } + } } } \ No newline at end of file diff --git a/MagicalLifeAPI/World/WorldEventArgs.cs b/MagicalLifeAPI/World/WorldEventArgs.cs new file mode 100644 index 00000000..c80339ce --- /dev/null +++ b/MagicalLifeAPI/World/WorldEventArgs.cs @@ -0,0 +1,20 @@ +using System; + +namespace MagicalLifeAPI.World +{ + /// + /// Event arguments for any event involving the world. + /// + public class WorldEventArgs : EventArgs + { + /// + /// The current state of the world. + /// + public World World { get; protected set; } + + public WorldEventArgs(World world) + { + this.World = world; + } + } +} \ No newline at end of file diff --git a/MagicalLifeAPI/World/WorldUtil.cs b/MagicalLifeAPI/World/WorldUtil.cs new file mode 100644 index 00000000..d8c2cb99 --- /dev/null +++ b/MagicalLifeAPI/World/WorldUtil.cs @@ -0,0 +1,30 @@ +using System.Diagnostics; +using MagicalLifeAPI.DataTypes; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MagicalLifeAPI.World +{ + /// + /// Holds some utilities for world stuff. + /// + public static class WorldUtil + { + /// + /// Returns a tile based on it's location in string format. + /// + /// + /// + public static Tile GetTileByID(Tile[,,] tiles, string str) + { + Point3D point = new Point3D(str); + Debug.WriteLine("Get tile by ID: "); + Debug.WriteLine(str); + Debug.WriteLine(point.X + " " + point.Y + " " + point.Z); + return tiles[point.X, point.Y, point.Z]; + } + } +} diff --git a/MagicalLifeGUI/Form1.Designer.cs b/MagicalLifeGUI/Form1.Designer.cs index eb1369f3..3728534f 100644 --- a/MagicalLifeGUI/Form1.Designer.cs +++ b/MagicalLifeGUI/Form1.Designer.cs @@ -65,6 +65,7 @@ private void InitializeComponent() this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown); this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress); + this.MouseClick += new System.Windows.Forms.MouseEventHandler(this.Form1_MouseClick); this.ResumeLayout(false); } diff --git a/MagicalLifeGUI/Form1.cs b/MagicalLifeGUI/Form1.cs index 7696d79e..7221a0d4 100644 --- a/MagicalLifeGUI/Form1.cs +++ b/MagicalLifeGUI/Form1.cs @@ -1,7 +1,9 @@ -using MagicalLifeAPI.World; +using MagicalLifeAPI.Universal; +using MagicalLifeRenderEngine.Main.GUI.Click; +using MagicalLifeAPI.World; using MagicalLifeAPI.World.World_Generation.Generators; -using MagicalLifeGUI.Storage; using MagicalLifeRenderEngine.Main; +using MagicalLifeSettings.Storage; using System; using System.Drawing; using System.Windows.Forms; @@ -10,7 +12,6 @@ namespace MagicalLifeGUI { public partial class Form1 : Form { - private World world; private Pipe pipe = new Pipe(); private Bitmap screen; @@ -19,6 +20,18 @@ public partial class Form1 : Form public Form1() { InitializeComponent(); + World.TurnStart += this.World_TurnStart; + World.TurnEnd += this.World_TurnEnd; + } + + private void World_TurnEnd(object sender, WorldEventArgs e) + { + this.Refresh(); + } + + private void World_TurnStart(object sender, WorldEventArgs e) + { + this.Refresh(); } private void Form1_Load(object sender, System.EventArgs e) @@ -33,9 +46,9 @@ private void QuitButton_Click(object sender, System.EventArgs e) private void NewGameButton_Click(object sender, EventArgs e) { this.ToggleMainMenu(); - this.world = new World(MainWindow.Default.ScreenSize.Height / Tile.GetTileSize().Height, + World.Initialize(MainWindow.Default.ScreenSize.Height / Tile.GetTileSize().Height, MainWindow.Default.ScreenSize.Width / Tile.GetTileSize().Width, 2, new Dirtland()); - screen = pipe.GetTiles(1, this.world); + screen = pipe.GetScreen(1); } /// @@ -62,7 +75,7 @@ private void Form1_Paint(object sender, PaintEventArgs e) if (this.screen != null) { //e.Graphics.DrawImage(this.screen, new Point(0, 0)); - e.Graphics.DrawImage(this.screen, new Rectangle(new Point(0, 0), MainWindow.Default.ScreenSize)); + e.Graphics.DrawImage(this.pipe.GetScreen(1), new Rectangle(new Point(0, 0), MainWindow.Default.ScreenSize)); } } @@ -77,5 +90,10 @@ private void Form1_KeyDown(object sender, KeyEventArgs e) this.ToggleMainMenu(); } } + + private void Form1_MouseClick(object sender, MouseEventArgs e) + { + ClickDistributor.Click(e); + } } } \ No newline at end of file diff --git a/MagicalLifeGUI/MagicalLifeGUI.csproj b/MagicalLifeGUI/MagicalLifeGUI.csproj index fca62267..d3d71e27 100644 --- a/MagicalLifeGUI/MagicalLifeGUI.csproj +++ b/MagicalLifeGUI/MagicalLifeGUI.csproj @@ -55,39 +55,12 @@ - - True - True - KeyBindings.settings - - - True - True - MainWindow.settings - - - True - True - Universal.settings - Form1.cs - - PublicSettingsSingleFileGenerator - MainWindow.Designer.cs - - - PublicSettingsSingleFileGenerator - Universal.Designer.cs - - - PublicSettingsSingleFileGenerator - KeyBindings.Designer.cs - @@ -98,6 +71,10 @@ {c1553f02-e940-4f5e-8c8c-dd6184922d86} MagicalLifeRenderEngine + + {76b12b63-df5d-40fd-8e90-03395095dd71} + MagicalLifeSettings + diff --git a/MagicalLifeGUI/StartupForm.cs b/MagicalLifeGUI/StartupForm.cs index 8137f045..83e461c5 100644 --- a/MagicalLifeGUI/StartupForm.cs +++ b/MagicalLifeGUI/StartupForm.cs @@ -1,4 +1,4 @@ -using MagicalLifeGUI.Storage; +using MagicalLifeSettings.Storage; using System.Windows.Forms; namespace MagicalLifeGUI diff --git a/MagicalLifeRenderEngine/MagicalLifeRenderEngine.csproj b/MagicalLifeRenderEngine/MagicalLifeRenderEngine.csproj index bef32e8a..b95f8e50 100644 --- a/MagicalLifeRenderEngine/MagicalLifeRenderEngine.csproj +++ b/MagicalLifeRenderEngine/MagicalLifeRenderEngine.csproj @@ -37,6 +37,7 @@ + @@ -45,10 +46,15 @@ + + + + + @@ -56,6 +62,10 @@ {fe8400a7-9dc8-4ab4-8c54-ac5f36bf7639} MagicalLifeAPI + + {76b12b63-df5d-40fd-8e90-03395095dd71} + MagicalLifeSettings + @@ -72,5 +82,10 @@ + + + + + \ No newline at end of file diff --git a/MagicalLifeRenderEngine/Main/GUI/Click/BoundsSorter.cs b/MagicalLifeRenderEngine/Main/GUI/Click/BoundsSorter.cs new file mode 100644 index 00000000..bbddbb2e --- /dev/null +++ b/MagicalLifeRenderEngine/Main/GUI/Click/BoundsSorter.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MagicalLifeRenderEngine.Main.GUI.Click +{ + /// + /// This class knows how to compare two objects. + /// + public class BoundsSorter : IComparer + { + public int Compare(ClickBounds x, ClickBounds y) + { + return x.Priority.CompareTo(y.Priority); + } + } +} diff --git a/MagicalLifeRenderEngine/Main/GUI/Click/ClickBounds.cs b/MagicalLifeRenderEngine/Main/GUI/Click/ClickBounds.cs new file mode 100644 index 00000000..b2eb1c0b --- /dev/null +++ b/MagicalLifeRenderEngine/Main/GUI/Click/ClickBounds.cs @@ -0,0 +1,58 @@ +using System.Windows.Forms; +using MagicalLifeAPI.Universal; +using System.Drawing; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MagicalLifeRenderEngine.Main.GUI.Click +{ + /// + /// Holds information about where a click is clicking within bounds, as well as priority and a event to subscribe to. + /// + public class ClickBounds : Unique + { + /// + /// The range of this obejct. + /// + public Rectangle Bounds { get; set; } + + /// + /// The priority of this click bounds. + /// The higher the value, the higher the priority. + /// + public int Priority { get; set; } + + /// + /// Constructs a new instance of the class. + /// + /// The point where this click bounds begins. + /// The size of this click bounds. + /// The priority of this click bounds. Must be equal to or greater than 0, unless this clickbounds ALWAYS has priority over other click bounds. + public ClickBounds(Rectangle bounds, int priority) + { + this.Bounds = bounds; + this.Priority = priority; + } + + /// + /// This event is raised whenever this clickbounds is clicked on, and given priority. + /// + public event EventHandler Clicked; + + /// + /// Raises the Clicked event. + /// + /// + public virtual void ClickMe(MouseEventArgs e) + { + EventHandler handler = Clicked; + if (handler != null) + { + handler(this, e); + } + } + } +} diff --git a/MagicalLifeRenderEngine/Main/GUI/Click/ClickDistributor.cs b/MagicalLifeRenderEngine/Main/GUI/Click/ClickDistributor.cs new file mode 100644 index 00000000..8b81facb --- /dev/null +++ b/MagicalLifeRenderEngine/Main/GUI/Click/ClickDistributor.cs @@ -0,0 +1,62 @@ +using System.Drawing; +using System.Windows.Forms; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MagicalLifeRenderEngine.Main.GUI.Click +{ + /// + /// Determines who is being clicked on when the user clicks. + /// + public static class ClickDistributor + { + /// + /// Contains all of the ClickBounds this class handles. + /// + private static SortedSet Bounds = new SortedSet(new BoundsSorter()); + + /// + /// Handles a click. + /// + /// + public static void Click(MouseEventArgs clickData) + { + foreach (ClickBounds item in Bounds) + { + if (item.Bounds.Contains(clickData.Location)) + { + item.ClickMe(clickData); + break; + } + } + } + + /// + /// Adds a object to the system to be handled. + /// + /// + public static void AddClickBounds(ClickBounds bounds) + { + Bounds.Add(bounds); + } + + /// + /// Removes a object by ID. + /// + /// + public static void RemoveClickBounds(Guid boundsID) + { + foreach (ClickBounds item in Bounds) + { + if (item.ID == boundsID) + { + Bounds.Remove(item); + break; + } + } + } + } +} diff --git a/MagicalLifeRenderEngine/Main/GUI/EndTurnButton.cs b/MagicalLifeRenderEngine/Main/GUI/EndTurnButton.cs new file mode 100644 index 00000000..5e3255ea --- /dev/null +++ b/MagicalLifeRenderEngine/Main/GUI/EndTurnButton.cs @@ -0,0 +1,77 @@ +using MagicalLifeRenderEngine.Main.GUI.Click; +using MagicalLifeRenderEngine.Util; +using MagicalLifeAPI.World; +using FastBitmapLib; +using MagicalLifeSettings.Storage; +using System.Drawing; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace MagicalLifeRenderEngine.Main.GUI +{ + /// + /// Knows how to draw the end turn button properly onto the screen. + /// + public static class EndTurnButtonGUI + { + private static readonly Bitmap State1; + private static readonly Bitmap State2; + + private const int scaleSize = 20; + private static Size ImageSize; + private static Size screenSize; + + private static Point drawLocation = new Point(screenSize.Width - ImageSize.Width, screenSize.Height - (int)(ImageSize.Height * 1.75)); + + + + /// + /// The ID of our click bounds. + /// + private static Guid boundsID; + + static EndTurnButtonGUI() + { + screenSize = MainWindow.Default.ScreenSize; + ImageSize = new Size(screenSize.Width / scaleSize, screenSize.Height / scaleSize); + + Bitmap s1 = TextureRegister.GetTexture("EndTurnButtonState1.png"); + Bitmap s2 = TextureRegister.GetTexture("EndTurnButtonState2.png"); + + EndTurnButtonGUI.State1 = new Bitmap(s1, ImageSize); + EndTurnButtonGUI.State2 = new Bitmap(s2, ImageSize); + + ClickBounds bounds = new ClickBounds(new Rectangle(drawLocation, ImageSize), int.MaxValue); + bounds.Clicked += Bounds_Clicked; + boundsID = bounds.ID; + ClickDistributor.AddClickBounds(bounds); + } + + private static void Bounds_Clicked(object sender, System.Windows.Forms.MouseEventArgs e) + { + World.EndTurn(); + } + + /// + /// Draws the end turn button onto the screen properly. + /// + /// + public static void Draw(ref Bitmap screen) + { + Bitmap currentTexture; + + if (World.IsPlayersTurn) + { + currentTexture = State2; + } + else + { + currentTexture = State1; + } + GraphicalUtils.DrawBitmapOnBitmap(currentTexture, screen, drawLocation); + } + } +} diff --git a/MagicalLifeRenderEngine/Main/Pipe.cs b/MagicalLifeRenderEngine/Main/Pipe.cs index 64b69b03..6280ccb5 100644 --- a/MagicalLifeRenderEngine/Main/Pipe.cs +++ b/MagicalLifeRenderEngine/Main/Pipe.cs @@ -1,4 +1,5 @@ -using FastBitmapLib; +using MagicalLifeRenderEngine.Main.GUI; +using FastBitmapLib; using MagicalLifeAPI.World; using System.Drawing; @@ -9,6 +10,21 @@ namespace MagicalLifeRenderEngine.Main /// public class Pipe { + /// + /// Generates the entire screen. The tiles as well as the gui. + /// + /// The level (z axis) that we should generate an image of all the tiles at. + /// + /// + public Bitmap GetScreen(int height) + { + Bitmap tiles = this.GetTiles(height); + EndTurnButtonGUI.Draw(ref tiles); + + + return tiles; + } + /// /// Returns what each tile on the map at a specified height looks like. /// This is a 2D array. @@ -16,15 +32,15 @@ public class Pipe /// The level (z axis) that we should generate an image of all the tiles at. /// /// - public Bitmap GetTiles(int height, World world) + public Bitmap GetTiles(int height) { int x = 0; int y = 0; int z = height; - int xSize = world.Tiles.GetLength(0); - int ySize = world.Tiles.GetLength(1); + int xSize = World.mainWorld.Tiles.GetLength(0); + int ySize = World.mainWorld.Tiles.GetLength(1); - Tile[,,] tiles = world.Tiles; + Tile[,,] tiles = World.mainWorld.Tiles; //The entire map, at the specified height. Bitmap entireMap = new Bitmap(Tile.GetTileSize().Height * xSize, Tile.GetTileSize().Width * ySize); diff --git a/MagicalLifeRenderEngine/Resource/Texture/EndTurnButtonState1.png b/MagicalLifeRenderEngine/Resource/Texture/EndTurnButtonState1.png new file mode 100644 index 00000000..e6aea2e4 Binary files /dev/null and b/MagicalLifeRenderEngine/Resource/Texture/EndTurnButtonState1.png differ diff --git a/MagicalLifeRenderEngine/Resource/Texture/EndTurnButtonState2.png b/MagicalLifeRenderEngine/Resource/Texture/EndTurnButtonState2.png new file mode 100644 index 00000000..1b547c2e Binary files /dev/null and b/MagicalLifeRenderEngine/Resource/Texture/EndTurnButtonState2.png differ diff --git a/MagicalLifeRenderEngine/Util/GraphicalUtils.cs b/MagicalLifeRenderEngine/Util/GraphicalUtils.cs new file mode 100644 index 00000000..308427fe --- /dev/null +++ b/MagicalLifeRenderEngine/Util/GraphicalUtils.cs @@ -0,0 +1,91 @@ +using System.Drawing; +using System; +using System.Collections.Generic; +using System.Diagnostics.Contracts; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using FastBitmapLib; + +namespace MagicalLifeRenderEngine.Util +{ + /// + /// Does some graphically based utilities. + /// + public static class GraphicalUtils + { + /// + /// Draws the source bitmap onto the target bitmap. + /// The target bitmap must be of equal or greater size to the source bitmap. + /// + /// + /// + /// The point to begin drawing the source bitmap at onto the target bitmap. + /// + public static Bitmap DrawBitmapOnBitmap(Bitmap source, Bitmap target, Point startingDestination) + { + int width = source.Width; + int height = source.Height; + + using (FastBitmap fastTarget = target.FastLock(), fastForeBitmap = source.FastLock()) + { + for (int y = 0; y < height; y++) + { + for (int x = 0; x < width; x++) + { + fastTarget.SetPixel(x + startingDestination.X, y + startingDestination.Y, FlattenColor(fastTarget.GetPixelUInt(x, y), fastForeBitmap.GetPixelUInt(x, y))); + } + } + } + + return target; + } + + /// + /// Flattens two colors using a GDI+ like color blending mode + /// + /// The back color to blend + /// The fore color to blend + /// The two colors, blended with a GDI+ like color bleding mode + [Pure] + public static uint FlattenColor(uint backColor, uint foreColor) + { + // Based off an answer by an anonymous user on StackOverlow http://stackoverflow.com/questions/1718825/blend-formula-for-gdi/2223241#2223241 + byte foreA = (byte)((foreColor >> 24) & 0xFF); + + if (foreA == 0) + { + return backColor; + } + + if (foreA == 255) + { + return foreColor; + } + + byte foreR = (byte)((foreColor >> 16) & 0xFF); + byte foreG = (byte)((foreColor >> 8) & 0xFF); + byte foreB = (byte)((foreColor) & 0xFF); + + byte backA = (byte)((backColor >> 24) & 0xFF); + byte backR = (byte)((backColor >> 16) & 0xFF); + byte backG = (byte)((backColor >> 8) & 0xFF); + byte backB = (byte)((backColor) & 0xFF); + + float backAlphaFloat = backA; + float foreAlphaFloat = foreA; + + float foreAlphaNormalized = foreAlphaFloat / 255; + float backColorMultiplier = backAlphaFloat * (1 - foreAlphaNormalized); + + float alpha = backAlphaFloat + foreAlphaFloat - backAlphaFloat * foreAlphaNormalized; + + uint finalA = (uint)Math.Min(255, alpha); + uint finalR = (uint)(Math.Min(255, (foreR * foreAlphaFloat + backR * backColorMultiplier) / alpha)); + uint finalG = (uint)(Math.Min(255, (foreG * foreAlphaFloat + backG * backColorMultiplier) / alpha)); + uint finalB = (uint)(Math.Min(255, (foreB * foreAlphaFloat + backB * backColorMultiplier) / alpha)); + + return finalA << 24 | finalR << 16 | finalG << 8 | finalB; + } + } +} \ No newline at end of file diff --git a/MagicalLifeSettings/MagicalLifeSettings.csproj b/MagicalLifeSettings/MagicalLifeSettings.csproj new file mode 100644 index 00000000..67dbdfd2 --- /dev/null +++ b/MagicalLifeSettings/MagicalLifeSettings.csproj @@ -0,0 +1,81 @@ + + + + + Debug + AnyCPU + {76B12B63-DF5D-40FD-8E90-03395095DD71} + Library + Properties + MagicalLifeSettings + MagicalLifeSettings + v4.6.1 + 512 + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + KeyBindings.settings + True + True + + + MainWindow.settings + True + True + + + Universal.settings + True + True + + + + + PublicSettingsSingleFileGenerator + KeyBindings.Designer.cs + + + + + PublicSettingsSingleFileGenerator + MainWindow.Designer.cs + + + + + PublicSettingsSingleFileGenerator + Universal.Designer.cs + + + + \ No newline at end of file diff --git a/MagicalLifeSettings/Properties/AssemblyInfo.cs b/MagicalLifeSettings/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..b8a9efde --- /dev/null +++ b/MagicalLifeSettings/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("MagicalLifeSettings")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("MagicalLifeSettings")] +[assembly: AssemblyCopyright("Copyright © 2018")] +[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("76b12b63-df5d-40fd-8e90-03395095dd71")] + +// 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/MagicalLifeGUI/Storage/KeyBindings.Designer.cs b/MagicalLifeSettings/Storage/KeyBindings.Designer.cs similarity index 97% rename from MagicalLifeGUI/Storage/KeyBindings.Designer.cs rename to MagicalLifeSettings/Storage/KeyBindings.Designer.cs index 4219cc08..b7525b83 100644 --- a/MagicalLifeGUI/Storage/KeyBindings.Designer.cs +++ b/MagicalLifeSettings/Storage/KeyBindings.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace MagicalLifeGUI.Storage { +namespace MagicalLifeSettings.Storage { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] diff --git a/MagicalLifeGUI/Storage/KeyBindings.settings b/MagicalLifeSettings/Storage/KeyBindings.settings similarity index 100% rename from MagicalLifeGUI/Storage/KeyBindings.settings rename to MagicalLifeSettings/Storage/KeyBindings.settings diff --git a/MagicalLifeGUI/Storage/MainWindow.Designer.cs b/MagicalLifeSettings/Storage/MainWindow.Designer.cs similarity index 98% rename from MagicalLifeGUI/Storage/MainWindow.Designer.cs rename to MagicalLifeSettings/Storage/MainWindow.Designer.cs index 5f843c1b..82d06dd1 100644 --- a/MagicalLifeGUI/Storage/MainWindow.Designer.cs +++ b/MagicalLifeSettings/Storage/MainWindow.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace MagicalLifeGUI.Storage { +namespace MagicalLifeSettings.Storage { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] diff --git a/MagicalLifeGUI/Storage/MainWindow.settings b/MagicalLifeSettings/Storage/MainWindow.settings similarity index 100% rename from MagicalLifeGUI/Storage/MainWindow.settings rename to MagicalLifeSettings/Storage/MainWindow.settings diff --git a/MagicalLifeGUI/Storage/Universal.Designer.cs b/MagicalLifeSettings/Storage/Universal.Designer.cs similarity index 97% rename from MagicalLifeGUI/Storage/Universal.Designer.cs rename to MagicalLifeSettings/Storage/Universal.Designer.cs index 2973ef62..62f01c99 100644 --- a/MagicalLifeGUI/Storage/Universal.Designer.cs +++ b/MagicalLifeSettings/Storage/Universal.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace MagicalLifeGUI.Storage { +namespace MagicalLifeSettings.Storage { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] diff --git a/MagicalLifeGUI/Storage/Universal.settings b/MagicalLifeSettings/Storage/Universal.settings similarity index 100% rename from MagicalLifeGUI/Storage/Universal.settings rename to MagicalLifeSettings/Storage/Universal.settings diff --git a/TilesEnumeration.snippet b/TilesEnumeration.snippet new file mode 100644 index 00000000..a206c254 --- /dev/null +++ b/TilesEnumeration.snippet @@ -0,0 +1,43 @@ + + + +
+ TilesEnumeration +
+ + + + + +
+
\ No newline at end of file