aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2020-05-12 12:37:53 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2020-05-12 12:37:53 +0300
commit39cba7ccdfc9e71e8bff5df2f1a6ff28a2ae3556 (patch)
treec67bcb9747c2539e39403a94db95b73ee054b1f8
parent46739772abb75cc1a27ecef6183bfcc65edc3a88 (diff)
downloadMundus-39cba7ccdfc9e71e8bff5df2f1a6ff28a2ae3556.tar
Mundus-39cba7ccdfc9e71e8bff5df2f1a6ff28a2ae3556.tar.gz
Mundus-39cba7ccdfc9e71e8bff5df2f1a6ff28a2ae3556.zip
Finished refactoring of data layer. Found a wierd bug with mob fighting (some are shown but you cant interract, after killing one the drops from the same mob are broken).
-rw-r--r--CREATE MySQL queries.sql2
-rw-r--r--Mundus/Data/Crafting/CraftingTableContext.cs90
-rw-r--r--Mundus/Data/DataBaseContexts.cs47
-rw-r--r--Mundus/Data/Dialogues/DI.cs33
-rw-r--r--Mundus/Data/GameEventLog.cs16
-rw-r--r--Mundus/Data/GameEventLogContext.cs37
-rw-r--r--Mundus/Data/GameEventLogs/GameEventLog.cs28
-rw-r--r--Mundus/Data/GameEventLogs/GameEventLogContext.cs64
-rw-r--r--Mundus/Data/SuperLayers/DBTables/LGPlacedTile.cs15
-rw-r--r--Mundus/Data/SuperLayers/DBTables/LMPlacedTile.cs23
-rw-r--r--Mundus/Data/SuperLayers/DBTables/LSPlacedTile.cs22
-rw-r--r--Mundus/Data/SuperLayers/DBTables/PlacedTile.cs37
-rw-r--r--Mundus/Data/SuperLayers/DBTables/SGPlacedTile.cs15
-rw-r--r--Mundus/Data/SuperLayers/DBTables/SMPlacedTile.cs22
-rw-r--r--Mundus/Data/SuperLayers/DBTables/SSPlacedTile.cs22
-rw-r--r--Mundus/Data/SuperLayers/DBTables/UGPlacedTile.cs15
-rw-r--r--Mundus/Data/SuperLayers/DBTables/UMPlacedTile.cs22
-rw-r--r--Mundus/Data/SuperLayers/DBTables/USPlacedTile.cs22
-rw-r--r--Mundus/Data/SuperLayers/ISuperLayerContext.cs64
-rw-r--r--Mundus/Data/SuperLayers/LandContext.cs188
-rw-r--r--Mundus/Data/SuperLayers/Mobs/MI.cs22
-rw-r--r--Mundus/Data/SuperLayers/SkyContext.cs187
-rw-r--r--Mundus/Data/SuperLayers/UndergroundContext.cs187
-rw-r--r--Mundus/Data/Values.cs49
-rw-r--r--Mundus/Data/Windows/WI.cs74
-rw-r--r--Mundus/Mundus.csproj13
-rw-r--r--Mundus/Service/Tiles/Crafting/CraftingRecipe.cs2
27 files changed, 945 insertions, 373 deletions
diff --git a/CREATE MySQL queries.sql b/CREATE MySQL queries.sql
index 399eff9..8f0edc7 100644
--- a/CREATE MySQL queries.sql
+++ b/CREATE MySQL queries.sql
@@ -6,7 +6,7 @@ CREATE TABLE GameEventLogs (
message VARCHAR(100) NOT NULL
);
-CREATE TABLE Recipes (
+CREATE TABLE CraftingRecipes (
id INT NOT NULL PRIMARY KEY AUTO_INCREMENT,
resultitem VARCHAR(45) NOT NULL,
count1 INT NOT NULL,
diff --git a/Mundus/Data/Crafting/CraftingTableContext.cs b/Mundus/Data/Crafting/CraftingTableContext.cs
index 6f7c6bb..284573f 100644
--- a/Mundus/Data/Crafting/CraftingTableContext.cs
+++ b/Mundus/Data/Crafting/CraftingTableContext.cs
@@ -1,45 +1,73 @@
-using System.Linq;
-using Microsoft.EntityFrameworkCore;
-using Mundus.Data.Superlayers.Mobs;
-using Mundus.Service.Tiles.Crafting;
-using Mundus.Service.Tiles.Items.Presets;
-
-namespace Mundus.Data.Crafting {
- public class CraftingTableContext : DbContext {
- public DbSet<CraftingRecipe> CraftingRecipes { get; private set; }
+namespace Mundus.Data.Crafting
+{
+ using System.Linq;
+ using Microsoft.EntityFrameworkCore;
+ using Mundus.Data.Superlayers.Mobs;
+ using Mundus.Service.Tiles.Crafting;
+ using Mundus.Service.Tiles.Items.Presets;
+ /// <summary>
+ /// Context for getting the crafting recipes
+ /// </summary>
+ public class CraftingTableContext : DbContext
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:Mundus.Data.Crafting.CraftingTableContext"/> class and adds all the recipes to the table
+ /// </summary>
public CraftingTableContext() : base()
- { }
+ {
+ this.AddRecipes();
+ }
- public void AddRecipes() {
- ResetTable();
+ /// <summary>
+ /// Gets DBSet of the CraftingRecipes table
+ /// </summary>
+ /// <value>The crafting recipes.</value>
+ public DbSet<CraftingRecipe> CraftingRecipes { get; private set; }
- CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenShovel().stock_id, 5, MaterialPresets.GetALandStick().stock_id));
- CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenPickaxe().stock_id, 4, MaterialPresets.GetALandStick().stock_id));
- CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenAxe().stock_id, 3, MaterialPresets.GetALandStick().stock_id));
- CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenLongsword().stock_id, 4, MaterialPresets.GetALandStick().stock_id));
+ /// <summary>
+ /// Returns an array with all the recipes that can be crafted with the items the player has
+ /// </summary>
+ public CraftingRecipe[] GetAvalableRecipes()
+ {
+ var recipes = this.CraftingRecipes.ToArray();
+ return recipes.Where(cr => cr.HasEnoughItems(MI.Player.Inventory.Items)).ToArray();
+ }
- CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockShovel().stock_id, 4, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id));
- CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockPickaxe().stock_id, 4, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id));
- CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockAxe().stock_id, 3, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id));
- CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockLongsword().stock_id, 5, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id));
+ // Used to set the connection string
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ optionsBuilder.UseMySQL(DataBaseContexts.ConnectionStringMySQL);
+ }
- CraftingRecipes.Add(new CraftingRecipe(StructurePresets.GetAWoodenLadder().inventory_stock_id, 6, MaterialPresets.GetALandStick().stock_id));
+ /// <summary>
+ /// Truncates CraftingRecipes table and adds the crafting recipes (and saves changes)
+ /// </summary>
+ private void AddRecipes()
+ {
+ this.TruncateTable();
- this.SaveChanges();
- }
+ this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenShovel().stock_id, 5, MaterialPresets.GetALandStick().stock_id));
+ this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenPickaxe().stock_id, 4, MaterialPresets.GetALandStick().stock_id));
+ this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenAxe().stock_id, 3, MaterialPresets.GetALandStick().stock_id));
+ this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenLongsword().stock_id, 4, MaterialPresets.GetALandStick().stock_id));
- private void ResetTable() {
- CraftingRecipes.RemoveRange(CraftingRecipes);
- }
+ this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockShovel().stock_id, 4, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id));
+ this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockPickaxe().stock_id, 4, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id));
+ this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockAxe().stock_id, 3, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id));
+ this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockLongsword().stock_id, 5, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id));
- public CraftingRecipe[] GetAvalableRecipes() {
- var recipes = CraftingRecipes.ToArray();
- return recipes.Where(cr => cr.HasEnoughItems(MI.Player.Inventory.Items)).ToArray();
+ this.CraftingRecipes.Add(new CraftingRecipe(StructurePresets.GetAWoodenLadder().inventory_stock_id, 6, MaterialPresets.GetALandStick().stock_id));
+
+ this.SaveChanges();
}
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
- optionsBuilder.UseMySQL(DataBaseContexts.ConnectionStringMySQL);
+ /// <summary>
+ /// Truncates the table CraftingRecipes (doesn't save the changes)
+ /// </summary>
+ private void TruncateTable()
+ {
+ this.Database.ExecuteSqlRaw("TRUNCATE TABLE CraftingRecipes");
}
}
}
diff --git a/Mundus/Data/DataBaseContexts.cs b/Mundus/Data/DataBaseContexts.cs
index 77425c2..44cad65 100644
--- a/Mundus/Data/DataBaseContexts.cs
+++ b/Mundus/Data/DataBaseContexts.cs
@@ -1,9 +1,17 @@
-using System;
-using Mundus.Data.Crafting;
-using Mundus.Data.SuperLayers;
+namespace Mundus.Data
+{
+ using Mundus.Data.Crafting;
+ using Mundus.Data.GameEventLogs;
+ using Mundus.Data.SuperLayers;
-namespace Mundus.Data {
- public static class DataBaseContexts {
+ /// <summary>
+ /// Used to store all the contexts that correspond to the database tables
+ /// </summary>
+ public static class DataBaseContexts
+ {
+ /// <summary>
+ /// The connection string for MySQL
+ /// </summary>
public const string ConnectionStringMySQL = "server=localhost;" +
"port=3306;" +
"user id=root; " +
@@ -11,17 +19,42 @@ namespace Mundus.Data {
"database=Mundus; " +
"SslMode=none";
+ /// <summary>
+ /// Gets the crafting table context instance
+ /// </summary>
public static CraftingTableContext CTContext { get; private set; }
+
+ /// <summary>
+ /// Gets the game event log table context instance
+ /// </summary>
public static GameEventLogContext GELContext { get; private set; }
+ /// <summary>
+ /// Gets the sky superlayer context instance
+ /// </summary>
public static SkyContext SContext { get; private set; }
+
+ /// <summary>
+ /// Gets the land superlayer context instance
+ /// </summary>
public static LandContext LContext { get; private set; }
+
+ /// <summary>
+ /// Gets the underground superlayer context instance
+ /// </summary>
public static UndergroundContext UContext { get; private set; }
+
+ /// <summary>
+ /// Gets the an array of all superlayer context instances
+ /// </summary>
public static ISuperLayerContext[] SuperLayerContexts { get; private set; }
- public static void CreateInstances() {
+ /// <summary>
+ /// Creates all instances of the contexts
+ /// </summary>
+ public static void CreateInstances()
+ {
CTContext = new CraftingTableContext();
- CTContext.AddRecipes();
GELContext = new GameEventLogContext();
SContext = new SkyContext();
diff --git a/Mundus/Data/Dialogues/DI.cs b/Mundus/Data/Dialogues/DI.cs
index 2f5bd3d..94f9ae7 100644
--- a/Mundus/Data/Dialogues/DI.cs
+++ b/Mundus/Data/Dialogues/DI.cs
@@ -1,19 +1,36 @@
-using Mundus.Views.Dialogs;
-using Gtk;
+namespace Mundus.Data.Dialogues
+{
+ using Mundus.Views.Dialogs;
-namespace Mundus.Data.Dialogues {
- public static class DI { //stands for Dialogue Instances
+ /// <summary>
+ /// Dialog Instances
+ /// Stores and creates all needed dialogs
+ /// </summary>
+ public static class DI
+ {
+ /// <summary>
+ /// Gets the exit dialoge
+ /// </summary>
public static ExitDialog DExit { get; private set; }
- public static void CreateInstances() {
+ /// <summary>
+ /// Creates all dialog instances
+ /// </summary>
+ public static void CreateInstances()
+ {
DExit = new ExitDialog();
HideAll();
}
- //Gtk opens all dialog (window) instances in the project automatically, unless they are hidden
- private static void HideAll() {
+ /// <summary>
+ /// Hides all dialogs
+ /// Gtk opens all dialog (window) instances in the project automatically,
+ /// so you need to manually hide them
+ /// </summary>
+ private static void HideAll()
+ {
DExit.Hide();
}
}
-}
+} \ No newline at end of file
diff --git a/Mundus/Data/GameEventLog.cs b/Mundus/Data/GameEventLog.cs
deleted file mode 100644
index eee5b54..0000000
--- a/Mundus/Data/GameEventLog.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System;
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
-
-namespace Mundus.Data {
- [Table("GameEventLogs", Schema = "Mundus")]
- public class GameEventLog {
- [Key]
- public int ID { get; private set; }
- public string Message { get; private set; }
-
- public GameEventLog(string message) {
- this.Message = message;
- }
- }
-}
diff --git a/Mundus/Data/GameEventLogContext.cs b/Mundus/Data/GameEventLogContext.cs
deleted file mode 100644
index eda4ffe..0000000
--- a/Mundus/Data/GameEventLogContext.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using System;
-using System.Linq;
-using Microsoft.EntityFrameworkCore;
-using Mundus.Service;
-
-namespace Mundus.Data {
- public class GameEventLogContext : DbContext {
- public DbSet<GameEventLog> GameEventLogs { get; private set; }
-
- public GameEventLogContext() :base()
- {
- ResetTable();
- }
-
- private void ResetTable() {
- Database.ExecuteSqlRaw("TRUNCATE TABLE GameEventLogs;");
- SaveChanges();
- }
-
- public void AddMessage(string message) {
- GameEventLogs.Add(new GameEventLog(message));
- this.SaveChanges();
- }
-
- public string GetMessage(int id) {
- return GameEventLogs.Single(x => x.ID == id).Message;
- }
-
- public int GetCount() {
- return GameEventLogs.Count();
- }
-
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
- optionsBuilder.UseMySQL(DataBaseContexts.ConnectionStringMySQL);
- }
- }
-}
diff --git a/Mundus/Data/GameEventLogs/GameEventLog.cs b/Mundus/Data/GameEventLogs/GameEventLog.cs
new file mode 100644
index 0000000..61b38b4
--- /dev/null
+++ b/Mundus/Data/GameEventLogs/GameEventLog.cs
@@ -0,0 +1,28 @@
+namespace Mundus.Data.GameEventLogs
+{
+ using System.ComponentModel.DataAnnotations;
+ using System.ComponentModel.DataAnnotations.Schema;
+
+ /// <summary>
+ /// Data type for the DBSet of GameEventLogs table
+ /// </summary>
+ [Table("GameEventLogs", Schema = "Mundus")]
+ public class GameEventLog
+ {
+ public GameEventLog(string message)
+ {
+ this.Message = message;
+ }
+
+ /// <summary>
+ /// Gets the unique identifier (primary key ; only used in the tables by MySQL)
+ /// </summary>
+ [Key]
+ public int ID { get; private set; }
+
+ /// <summary>
+ /// Gets the message of the log
+ /// </summary>
+ public string Message { get; private set; }
+ }
+} \ No newline at end of file
diff --git a/Mundus/Data/GameEventLogs/GameEventLogContext.cs b/Mundus/Data/GameEventLogs/GameEventLogContext.cs
new file mode 100644
index 0000000..5440bd8
--- /dev/null
+++ b/Mundus/Data/GameEventLogs/GameEventLogContext.cs
@@ -0,0 +1,64 @@
+namespace Mundus.Data.GameEventLogs
+{
+ using System.Linq;
+ using Microsoft.EntityFrameworkCore;
+
+ /// <summary>
+ /// Add and get log messages from the GameEventLogs table
+ /// </summary>
+ public class GameEventLogContext : DbContext
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="T:Mundus.Data.GameEventLogs.GameEventLogContext"/> class and truncates the table
+ /// </summary>
+ public GameEventLogContext() : base()
+ {
+ this.ResetTable();
+ }
+
+ /// <summary>
+ /// Gets DbSet of the game event logs table
+ /// </summary>
+ public DbSet<GameEventLog> GameEventLogs { get; private set; }
+
+ /// <summary>
+ /// Adds a message to the GameEventLogs table
+ /// </summary>
+ public void AddMessage(string message)
+ {
+ this.GameEventLogs.Add(new GameEventLog(message));
+ this.SaveChanges();
+ }
+
+ /// <summary>
+ /// Gets a message from the GameEventLogs table that has the specified id
+ /// </summary>
+ public string GetMessage(int id)
+ {
+ return this.GameEventLogs.Single(x => x.ID == id).Message;
+ }
+
+ /// <summary>
+ /// Gets count of game event logs
+ /// </summary>
+ public int GetCount()
+ {
+ return this.GameEventLogs.Count();
+ }
+
+ // Used to set the connection string
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
+ optionsBuilder.UseMySQL(DataBaseContexts.ConnectionStringMySQL);
+ }
+
+ /// <summary>
+ /// Truncates the GameEventLogs table (saves the change)
+ /// </summary>
+ private void ResetTable()
+ {
+ this.Database.ExecuteSqlRaw("TRUNCATE TABLE GameEventLogs;");
+ this.SaveChanges();
+ }
+ }
+} \ No newline at end of file
diff --git a/Mundus/Data/SuperLayers/DBTables/LGPlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/LGPlacedTile.cs
index 44a0db3..e7ef095 100644
--- a/Mundus/Data/SuperLayers/DBTables/LGPlacedTile.cs
+++ b/Mundus/Data/SuperLayers/DBTables/LGPlacedTile.cs
@@ -1,10 +1,15 @@
-using System;
-using System.ComponentModel.DataAnnotations.Schema;
+namespace Mundus.Data.SuperLayers.DBTables
+{
+ using System.ComponentModel.DataAnnotations.Schema;
-namespace Mundus.Data.SuperLayers.DBTables {
+ /// <summary>
+ /// Data type for the DBSet of (Land) LGroundLayer table
+ /// </summary>
[Table("LGroundLayer", Schema = "Mundus")]
- public class LGPlacedTile : PlacedTile {
- public LGPlacedTile(string stock_id, int yPos, int xPos) : base(stock_id, yPos, xPos) {
+ public class LGPlacedTile : PlacedTile
+ {
+ public LGPlacedTile(string stock_id, int yPos, int xPos) : base(stock_id, yPos, xPos)
+ {
}
}
}
diff --git a/Mundus/Data/SuperLayers/DBTables/LMPlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/LMPlacedTile.cs
index a61c39c..a009ef6 100644
--- a/Mundus/Data/SuperLayers/DBTables/LMPlacedTile.cs
+++ b/Mundus/Data/SuperLayers/DBTables/LMPlacedTile.cs
@@ -1,14 +1,21 @@
-using System;
-using System.ComponentModel.DataAnnotations.Schema;
-using Mundus.Data.Windows;
+namespace Mundus.Data.SuperLayers.DBTables
+{
+ using System.ComponentModel.DataAnnotations.Schema;
-namespace Mundus.Data.SuperLayers.DBTables {
+ /// <summary>
+ /// Data type for the DBSet of (Land) LMobLayer table
+ /// </summary>
[Table("LMobLayer", Schema = "Mundus")]
- public class LMPlacedTile : PlacedTile {
- public int Health { get; set; }
-
- public LMPlacedTile(string stock_id, int health, int yPos, int xPos) : base(stock_id, yPos, xPos) {
+ public class LMPlacedTile : PlacedTile
+ {
+ public LMPlacedTile(string stock_id, int health, int yPos, int xPos) : base(stock_id, yPos, xPos)
+ {
this.Health = health;
}
+
+ /// <summary>
+ /// Gets or sets the health of the mob
+ /// </summary>
+ public int Health { get; set; }
}
}
diff --git a/Mundus/Data/SuperLayers/DBTables/LSPlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/LSPlacedTile.cs
index a4ab6e3..44d095b 100644
--- a/Mundus/Data/SuperLayers/DBTables/LSPlacedTile.cs
+++ b/Mundus/Data/SuperLayers/DBTables/LSPlacedTile.cs
@@ -1,13 +1,21 @@
-using System;
-using System.ComponentModel.DataAnnotations.Schema;
+namespace Mundus.Data.SuperLayers.DBTables
+{
+ using System.ComponentModel.DataAnnotations.Schema;
-namespace Mundus.Data.SuperLayers.DBTables {
+ /// <summary>
+ /// Data type for the DBSet of (Land) LStructureLayer table
+ /// </summary>
[Table("LStructureLayer", Schema = "Mundus")]
- public class LSPlacedTile : PlacedTile {
- public int Health { get; set; }
-
- public LSPlacedTile(string stock_id, int health, int yPos, int xPos) : base(stock_id, yPos, xPos) {
+ public class LSPlacedTile : PlacedTile
+ {
+ public LSPlacedTile(string stock_id, int health, int yPos, int xPos) : base(stock_id, yPos, xPos)
+ {
this.Health = health;
}
+
+ /// <summary>
+ /// Gets or sets the health of the structure
+ /// </summary>
+ public int Health { get; set; }
}
}
diff --git a/Mundus/Data/SuperLayers/DBTables/PlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/PlacedTile.cs
index 31bd1bb..53c7dd2 100644
--- a/Mundus/Data/SuperLayers/DBTables/PlacedTile.cs
+++ b/Mundus/Data/SuperLayers/DBTables/PlacedTile.cs
@@ -1,14 +1,35 @@
-namespace Mundus.Data.SuperLayers.DBTables {
- public abstract class PlacedTile {
- public int ID { get; private set; }
- public int XPos { get; private set; }
- public int YPos { get; private set; }
- public string stock_id { get; set; }
-
- public PlacedTile(string stock_id, int yPos, int xPos) {
+namespace Mundus.Data.SuperLayers.DBTables
+{
+ /// <summary>
+ /// Abstract class that is used for the classes that correspond to DBSets
+ /// </summary>
+ public abstract class PlacedTile
+ {
+ public PlacedTile(string stock_id, int yPos, int xPos)
+ {
this.YPos = yPos;
this.XPos = xPos;
this.stock_id = stock_id;
}
+
+ /// <summary>
+ /// Gets the unique identifier (primary key ; only used in the tables by MySQL)
+ /// </summary>
+ public int ID { get; private set; }
+
+ /// <summary>
+ /// Gets the position on the horizontal (x) axis of the tile in it's layer
+ /// </summary>
+ public int XPos { get; private set; }
+
+ /// <summary>
+ /// Gets the position on the vertical (y) axis of the tile in it's layer
+ /// </summary>
+ public int YPos { get; private set; }
+
+ /// <summary>
+ /// Gets or sets the stock _id of the tile
+ /// </summary>
+ public string stock_id { get; set; }
}
}
diff --git a/Mundus/Data/SuperLayers/DBTables/SGPlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/SGPlacedTile.cs
index 0791cc4..74a41a4 100644
--- a/Mundus/Data/SuperLayers/DBTables/SGPlacedTile.cs
+++ b/Mundus/Data/SuperLayers/DBTables/SGPlacedTile.cs
@@ -1,10 +1,15 @@
-using System;
-using System.ComponentModel.DataAnnotations.Schema;
+namespace Mundus.Data.SuperLayers.DBTables
+{
+ using System.ComponentModel.DataAnnotations.Schema;
-namespace Mundus.Data.SuperLayers.DBTables {
+ /// <summary>
+ /// Data type for the DBSet of (Sky) SGroundLayer table
+ /// </summary>
[Table("SGroundLayer", Schema = "Mundus")]
- public class SGPlacedTile : PlacedTile {
- public SGPlacedTile(string stock_id, int yPos, int xPos) : base(stock_id, yPos, xPos) {
+ public class SGPlacedTile : PlacedTile
+ {
+ public SGPlacedTile(string stock_id, int yPos, int xPos) : base(stock_id, yPos, xPos)
+ {
}
}
}
diff --git a/Mundus/Data/SuperLayers/DBTables/SMPlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/SMPlacedTile.cs
index 36bc5bf..ad2fd23 100644
--- a/Mundus/Data/SuperLayers/DBTables/SMPlacedTile.cs
+++ b/Mundus/Data/SuperLayers/DBTables/SMPlacedTile.cs
@@ -1,13 +1,21 @@
-using System;
-using System.ComponentModel.DataAnnotations.Schema;
+namespace Mundus.Data.SuperLayers.DBTables
+{
+ using System.ComponentModel.DataAnnotations.Schema;
-namespace Mundus.Data.SuperLayers.DBTables {
+ /// <summary>
+ /// Data type for the DBSet of (Sky) SMobLayer table
+ /// </summary>
[Table("SMobLayer", Schema = "Mundus")]
- public class SMPlacedTile : PlacedTile {
- public int Health { get; set; }
-
- public SMPlacedTile(string stock_id, int health, int yPos, int xPos) : base(stock_id, yPos, xPos) {
+ public class SMPlacedTile : PlacedTile
+ {
+ public SMPlacedTile(string stock_id, int health, int yPos, int xPos) : base(stock_id, yPos, xPos)
+ {
this.Health = health;
}
+
+ /// <summary>
+ /// Gets or sets the health of the mob
+ /// </summary>
+ public int Health { get; set; }
}
}
diff --git a/Mundus/Data/SuperLayers/DBTables/SSPlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/SSPlacedTile.cs
index 251a568..f70eee4 100644
--- a/Mundus/Data/SuperLayers/DBTables/SSPlacedTile.cs
+++ b/Mundus/Data/SuperLayers/DBTables/SSPlacedTile.cs
@@ -1,13 +1,21 @@
-using System;
-using System.ComponentModel.DataAnnotations.Schema;
+namespace Mundus.Data.SuperLayers.DBTables
+{
+ using System.ComponentModel.DataAnnotations.Schema;
-namespace Mundus.Data.SuperLayers.DBTables {
+ /// <summary>
+ /// Data type for the DBSet of (Sky) SStructureLayer table
+ /// </summary>
[Table("SStructureLayer", Schema = "Mundus")]
- public class SSPlacedTile : PlacedTile {
- public int Health { get; set; }
-
- public SSPlacedTile(string stock_id, int health, int yPos, int xPos):base(stock_id, yPos, xPos) {
+ public class SSPlacedTile : PlacedTile
+ {
+ public SSPlacedTile(string stock_id, int health, int yPos, int xPos) : base(stock_id, yPos, xPos)
+ {
this.Health = health;
}
+
+ /// <summary>
+ /// Gets or sets the health of the structure
+ /// </summary>
+ public int Health { get; set; }
}
}
diff --git a/Mundus/Data/SuperLayers/DBTables/UGPlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/UGPlacedTile.cs
index 762af7e..8c1240a 100644
--- a/Mundus/Data/SuperLayers/DBTables/UGPlacedTile.cs
+++ b/Mundus/Data/SuperLayers/DBTables/UGPlacedTile.cs
@@ -1,10 +1,15 @@
-using System;
-using System.ComponentModel.DataAnnotations.Schema;
+namespace Mundus.Data.SuperLayers.DBTables
+{
+ using System.ComponentModel.DataAnnotations.Schema;
-namespace Mundus.Data.SuperLayers.DBTables {
+ /// <summary>
+ /// Data type for the DBSet of (Undergound) UGroundLayer table
+ /// </summary>
[Table("UGroundLayer", Schema = "Mundus")]
- public class UGPlacedTile : PlacedTile {
- public UGPlacedTile(string stock_id, int yPos, int xPos) : base(stock_id, yPos, xPos) {
+ public class UGPlacedTile : PlacedTile
+ {
+ public UGPlacedTile(string stock_id, int yPos, int xPos) : base(stock_id, yPos, xPos)
+ {
}
}
}
diff --git a/Mundus/Data/SuperLayers/DBTables/UMPlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/UMPlacedTile.cs
index 0f2fdbc..fb60068 100644
--- a/Mundus/Data/SuperLayers/DBTables/UMPlacedTile.cs
+++ b/Mundus/Data/SuperLayers/DBTables/UMPlacedTile.cs
@@ -1,13 +1,21 @@
-using System;
-using System.ComponentModel.DataAnnotations.Schema;
+namespace Mundus.Data.SuperLayers.DBTables
+{
+ using System.ComponentModel.DataAnnotations.Schema;
-namespace Mundus.Data.SuperLayers.DBTables {
+ /// <summary>
+ /// Data type for the DBSet of (Undergound) UMobLayer table
+ /// </summary>
[Table("UMobLayer", Schema = "Mundus")]
- public class UMPlacedTile : PlacedTile {
- public int Health { get; set; }
-
- public UMPlacedTile(string stock_id, int health, int yPos, int xPos) : base(stock_id, yPos, xPos) {
+ public class UMPlacedTile : PlacedTile
+ {
+ public UMPlacedTile(string stock_id, int health, int yPos, int xPos) : base(stock_id, yPos, xPos)
+ {
this.Health = health;
}
+
+ /// <summary>
+ /// Gets or sets the health of the mob
+ /// </summary>
+ public int Health { get; set; }
}
}
diff --git a/Mundus/Data/SuperLayers/DBTables/USPlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/USPlacedTile.cs
index d536640..90478e4 100644
--- a/Mundus/Data/SuperLayers/DBTables/USPlacedTile.cs
+++ b/Mundus/Data/SuperLayers/DBTables/USPlacedTile.cs
@@ -1,13 +1,21 @@
-using System;
-using System.ComponentModel.DataAnnotations.Schema;
+namespace Mundus.Data.SuperLayers.DBTables
+{
+ using System.ComponentModel.DataAnnotations.Schema;
-namespace Mundus.Data.SuperLayers.DBTables {
+ /// <summary>
+ /// Data type for the DBSet of (Undergound) UStructureLayer table
+ /// </summary>
[Table("UStructureLayer", Schema = "Mundus")]
- public class USPlacedTile : PlacedTile {
- public int Health { get; set; }
-
- public USPlacedTile(string stock_id, int health, int yPos, int xPos) : base(stock_id, yPos, xPos) {
+ public class USPlacedTile : PlacedTile
+ {
+ public USPlacedTile(string stock_id, int health, int yPos, int xPos) : base(stock_id, yPos, xPos)
+ {
this.Health = health;
}
+
+ /// <summary>
+ /// Gets or sets the health of the structure
+ /// </summary>
+ public int Health { get; set; }
}
}
diff --git a/Mundus/Data/SuperLayers/ISuperLayerContext.cs b/Mundus/Data/SuperLayers/ISuperLayerContext.cs
index 20a5551..e6884ad 100644
--- a/Mundus/Data/SuperLayers/ISuperLayerContext.cs
+++ b/Mundus/Data/SuperLayers/ISuperLayerContext.cs
@@ -1,22 +1,80 @@
-using System;
-namespace Mundus.Data.SuperLayers {
- public interface ISuperLayerContext {
+namespace Mundus.Data.SuperLayers
+{
+ /// <summary>
+ /// Add, remove and change values in the different superlayers (database tables)
+ /// </summary>
+ public interface ISuperLayerContext
+ {
+ /// <summary>
+ /// Returns the stock_id of the mob at the specified positoin
+ /// </summary>
string GetMobLayerStock(int yPos, int xPos);
+
+ /// <summary>
+ /// Returns the stock_id of the structure at the specified positoin
+ /// </summary>
string GetStructureLayerStock(int yPos, int xPos);
+
+ /// <summary>
+ /// Returns the stock_id of the ground (tile) at the specified positoin
+ /// </summary>
string GetGroundLayerStock(int yPos, int xPos);
+ /// <summary>
+ /// Adds a mob's stock_id, it's health and the specified position in the mob layer table
+ /// </summary>
void AddMobAtPosition(string stock_id, int health, int yPos, int xPos);
+
+ /// <summary>
+ /// Sets the mob's stock_id and health for the specified position of the mob layer table
+ /// </summary>
void SetMobAtPosition(string stock_id, int health, int yPos, int xPos);
+
+ /// <summary>
+ /// Sets invalid values for stock_id (null) and health (-1) for the specified position of the mob layer table
+ /// </summary>
void RemoveMobFromPosition(int yPos, int xPos);
+
+ /// <summary>
+ /// Removes health from the mob on the specified position in the mob layer table
+ /// </summary>
+ /// <returns><c>true</c>If the mob can still be damaged (alive)<c>false</c> otherwise.</returns>
bool TakeDamageMobAtPosition(int yPos, int xPos, int damage);
+ /// <summary>
+ /// Adds a structure's stock_id, it's health and the specified position in the structure layer table
+ /// </summary>
void AddStructureAtPosition(string stock_id, int health, int yPos, int xPos);
+
+ /// <summary>
+ /// Sets the structure's stock_id and health for the specified position of the structure layer table
+ /// </summary>
void SetStructureAtPosition(string stock_id, int health, int yPos, int xPos);
+
+ /// <summary>
+ /// Sets invalid values for stock_id (null) and health (-1) for the specified position of the structure layer table
+ /// </summary>
void RemoveStructureFromPosition(int yPos, int xPos);
+
+ /// <summary>
+ /// Removes health from the structure on the specified position in the structure layer table
+ /// </summary>
+ /// <returns><c>true</c>If the structure can still be damaged <c>false</c> otherwise.</returns>
bool TakeDamageStructureAtPosition(int yPos, int xPos, int damage);
+ /// <summary>
+ /// Adds a ground (tile)'s stock_id and the specified position in the ground (tile) layer table
+ /// </summary>
void AddGroundAtPosition(string stock_id, int yPos, int xPos);
+
+ /// <summary>
+ /// Sets the ground (tile)'s stock_id and health for the specified position of the ground (tile) layer table
+ /// </summary>
void SetGroundAtPosition(string stock_id, int yPos, int xPos);
+
+ /// <summary>
+ /// Sets invalid values for stock_id (null) for the specified position of the ground (tile) layer table
+ /// </summary>
void RemoveGroundFromPosition(int yPos, int xPos);
}
}
diff --git a/Mundus/Data/SuperLayers/LandContext.cs b/Mundus/Data/SuperLayers/LandContext.cs
index 26f6f41..7e23498 100644
--- a/Mundus/Data/SuperLayers/LandContext.cs
+++ b/Mundus/Data/SuperLayers/LandContext.cs
@@ -1,92 +1,166 @@
-using System;
-using System.Linq;
-using Microsoft.EntityFrameworkCore;
-using Mundus.Data.SuperLayers.DBTables;
-using Mundus.Service.SuperLayers;
-using Mundus.Service.Tiles.Mobs.LandMobs;
-
-namespace Mundus.Data.SuperLayers {
- public class LandContext : DbContext, ISuperLayerContext {
+namespace Mundus.Data.SuperLayers
+{
+ using System.Linq;
+ using Microsoft.EntityFrameworkCore;
+ using Mundus.Data.SuperLayers.DBTables;
+
+ /// <summary>
+ /// Add, remove and change values in the land superlayer
+ /// </summary>
+ public class LandContext : DbContext, ISuperLayerContext
+ {
+ /// <summary>
+ /// Initializes a new instance of the LandContext class and truncates all related tables
+ /// </summary>
+ public LandContext() : base()
+ {
+ this.Database.ExecuteSqlRaw("TRUNCATE TABLE LMobLayer");
+ this.Database.ExecuteSqlRaw("TRUNCATE TABLE LStructureLayer");
+ this.Database.ExecuteSqlRaw("TRUNCATE TABLE LGroundLayer");
+
+ this.SaveChanges();
+ }
+
+ /// <summary>
+ /// Gets DBSet of the land mob layer table
+ /// </summary>
public DbSet<LMPlacedTile> LMobLayer { get; private set; }
+
+ /// <summary>
+ /// Gets DBSet of the land structure layer table
+ /// </summary>
public DbSet<LSPlacedTile> LStructureLayer { get; private set; }
+
+ /// <summary>
+ /// Gets DBSet of the land ground (tile) layer table
+ /// </summary>
public DbSet<LGPlacedTile> LGroundLayer { get; private set; }
- public LandContext() : base() {
- Database.ExecuteSqlRaw("TRUNCATE TABLE LMobLayer");
- Database.ExecuteSqlRaw("TRUNCATE TABLE LStructureLayer");
- Database.ExecuteSqlRaw("TRUNCATE TABLE LGroundLayer");
- SaveChanges();
+ /// <summary>
+ /// Returns the stock_id of the mob at the specified positoin
+ /// </summary>
+ public string GetMobLayerStock(int yPos, int xPos)
+ {
+ return this.LMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
}
- public string GetMobLayerStock(int yPos, int xPos) {
- return LMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
+ /// <summary>
+ /// Returns the stock_id of the structure at the specified positoin
+ /// </summary>
+ public string GetStructureLayerStock(int yPos, int xPos)
+ {
+ return this.LStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
}
- public string GetStructureLayerStock(int yPos, int xPos) {
- return LStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
- }
- public string GetGroundLayerStock(int yPos, int xPos) {
- return LGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
+
+ /// <summary>
+ /// Returns the stock_id of the ground (tile) at the specified positoin
+ /// </summary>
+ public string GetGroundLayerStock(int yPos, int xPos)
+ {
+ return this.LGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
}
- public void AddMobAtPosition(string stock_id, int health, int yPos, int xPos) {
- LMobLayer.Add(new LMPlacedTile(stock_id, health, yPos, xPos));
-
+ /// <summary>
+ /// Adds a mob's stock_id, it's health and the specified position in the mob layer table
+ /// </summary>
+ public void AddMobAtPosition(string stock_id, int health, int yPos, int xPos)
+ {
+ this.LMobLayer.Add(new LMPlacedTile(stock_id, health, yPos, xPos));
}
- public void SetMobAtPosition(string stock_id, int health, int yPos, int xPos) {
- LMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
- LMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = health;
+ /// <summary>
+ /// Sets the mob's stock_id and health for the specified position of the mob layer table
+ /// </summary>
+ public void SetMobAtPosition(string stock_id, int health, int yPos, int xPos)
+ {
+ this.LMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
+ this.LMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = health;
}
- public void RemoveMobFromPosition(int yPos, int xPos) {
- LMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
- LMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = -1;
+
+ /// <summary>
+ /// Sets invalid values for stock_id (null) and health (-1) for the specified position of the mob layer table
+ /// </summary>
+ public void RemoveMobFromPosition(int yPos, int xPos)
+ {
+ this.LMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
+ this.LMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = -1;
}
- public bool TakeDamageMobAtPosition(int yPos, int xPos, int damage) {
- var mob = LMobLayer.First(x => x.YPos == yPos && x.XPos == xPos);
+
+ /// <summary>
+ /// Removes health from the mob on the specified position in the mob layer table
+ /// </summary>
+ /// <returns><c>true</c>If the mob can still be damaged (alive)<c>false</c> otherwise.</returns>
+ public bool TakeDamageMobAtPosition(int yPos, int xPos, int damage)
+ {
+ var mob = this.LMobLayer.First(x => x.YPos == yPos && x.XPos == xPos);
mob.Health -= damage;
return mob.Health > 0;
}
- public void AddStructureAtPosition(string stock_id, int health, int yPos, int xPos) {
- LStructureLayer.Add(new LSPlacedTile(stock_id, health, yPos, xPos));
-
+ /// <summary>
+ /// Adds a structure's stock_id, it's health and the specified position in the structure layer table
+ /// </summary>
+ public void AddStructureAtPosition(string stock_id, int health, int yPos, int xPos)
+ {
+ this.LStructureLayer.Add(new LSPlacedTile(stock_id, health, yPos, xPos));
}
- public void SetStructureAtPosition(string stock_id, int health, int yPos, int xPos) {
- LStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
- LStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = health;
-
+ /// <summary>
+ /// Sets the structure's stock_id and health for the specified position of the structure layer table
+ /// </summary>
+ public void SetStructureAtPosition(string stock_id, int health, int yPos, int xPos)
+ {
+ this.LStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
+ this.LStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = health;
}
- public void RemoveStructureFromPosition(int yPos, int xPos) {
- LStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
- LStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = -1;
+ /// <summary>
+ /// Sets invalid values for stock_id (null) and health (-1) for the specified position of the structure layer table
+ /// </summary>
+ public void RemoveStructureFromPosition(int yPos, int xPos)
+ {
+ this.LStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
+ this.LStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = -1;
}
- public bool TakeDamageStructureAtPosition(int yPos, int xPos, int damage) {
- var structure = LStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos);
+
+ /// <summary>
+ /// Removes health from the structure on the specified position in the structure layer table
+ /// </summary>
+ /// <returns><c>true</c>If the structure can still be damaged <c>false</c> otherwise.</returns>
+ public bool TakeDamageStructureAtPosition(int yPos, int xPos, int damage)
+ {
+ var structure = this.LStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos);
structure.Health -= damage;
return structure.Health > 0;
}
- public void AddGroundAtPosition(string stock_id, int yPos, int xPos) {
- LGroundLayer.Add(new LGPlacedTile(stock_id, yPos, xPos));
-
+ /// <summary>
+ /// Adds a ground (tile)'s stock_id and the specified position in the ground (tile) layer table
+ /// </summary>
+ public void AddGroundAtPosition(string stock_id, int yPos, int xPos)
+ {
+ this.LGroundLayer.Add(new LGPlacedTile(stock_id, yPos, xPos));
}
- public void SetGroundAtPosition(string stock_id, int yPos, int xPos) {
- LGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
-
- }
- public void RemoveGroundFromPosition(int yPos, int xPos) {
- LGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
-
+ /// <summary>
+ /// Sets the ground (tile)'s stock_id and health for the specified position of the ground (tile) layer table
+ /// </summary>
+ public void SetGroundAtPosition(string stock_id, int yPos, int xPos)
+ {
+ this.LGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
}
- public string SuperLayerName() {
- return "Land";
+ /// <summary>
+ /// Sets invalid values for stock_id (null) for the specified position of the ground (tile) layer table
+ /// </summary>
+ public void RemoveGroundFromPosition(int yPos, int xPos)
+ {
+ this.LGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
}
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
+ // Used to set the connection string
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
optionsBuilder.UseMySQL(DataBaseContexts.ConnectionStringMySQL);
}
}
diff --git a/Mundus/Data/SuperLayers/Mobs/MI.cs b/Mundus/Data/SuperLayers/Mobs/MI.cs
index f309968..0a805f8 100644
--- a/Mundus/Data/SuperLayers/Mobs/MI.cs
+++ b/Mundus/Data/SuperLayers/Mobs/MI.cs
@@ -1,16 +1,24 @@
-using Mundus.Data.SuperLayers;
-using Mundus.Service.Tiles.Mobs.LandMobs;
-using Mundus.Service.Tiles.Items.Presets;
+namespace Mundus.Data.Superlayers.Mobs
+{
+ using Mundus.Service.Tiles.Items.Presets;
+ using Mundus.Service.Tiles.Mobs.LandMobs;
-namespace Mundus.Data.Superlayers.Mobs {
- public static class MI { //stands for Mob Instances
+ /// <summary>
+ /// Used to store universally accessed mob instances (player)
+ /// </summary>
+ public static class MI
+ {
+ /// <summary>
+ /// Gets the mob that is used by the person who plays the game
+ /// </summary>
public static Player Player { get; private set; }
/// <summary>
/// Creates the instances of the universally accessed mobs.
- /// Note: player has a health of 4 * inventorySize
+ /// Note: player has a health of 4 * inventorySize and gets a wooden axe and a wooden pickaxe
/// </summary>
- public static void CreateInstances() {
+ public static void CreateInstances()
+ {
Player = new Player("player", 5, DataBaseContexts.LContext);
Player.Inventory.AppendToHotbar(ToolPresets.GetAWoodenAxe());
Player.Inventory.AppendToHotbar(ToolPresets.GetAWoodenPickaxe());
diff --git a/Mundus/Data/SuperLayers/SkyContext.cs b/Mundus/Data/SuperLayers/SkyContext.cs
index af446b1..72bef8d 100644
--- a/Mundus/Data/SuperLayers/SkyContext.cs
+++ b/Mundus/Data/SuperLayers/SkyContext.cs
@@ -1,93 +1,166 @@
-using System;
-using System.Linq;
-using Microsoft.EntityFrameworkCore;
-using Mundus.Data.SuperLayers.DBTables;
-using Mundus.Service.SuperLayers;
-using Mundus.Service.SuperLayers.Generators;
-
-namespace Mundus.Data.SuperLayers {
- public class SkyContext : DbContext, ISuperLayerContext {
+namespace Mundus.Data.SuperLayers
+{
+ using System.Linq;
+ using Microsoft.EntityFrameworkCore;
+ using Mundus.Data.SuperLayers.DBTables;
+
+ /// <summary>
+ /// Add, remove and change values in the sky superlayer
+ /// </summary>
+ public class SkyContext : DbContext, ISuperLayerContext
+ {
+ /// <summary>
+ /// Initializes a new instance of the SkyContext class and truncates all related tables
+ /// </summary>
+ public SkyContext() : base()
+ {
+ this.Database.ExecuteSqlRaw("TRUNCATE TABLE SMobLayer");
+ this.Database.ExecuteSqlRaw("TRUNCATE TABLE SStructureLayer");
+ this.Database.ExecuteSqlRaw("TRUNCATE TABLE SGroundLayer");
+
+ this.SaveChanges();
+ }
+
+ /// <summary>
+ /// Gets DBSet of the sky mob layer table
+ /// </summary>
public DbSet<SMPlacedTile> SMobLayer { get; private set; }
+
+ /// <summary>
+ /// Gets DBSet of the sky structure layer table
+ /// </summary>
public DbSet<SSPlacedTile> SStructureLayer { get; private set; }
+
+ /// <summary>
+ /// Gets DBSet of the sky structure layer table
+ /// </summary>
public DbSet<SGPlacedTile> SGroundLayer { get; private set; }
- public SkyContext() :base() {
- Database.ExecuteSqlRaw("TRUNCATE TABLE SMobLayer");
- Database.ExecuteSqlRaw("TRUNCATE TABLE SStructureLayer");
- Database.ExecuteSqlRaw("TRUNCATE TABLE SGroundLayer");
- SaveChanges();
+ /// <summary>
+ /// Returns the stock_id of the mob at the specified positoin
+ /// </summary>
+ public string GetMobLayerStock(int yPos, int xPos)
+ {
+ return this.SMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
}
- public string GetMobLayerStock(int yPos, int xPos) {
- return SMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
+ /// <summary>
+ /// Returns the stock_id of the structure at the specified positoin
+ /// </summary>
+ public string GetStructureLayerStock(int yPos, int xPos)
+ {
+ return this.SStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
}
- public string GetStructureLayerStock(int yPos, int xPos) {
- return SStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
- }
- public string GetGroundLayerStock(int yPos, int xPos) {
- return SGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
+
+ /// <summary>
+ /// Returns the stock_id of the ground (tile) at the specified positoin
+ /// </summary>
+ public string GetGroundLayerStock(int yPos, int xPos)
+ {
+ return this.SGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
}
- public void AddMobAtPosition(string stock_id, int health, int yPos, int xPos) {
- SMobLayer.Add(new SMPlacedTile(stock_id, health, yPos, xPos));
-
+ /// <summary>
+ /// Adds a mob's stock_id, it's health and the specified position in the mob layer table
+ /// </summary>
+ public void AddMobAtPosition(string stock_id, int health, int yPos, int xPos)
+ {
+ this.SMobLayer.Add(new SMPlacedTile(stock_id, health, yPos, xPos));
}
- public void SetMobAtPosition(string stock_id, int health, int yPos, int xPos) {
- SMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
- SMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = health;
+ /// <summary>
+ /// Sets the mob's stock_id and health for the specified position of the mob layer table
+ /// </summary>
+ public void SetMobAtPosition(string stock_id, int health, int yPos, int xPos)
+ {
+ this.SMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
+ this.SMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = health;
}
- public void RemoveMobFromPosition(int yPos, int xPos) {
- SMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
- SMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = -1;
+ /// <summary>
+ /// Sets invalid values for stock_id (null) and health (-1) for the specified position of the mob layer table
+ /// </summary>
+ public void RemoveMobFromPosition(int yPos, int xPos)
+ {
+ this.SMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
+ this.SMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = -1;
}
- public bool TakeDamageMobAtPosition(int yPos, int xPos, int damage) {
- var mob = SMobLayer.First(x => x.YPos == yPos && x.XPos == xPos);
+
+ /// <summary>
+ /// Removes health from the mob on the specified position in the mob layer table
+ /// </summary>
+ /// <returns><c>true</c>If the mob can still be damaged (alive)<c>false</c> otherwise.</returns>
+ public bool TakeDamageMobAtPosition(int yPos, int xPos, int damage)
+ {
+ var mob = this.SMobLayer.First(x => x.YPos == yPos && x.XPos == xPos);
mob.Health -= damage;
return mob.Health > 0;
}
- public void AddStructureAtPosition(string stock_id, int health, int yPos, int xPos) {
- SStructureLayer.Add(new SSPlacedTile(stock_id, health, yPos, xPos));
-
+ /// <summary>
+ /// Adds a structure's stock_id, it's health and the specified position in the structure layer table
+ /// </summary>
+ public void AddStructureAtPosition(string stock_id, int health, int yPos, int xPos)
+ {
+ this.SStructureLayer.Add(new SSPlacedTile(stock_id, health, yPos, xPos));
}
- public void SetStructureAtPosition(string stock_id, int health, int yPos, int xPos) {
- SStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
- SStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = health;
-
+ /// <summary>
+ /// Sets the structure's stock_id and health for the specified position of the structure layer table
+ /// </summary>
+ public void SetStructureAtPosition(string stock_id, int health, int yPos, int xPos)
+ {
+ this.SStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
+ this.SStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = health;
}
- public void RemoveStructureFromPosition(int yPos, int xPos) {
- SStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
- SStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = -1;
+ /// <summary>
+ /// Sets invalid values for stock_id (null) and health (-1) for the specified position of the structure layer table
+ /// </summary>
+ public void RemoveStructureFromPosition(int yPos, int xPos)
+ {
+ this.SStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
+ this.SStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = -1;
}
- public bool TakeDamageStructureAtPosition(int yPos, int xPos, int damage) {
- var structure = SStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos);
+
+ /// <summary>
+ /// Removes health from the structure on the specified position in the structure layer table
+ /// </summary>
+ /// <returns><c>true</c>If the structure can still be damaged <c>false</c> otherwise.</returns>
+ public bool TakeDamageStructureAtPosition(int yPos, int xPos, int damage)
+ {
+ var structure = this.SStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos);
structure.Health -= damage;
return structure.Health > 0;
}
- public void AddGroundAtPosition(string stock_id, int yPos, int xPos) {
- SGroundLayer.Add(new SGPlacedTile(stock_id, yPos, xPos));
-
+ /// <summary>
+ /// Adds a ground (tile)'s stock_id and the specified position in the ground (tile) layer table
+ /// </summary>
+ public void AddGroundAtPosition(string stock_id, int yPos, int xPos)
+ {
+ this.SGroundLayer.Add(new SGPlacedTile(stock_id, yPos, xPos));
}
- public void SetGroundAtPosition(string stock_id, int yPos, int xPos) {
- SGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
-
- }
- public void RemoveGroundFromPosition(int yPos, int xPos) {
- SGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
-
+ /// <summary>
+ /// Sets the ground (tile)'s stock_id and health for the specified position of the ground (tile) layer table
+ /// </summary>
+ public void SetGroundAtPosition(string stock_id, int yPos, int xPos)
+ {
+ this.SGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
}
- public string SuperLayerName() {
- return "Sky";
+ /// <summary>
+ /// Sets invalid values for stock_id (null) for the specified position of the ground (tile) layer table
+ /// </summary>
+ public void RemoveGroundFromPosition(int yPos, int xPos)
+ {
+ this.SGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
}
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
+ // Used to set the connection string
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
optionsBuilder.UseMySQL(DataBaseContexts.ConnectionStringMySQL);
}
}
diff --git a/Mundus/Data/SuperLayers/UndergroundContext.cs b/Mundus/Data/SuperLayers/UndergroundContext.cs
index 0d16979..8e06ae4 100644
--- a/Mundus/Data/SuperLayers/UndergroundContext.cs
+++ b/Mundus/Data/SuperLayers/UndergroundContext.cs
@@ -1,93 +1,166 @@
-using System;
-using System.Linq;
-using Microsoft.EntityFrameworkCore;
-using Mundus.Data.SuperLayers.DBTables;
-using Mundus.Service.SuperLayers;
-
-namespace Mundus.Data.SuperLayers {
- public class UndergroundContext : DbContext, ISuperLayerContext {
+namespace Mundus.Data.SuperLayers
+{
+ using System.Linq;
+ using Microsoft.EntityFrameworkCore;
+ using Mundus.Data.SuperLayers.DBTables;
+
+ /// <summary>
+ /// Add, remove and change values in the underground superlayer
+ /// </summary>
+ public class UndergroundContext : DbContext, ISuperLayerContext
+ {
+ /// <summary>
+ /// Initializes a new instance of the UndergroundContext class and truncates all related tables
+ /// </summary>
+ public UndergroundContext() : base()
+ {
+ this.Database.ExecuteSqlRaw("TRUNCATE TABLE UMobLayer");
+ this.Database.ExecuteSqlRaw("TRUNCATE TABLE UStructureLayer");
+ this.Database.ExecuteSqlRaw("TRUNCATE TABLE UGroundLayer");
+
+ this.SaveChanges();
+ }
+
+ /// <summary>
+ /// Gets DBSet of the underground mob layer table
+ /// </summary>
public DbSet<UMPlacedTile> UMobLayer { get; private set; }
+
+ /// <summary>
+ /// Gets DBSet of the underground structure layer table
+ /// </summary>
public DbSet<USPlacedTile> UStructureLayer { get; private set; }
+
+ /// <summary>
+ /// Gets DBSet of the sky underground layer table
+ /// </summary>
public DbSet<UGPlacedTile> UGroundLayer { get; private set; }
- public UndergroundContext() : base() {
- Database.ExecuteSqlRaw("TRUNCATE TABLE UMobLayer");
- Database.ExecuteSqlRaw("TRUNCATE TABLE UStructureLayer");
- Database.ExecuteSqlRaw("TRUNCATE TABLE UGroundLayer");
- SaveChanges();
+ /// <summary>
+ /// Returns the stock_id of the mob at the specified positoin
+ /// </summary>
+ public string GetMobLayerStock(int yPos, int xPos)
+ {
+ return this.UMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
}
- public string GetMobLayerStock(int yPos, int xPos) {
- return UMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
+ /// <summary>
+ /// Returns the stock_id of the structure at the specified positoin
+ /// </summary>
+ public string GetStructureLayerStock(int yPos, int xPos)
+ {
+ return this.UStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
}
- public string GetStructureLayerStock(int yPos, int xPos) {
- return UStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
- }
- public string GetGroundLayerStock(int yPos, int xPos) {
- return UGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
+
+ /// <summary>
+ /// Returns the stock_id of the ground (tile) at the specified positoin
+ /// </summary>
+ public string GetGroundLayerStock(int yPos, int xPos)
+ {
+ return this.UGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id;
}
- public void AddMobAtPosition(string stock_id, int health, int yPos, int xPos) {
- UMobLayer.Add(new UMPlacedTile(stock_id, health, yPos, xPos));
-
+ /// <summary>
+ /// Adds a mob's stock_id, it's health and the specified position in the mob layer table
+ /// </summary>
+ public void AddMobAtPosition(string stock_id, int health, int yPos, int xPos)
+ {
+ this.UMobLayer.Add(new UMPlacedTile(stock_id, health, yPos, xPos));
}
- public void SetMobAtPosition(string stock_id, int health, int yPos, int xPos) {
- UMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
- UMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = health;
-
+ /// <summary>
+ /// Sets the mob's stock_id and health for the specified position of the mob layer table
+ /// </summary>
+ public void SetMobAtPosition(string stock_id, int health, int yPos, int xPos)
+ {
+ this.UMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
+ this.UMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = health;
}
- public void RemoveMobFromPosition(int yPos, int xPos) {
- UMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
- UMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = -1;
+ /// <summary>
+ /// Sets invalid values for stock_id (null) and health (-1) for the specified position of the mob layer table
+ /// </summary>
+ public void RemoveMobFromPosition(int yPos, int xPos)
+ {
+ this.UMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
+ this.UMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = -1;
}
- public bool TakeDamageMobAtPosition(int yPos, int xPos, int damage) {
- var mob = UMobLayer.First(x => x.YPos == yPos && x.XPos == xPos);
+
+ /// <summary>
+ /// Removes health from the mob on the specified position in the mob layer table
+ /// </summary>
+ /// <returns><c>true</c>If the mob can still be damaged (alive)<c>false</c> otherwise.</returns>
+ public bool TakeDamageMobAtPosition(int yPos, int xPos, int damage)
+ {
+ var mob = this.UMobLayer.First(x => x.YPos == yPos && x.XPos == xPos);
mob.Health -= damage;
return mob.Health > 0;
}
- public void AddStructureAtPosition(string stock_id, int health, int yPos, int xPos) {
- UStructureLayer.Add(new USPlacedTile(stock_id, health, yPos, xPos));
-
+ /// <summary>
+ /// Adds a structure's stock_id, it's health and the specified position in the structure layer table
+ /// </summary>
+ public void AddStructureAtPosition(string stock_id, int health, int yPos, int xPos)
+ {
+ this.UStructureLayer.Add(new USPlacedTile(stock_id, health, yPos, xPos));
}
- public void SetStructureAtPosition(string stock_id, int health, int yPos, int xPos) {
- UStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
- UStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = health;
-
+ /// <summary>
+ /// Sets the structure's stock_id and health for the specified position of the structure layer table
+ /// </summary>
+ public void SetStructureAtPosition(string stock_id, int health, int yPos, int xPos)
+ {
+ this.UStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
+ this.UStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = health;
}
- public void RemoveStructureFromPosition(int yPos, int xPos) {
- UStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
- UStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = -1;
+ /// <summary>
+ /// Sets invalid values for stock_id (null) and health (-1) for the specified position of the structure layer table
+ /// </summary>
+ public void RemoveStructureFromPosition(int yPos, int xPos)
+ {
+ this.UStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
+ this.UStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).Health = -1;
}
- public bool TakeDamageStructureAtPosition(int yPos, int xPos, int damage) {
- var structure = UStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos);
+
+ /// <summary>
+ /// Removes health from the structure on the specified position in the structure layer table
+ /// </summary>
+ /// <returns><c>true</c>If the structure can still be damaged <c>false</c> otherwise.</returns>
+ public bool TakeDamageStructureAtPosition(int yPos, int xPos, int damage)
+ {
+ var structure = this.UStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos);
structure.Health -= damage;
return structure.Health > 0;
}
- public void AddGroundAtPosition(string stock_id, int yPos, int xPos) {
- UGroundLayer.Add(new UGPlacedTile(stock_id, yPos, xPos));
-
+ /// <summary>
+ /// Adds a ground (tile)'s stock_id and the specified position in the ground (tile) layer table
+ /// </summary>
+ public void AddGroundAtPosition(string stock_id, int yPos, int xPos)
+ {
+ this.UGroundLayer.Add(new UGPlacedTile(stock_id, yPos, xPos));
}
- public void SetGroundAtPosition(string stock_id, int yPos, int xPos) {
- UGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
-
- }
- public void RemoveGroundFromPosition(int yPos, int xPos) {
- UGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
-
+ /// <summary>
+ /// Sets the ground (tile)'s stock_id and health for the specified position of the ground (tile) layer table
+ /// </summary>
+ public void SetGroundAtPosition(string stock_id, int yPos, int xPos)
+ {
+ this.UGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
}
- public string SuperLayerName() {
- return "Underground";
+ /// <summary>
+ /// Sets invalid values for stock_id (null) for the specified position of the ground (tile) layer table
+ /// </summary>
+ public void RemoveGroundFromPosition(int yPos, int xPos)
+ {
+ this.UGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
}
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
+ // Used to set the connection string
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
+ {
optionsBuilder.UseMySQL(DataBaseContexts.ConnectionStringMySQL);
}
}
diff --git a/Mundus/Data/Values.cs b/Mundus/Data/Values.cs
index 6091b3c..eb9812b 100644
--- a/Mundus/Data/Values.cs
+++ b/Mundus/Data/Values.cs
@@ -1,34 +1,51 @@
-using System;
-namespace Mundus.Data {
- public static class Values {
-
- public static MapSize CurrMapSize { get; set; }
- public enum MapSize {
+namespace Mundus.Data
+{
+ /// <summary>
+ /// Stores all needed values
+ /// </summary>
+ public static class Values
+ {
+ public enum MapSize
+ {
SMALL = 14,
MEDIUM = 16,
LARGE = 12
}
- public static Difficulty CurrDifficulty { get; set; }
- public enum Difficulty {
+ public enum Difficulty
+ {
Peaceful = -10,
Easy = -5,
Normal = 10,
Hard = 40,
Insane = 80
}
- /// <summary>
- /// Returns selected difficulty divided by a number. Used to change energy drain values.
- /// </summary>
- public static double DifficultyValueModifier() {
- return (int)CurrDifficulty / 80.0;
- }
- public enum ToolType {
+ public enum ToolType
+ {
Shovel,
Axe,
Pickaxe,
Sword
}
+
+ /// <summary>
+ /// Gets or sets the current (selected) map size
+ /// </summary>
+ public static MapSize CurrMapSize { get; set; }
+
+ /// <summary>
+ /// Gets or sets the current (selected) difficulty
+ /// </summary>
+ public static Difficulty CurrDifficulty { get; set; }
+
+ /// <summary>
+ /// Returns selected difficulty divided by a number (80).
+ /// Used to change energy drain values.
+ /// </summary>
+ public static double DifficultyValueModifier()
+ {
+ return (int)CurrDifficulty / 80.0;
+ }
}
-}
+} \ No newline at end of file
diff --git a/Mundus/Data/Windows/WI.cs b/Mundus/Data/Windows/WI.cs
index dbba9a8..0aa04a2 100644
--- a/Mundus/Data/Windows/WI.cs
+++ b/Mundus/Data/Windows/WI.cs
@@ -1,42 +1,106 @@
-using Mundus.Views.Windows;
+namespace Mundus.Data.Windows
+{
+ using Mundus.Views.Windows;
-namespace Mundus.Data.Windows {
- public static class WI { //stands for Window Instances
+ /// <summary>
+ /// Used to store universally accessed windows
+ /// </summary>
+ public static class WI
+ {
+ /// <summary>
+ /// Full name of the build that is used in MainMenu and Pause windows
+ /// </summary>
public const string BuildName = "Requirements Build";
+ /// <summary>
+ /// Gets or sets the selected game window (should be WSGame, WMGame or WLGame)
+ /// </summary>
+ /// <value>The sel window.</value>
public static IGameWindow SelWin { get; set; }
+ /// <summary>
+ /// Gets the main window
+ /// </summary>
public static MainWindow WMain { get; private set; }
+
+ /// <summary>
+ /// Gets the new game window
+ /// </summary>
public static NewGameWindow WNewGame { get; private set; }
+
+ /// <summary>
+ /// Gets the small (sized) game window
+ /// </summary>
public static SmallGameWindow WSGame { get; private set; }
+
+ /// <summary>
+ /// Gets the medium (sized) window
+ /// </summary>
public static MediumGameWindow WMGame { get; private set; }
+
+ /// <summary>
+ /// Gets the large (sized) window
+ /// </summary>
public static LargeGameWindow WLGame { get; private set; }
+
+ /// <summary>
+ /// Gets the settings window
+ /// </summary>
public static SettingsWindow WSettings { get; private set; }
+
+ /// <summary>
+ /// Gets the pause window
+ /// </summary>
public static PauseWindow WPause { get; private set; }
+
+ /// <summary>
+ /// Gets the music window
+ /// </summary>
public static MusicWindow WMusic { get; private set; }
+
+ /// <summary>
+ /// Gets the crafting window
+ /// </summary>
public static CraftingWindow WCrafting { get; private set; }
+
+ /// <summary>
+ /// Gets the log window
+ /// </summary>
public static LogWindow WLog { get; private set; }
- //Gtk opens all window instances in the project automatically, unless they are hidden
- public static void CreateInstances() {
+ /// <summary>
+ /// Creates all instances of the windows and hides them
+ /// Gtk opens all window instances in the project automatically, unless they are hidden
+ /// </summary>
+ public static void CreateInstances()
+ {
WMain = new MainWindow();
WMain.Hide();
+
WNewGame = new NewGameWindow();
WNewGame.Hide();
+
WSGame = new SmallGameWindow();
WSGame.Hide();
+
WMGame = new MediumGameWindow();
WMGame.Hide();
+
WLGame = new LargeGameWindow();
WLGame.Hide();
+
WSettings = new SettingsWindow();
WSettings.Hide();
+
WPause = new PauseWindow();
WPause.Hide();
+
WMusic = new MusicWindow();
WMusic.Hide();
+
WCrafting = new CraftingWindow();
WCrafting.Hide();
+
WLog = new LogWindow();
WLog.Hide();
}
diff --git a/Mundus/Mundus.csproj b/Mundus/Mundus.csproj
index dfe8ea5..8b371a8 100644
--- a/Mundus/Mundus.csproj
+++ b/Mundus/Mundus.csproj
@@ -284,16 +284,18 @@
<Compile Include="Views\Windows\GameWindows\MediumGameWindow.cs" />
<Compile Include="Views\Windows\GameWindows\SmallGameWindow.cs" />
<Compile Include="Data\Crafting\CraftingTableContext.cs" />
- <Compile Include="Data\GameEventLogContext.cs" />
<Compile Include="Data\DataBaseContexts.cs" />
- <Compile Include="Data\SuperLayers\SkyContext.cs" />
- <Compile Include="Data\SuperLayers\ISuperLayerContext.cs" />
+ <Compile Include="Data\SuperLayers\SkyContext.cs">
+ <ExcludeFromStyleCop>false</ExcludeFromStyleCop>
+ </Compile>
+ <Compile Include="Data\SuperLayers\ISuperLayerContext.cs">
+ <ExcludeFromStyleCop>false</ExcludeFromStyleCop>
+ </Compile>
<Compile Include="Data\SuperLayers\LandContext.cs" />
<Compile Include="Data\SuperLayers\UndergroundContext.cs" />
<Compile Include="Data\Values.cs" />
<Compile Include="Data\SuperLayers\DBTables\PlacedTile.cs" />
<Compile Include="Data\SuperLayers\DBTables\SSPlacedTile.cs" />
- <Compile Include="Data\GameEventLog.cs" />
<Compile Include="Data\SuperLayers\DBTables\SGPlacedTile.cs" />
<Compile Include="Data\SuperLayers\DBTables\SMPlacedTile.cs" />
<Compile Include="Data\SuperLayers\DBTables\UGPlacedTile.cs" />
@@ -302,6 +304,8 @@
<Compile Include="Data\SuperLayers\DBTables\LGPlacedTile.cs" />
<Compile Include="Data\SuperLayers\DBTables\LSPlacedTile.cs" />
<Compile Include="Data\SuperLayers\DBTables\LMPlacedTile.cs" />
+ <Compile Include="Data\GameEventLogs\GameEventLog.cs" />
+ <Compile Include="Data\GameEventLogs\GameEventLogContext.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Service\" />
@@ -327,6 +331,7 @@
<Folder Include="Views\Windows\GameWindows\" />
<Folder Include="Icons\UI\Hearth\" />
<Folder Include="Data\SuperLayers\DBTables\" />
+ <Folder Include="Data\GameEventLogs\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
diff --git a/Mundus/Service/Tiles/Crafting/CraftingRecipe.cs b/Mundus/Service/Tiles/Crafting/CraftingRecipe.cs
index 85833e2..148e76b 100644
--- a/Mundus/Service/Tiles/Crafting/CraftingRecipe.cs
+++ b/Mundus/Service/Tiles/Crafting/CraftingRecipe.cs
@@ -5,7 +5,7 @@ using System.Linq;
using Mundus.Service.Tiles.Items;
namespace Mundus.Service.Tiles.Crafting {
- [Table("Recipes", Schema = "Mundus")]
+ [Table("CraftingRecipes", Schema = "Mundus")]
public class CraftingRecipe {
[Key]
public int ID { get; set; }