aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2020-05-11 10:26:50 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2020-05-11 10:26:50 +0300
commitb036eb97201e75544e41fe5e6be8c422d9ee0ed1 (patch)
tree58c34a709f898abf8ace3ffd9ec356008dd9d7ed
parent0456aaa884f36bf3a5181f37b29a72af0db39c05 (diff)
downloadMundus-b036eb97201e75544e41fe5e6be8c422d9ee0ed1.tar
Mundus-b036eb97201e75544e41fe5e6be8c422d9ee0ed1.tar.gz
Mundus-b036eb97201e75544e41fe5e6be8c422d9ee0ed1.zip
The map is now integrated in the MySQL database (Note: mob fighting and mob terraforming are kind of broken). Constants are now grouped as enums in Values.cs (will do this in master). Tables now get truncated upon program start.
-rw-r--r--Mundus/Data/DataBaseContext.cs15
-rw-r--r--Mundus/Data/DataBaseContexts.cs26
-rw-r--r--Mundus/Data/Difficulty.cs19
-rw-r--r--Mundus/Data/GameEventLog.cs (renamed from Mundus/Service/GameEventLog.cs)2
-rw-r--r--Mundus/Data/GameEventLogContext.cs4
-rw-r--r--Mundus/Data/MapSizes.cs10
-rw-r--r--Mundus/Data/SuperLayers/DBTables/LGPlacedTile.cs10
-rw-r--r--Mundus/Data/SuperLayers/DBTables/LMPlacedTile.cs10
-rw-r--r--Mundus/Data/SuperLayers/DBTables/LSPlacedTile.cs10
-rw-r--r--Mundus/Data/SuperLayers/DBTables/PlacedTile.cs14
-rw-r--r--Mundus/Data/SuperLayers/DBTables/SGPlacedTile.cs10
-rw-r--r--Mundus/Data/SuperLayers/DBTables/SMPlacedTile.cs10
-rw-r--r--Mundus/Data/SuperLayers/DBTables/SSPlacedTile.cs10
-rw-r--r--Mundus/Data/SuperLayers/DBTables/UGPlacedTile.cs10
-rw-r--r--Mundus/Data/SuperLayers/DBTables/UMPlacedTile.cs10
-rw-r--r--Mundus/Data/SuperLayers/DBTables/USPlacedTile.cs10
-rw-r--r--Mundus/Data/SuperLayers/ISuperLayer.cs22
-rw-r--r--Mundus/Data/SuperLayers/ISuperLayerContext.cs20
-rw-r--r--Mundus/Data/SuperLayers/LI.cs18
-rw-r--r--Mundus/Data/SuperLayers/Land.cs56
-rw-r--r--Mundus/Data/SuperLayers/LandContext.cs86
-rw-r--r--Mundus/Data/SuperLayers/Mobs/MI.cs2
-rw-r--r--Mundus/Data/SuperLayers/Sky.cs57
-rw-r--r--Mundus/Data/SuperLayers/SkyContext.cs87
-rw-r--r--Mundus/Data/SuperLayers/Underground.cs58
-rw-r--r--Mundus/Data/SuperLayers/UndergroundContext.cs86
-rw-r--r--Mundus/Data/Tiles/ToolTypes.cs8
-rw-r--r--Mundus/Data/Values.cs34
-rw-r--r--Mundus/Mundus.csproj32
-rw-r--r--Mundus/Program.cs3
-rw-r--r--Mundus/Service/Calculate.cs12
-rw-r--r--Mundus/Service/GameEventLogController.cs (renamed from Mundus/Service/LogController.cs)8
-rw-r--r--Mundus/Service/GameGenerator.cs22
-rw-r--r--Mundus/Service/SuperLayers/Generators/LandSuperLayerGenerator.cs82
-rw-r--r--Mundus/Service/SuperLayers/Generators/SkySuperLayerGenerator.cs34
-rw-r--r--Mundus/Service/SuperLayers/Generators/UndergroundSuperLayerGenerator.cs46
-rw-r--r--Mundus/Service/SuperLayers/HeightController.cs17
-rw-r--r--Mundus/Service/SuperLayers/ImageController.cs25
-rw-r--r--Mundus/Service/Tiles/Crafting/CraftingController.cs2
-rw-r--r--Mundus/Service/Tiles/Items/GroundTile.cs4
-rw-r--r--Mundus/Service/Tiles/Items/Presets/GroundPresets.cs9
-rw-r--r--Mundus/Service/Tiles/Items/Presets/StructurePresets.cs14
-rw-r--r--Mundus/Service/Tiles/Items/Presets/ToolPresets.cs18
-rw-r--r--Mundus/Service/Tiles/Items/Structure.cs8
-rw-r--r--Mundus/Service/Tiles/Items/Tool.cs6
-rw-r--r--Mundus/Service/Tiles/Mobs/Controllers/MobFighting.cs24
-rw-r--r--Mundus/Service/Tiles/Mobs/Controllers/MobMovement.cs76
-rw-r--r--Mundus/Service/Tiles/Mobs/Controllers/MobStatsController.cs6
-rw-r--r--Mundus/Service/Tiles/Mobs/Controllers/MobTerraforming.cs75
-rw-r--r--Mundus/Service/Tiles/Mobs/LandMobs/LandMobsPresets.cs17
-rw-r--r--Mundus/Service/Tiles/Mobs/LandMobs/Player.cs2
-rw-r--r--Mundus/Service/Tiles/Mobs/MobTile.cs4
-rw-r--r--Mundus/Views/Windows/GameWindows/LargeGameWindow.cs4
-rw-r--r--Mundus/Views/Windows/GameWindows/MediumGameWindow.cs4
-rw-r--r--Mundus/Views/Windows/GameWindows/SmallGameWindow.cs4
-rw-r--r--Mundus/Views/Windows/LogWindow.cs6
-rw-r--r--Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs1
-rw-r--r--Mundus/gtk-gui/Mundus.Views.Windows.NewGameWindow.cs5
-rw-r--r--Mundus/gtk-gui/gui.stetic6
59 files changed, 767 insertions, 523 deletions
diff --git a/Mundus/Data/DataBaseContext.cs b/Mundus/Data/DataBaseContext.cs
deleted file mode 100644
index 5e9076a..0000000
--- a/Mundus/Data/DataBaseContext.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-using System;
-using Mundus.Data.Crafting;
-
-namespace Mundus.Data {
- public static class DataBaseContext {
- public static CraftingTableContext CTContext { get; private set; }
- public static GameEventLogContext GELContext { get; private set; }
-
- public static void CreateInstances() {
- CTContext = new CraftingTableContext();
- CTContext.AddRecipes();
- GELContext = new GameEventLogContext();
- }
- }
-}
diff --git a/Mundus/Data/DataBaseContexts.cs b/Mundus/Data/DataBaseContexts.cs
new file mode 100644
index 0000000..18e75c9
--- /dev/null
+++ b/Mundus/Data/DataBaseContexts.cs
@@ -0,0 +1,26 @@
+using System;
+using Mundus.Data.Crafting;
+using Mundus.Data.SuperLayers;
+
+namespace Mundus.Data {
+ public static class DataBaseContexts {
+ public static CraftingTableContext CTContext { get; private set; }
+ public static GameEventLogContext GELContext { get; private set; }
+
+ public static SkyContext SContext { get; private set; }
+ public static LandContext LContext { get; private set; }
+ public static UndergroundContext UContext { get; private set; }
+ public static ISuperLayerContext[] SuperLayerContexts { get; private set; }
+
+ public static void CreateInstances() {
+ CTContext = new CraftingTableContext();
+ CTContext.AddRecipes();
+ GELContext = new GameEventLogContext();
+
+ SContext = new SkyContext();
+ LContext = new LandContext();
+ UContext = new UndergroundContext();
+ SuperLayerContexts = new ISuperLayerContext[] { SContext, LContext, UContext };
+ }
+ }
+}
diff --git a/Mundus/Data/Difficulty.cs b/Mundus/Data/Difficulty.cs
deleted file mode 100644
index 3e79ecc..0000000
--- a/Mundus/Data/Difficulty.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-using System;
-namespace Mundus.Data {
- public static class Difficulty {
- public const int Peaceful = -10;
- public const int Easy = -5;
- public const int Normal = 10;
- public const int Hard = 40;
- public const int Insane = 80;
-
- public static int SelDifficulty { get; set; }
-
- /// <summary>
- /// Returns selected difficulty divided by a number. Used to change energy drain values.
- /// </summary>
- public static double ValueModifier() {
- return SelDifficulty / 80.0;
- }
- }
-}
diff --git a/Mundus/Service/GameEventLog.cs b/Mundus/Data/GameEventLog.cs
index f718e82..eee5b54 100644
--- a/Mundus/Service/GameEventLog.cs
+++ b/Mundus/Data/GameEventLog.cs
@@ -2,7 +2,7 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
-namespace Mundus.Service {
+namespace Mundus.Data {
[Table("GameEventLogs", Schema = "Mundus")]
public class GameEventLog {
[Key]
diff --git a/Mundus/Data/GameEventLogContext.cs b/Mundus/Data/GameEventLogContext.cs
index be1fe53..8c7088d 100644
--- a/Mundus/Data/GameEventLogContext.cs
+++ b/Mundus/Data/GameEventLogContext.cs
@@ -13,8 +13,8 @@ namespace Mundus.Data {
}
private void ResetTable() {
- GameEventLogs.RemoveRange(GameEventLogs);
- this.SaveChanges();
+ Database.ExecuteSqlRaw("TRUNCATE TABLE GameEventLogs;");
+ SaveChanges();
}
public void AddMessage(string message) {
diff --git a/Mundus/Data/MapSizes.cs b/Mundus/Data/MapSizes.cs
deleted file mode 100644
index a097c58..0000000
--- a/Mundus/Data/MapSizes.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-namespace Mundus.Data {
- public static class MapSizes {
- //These are the map sizes that are generated
- public const int SMALL = 30;
- public const int MEDIUM = 60;
- public const int LARGE = 100;
-
- public static int CurrSize { get; set; }
- }
-}
diff --git a/Mundus/Data/SuperLayers/DBTables/LGPlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/LGPlacedTile.cs
new file mode 100644
index 0000000..44a0db3
--- /dev/null
+++ b/Mundus/Data/SuperLayers/DBTables/LGPlacedTile.cs
@@ -0,0 +1,10 @@
+using System;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Mundus.Data.SuperLayers.DBTables {
+ [Table("LGroundLayer", Schema = "Mundus")]
+ 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
new file mode 100644
index 0000000..d5a15be
--- /dev/null
+++ b/Mundus/Data/SuperLayers/DBTables/LMPlacedTile.cs
@@ -0,0 +1,10 @@
+using System;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Mundus.Data.SuperLayers.DBTables {
+ [Table("LMobLayer", Schema = "Mundus")]
+ public class LMPlacedTile : PlacedTile {
+ public LMPlacedTile(string stock_id, int yPos, int xPos) : base(stock_id, yPos, xPos) {
+ }
+ }
+}
diff --git a/Mundus/Data/SuperLayers/DBTables/LSPlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/LSPlacedTile.cs
new file mode 100644
index 0000000..ed54601
--- /dev/null
+++ b/Mundus/Data/SuperLayers/DBTables/LSPlacedTile.cs
@@ -0,0 +1,10 @@
+using System;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Mundus.Data.SuperLayers.DBTables {
+ [Table("LStructureLayer", Schema = "Mundus")]
+ public class LSPlacedTile : PlacedTile {
+ public LSPlacedTile(string stock_id, int yPos, int xPos) : base(stock_id, yPos, xPos) {
+ }
+ }
+}
diff --git a/Mundus/Data/SuperLayers/DBTables/PlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/PlacedTile.cs
new file mode 100644
index 0000000..31bd1bb
--- /dev/null
+++ b/Mundus/Data/SuperLayers/DBTables/PlacedTile.cs
@@ -0,0 +1,14 @@
+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) {
+ this.YPos = yPos;
+ this.XPos = xPos;
+ this.stock_id = stock_id;
+ }
+ }
+}
diff --git a/Mundus/Data/SuperLayers/DBTables/SGPlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/SGPlacedTile.cs
new file mode 100644
index 0000000..0791cc4
--- /dev/null
+++ b/Mundus/Data/SuperLayers/DBTables/SGPlacedTile.cs
@@ -0,0 +1,10 @@
+using System;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Mundus.Data.SuperLayers.DBTables {
+ [Table("SGroundLayer", Schema = "Mundus")]
+ 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
new file mode 100644
index 0000000..9a3cf00
--- /dev/null
+++ b/Mundus/Data/SuperLayers/DBTables/SMPlacedTile.cs
@@ -0,0 +1,10 @@
+using System;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Mundus.Data.SuperLayers.DBTables {
+ [Table("SMobLayer", Schema = "Mundus")]
+ public class SMPlacedTile : PlacedTile {
+ public SMPlacedTile(string stock_id, int yPos, int xPos) : base(stock_id, yPos, xPos) {
+ }
+ }
+}
diff --git a/Mundus/Data/SuperLayers/DBTables/SSPlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/SSPlacedTile.cs
new file mode 100644
index 0000000..e7734fa
--- /dev/null
+++ b/Mundus/Data/SuperLayers/DBTables/SSPlacedTile.cs
@@ -0,0 +1,10 @@
+using System;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Mundus.Data.SuperLayers.DBTables {
+ [Table("SStructureLayer", Schema = "Mundus")]
+ public class SSPlacedTile : PlacedTile {
+ public SSPlacedTile(string stock_id, int yPos, int xPos):base(stock_id, yPos, xPos) {
+ }
+ }
+}
diff --git a/Mundus/Data/SuperLayers/DBTables/UGPlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/UGPlacedTile.cs
new file mode 100644
index 0000000..762af7e
--- /dev/null
+++ b/Mundus/Data/SuperLayers/DBTables/UGPlacedTile.cs
@@ -0,0 +1,10 @@
+using System;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Mundus.Data.SuperLayers.DBTables {
+ [Table("UGroundLayer", Schema = "Mundus")]
+ 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
new file mode 100644
index 0000000..5c27c2c
--- /dev/null
+++ b/Mundus/Data/SuperLayers/DBTables/UMPlacedTile.cs
@@ -0,0 +1,10 @@
+using System;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Mundus.Data.SuperLayers.DBTables {
+ [Table("UMobLayer", Schema = "Mundus")]
+ public class UMPlacedTile : PlacedTile {
+ public UMPlacedTile(string stock_id, int yPos, int xPos) : base(stock_id, yPos, xPos) {
+ }
+ }
+}
diff --git a/Mundus/Data/SuperLayers/DBTables/USPlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/USPlacedTile.cs
new file mode 100644
index 0000000..4999913
--- /dev/null
+++ b/Mundus/Data/SuperLayers/DBTables/USPlacedTile.cs
@@ -0,0 +1,10 @@
+using System;
+using System.ComponentModel.DataAnnotations.Schema;
+
+namespace Mundus.Data.SuperLayers.DBTables {
+ [Table("UStructureLayer", Schema = "Mundus")]
+ public class USPlacedTile : PlacedTile {
+ public USPlacedTile(string stock_id, int yPos, int xPos) : base(stock_id, yPos, xPos) {
+ }
+ }
+}
diff --git a/Mundus/Data/SuperLayers/ISuperLayer.cs b/Mundus/Data/SuperLayers/ISuperLayer.cs
deleted file mode 100644
index 8f140ad..0000000
--- a/Mundus/Data/SuperLayers/ISuperLayer.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-using Mundus.Service.Tiles.Mobs;
-using Mundus.Service.Tiles.Items;
-
-namespace Mundus.Data.SuperLayers {
- public interface ISuperLayer {
- MobTile GetMobLayerTile(int yPos, int xPos);
- Structure GetStructureLayerTile(int yPos, int xPos);
- GroundTile GetGroundLayerTile(int yPos, int xPos);
-
- void SetMobLayer(MobTile[,] mobTiles);
- void SetMobAtPosition(MobTile tile, int yPos, int xPos);
- void RemoveMobFromPosition(int yPos, int xPos);
-
- void SetStructureLayer(Structure[,] itemTiles);
- void SetStructureAtPosition(Structure tile, int yPos, int xPos);
- void RemoveStructureFromPosition(int yPos, int xPos);
-
- void SetGroundLayer(GroundTile[,] groundTiles);
- void SetGroundAtPosition(GroundTile tile, int yPos, int xPos);
- void RemoveGroundFromPosition(int yPos, int xPos);
- }
-}
diff --git a/Mundus/Data/SuperLayers/ISuperLayerContext.cs b/Mundus/Data/SuperLayers/ISuperLayerContext.cs
new file mode 100644
index 0000000..ecdb592
--- /dev/null
+++ b/Mundus/Data/SuperLayers/ISuperLayerContext.cs
@@ -0,0 +1,20 @@
+using System;
+namespace Mundus.Data.SuperLayers {
+ public interface ISuperLayerContext {
+ string GetMobLayerStock(int yPos, int xPos);
+ string GetStructureLayerStock(int yPos, int xPos);
+ string GetGroundLayerStock(int yPos, int xPos);
+
+ void AddMobAtPosition(string stock_id, int yPos, int xPos);
+ void SetMobAtPosition(string stock_id, int yPos, int xPos);
+ void RemoveMobFromPosition(int yPos, int xPos);
+
+ void AddStructureAtPosition(string stock_id, int yPos, int xPos);
+ void SetStructureAtPosition(string stock_id, int yPos, int xPos);
+ void RemoveStructureFromPosition(int yPos, int xPos);
+
+ void AddGroundAtPosition(string stock_id, int yPos, int xPos);
+ void SetGroundAtPosition(string stock_id, int yPos, int xPos);
+ void RemoveGroundFromPosition(int yPos, int xPos);
+ }
+}
diff --git a/Mundus/Data/SuperLayers/LI.cs b/Mundus/Data/SuperLayers/LI.cs
deleted file mode 100644
index 7ef2c2c..0000000
--- a/Mundus/Data/SuperLayers/LI.cs
+++ /dev/null
@@ -1,18 +0,0 @@
-namespace Mundus.Data.SuperLayers {
- public static class LI { //stands for Layer Instances
- //add other layers
- public static Sky Sky { get; private set; }
- public static Land Land { get; private set; }
- public static Underground Underground { get; private set; }
-
- public static void CreateInstances() {
- Sky = new Sky();
- Land = new Land();
- Underground = new Underground();
- }
-
- public static ISuperLayer[] AllSuperLayers() {
- return new ISuperLayer[] { Sky, Land, Underground};
- }
- }
-}
diff --git a/Mundus/Data/SuperLayers/Land.cs b/Mundus/Data/SuperLayers/Land.cs
deleted file mode 100644
index 73ffd17..0000000
--- a/Mundus/Data/SuperLayers/Land.cs
+++ /dev/null
@@ -1,56 +0,0 @@
-using Mundus.Service.Tiles.Mobs;
-using Mundus.Service.Tiles.Items;
-
-namespace Mundus.Data.SuperLayers {
- public class Land : ISuperLayer {
- private static MobTile[,] mobLayer;
- private static Structure[,] structureLayer;
- private static GroundTile[,] groundLayer;
-
- public Land() { }
-
- public MobTile GetMobLayerTile(int yPos, int xPos) {
- return mobLayer[yPos, xPos];
- }
- public Structure GetStructureLayerTile(int yPos, int xPos) {
- return structureLayer[yPos, xPos];
- }
- public GroundTile GetGroundLayerTile(int yPos, int xPos) {
- return groundLayer[yPos, xPos];
- }
-
- public void SetMobLayer(MobTile[,] mobTiles) {
- mobLayer = mobTiles;
- }
- public void SetMobAtPosition(MobTile tile, int yPos, int xPos) {
- mobLayer[yPos, xPos] = tile;
- }
- public void RemoveMobFromPosition(int yPos, int xPos) {
- mobLayer[yPos, xPos] = null;
- }
-
- public void SetStructureLayer(Structure[,] itemTiles) {
- structureLayer = itemTiles;
- }
- public void SetStructureAtPosition(Structure tile, int yPos, int xPos) {
- structureLayer[yPos, xPos] = tile;
- }
- public void RemoveStructureFromPosition(int yPos, int xPos) {
- structureLayer[yPos, xPos] = null;
- }
-
- public void SetGroundLayer(GroundTile[,] groundTiles) {
- groundLayer = groundTiles;
- }
- public void SetGroundAtPosition(GroundTile tile, int yPos, int xPos) {
- groundLayer[yPos, xPos] = tile;
- }
- public void RemoveGroundFromPosition(int yPos, int xPos) {
- groundLayer[yPos, xPos] = null;
- }
-
- public override string ToString() {
- return "Land";
- }
- }
-}
diff --git a/Mundus/Data/SuperLayers/LandContext.cs b/Mundus/Data/SuperLayers/LandContext.cs
new file mode 100644
index 0000000..89bed78
--- /dev/null
+++ b/Mundus/Data/SuperLayers/LandContext.cs
@@ -0,0 +1,86 @@
+using System;
+using System.Linq;
+using Microsoft.EntityFrameworkCore;
+using Mundus.Data.SuperLayers.DBTables;
+using Mundus.Service.SuperLayers;
+
+namespace Mundus.Data.SuperLayers {
+ public class LandContext : DbContext, ISuperLayerContext {
+ public DbSet<LMPlacedTile> LMobLayer { get; private set; }
+ public DbSet<LSPlacedTile> LStructureLayer { get; private set; }
+ 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();
+ }
+
+ public string GetMobLayerStock(int yPos, int xPos) {
+ return LMobLayer.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;
+ }
+
+ public void AddMobAtPosition(string stock_id, int yPos, int xPos) {
+ LMobLayer.Add(new LMPlacedTile(stock_id, yPos, xPos));
+
+ }
+
+ public void SetMobAtPosition(string stock_id, int yPos, int xPos) {
+ LMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
+
+ }
+ public void RemoveMobFromPosition(int yPos, int xPos) {
+ LMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
+
+ }
+
+ public void AddStructureAtPosition(string stock_id, int yPos, int xPos) {
+ LStructureLayer.Add(new LSPlacedTile(stock_id, yPos, xPos));
+
+ }
+
+ public void SetStructureAtPosition(string stock_id, int yPos, int xPos) {
+ LStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
+
+ }
+ public void RemoveStructureFromPosition(int yPos, int xPos) {
+ LStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
+
+ }
+
+ public void AddGroundAtPosition(string stock_id, int yPos, int xPos) {
+ 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;
+
+ }
+
+ public string SuperLayerName() {
+ return "Land";
+ }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
+ optionsBuilder.UseMySQL(
+ "server=localhost;" +
+ "port=3306;" +
+ "user id=root; " +
+ "password=password; " +
+ "database=Mundus; " +
+ "SslMode=none");
+ }
+}
+}
diff --git a/Mundus/Data/SuperLayers/Mobs/MI.cs b/Mundus/Data/SuperLayers/Mobs/MI.cs
index 3e9cdeb..f309968 100644
--- a/Mundus/Data/SuperLayers/Mobs/MI.cs
+++ b/Mundus/Data/SuperLayers/Mobs/MI.cs
@@ -11,7 +11,7 @@ namespace Mundus.Data.Superlayers.Mobs {
/// Note: player has a health of 4 * inventorySize
/// </summary>
public static void CreateInstances() {
- Player = new Player("player", 5, LI.Land);
+ Player = new Player("player", 5, DataBaseContexts.LContext);
Player.Inventory.AppendToHotbar(ToolPresets.GetAWoodenAxe());
Player.Inventory.AppendToHotbar(ToolPresets.GetAWoodenPickaxe());
}
diff --git a/Mundus/Data/SuperLayers/Sky.cs b/Mundus/Data/SuperLayers/Sky.cs
deleted file mode 100644
index cb4343d..0000000
--- a/Mundus/Data/SuperLayers/Sky.cs
+++ /dev/null
@@ -1,57 +0,0 @@
-using System;
-using Mundus.Service.Tiles.Mobs;
-using Mundus.Service.Tiles.Items;
-
-namespace Mundus.Data.SuperLayers {
- public class Sky : ISuperLayer {
- private static MobTile[,] mobLayer;
- private static Structure[,] structureLayer;
- private static GroundTile[,] groundLayer;
-
- public Sky() { }
-
- public MobTile GetMobLayerTile(int yPos, int xPos) {
- return mobLayer[yPos, xPos];
- }
- public Structure GetStructureLayerTile(int yPos, int xPos) {
- return structureLayer[yPos, xPos];
- }
- public GroundTile GetGroundLayerTile(int yPos, int xPos) {
- return groundLayer[yPos, xPos];
- }
-
- public void SetMobLayer(MobTile[,] mobTiles) {
- mobLayer = mobTiles;
- }
- public void SetMobAtPosition(MobTile tile, int yPos, int xPos) {
- mobLayer[yPos, xPos] = tile;
- }
- public void RemoveMobFromPosition(int yPos, int xPos) {
- mobLayer[yPos, xPos] = null;
- }
-
- public void SetStructureLayer(Structure[,] itemTiles) {
- structureLayer = itemTiles;
- }
- public void SetStructureAtPosition(Structure tile, int yPos, int xPos) {
- structureLayer[yPos, xPos] = tile;
- }
- public void RemoveStructureFromPosition(int yPos, int xPos) {
- structureLayer[yPos, xPos] = null;
- }
-
- public void SetGroundLayer(GroundTile[,] groundTiles) {
- groundLayer = groundTiles;
- }
- public void SetGroundAtPosition(GroundTile tile, int yPos, int xPos) {
- groundLayer[yPos, xPos] = tile;
- }
- public void RemoveGroundFromPosition(int yPos, int xPos) {
- groundLayer[yPos, xPos] = null;
- }
-
- public override string ToString() {
- return "Sky";
- }
- }
-}
diff --git a/Mundus/Data/SuperLayers/SkyContext.cs b/Mundus/Data/SuperLayers/SkyContext.cs
new file mode 100644
index 0000000..8c68d2b
--- /dev/null
+++ b/Mundus/Data/SuperLayers/SkyContext.cs
@@ -0,0 +1,87 @@
+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 {
+ public DbSet<SMPlacedTile> SMobLayer { get; private set; }
+ public DbSet<SSPlacedTile> SStructureLayer { get; private set; }
+ 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();
+ }
+
+ public string GetMobLayerStock(int yPos, int xPos) {
+ return SMobLayer.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;
+ }
+
+ public void AddMobAtPosition(string stock_id, int yPos, int xPos) {
+ SMobLayer.Add(new SMPlacedTile(stock_id, yPos, xPos));
+
+ }
+
+ public void SetMobAtPosition(string stock_id, int yPos, int xPos) {
+ SMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
+
+ }
+ public void RemoveMobFromPosition(int yPos, int xPos) {
+ SMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
+
+ }
+
+ public void AddStructureAtPosition(string stock_id, int yPos, int xPos) {
+ SStructureLayer.Add(new SSPlacedTile(stock_id, yPos, xPos));
+
+ }
+
+ public void SetStructureAtPosition(string stock_id, int yPos, int xPos) {
+ SStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
+
+ }
+ public void RemoveStructureFromPosition(int yPos, int xPos) {
+ SStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
+
+ }
+
+ public void AddGroundAtPosition(string stock_id, int yPos, int xPos) {
+ 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;
+
+ }
+
+ public string SuperLayerName() {
+ return "Sky";
+ }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
+ optionsBuilder.UseMySQL(
+ "server=localhost;" +
+ "port=3306;" +
+ "user id=root; " +
+ "password=password; " +
+ "database=Mundus; " +
+ "SslMode=none");
+ }
+ }
+}
diff --git a/Mundus/Data/SuperLayers/Underground.cs b/Mundus/Data/SuperLayers/Underground.cs
deleted file mode 100644
index d78930a..0000000
--- a/Mundus/Data/SuperLayers/Underground.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System;
-using Mundus.Service.Tiles.Mobs;
-using Mundus.Service.Tiles.Items;
-
-namespace Mundus.Data.SuperLayers {
- public class Underground : ISuperLayer {
- private static MobTile[,] mobLayer;
- private static Structure[,] structureLayer;
- private static GroundTile[,] groundLayer;
-
- public Underground()
- { }
-
- public MobTile GetMobLayerTile(int yPos, int xPos) {
- return mobLayer[yPos, xPos];
- }
- public Structure GetStructureLayerTile(int yPos, int xPos) {
- return structureLayer[yPos, xPos];
- }
- public GroundTile GetGroundLayerTile(int yPos, int xPos) {
- return groundLayer[yPos, xPos];
- }
-
- public void SetMobLayer(MobTile[,] mobTiles) {
- mobLayer = mobTiles;
- }
- public void SetMobAtPosition(MobTile tile, int yPos, int xPos) {
- mobLayer[yPos, xPos] = tile;
- }
- public void RemoveMobFromPosition(int yPos, int xPos) {
- mobLayer[yPos, xPos] = null;
- }
-
- public void SetStructureLayer(Structure[,] itemTiles) {
- structureLayer = itemTiles;
- }
- public void SetStructureAtPosition(Structure tile, int yPos, int xPos) {
- structureLayer[yPos, xPos] = tile;
- }
- public void RemoveStructureFromPosition(int yPos, int xPos) {
- structureLayer[yPos, xPos] = null;
- }
-
- public void SetGroundLayer(GroundTile[,] groundTiles) {
- groundLayer = groundTiles;
- }
- public void SetGroundAtPosition(GroundTile tile, int yPos, int xPos) {
- groundLayer[yPos, xPos] = tile;
- }
- public void RemoveGroundFromPosition(int yPos, int xPos) {
- groundLayer[yPos, xPos] = null;
- }
-
- public override string ToString() {
- return "Underground";
- }
- }
-}
diff --git a/Mundus/Data/SuperLayers/UndergroundContext.cs b/Mundus/Data/SuperLayers/UndergroundContext.cs
new file mode 100644
index 0000000..ffb90a5
--- /dev/null
+++ b/Mundus/Data/SuperLayers/UndergroundContext.cs
@@ -0,0 +1,86 @@
+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 {
+ public DbSet<UMPlacedTile> UMobLayer { get; private set; }
+ public DbSet<USPlacedTile> UStructureLayer { get; private set; }
+ 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();
+ }
+
+ public string GetMobLayerStock(int yPos, int xPos) {
+ return UMobLayer.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;
+ }
+
+ public void AddMobAtPosition(string stock_id, int yPos, int xPos) {
+ UMobLayer.Add(new UMPlacedTile(stock_id, yPos, xPos));
+
+ }
+
+ public void SetMobAtPosition(string stock_id, int yPos, int xPos) {
+ UMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
+
+ }
+ public void RemoveMobFromPosition(int yPos, int xPos) {
+ UMobLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
+
+ }
+
+ public void AddStructureAtPosition(string stock_id, int yPos, int xPos) {
+ UStructureLayer.Add(new USPlacedTile(stock_id, yPos, xPos));
+
+ }
+
+ public void SetStructureAtPosition(string stock_id, int yPos, int xPos) {
+ UStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = stock_id;
+
+ }
+ public void RemoveStructureFromPosition(int yPos, int xPos) {
+ UStructureLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null;
+
+ }
+
+ public void AddGroundAtPosition(string stock_id, int yPos, int xPos) {
+ 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;
+
+ }
+
+ public string SuperLayerName() {
+ return "Underground";
+ }
+
+ protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) {
+ optionsBuilder.UseMySQL(
+ "server=localhost;" +
+ "port=3306;" +
+ "user id=root; " +
+ "password=password; " +
+ "database=Mundus; " +
+ "SslMode=none");
+ }
+}
+}
diff --git a/Mundus/Data/Tiles/ToolTypes.cs b/Mundus/Data/Tiles/ToolTypes.cs
deleted file mode 100644
index 1329061..0000000
--- a/Mundus/Data/Tiles/ToolTypes.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Mundus.Data.Tiles {
- public static class ToolTypes {
- public const int Shovel = 0;
- public const int Axe = 1;
- public const int Pickaxe = 2;
- public const int Sword = 3;
- }
-}
diff --git a/Mundus/Data/Values.cs b/Mundus/Data/Values.cs
new file mode 100644
index 0000000..6091b3c
--- /dev/null
+++ b/Mundus/Data/Values.cs
@@ -0,0 +1,34 @@
+using System;
+namespace Mundus.Data {
+ public static class Values {
+
+ public static MapSize CurrMapSize { get; set; }
+ public enum MapSize {
+ SMALL = 14,
+ MEDIUM = 16,
+ LARGE = 12
+ }
+
+ public static Difficulty CurrDifficulty { get; set; }
+ 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 {
+ Shovel,
+ Axe,
+ Pickaxe,
+ Sword
+ }
+ }
+}
diff --git a/Mundus/Mundus.csproj b/Mundus/Mundus.csproj
index 46985db..1fb328d 100644
--- a/Mundus/Mundus.csproj
+++ b/Mundus/Mundus.csproj
@@ -242,32 +242,24 @@
<Compile Include="Views\Dialogs\ExitDialog.cs" />
<Compile Include="gtk-gui\Mundus.Views.Dialogs.ExitDialog.cs" />
<Compile Include="Service\Tiles\ITile.cs" />
- <Compile Include="Data\MapSizes.cs" />
<Compile Include="Service\SuperLayers\ImageController.cs" />
<Compile Include="Service\Calculate.cs" />
<Compile Include="Data\Windows\WI.cs" />
<Compile Include="Data\Dialogues\DI.cs" />
- <Compile Include="Data\SuperLayers\Land.cs" />
- <Compile Include="Data\SuperLayers\ISuperLayer.cs" />
- <Compile Include="Data\SuperLayers\LI.cs" />
<Compile Include="Data\SuperLayers\Mobs\MI.cs" />
<Compile Include="Service\WindowController.cs" />
<Compile Include="Service\GameGenerator.cs" />
<Compile Include="Service\Tiles\Items\ItemTile.cs" />
<Compile Include="Service\Tiles\Items\Tool.cs" />
<Compile Include="Service\Tiles\Items\Structure.cs" />
- <Compile Include="Data\Tiles\ToolTypes.cs" />
<Compile Include="Service\Tiles\Items\Material.cs" />
<Compile Include="Service\Tiles\Items\Gear.cs" />
- <Compile Include="Data\SuperLayers\Underground.cs" />
<Compile Include="Service\SuperLayers\Generators\LandSuperLayerGenerator.cs" />
<Compile Include="Service\SuperLayers\Generators\UndergroundSuperLayerGenerator.cs" />
<Compile Include="Service\Tiles\Items\GroundTile.cs" />
<Compile Include="Service\SuperLayers\HeightController.cs" />
- <Compile Include="Data\SuperLayers\Sky.cs" />
<Compile Include="Service\SuperLayers\Generators\SkySuperLayerGenerator.cs" />
- <Compile Include="Data\Difficulty.cs" />
- <Compile Include="Service\LogController.cs" />
+ <Compile Include="Service\GameEventLogController.cs" />
<Compile Include="Views\Windows\LogWindow.cs" />
<Compile Include="gtk-gui\Mundus.Views.Windows.LogWindow.cs" />
<Compile Include="Service\Tiles\Mobs\Controllers\MobFighting.cs" />
@@ -293,8 +285,23 @@
<Compile Include="Views\Windows\GameWindows\SmallGameWindow.cs" />
<Compile Include="Data\Crafting\CraftingTableContext.cs" />
<Compile Include="Data\GameEventLogContext.cs" />
- <Compile Include="Service\GameEventLog.cs" />
- <Compile Include="Data\DataBaseContext.cs" />
+ <Compile Include="Data\DataBaseContexts.cs" />
+ <Compile Include="Data\SuperLayers\SkyContext.cs" />
+ <Compile Include="Data\SuperLayers\ISuperLayerContext.cs" />
+ <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" />
+ <Compile Include="Data\SuperLayers\DBTables\USPlacedTile.cs" />
+ <Compile Include="Data\SuperLayers\DBTables\UMPlacedTile.cs" />
+ <Compile Include="Data\SuperLayers\DBTables\LGPlacedTile.cs" />
+ <Compile Include="Data\SuperLayers\DBTables\LSPlacedTile.cs" />
+ <Compile Include="Data\SuperLayers\DBTables\LMPlacedTile.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Service\" />
@@ -310,7 +317,6 @@
<Folder Include="Data\SuperLayers\" />
<Folder Include="Data\SuperLayers\Mobs\" />
<Folder Include="Service\Tiles\Items\" />
- <Folder Include="Data\Tiles\" />
<Folder Include="Data\Crafting\" />
<Folder Include="Icons\Land\Materials\" />
<Folder Include="Service\SuperLayers\Generators\" />
@@ -320,6 +326,8 @@
<Folder Include="Service\Tiles\Items\Presets\" />
<Folder Include="Views\Windows\GameWindows\" />
<Folder Include="Icons\UI\Hearth\" />
+ <Folder Include="Service\SuperLayers\PlacedTiles\" />
+ <Folder Include="Data\SuperLayers\DBTables\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
diff --git a/Mundus/Program.cs b/Mundus/Program.cs
index 2750469..a9462a2 100644
--- a/Mundus/Program.cs
+++ b/Mundus/Program.cs
@@ -11,12 +11,11 @@ namespace Mundus {
public static bool runGame = true;
public static void Main(string[] args) {
- DataBaseContext.CreateInstances();
+ DataBaseContexts.CreateInstances();
Application.Init();
//All windows and dialogues that are used by user (instances) are saved and created in WindowInstances.cs
WI.CreateInstances();
DI.CreateInstances();
- LI.CreateInstances();
WI.WMain.Show();
Application.Run();
diff --git a/Mundus/Service/Calculate.cs b/Mundus/Service/Calculate.cs
index 9d2e6c0..f1a730f 100644
--- a/Mundus/Service/Calculate.cs
+++ b/Mundus/Service/Calculate.cs
@@ -11,21 +11,21 @@ namespace Mundus.Service {
*he isn't, it depends on the screen and map sizes.*/
public static int CalculateMaxY(int size) {
int maxY = (MI.Player.YPos - size/2 >= 0) ? MI.Player.YPos + size/2 : size - 1;
- if (maxY >= MapSizes.CurrSize) maxY = MapSizes.CurrSize - 1;
+ if (maxY >= (int)Values.CurrMapSize) maxY = (int)Values.CurrMapSize - 1;
return maxY;
}
public static int CalculateStartY(int size) {
- int startY = (MI.Player.YPos - size/2 <= MapSizes.CurrSize - size) ? MI.Player.YPos - size/2 : MapSizes.CurrSize - size;
+ int startY = (MI.Player.YPos - size/2 <= (int)Values.CurrMapSize - size) ? MI.Player.YPos - size/2 : (int)Values.CurrMapSize - size;
if (startY < 0) startY = 0;
return startY;
}
public static int CalculateMaxX(int size) {
int maxX = (MI.Player.XPos - size/2 >= 0) ? MI.Player.XPos + size/2 : size - 1;
- if (maxX >= MapSizes.CurrSize) maxX = MapSizes.CurrSize - 1;
+ if (maxX >= (int)Values.CurrMapSize) maxX = (int)Values.CurrMapSize - 1;
return maxX;
}
public static int CalculateStartX(int size) {
- int startX = (MI.Player.XPos - size/2 <= MapSizes.CurrSize - size) ? MI.Player.XPos - size/2 : MapSizes.CurrSize - size;
+ int startX = (MI.Player.XPos - size/2 <= (int)Values.CurrMapSize - size) ? MI.Player.XPos - size/2 : (int)Values.CurrMapSize - size;
if (startX < 0) startX = 0;
return startX;
}
@@ -33,12 +33,12 @@ namespace Mundus.Service {
//Screen buttons show only a certain part of the whole map
public static int CalculateYFromButton(int buttonYPos, int size) {
int newYPos = (MI.Player.YPos - size/2 >= 0) ? MI.Player.YPos - size/2 + buttonYPos : buttonYPos;
- if (MI.Player.YPos > MapSizes.CurrSize - Math.Ceiling(size/2.0)) newYPos = buttonYPos + MapSizes.CurrSize - size;
+ if (MI.Player.YPos > (int)Values.CurrMapSize - Math.Ceiling(size/2.0)) newYPos = buttonYPos + (int)Values.CurrMapSize - size;
return newYPos;
}
public static int CalculateXFromButton(int buttonXPos, int size) {
int newXPos = (MI.Player.XPos - size/2 >= 0) ? MI.Player.XPos - size/2 + buttonXPos : buttonXPos;
- if (MI.Player.XPos > MapSizes.CurrSize - Math.Ceiling(size/2.0)) newXPos = buttonXPos + MapSizes.CurrSize - size;
+ if (MI.Player.XPos > (int)Values.CurrMapSize - Math.Ceiling(size/2.0)) newXPos = buttonXPos + (int)Values.CurrMapSize - size;
return newXPos;
}
}
diff --git a/Mundus/Service/LogController.cs b/Mundus/Service/GameEventLogController.cs
index 07a0f3a..65eb9c6 100644
--- a/Mundus/Service/LogController.cs
+++ b/Mundus/Service/GameEventLogController.cs
@@ -3,17 +3,17 @@ using System.Collections.Generic;
using Mundus.Data;
namespace Mundus.Service {
- public static class LogController {
+ public static class GameEventLogController {
public static void AddMessage(string logMessage) {
- DataBaseContext.GELContext.AddMessage(logMessage);
+ DataBaseContexts.GELContext.AddMessage(logMessage);
}
public static string GetMessagage(int index) {
- return (0 <= index && index < GetCount()) ? DataBaseContext.GELContext.GetMessage(index + 1) : null;
+ return (0 <= index && index < GetCount()) ? DataBaseContexts.GELContext.GetMessage(index + 1) : null;
}
public static int GetCount() {
- return DataBaseContext.GELContext.GetCount();
+ return DataBaseContexts.GELContext.GetCount();
}
}
} \ No newline at end of file
diff --git a/Mundus/Service/GameGenerator.cs b/Mundus/Service/GameGenerator.cs
index 81fbf8d..df89e21 100644
--- a/Mundus/Service/GameGenerator.cs
+++ b/Mundus/Service/GameGenerator.cs
@@ -12,15 +12,15 @@ namespace Mundus.Service {
/// <param name="size">Size of the map ("small", "medium" or "large")</param>
public static void GenerateMap(string size) {
switch (size.ToLower()) {
- case "small": MapSizes.CurrSize = MapSizes.SMALL; break;
- case "medium": MapSizes.CurrSize = MapSizes.MEDIUM; break;
- case "large": MapSizes.CurrSize = MapSizes.LARGE; break;
+ case "small": Values.CurrMapSize =Values.MapSize.SMALL; break;
+ case "medium": Values.CurrMapSize = Values.MapSize.MEDIUM; break;
+ case "large": Values.CurrMapSize = Values.MapSize.LARGE; break;
default: throw new ArgumentException( "Map size must be \"small\", \"medium\" or \"large\"" );
}
- SkySuperLayerGenerator.GenerateAllLayers(MapSizes.CurrSize);
- LandSuperLayerGenerator.GenerateAllLayers(MapSizes.CurrSize);
- UndergroundSuperLayerGenerator.GenerateAllLayers(MapSizes.CurrSize);
+ SkySuperLayerGenerator.GenerateAllLayers(Values.CurrMapSize);
+ LandSuperLayerGenerator.GenerateAllLayers(Values.CurrMapSize);
+ UndergroundSuperLayerGenerator.GenerateAllLayers(Values.CurrMapSize);
}
/// <summary>
@@ -53,11 +53,11 @@ namespace Mundus.Service {
/// <param name="value">Must be "peaceful", "easy", "normal", "hard" or "insane"</param>
public static void SetDifficulty(string value) {
switch(value.ToLower()) {
- case "peaceful": Difficulty.SelDifficulty = Difficulty.Peaceful; break;
- case "easy": Difficulty.SelDifficulty = Difficulty.Easy; break;
- case "normal": Difficulty.SelDifficulty = Difficulty.Normal; break;
- case "hard": Difficulty.SelDifficulty = Difficulty.Hard; break;
- case "insane": Difficulty.SelDifficulty = Difficulty.Insane; break;
+ case "peaceful": Values.CurrDifficulty = Values.Difficulty.Peaceful; break;
+ case "easy": Values.CurrDifficulty = Values.Difficulty.Easy; break;
+ case "normal": Values.CurrDifficulty = Values.Difficulty.Normal; break;
+ case "hard": Values.CurrDifficulty = Values.Difficulty.Hard; break;
+ case "insane": Values.CurrDifficulty = Values.Difficulty.Insane; break;
default: throw new ArgumentException($"Invalid difficulty value {value}. Must be \"peaceful\", \"easy\", \"normal\", \"hard\" or \"insane\"");
}
}
diff --git a/Mundus/Service/SuperLayers/Generators/LandSuperLayerGenerator.cs b/Mundus/Service/SuperLayers/Generators/LandSuperLayerGenerator.cs
index c83d62a..eedd87a 100644
--- a/Mundus/Service/SuperLayers/Generators/LandSuperLayerGenerator.cs
+++ b/Mundus/Service/SuperLayers/Generators/LandSuperLayerGenerator.cs
@@ -6,85 +6,91 @@ using Mundus.Service.Tiles.Mobs.LandMobs;
using Mundus.Service.Tiles.Mobs;
using Mundus.Service.Tiles.Items.Presets;
using Mundus.Service.Tiles.Items;
+using static Mundus.Data.Values;
namespace Mundus.Service.SuperLayers.Generators {
public static class LandSuperLayerGenerator {
private static Random rnd;
+ private static LandContext context = DataBaseContexts.LContext;
- public static void GenerateAllLayers(int size) {
- LI.Land.SetGroundLayer(GenerateGroundLayer(size));
- LI.Land.SetStructureLayer(GenerateStructureLayer(size));
- LI.Land.SetMobLayer(GenerateMobLayer(size));
- }
-
- private static GroundTile[,] GenerateGroundLayer(int size) {
+ public static void GenerateAllLayers(MapSize mapSize) {
rnd = new Random();
- GroundTile[,] tiles = new GroundTile[size, size];
+ int size = (int)mapSize;
+
+ GenerateGroundLayer(size);
+ GenerateStructureLayer(size);
+ GenerateMobLayer(size);
+ }
+ private static void GenerateGroundLayer(int size) {
for(int col = 0; col < size; col++) {
for(int row = 0; row < size; row++) {
bool atPlayerSpawnPosition = (col == size / 2) && (row == size / 2);
// Holes in the ground should be more common with higher difficulties
- if (rnd.Next(0, 210 - Difficulty.SelDifficulty) == 1 && !atPlayerSpawnPosition) {
- tiles[col, row] = null;
+ if (rnd.Next(0, 210 - (int)CurrDifficulty) == 1 && !atPlayerSpawnPosition) {
+ context.AddGroundAtPosition(null, row, col);
}
else {
- tiles[col, row] = GroundPresets.GetALGrass();
+ context.AddGroundAtPosition(GroundPresets.GetALGrass().stock_id, row, col);
}
}
}
- return tiles;
+ context.SaveChanges();
}
- private static Structure[,] GenerateStructureLayer(int size) {
- Structure[,] tiles = new Structure[size, size];
-
+ private static void GenerateStructureLayer(int size) {
for (int col = 0; col < size; col++) {
for (int row = 0; row < size; row++) {
bool atPlayerSpawnPosition = (col == size / 2) && (row == size / 2);
- if (LI.Land.GetGroundLayerTile(col, row) != null &&
+ if (context.GetGroundLayerStock(row, col) != null &&
!atPlayerSpawnPosition) {
- if (rnd.Next(0, 15 + Difficulty.SelDifficulty) == 1) {
- tiles[col, row] = StructurePresets.GetALTree();
+ if (rnd.Next(0, 15 + (int)CurrDifficulty) == 1) {
+ context.AddStructureAtPosition(StructurePresets.GetALTree().stock_id, row, col);
+ }
+ else if (rnd.Next(0, 40 + (int)CurrDifficulty) == 1) {
+ context.AddStructureAtPosition(StructurePresets.GetALBoulder().stock_id, row, col);
}
- else if (rnd.Next(0, 40 + Difficulty.SelDifficulty) == 1) {
- tiles[col, row] = StructurePresets.GetALBoulder();
+ else {
+ context.AddStructureAtPosition(null, row, col);
}
}
+ else {
+ context.AddStructureAtPosition(null, row, col);
+ }
}
}
- return tiles;
+ context.SaveChanges();
}
- private static MobTile[,] GenerateMobLayer(int size) {
- MobTile[,] tiles = new MobTile[size, size];
-
+ private static void GenerateMobLayer(int size) {
for (int col = 0; col < size; col++) {
for (int row = 0; row < size; row++) {
bool atPlayerSpawnPosition = (col == size / 2) && (row == size / 2);
- if (LI.Land.GetGroundLayerTile(col, row) != null &&
- LI.Land.GetStructureLayerTile(col, row) == null) {
+ if (context.GetGroundLayerStock(row, col) != null &&
+ context.GetStructureLayerStock(row, col) == null) {
if (atPlayerSpawnPosition) {
- MI.Player.YPos = col;
- MI.Player.XPos = row;
- tiles[col, row] = MI.Player;
+ MI.Player.YPos = row;
+ MI.Player.XPos = col;
+ context.AddMobAtPosition(MI.Player.stock_id, row, col);
}
- else if (rnd.Next(0, 15 + Difficulty.SelDifficulty) == 1) {
- tiles[col, row] = LandMobsPresets.GetACow();
- tiles[col, row].YPos = col;
- tiles[col, row].XPos = row;
+ else if (rnd.Next(0, 15 + (int)CurrDifficulty) == 1) {
+ context.AddMobAtPosition(LandMobsPresets.GetACow().stock_id, row, col);
}
- else if (rnd.Next(0, 15 + Difficulty.SelDifficulty) == 1) {
- tiles[col, row] = LandMobsPresets.GetASheep();
- tiles[col, row].YPos = col;
- tiles[col, row].XPos = row;
+ else if (rnd.Next(0, 15 + (int)CurrDifficulty) == 1) {
+ context.AddMobAtPosition(LandMobsPresets.GetASheep().stock_id, row, col);
}
+ else {
+ context.AddMobAtPosition(null, row, col);
+ }
+ }
+ else {
+ context.AddMobAtPosition(null, row, col);
}
}
}
- return tiles;
+ context.SaveChanges();
}
}
}
diff --git a/Mundus/Service/SuperLayers/Generators/SkySuperLayerGenerator.cs b/Mundus/Service/SuperLayers/Generators/SkySuperLayerGenerator.cs
index 4420d06..866e431 100644
--- a/Mundus/Service/SuperLayers/Generators/SkySuperLayerGenerator.cs
+++ b/Mundus/Service/SuperLayers/Generators/SkySuperLayerGenerator.cs
@@ -3,48 +3,48 @@ using Mundus.Data.SuperLayers;
using Mundus.Service.Tiles.Mobs;
using Mundus.Service.Tiles.Items.Presets;
using Mundus.Service.Tiles.Items;
+using Mundus.Data;
+using static Mundus.Data.Values;
namespace Mundus.Service.SuperLayers.Generators {
public static class SkySuperLayerGenerator {
private static Random rnd;
+ private static SkyContext context = DataBaseContexts.SContext;
- public static void GenerateAllLayers(int size) {
+ public static void GenerateAllLayers(MapSize mapSize) {
rnd = new Random();
+ int size = (int)mapSize;
- LI.Sky.SetMobLayer(GenerateMobLayer(size));
- LI.Sky.SetGroundLayer(GenerateGroundLayer(size));
- LI.Sky.SetStructureLayer(GenerateStructureLayer(size));
+ GenerateMobLayer(size);
+ GenerateGroundLayer(size);
+ GenerateStructureLayer(size);
}
- private static MobTile[,] GenerateMobLayer(int size) {
- MobTile[,] tiles = new MobTile[size, size];
-
+ private static void GenerateMobLayer(int size) {
for (int col = 0; col < size; col++) {
for (int row = 0; row < size; row++) {
+ context.AddMobAtPosition(null, row, col);
}
}
- return tiles;
+ context.SaveChanges();
}
- private static GroundTile[,] GenerateGroundLayer(int size) {
- GroundTile[,] tiles = new GroundTile[size, size];
-
+ private static void GenerateGroundLayer(int size) {
for (int col = 0; col < size; col++) {
for (int row = 0; row < size; row++) {
- tiles[col, row] = GroundPresets.GetASSky();
+ context.AddGroundAtPosition(GroundPresets.GetASSky().stock_id, row, col);
}
}
- return tiles;
+ context.SaveChanges();
}
- private static Structure[,] GenerateStructureLayer(int size) {
- Structure[,] tiles = new Structure[size, size];
-
+ private static void GenerateStructureLayer(int size) {
for (int col = 0; col < size; col++) {
for (int row = 0; row < size; row++) {
+ context.AddStructureAtPosition(null, row, col);
}
}
- return tiles;
+ context.SaveChanges();
}
}
}
diff --git a/Mundus/Service/SuperLayers/Generators/UndergroundSuperLayerGenerator.cs b/Mundus/Service/SuperLayers/Generators/UndergroundSuperLayerGenerator.cs
index 31cc38f..1caace1 100644
--- a/Mundus/Service/SuperLayers/Generators/UndergroundSuperLayerGenerator.cs
+++ b/Mundus/Service/SuperLayers/Generators/UndergroundSuperLayerGenerator.cs
@@ -3,54 +3,56 @@ using Mundus.Data.SuperLayers;
using Mundus.Service.Tiles.Mobs;
using Mundus.Service.Tiles.Items.Presets;
using Mundus.Service.Tiles.Items;
+using Mundus.Data;
+using static Mundus.Data.Values;
namespace Mundus.Service.SuperLayers.Generators {
public static class UndergroundSuperLayerGenerator {
private static Random rnd;
+ private static UndergroundContext context = DataBaseContexts.UContext;
- public static void GenerateAllLayers(int size) {
- LI.Underground.SetMobLayer(GenerateMobLayer(size));
- LI.Underground.SetGroundLayer(GenerateGroundLayer(size));
- LI.Underground.SetStructureLayer(GenerateStructureLayer(size));
- }
+ public static void GenerateAllLayers(MapSize mapSize) {
+ rnd = new Random();
+ int size = (int)mapSize;
- private static MobTile[,] GenerateMobLayer(int size) {
- MobTile[,] tiles = new MobTile[size, size];
+ GenerateMobLayer(size);
+ GenerateGroundLayer(size);
+ GenerateStructureLayer(size);
+ }
+ private static void GenerateMobLayer(int size) {
for (int col = 0; col < size; col++) {
for (int row = 0; row < size; row++) {
-
+ context.AddMobAtPosition(null, row, col);
}
}
- return tiles;
+ context.SaveChanges();
}
- private static GroundTile[,] GenerateGroundLayer(int size) {
- rnd = new Random();
- GroundTile[,] tiles = new GroundTile[size, size];
-
+ private static void GenerateGroundLayer(int size) {
for (int col = 0; col < size; col++) {
for (int row = 0; row < size; row++) {
- tiles[col, row] = GroundPresets.GetAURoche();
+ context.AddGroundAtPosition(GroundPresets.GetAURoche().stock_id, row, col);
}
}
- return tiles;
+ context.SaveChanges();
}
- private static Structure[,] GenerateStructureLayer(int size) {
- Structure[,] tiles = new Structure[size, size];
-
+ private static void GenerateStructureLayer(int size) {
for (int col = 0; col < size; col++) {
for (int row = 0; row < size; row++) {
- if (LI.Land.GetGroundLayerTile(col, row) != null) {
- tiles[col, row] = StructurePresets.GetAURock();
+ if (context.GetGroundLayerStock(row, col) != null) {
if (rnd.Next(0, 10) == 1) {
- tiles[col, row] = null;
+ context.AddStructureAtPosition(null, row, col);
+ }
+ else {
+ context.AddStructureAtPosition(StructurePresets.GetAURock().stock_id, row, col);
+
}
}
}
}
- return tiles;
+ context.SaveChanges();
}
}
}
diff --git a/Mundus/Service/SuperLayers/HeightController.cs b/Mundus/Service/SuperLayers/HeightController.cs
index 8a3ab6b..4757aac 100644
--- a/Mundus/Service/SuperLayers/HeightController.cs
+++ b/Mundus/Service/SuperLayers/HeightController.cs
@@ -1,15 +1,16 @@
-using Mundus.Data.SuperLayers;
+using Mundus.Data;
+using Mundus.Data.SuperLayers;
using Mundus.Service.Tiles.Mobs;
namespace Mundus.Service.SuperLayers {
public static class HeightController {
// Order of layers (top to bottom): sky, land, underground
- private static ISuperLayer sky = LI.Sky;
- private static ISuperLayer land = LI.Land;
- private static ISuperLayer underground = LI.Underground;
+ private static ISuperLayerContext sky = DataBaseContexts.SContext;
+ private static ISuperLayerContext land = DataBaseContexts.LContext;
+ private static ISuperLayerContext underground = DataBaseContexts.UContext;
- public static ISuperLayer GetLayerUnderneath(ISuperLayer currentLayer) {
+ public static ISuperLayerContext GetLayerUnderneath(ISuperLayerContext currentLayer) {
if (land == currentLayer) {
return underground;
}
@@ -19,11 +20,11 @@ namespace Mundus.Service.SuperLayers {
return null;
}
- public static ISuperLayer GetLayerUnderneathMob(MobTile currentMob) {
+ public static ISuperLayerContext GetLayerUnderneathMob(MobTile currentMob) {
return GetLayerUnderneath(currentMob.CurrSuperLayer);
}
- public static ISuperLayer GetLayerAbove(ISuperLayer currentLayer) {
+ public static ISuperLayerContext GetLayerAbove(ISuperLayerContext currentLayer) {
if (underground == currentLayer) {
return land;
}
@@ -33,7 +34,7 @@ namespace Mundus.Service.SuperLayers {
return null;
}
- public static ISuperLayer GetLayerAboveMob(MobTile currentMob) {
+ public static ISuperLayerContext GetLayerAboveMob(MobTile currentMob) {
return GetLayerAbove(currentMob.CurrSuperLayer);
}
}
diff --git a/Mundus/Service/SuperLayers/ImageController.cs b/Mundus/Service/SuperLayers/ImageController.cs
index 74ec3f8..2e598d2 100644
--- a/Mundus/Service/SuperLayers/ImageController.cs
+++ b/Mundus/Service/SuperLayers/ImageController.cs
@@ -3,6 +3,7 @@ using Mundus.Data;
using Mundus.Data.Superlayers.Mobs;
using Mundus.Data.SuperLayers;
using Mundus.Service.Tiles.Items;
+using static Mundus.Data.Values;
namespace Mundus.Service.SuperLayers {
public static class ImageController {
@@ -13,7 +14,7 @@ namespace Mundus.Service.SuperLayers {
/// Note: null structure tiles and null mob tiles are skipped (returns null)
/// </summary>
public static Image GetScreenImage(int row, int col, int layer) {
- ISuperLayer superLayer = MI.Player.CurrSuperLayer;
+ ISuperLayerContext superLayer = MI.Player.CurrSuperLayer;
Image img = null;
//Layer 0 is GroundLayer, 1 is ItemLayer and 2 is Moblayer
@@ -21,13 +22,13 @@ namespace Mundus.Service.SuperLayers {
{
img = new Image(GetPlayerGroundImage(row, col).Stock, IconSize.Dnd);
}
- else if (layer == 1 && superLayer.GetStructureLayerTile( row, col ) != null)
+ else if (layer == 1 && superLayer.GetStructureLayerStock( row, col ) != null)
{
img = new Image(GetPlayerStructureImage(row, col).Stock, IconSize.Dnd );
}
- else if (layer == 2 && superLayer.GetMobLayerTile(row, col) != null)
+ else if (layer == 2 && superLayer.GetMobLayerStock(row, col) != null)
{
- img = new Image(superLayer.GetMobLayerTile(row, col).stock_id, IconSize.Dnd);
+ img = new Image(superLayer.GetMobLayerStock(row, col), IconSize.Dnd);
}
return img;
}
@@ -37,12 +38,12 @@ namespace Mundus.Service.SuperLayers {
/// Note: null values (holes) get the "L_hole" image
/// </summary>
public static Image GetPlayerGroundImage(int row, int col) {
- ISuperLayer superLayer = MI.Player.CurrSuperLayer;
+ ISuperLayerContext superLayer = MI.Player.CurrSuperLayer;
Image img = new Image("L_hole", IconSize.Dnd);
- if (row >= 0 && col >= 0 && col < MapSizes.CurrSize && row < MapSizes.CurrSize &&
- superLayer.GetGroundLayerTile(row, col) != null) {
- img = superLayer.GetGroundLayerTile( row, col ).Texture;
+ if (row >= 0 && col >= 0 && col < (int)Values.CurrMapSize && row < (int)Values.CurrMapSize &&
+ superLayer.GetGroundLayerStock(row, col) != null) {
+ img = new Image(superLayer.GetGroundLayerStock(row, col), IconSize.Dnd);
}
return img;
}
@@ -52,20 +53,20 @@ namespace Mundus.Service.SuperLayers {
/// Note: null values get the "blank" image ; GetScreenImage skips if the value is null
/// </summary>
public static Image GetPlayerStructureImage(int row, int col) {
- ISuperLayer superLayer = MI.Player.CurrSuperLayer;
+ ISuperLayerContext superLayer = MI.Player.CurrSuperLayer;
Image img = new Image("blank", IconSize.Dnd );
if (IsInsideBoundaries(row, col) &&
- superLayer.GetStructureLayerTile(row, col) != null)
+ superLayer.GetStructureLayerStock(row, col) != null)
{
- img = superLayer.GetStructureLayerTile(row, col).Texture;
+ img = new Image(superLayer.GetStructureLayerStock(row, col), IconSize.Dnd);
}
return img;
}
// Checks if the position is inside the map
private static bool IsInsideBoundaries(int row, int col) {
- return row >= 0 && col >= 0 && col < MapSizes.CurrSize && row < MapSizes.CurrSize;
+ return row >= 0 && col >= 0 && col < (int)Values.CurrMapSize && row < (int)Values.CurrMapSize;
}
/// <summary>
diff --git a/Mundus/Service/Tiles/Crafting/CraftingController.cs b/Mundus/Service/Tiles/Crafting/CraftingController.cs
index 8a61c90..64cdc27 100644
--- a/Mundus/Service/Tiles/Crafting/CraftingController.cs
+++ b/Mundus/Service/Tiles/Crafting/CraftingController.cs
@@ -14,7 +14,7 @@ namespace Mundus.Service.Tiles.Crafting {
/// </summary>
/// <returns>All avalable recipies.</returns>
public static CraftingRecipe[] GetAvalableRecipes() {
- return DataBaseContext.CTContext.GetAvalableRecipes();
+ return DataBaseContexts.CTContext.GetAvalableRecipes();
}
/// <summary>
diff --git a/Mundus/Service/Tiles/Items/GroundTile.cs b/Mundus/Service/Tiles/Items/GroundTile.cs
index 3f31a7f..e6657d2 100644
--- a/Mundus/Service/Tiles/Items/GroundTile.cs
+++ b/Mundus/Service/Tiles/Items/GroundTile.cs
@@ -1,5 +1,5 @@
using Gtk;
-using Mundus.Data.Tiles;
+using static Mundus.Data.Values;
namespace Mundus.Service.Tiles.Items {
public class GroundTile : ItemTile {
@@ -21,7 +21,7 @@ namespace Mundus.Service.Tiles.Items {
}
public override string ToString() {
- return $"GroundTile | ID: {this.stock_id} TT: {ToolTypes.Shovel} TC: {this.ReqShovelClass}";
+ return $"GroundTile | ID: {this.stock_id} TT: {ToolType.Shovel} TC: {this.ReqShovelClass}";
}
}
}
diff --git a/Mundus/Service/Tiles/Items/Presets/GroundPresets.cs b/Mundus/Service/Tiles/Items/Presets/GroundPresets.cs
index 5d280eb..76184a4 100644
--- a/Mundus/Service/Tiles/Items/Presets/GroundPresets.cs
+++ b/Mundus/Service/Tiles/Items/Presets/GroundPresets.cs
@@ -20,5 +20,14 @@
public static GroundTile GetAURoche() {
return new GroundTile("U_roche", 10);
}
+
+ public static GroundTile GetFromStock(string stock_id) {
+ switch(stock_id) {
+ case "S_sky": return GetASSky();
+ case "L_grass": return GetALGrass();
+ case "U_roche": return GetAURoche();
+ default: return null;
+ }
+ }
}
}
diff --git a/Mundus/Service/Tiles/Items/Presets/StructurePresets.cs b/Mundus/Service/Tiles/Items/Presets/StructurePresets.cs
index e71111a..7fbfa21 100644
--- a/Mundus/Service/Tiles/Items/Presets/StructurePresets.cs
+++ b/Mundus/Service/Tiles/Items/Presets/StructurePresets.cs
@@ -1,4 +1,4 @@
-using Mundus.Data.Tiles;
+using static Mundus.Data.Values;
namespace Mundus.Service.Tiles.Items.Presets {
public static class StructurePresets {
@@ -6,29 +6,33 @@ namespace Mundus.Service.Tiles.Items.Presets {
/// Returns a new instance of the land boulder structure
/// </summary>
public static Structure GetALBoulder() {
- return new Structure("L_boulder", "L_boulder_inventory", 7, ToolTypes.Pickaxe, 1, false, false, MaterialPresets.GetALandRock());
+ return new Structure("L_boulder", "L_boulder_inventory", 7, ToolType.Pickaxe, 1, false, false, MaterialPresets.GetALandRock());
}
/// <summary>
/// Returns a new instance of the land tree structure
/// </summary>
public static Structure GetALTree() {
- return new Structure("L_tree", "L_tree_inventory", 5, ToolTypes.Axe, 1, false, false, MaterialPresets.GetALandStick());
+ return new Structure("L_tree", "L_tree_inventory", 5, ToolType.Axe, 1, false, false, MaterialPresets.GetALandStick());
}
/// <summary>
/// Returns a new instance of the underground rock structure
/// </summary>
public static Structure GetAURock() {
- return new Structure("U_rock", "U_rock", 10, ToolTypes.Pickaxe, 2, false, false, MaterialPresets.GetAStone());
+ return new Structure("U_rock", "U_rock", 10, ToolType.Pickaxe, 2, false, false, MaterialPresets.GetAStone());
}
public static Structure GetAWoodenLadder() {
- return new Structure("L_wooden_ladder", "L_wooden_ladder_inventory", 1, ToolTypes.Axe, 1, true, true);
+ return new Structure("L_wooden_ladder", "L_wooden_ladder_inventory", 1, ToolType.Axe, 1, true, true);
}
public static Structure GetFromStock(string stock_id) {
switch(stock_id) {
+ case "L_boulder": return GetALBoulder();
+ case "L_tree": return GetALTree();
+ case "U_rock": return GetAURock();
+ case "L_wooden_ladder_inventory":
case "L_wooden_ladder": return GetAWoodenLadder();
default: return null;
}
diff --git a/Mundus/Service/Tiles/Items/Presets/ToolPresets.cs b/Mundus/Service/Tiles/Items/Presets/ToolPresets.cs
index a52e027..6bac612 100644
--- a/Mundus/Service/Tiles/Items/Presets/ToolPresets.cs
+++ b/Mundus/Service/Tiles/Items/Presets/ToolPresets.cs
@@ -1,37 +1,37 @@
-using Mundus.Data.Tiles;
+using static Mundus.Data.Values;
namespace Mundus.Service.Tiles.Items.Presets {
public static class ToolPresets {
public static Tool GetAWoodenPickaxe() {
- return new Tool("wooden_pickaxe", ToolTypes.Pickaxe, 1);
+ return new Tool("wooden_pickaxe", ToolType.Pickaxe, 1);
}
public static Tool GetAWoodenAxe() {
- return new Tool("wooden_axe", ToolTypes.Axe, 1);
+ return new Tool("wooden_axe", ToolType.Axe, 1);
}
public static Tool GetAWoodenShovel() {
- return new Tool("wooden_shovel", ToolTypes.Shovel, 1);
+ return new Tool("wooden_shovel", ToolType.Shovel, 1);
}
public static Tool GetAWoodenLongsword() {
- return new Tool("wooden_longsword", ToolTypes.Sword, 2);
+ return new Tool("wooden_longsword", ToolType.Sword, 2);
}
public static Tool GetARockPickaxe() {
- return new Tool("rock_pickaxe", ToolTypes.Pickaxe, 2);
+ return new Tool("rock_pickaxe", ToolType.Pickaxe, 2);
}
public static Tool GetARockAxe() {
- return new Tool("rock_axe", ToolTypes.Axe, 2);
+ return new Tool("rock_axe", ToolType.Axe, 2);
}
public static Tool GetARockShovel() {
- return new Tool("rock_shovel", ToolTypes.Shovel, 2);
+ return new Tool("rock_shovel", ToolType.Shovel, 2);
}
public static Tool GetARockLongsword() {
- return new Tool("rock_longsword", ToolTypes.Sword, 4);
+ return new Tool("rock_longsword", ToolType.Sword, 4);
}
public static Tool GetFromStock(string stock_id) {
diff --git a/Mundus/Service/Tiles/Items/Structure.cs b/Mundus/Service/Tiles/Items/Structure.cs
index b5d7747..8db23ad 100644
--- a/Mundus/Service/Tiles/Items/Structure.cs
+++ b/Mundus/Service/Tiles/Items/Structure.cs
@@ -1,4 +1,6 @@
-namespace Mundus.Service.Tiles.Items {
+using static Mundus.Data.Values;
+
+namespace Mundus.Service.Tiles.Items {
public class Structure : ItemTile {
private Material droppedMaterial;
@@ -9,7 +11,7 @@
/// <summary>
/// Required type of tool to break the structure
/// </summary>
- public int ReqToolType { get; private set; }
+ public ToolType ReqToolType { get; private set; }
/// <summary>
/// Required minimal tool class to break the structure
/// </summary>
@@ -30,7 +32,7 @@
structure.IsWalkable, (structure.droppedMaterial != null)?new Material(structure.droppedMaterial.stock_id):null) {
}
- public Structure(string stock_id, string inventory_stock_id, int health, int reqToolType, int reqToolClass, bool isWalkable = false, bool isClimable = false, Material droppedMaterial = null) : base(stock_id) {
+ public Structure(string stock_id, string inventory_stock_id, int health, ToolType reqToolType, int reqToolClass, bool isWalkable = false, bool isClimable = false, Material droppedMaterial = null) : base(stock_id) {
this.inventory_stock_id = inventory_stock_id;
this.Health = health;
this.ReqToolType = reqToolType;
diff --git a/Mundus/Service/Tiles/Items/Tool.cs b/Mundus/Service/Tiles/Items/Tool.cs
index ac7bd55..deb5a01 100644
--- a/Mundus/Service/Tiles/Items/Tool.cs
+++ b/Mundus/Service/Tiles/Items/Tool.cs
@@ -1,14 +1,14 @@
-using Mundus.Data.Tiles;
+using static Mundus.Data.Values;
namespace Mundus.Service.Tiles.Items {
public class Tool : ItemTile {
- public int Type { get; private set; }
+ public ToolType Type { get; private set; }
public int Class { get; private set; }
public Tool(Tool tool) : this(tool.stock_id, tool.Type, tool.Class)
{ }
- public Tool(string stock_id, int toolType, int toolClass) : base(stock_id) {
+ public Tool(string stock_id, ToolType toolType, int toolClass) : base(stock_id) {
this.Type = toolType;
this.Class = toolClass;
}
diff --git a/Mundus/Service/Tiles/Mobs/Controllers/MobFighting.cs b/Mundus/Service/Tiles/Mobs/Controllers/MobFighting.cs
index 25a02d1..ed9b51e 100644
--- a/Mundus/Service/Tiles/Mobs/Controllers/MobFighting.cs
+++ b/Mundus/Service/Tiles/Mobs/Controllers/MobFighting.cs
@@ -1,9 +1,9 @@
using System.Linq;
using Mundus.Data;
using Mundus.Data.Superlayers.Mobs;
-using Mundus.Data.Tiles;
using Mundus.Service.Tiles.Items;
using Mundus.Service.Tiles.Mobs.LandMobs;
+using static Mundus.Data.Values;
namespace Mundus.Service.Tiles.Mobs.Controllers {
public static class MobFighting {
@@ -22,7 +22,7 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
/// <param name="mapYPos">YPos of target mob</param>
/// <param name="mapXPos">XPos of target mob</param>
public static bool ExistsFightTargetForMob(MobTile mob, int mapYPos, int mapXPos) {
- return mob.CurrSuperLayer.GetMobLayerTile(mapYPos, mapXPos) != null;
+ return mob.CurrSuperLayer.GetMobLayerStock(mapYPos, mapXPos) != null;
}
private const double TAKEN_ENERGY_FROM_FIGHTING = 0.5;
@@ -36,15 +36,15 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
/// <param name="mapXPos">XPos of target mob</param>
public static void PlayerTryFight(string selPlace, int selIndex, int mapYPos, int mapXPos) {
if (MobTryFight(MI.Player, selPlace, selIndex, mapYPos, mapXPos)) {
- MI.Player.DrainEnergy(TAKEN_ENERGY_FROM_FIGHTING + Difficulty.ValueModifier());
+ MI.Player.DrainEnergy(TAKEN_ENERGY_FROM_FIGHTING + DifficultyValueModifier());
}
}
// Checks if the mob has a proper fighting item selected
private static bool MobCanFight(MobTile mob, string selPlace, int selIndex, int mapYPos, int mapXPos) {
return Inventory.GetPlayerItem(selPlace, selIndex).GetType() == typeof(Tool) &&
- ((Tool)Inventory.GetPlayerItem(selPlace, selIndex)).Type == ToolTypes.Sword &&
- mob.CurrSuperLayer.GetMobLayerTile(mapYPos, mapXPos) != null;
+ ((Tool)Inventory.GetPlayerItem(selPlace, selIndex)).Type == ToolType.Sword &&
+ mob.CurrSuperLayer.GetMobLayerStock(mapYPos, mapXPos) != null;
}
/// <summary>
@@ -60,7 +60,7 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
public static bool MobTryFight(MobTile mob, string selPlace, int selIndex, int mapYPos, int mapXPos) {
if (MobCanFight(mob, selPlace, selIndex, mapYPos, mapXPos)) {
Tool selTool = (Tool)Inventory.GetPlayerItem(selPlace, selIndex);
- MobTile targetMob = mob.CurrSuperLayer.GetMobLayerTile(mapYPos, mapXPos);
+ MobTile targetMob = LandMobsPresets.GetFromStock(mob.CurrSuperLayer.GetMobLayerStock(mapYPos, mapXPos));
if (selTool.Class >= targetMob.Defense) {
int damagePoints = 1 + (selTool.Class - targetMob.Defense);
@@ -73,22 +73,22 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
}
if (mob.GetType() == typeof(Player)) {
- LogController.AddMessage($"Player killed \"{targetMob.stock_id}\"");
+ GameEventLogController.AddMessage($"Player killed \"{targetMob.stock_id}\"");
}
} else if (mob.GetType() == typeof(Player)) {
- LogController.AddMessage($"Player did {damagePoints} damage to \"{targetMob.stock_id}\" (H:{targetMob.Health}) ");
+ GameEventLogController.AddMessage($"Player did {damagePoints} damage to \"{targetMob.stock_id}\" (H:{targetMob.Health}) ");
}
return true;
}
else if (mob.GetType() == typeof(Player)) {
- LogController.AddMessage($"You need a tool class of atleast {targetMob.Defense} to fight this mob");
+ GameEventLogController.AddMessage($"You need a tool class of atleast {targetMob.Defense} to fight this mob");
}
}
- else if (mob.CurrSuperLayer.GetMobLayerTile(mapYPos, mapXPos) == null && mob.GetType() == typeof(Player)) {
- LogController.AddMessage($"There is no mob to fight on \"{mob.CurrSuperLayer}\" at Y:{mapYPos}, X:{mapXPos}");
+ else if (mob.CurrSuperLayer.GetMobLayerStock(mapYPos, mapXPos) == null && mob.GetType() == typeof(Player)) {
+ GameEventLogController.AddMessage($"There is no mob to fight on \"{mob.CurrSuperLayer}\" at Y:{mapYPos}, X:{mapXPos}");
}
else if (mob.GetType() == typeof(Player)) { // Inventory.GetPlayerItem(selPlace, selIndex).GetType() != typeof(Tool) || ((Tool)Inventory.GetPlayerItem(selPlace, selIndex)).Type != ToolTypes.Sword
- LogController.AddMessage($"You need a Tool of type {ToolTypes.Sword} to fight with other mobs");
+ GameEventLogController.AddMessage($"You need a Tool of type {ToolType.Sword} to fight with other mobs");
}
return false;
}
diff --git a/Mundus/Service/Tiles/Mobs/Controllers/MobMovement.cs b/Mundus/Service/Tiles/Mobs/Controllers/MobMovement.cs
index 5ebd300..9b0b3a2 100644
--- a/Mundus/Service/Tiles/Mobs/Controllers/MobMovement.cs
+++ b/Mundus/Service/Tiles/Mobs/Controllers/MobMovement.cs
@@ -3,6 +3,7 @@ using Mundus.Data;
using Mundus.Data.Superlayers.Mobs;
using Mundus.Data.SuperLayers;
using Mundus.Service.SuperLayers;
+using Mundus.Service.Tiles.Items.Presets;
using Mundus.Service.Tiles.Mobs;
using Mundus.Service.Tiles.Mobs.LandMobs;
@@ -15,13 +16,13 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
/// in a 3x3 radius (including the tile they are currently on)
/// </summary>
public static void MoveRandomlyAllMobs() {
- foreach(var superLayer in LI.AllSuperLayers())
+ foreach(var superLayer in DataBaseContexts.SuperLayerContexts)
{
- for (int y = 0; y < MapSizes.CurrSize; y++)
+ for (int y = 0; y < (int)Values.CurrMapSize; y++)
{
- for (int x = 0; x < MapSizes.CurrSize; x++)
+ for (int x = 0; x < (int)Values.CurrMapSize; x++)
{
- MobTile mob = superLayer.GetMobLayerTile(y, x);
+ MobTile mob = LandMobsPresets.GetFromStock(superLayer.GetMobLayerStock(y, x));
if (mob != null) {
// Checks validity of RndMovementRate and descides if a mob will move to another tile
@@ -30,7 +31,7 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
int newYPos = rnd.Next(mob.YPos - 1, mob.YPos + 2);
int newXPos = rnd.Next(mob.XPos - 1, mob.XPos + 2);
- ChangeMobPosition(mob, newYPos, newXPos, MapSizes.CurrSize);
+ ChangeMobPosition(mob, newYPos, newXPos, (int)Values.CurrMapSize);
}
}
}
@@ -44,7 +45,7 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
ChangeMobPosition(mob, yPos, xPos);
}
else if (mob.GetType() == typeof(Player)) {
- LogController.AddMessage($"Cannot walk to Y:{yPos}, X:{xPos}");
+ GameEventLogController.AddMessage($"Cannot walk to Y:{yPos}, X:{xPos}");
}
}
}
@@ -54,7 +55,7 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
ChangeMobPosition(MI.Player, yPos, xPos, mapSize);
if (MI.Player.YPos == yPos && MI.Player.XPos == xPos) {
- MI.Player.DrainEnergy(TAKEN_ENERGY_FROM_MOVEMENT + Difficulty.ValueModifier());
+ MI.Player.DrainEnergy(TAKEN_ENERGY_FROM_MOVEMENT + Values.DifficultyValueModifier());
}
}
@@ -64,88 +65,93 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
mob.CurrSuperLayer.RemoveMobFromPosition(mob.YPos, mob.XPos);
// If mob can go down a layer from a hole
- if (mob.CurrSuperLayer.GetGroundLayerTile(yPos, xPos) == null &&
+ if (mob.CurrSuperLayer.GetGroundLayerStock(yPos, xPos) == null &&
HeightController.GetLayerUnderneathMob(mob) != null)
{
- if (HeightController.GetLayerUnderneathMob(mob).GetMobLayerTile(yPos, xPos) == null)
+ if (HeightController.GetLayerUnderneathMob(mob).GetMobLayerStock(yPos, xPos) == null)
{
mob.CurrSuperLayer = HeightController.GetLayerUnderneathMob(mob);
if (mob.GetType() == typeof(Player)) {
- LogController.AddMessage($"Player fell down a superlayer, to {mob.CurrSuperLayer}");
+ GameEventLogController.AddMessage($"Player fell down a superlayer, to {mob.CurrSuperLayer}");
}
}
else if (mob.GetType() == typeof(Player)) {
- LogController.AddMessage($"Cannot fall down a superlayer, blocked by {HeightController.GetLayerUnderneathMob(mob).GetMobLayerTile(yPos, xPos).stock_id}");
+ GameEventLogController.AddMessage($"Cannot fall down a superlayer, blocked by {HeightController.GetLayerUnderneathMob(mob).GetMobLayerStock(yPos, xPos)}");
}
}
// If mob can go down a layer from non-solid ground
- else if (!mob.CurrSuperLayer.GetGroundLayerTile(yPos, xPos).Solid &&
+ else if (!GroundPresets.GetFromStock(mob.CurrSuperLayer.GetGroundLayerStock(yPos, xPos)).Solid &&
HeightController.GetLayerUnderneathMob(mob) != null)
{
- if (HeightController.GetLayerUnderneathMob(mob).GetMobLayerTile(yPos, xPos) == null)
+ if (HeightController.GetLayerUnderneathMob(mob).GetMobLayerStock(yPos, xPos) == null)
{
mob.CurrSuperLayer = HeightController.GetLayerUnderneathMob(mob);
if (mob.GetType() == typeof(Player)) {
- LogController.AddMessage($"Player descended a superlayer, to {mob.CurrSuperLayer}");
+ GameEventLogController.AddMessage($"Player descended a superlayer, to {mob.CurrSuperLayer}");
}
}
else if (mob.GetType() == typeof(Player)) {
- LogController.AddMessage($"Cannot descend a superlayer, blocked by {HeightController.GetLayerUnderneathMob(mob).GetMobLayerTile(yPos, xPos).stock_id}");
+ GameEventLogController.AddMessage($"Cannot descend a superlayer, blocked by {HeightController.GetLayerUnderneathMob(mob).GetMobLayerStock(yPos, xPos)}");
}
}
// If mob can climb up
- else if (mob.CurrSuperLayer.GetStructureLayerTile(yPos, xPos) != null &&
- HeightController.GetLayerAboveMob(mob).GetMobLayerTile(yPos, xPos) == null)
+ else if (mob.CurrSuperLayer.GetStructureLayerStock(yPos, xPos) != null &&
+ HeightController.GetLayerAboveMob(mob).GetMobLayerStock(yPos, xPos) == null)
{
// Mobs can only climb to the superlayer on top of them, if
// there is a climable structure and there is a "hole" on top of the climable structure
- if (mob.CurrSuperLayer.GetStructureLayerTile(yPos, xPos).IsClimable &&
+ if (StructurePresets.GetFromStock(mob.CurrSuperLayer.GetStructureLayerStock(yPos, xPos)).IsClimable &&
HeightController.GetLayerAboveMob(mob) != null)
{
// The ground above isn't solid or doesnt exist and there are no mobs on top
- if (HeightController.GetLayerAboveMob(mob).GetGroundLayerTile(yPos, xPos) == null ||
- !HeightController.GetLayerAboveMob(mob).GetGroundLayerTile(yPos, xPos).Solid)
+ if (HeightController.GetLayerAboveMob(mob).GetGroundLayerStock(yPos, xPos) == null ||
+ !GroundPresets.GetFromStock(HeightController.GetLayerAboveMob(mob).GetGroundLayerStock(yPos, xPos)).Solid)
{
mob.CurrSuperLayer = HeightController.GetLayerAboveMob(mob);
if (mob.GetType() == typeof(Player)) {
- LogController.AddMessage($"Player climbed up a superlayer");
+ GameEventLogController.AddMessage($"Player climbed up a superlayer");
}
}
- else if (HeightController.GetLayerAboveMob(mob).GetGroundLayerTile(yPos, xPos) != null && mob.GetType() == typeof(Player)) {
- LogController.AddMessage($"Cannot climb up a superlayer, there is solid ground above");
+ else if (HeightController.GetLayerAboveMob(mob).GetGroundLayerStock(yPos, xPos) != null && mob.GetType() == typeof(Player)) {
+ GameEventLogController.AddMessage($"Cannot climb up a superlayer, there is solid ground above");
}
}
- else if (!mob.CurrSuperLayer.GetStructureLayerTile(yPos, xPos).IsClimable && mob.GetType() == typeof(Player)) {
- LogController.AddMessage($"Cannot climb up a superlayer using a \"{mob.CurrSuperLayer.GetStructureLayerTile(yPos, xPos).stock_id}\"");
+ else if (!StructurePresets.GetFromStock(mob.CurrSuperLayer.GetStructureLayerStock(yPos, xPos)).IsClimable && mob.GetType() == typeof(Player)) {
+ GameEventLogController.AddMessage($"Cannot climb up a superlayer using a \"{mob.CurrSuperLayer.GetStructureLayerStock(yPos, xPos)}\"");
}
else if (HeightController.GetLayerAboveMob(mob) == null && mob.GetType() == typeof(Player)) {
- LogController.AddMessage($"There is no superlayer to climb up to");
+ GameEventLogController.AddMessage($"There is no superlayer to climb up to");
}
}
- else if (HeightController.GetLayerAboveMob(mob).GetMobLayerTile(yPos, xPos) != null && mob.GetType() == typeof(Player)) {
- LogController.AddMessage($"Cannot climb up a superlayer, {HeightController.GetLayerAboveMob(mob).GetMobLayerTile(yPos, xPos).stock_id} is blocking the way");
+ else if (HeightController.GetLayerAboveMob(mob).GetMobLayerStock(yPos, xPos) != null && mob.GetType() == typeof(Player)) {
+ GameEventLogController.AddMessage($"Cannot climb up a superlayer, {HeightController.GetLayerAboveMob(mob).GetMobLayerStock(yPos, xPos)} is blocking the way");
}
mob.YPos = yPos;
mob.XPos = xPos;
- mob.CurrSuperLayer.SetMobAtPosition(mob, yPos, xPos);
+ mob.CurrSuperLayer.SetMobAtPosition(mob.stock_id, yPos, xPos);
}
- private static bool CanWalkTo(MobTile mob, int yPos, int xPos) {
+ private static bool CanWalkTo(MobTile mob, int yPos, int xPos) {
//Mobs can only walk on free ground (no structure or mob) or walkable structures
- return (mob.CurrSuperLayer.GetStructureLayerTile(yPos, xPos) == null ||
- mob.CurrSuperLayer.GetStructureLayerTile(yPos, xPos).IsWalkable) &&
- (mob.CurrSuperLayer.GetMobLayerTile(yPos, xPos) == null ||
- mob.CurrSuperLayer.GetMobLayerTile(yPos, xPos) == mob);
+ if (StructurePresets.GetFromStock(mob.CurrSuperLayer.GetStructureLayerStock(yPos, xPos)) == null) {
+ return mob.CurrSuperLayer.GetMobLayerStock(yPos, xPos) == null ||
+ LandMobsPresets.GetFromStock(mob.CurrSuperLayer.GetMobLayerStock(yPos, xPos)) == mob;
+ }
+ else if (StructurePresets.GetFromStock(mob.CurrSuperLayer.GetStructureLayerStock(yPos, xPos)).IsWalkable) {
+ return mob.CurrSuperLayer.GetMobLayerStock(yPos, xPos) == null ||
+ LandMobsPresets.GetFromStock(mob.CurrSuperLayer.GetMobLayerStock(yPos, xPos)) == mob;
+ }
+ return false;
}
// Returns if the chosen new location is inside the map
private static bool InBoundaries(int yPos, int xPos) {
- return yPos >= 0 && xPos >= 0 && yPos < MapSizes.CurrSize && xPos < MapSizes.CurrSize;
+ return yPos >= 0 && xPos >= 0 && yPos < (int)Values.CurrMapSize && xPos < (int)Values.CurrMapSize;
}
}
}
diff --git a/Mundus/Service/Tiles/Mobs/Controllers/MobStatsController.cs b/Mundus/Service/Tiles/Mobs/Controllers/MobStatsController.cs
index f8a5c19..a0ce9f7 100644
--- a/Mundus/Service/Tiles/Mobs/Controllers/MobStatsController.cs
+++ b/Mundus/Service/Tiles/Mobs/Controllers/MobStatsController.cs
@@ -2,9 +2,11 @@
using Mundus.Data;
using Mundus.Data.Superlayers.Mobs;
using Mundus.Service.SuperLayers;
+using Mundus.Service.Tiles.Items.Presets;
namespace Mundus.Service.Tiles.Mobs.Controllers {
public static class MobStatsController {
+ public static object GroundPresetsHeightController { get; private set; }
/// <summary>
/// Returns the stock_id of the hearth icon that must be used on the given position of the health bar
@@ -73,8 +75,8 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
if (HeightController.GetLayerAboveMob(MI.Player) == null) {
return false;
}
- return HeightController.GetLayerAboveMob(MI.Player).GetGroundLayerTile(MI.Player.YPos, MI.Player.XPos) == null ||
- !HeightController.GetLayerAboveMob(MI.Player).GetGroundLayerTile(MI.Player.YPos, MI.Player.XPos).Solid;
+ return HeightController.GetLayerAboveMob(MI.Player).GetGroundLayerStock(MI.Player.YPos, MI.Player.XPos) == null ||
+ !GroundPresets.GetFromStock(HeightController.GetLayerAboveMob(MI.Player).GetGroundLayerStock(MI.Player.YPos, MI.Player.XPos)).Solid;
}
}
}
diff --git a/Mundus/Service/Tiles/Mobs/Controllers/MobTerraforming.cs b/Mundus/Service/Tiles/Mobs/Controllers/MobTerraforming.cs
index e6afb09..f460970 100644
--- a/Mundus/Service/Tiles/Mobs/Controllers/MobTerraforming.cs
+++ b/Mundus/Service/Tiles/Mobs/Controllers/MobTerraforming.cs
@@ -1,10 +1,11 @@
using System.Linq;
-using Mundus.Data;
+using static Mundus.Data.Values;
using Mundus.Data.Superlayers.Mobs;
using Mundus.Data.SuperLayers;
-using Mundus.Data.Tiles;
using Mundus.Service.SuperLayers;
using Mundus.Service.Tiles.Items;
+using Mundus.Service.Tiles.Items.Presets;
+using Mundus.Data;
namespace Mundus.Service.Tiles.Mobs.Controllers {
public static class MobTerraforming {
@@ -23,7 +24,7 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
MI.Player.Inventory.DeleteItemTile(inventoryPlace, inventoryIndex);
}
else {
- LogController.AddMessage($"Cannot build structure at Y:{mapYPos}, X:{mapXPos}");
+ GameEventLogController.AddMessage($"Cannot build structure at Y:{mapYPos}, X:{mapXPos}");
}
}
@@ -34,7 +35,7 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
MI.Player.Inventory.DeleteItemTile(inventoryPlace, inventoryIndex);
}
else {
- LogController.AddMessage($"Cannot place ground at Y:{mapYPos}, X:{mapXPos}");
+ GameEventLogController.AddMessage($"Cannot place ground at Y:{mapYPos}, X:{mapXPos}");
}
}
// If player can mine/dig
@@ -43,15 +44,15 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
PlayerDestroyAt(mapYPos, mapXPos, inventoryPlace, inventoryIndex);
}
else {
- LogController.AddMessage($"Cannot destroy at Y:{mapYPos}, X:{mapXPos}");
+ GameEventLogController.AddMessage($"Cannot destroy at Y:{mapYPos}, X:{mapXPos}");
}
}
}
// Player can't destory structures/ground tiles if there are none
private static bool PlayerCanDestroyAt(int yPos, int xPos) {
- return MI.Player.CurrSuperLayer.GetStructureLayerTile(yPos, xPos) != null ||
- MI.Player.CurrSuperLayer.GetGroundLayerTile(yPos, xPos) != null;
+ return MI.Player.CurrSuperLayer.GetStructureLayerStock(yPos, xPos) != null ||
+ MI.Player.CurrSuperLayer.GetGroundLayerStock(yPos, xPos) != null;
}
private const double ENERGY_TAKEN_FROM_DESTROYING = 0.6;
@@ -59,30 +60,30 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
var selectedTool = (Tool)MI.Player.Inventory.GetItemTile(place, index);
// Only shovels can destroy ground layer tiles, but not when there is something over the ground tile
- if (selectedTool.Type == ToolTypes.Shovel && MI.Player.CurrSuperLayer.GetStructureLayerTile(mapYPos, mapXPos) == null) {
+ if (selectedTool.Type == ToolType.Shovel && MI.Player.CurrSuperLayer.GetStructureLayerStock(mapYPos, mapXPos) == null) {
if (PlayerTryDestroyGroundAt(mapYPos, mapXPos, selectedTool)) {
- MI.Player.DrainEnergy(ENERGY_TAKEN_FROM_DESTROYING + Difficulty.ValueModifier());
+ MI.Player.DrainEnergy(ENERGY_TAKEN_FROM_DESTROYING + Values.DifficultyValueModifier());
}
}
// Don't try to destroy structure if there is no structure
- else if (MI.Player.CurrSuperLayer.GetStructureLayerTile(mapYPos, mapXPos) != null) {
+ else if (MI.Player.CurrSuperLayer.GetStructureLayerStock(mapYPos, mapXPos) != null) {
if (PlayerTryDestroyStructureAt(mapYPos, mapXPos, selectedTool)) {
- MI.Player.DrainEnergy(ENERGY_TAKEN_FROM_DESTROYING + Difficulty.ValueModifier());
+ MI.Player.DrainEnergy(ENERGY_TAKEN_FROM_DESTROYING + Values.DifficultyValueModifier());
}
}
}
private static bool PlayerTryDestroyGroundAt(int mapYPos, int mapXPos, Tool shovel) {
- var selectedGround = MI.Player.CurrSuperLayer.GetGroundLayerTile(mapYPos, mapXPos);
+ var selectedGround = GroundPresets.GetFromStock(MI.Player.CurrSuperLayer.GetGroundLayerStock(mapYPos, mapXPos));
// Ground tiles that should be unbreakable have a negative required shovel class
if (selectedGround.ReqShovelClass <= shovel.Class && selectedGround.ReqShovelClass >= 0) {
MI.Player.CurrSuperLayer.SetGroundAtPosition(null, mapYPos, mapXPos);
- ISuperLayer under = HeightController.GetLayerUnderneathMob(MI.Player);
+ ISuperLayerContext under = HeightController.GetLayerUnderneathMob(MI.Player);
// When a shovel destroys ground tile, it destroys the structure below it (but only if it is not walkable)
- if (under != null && under.GetStructureLayerTile(mapYPos, mapXPos) != null) {
- if (!under.GetStructureLayerTile(mapYPos, mapXPos).IsWalkable) {
+ if (under != null && under.GetStructureLayerStock(mapYPos, mapXPos) != null) {
+ if (!StructurePresets.GetFromStock(under.GetStructureLayerStock(mapYPos, mapXPos)).IsWalkable) {
under.RemoveStructureFromPosition(mapYPos, mapXPos);
}
}
@@ -91,20 +92,20 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
MI.Player.Inventory.AppendToItems(new GroundTile(selectedGround));
}
- LogController.AddMessage($"Player destroyed \"{selectedGround.stock_id}\" from layer \"{MI.Player.CurrSuperLayer}\" at Y:{mapYPos}, X:{mapXPos}");
+ GameEventLogController.AddMessage($"Player destroyed \"{selectedGround.stock_id}\" from layer \"{MI.Player.CurrSuperLayer}\" at Y:{mapYPos}, X:{mapXPos}");
return true;
}
else if (selectedGround.ReqShovelClass > shovel.Class) {
- LogController.AddMessage($"Ground \"{selectedGround.stock_id}\" requires minimum shovel class of: {selectedGround.ReqShovelClass}");
+ GameEventLogController.AddMessage($"Ground \"{selectedGround.stock_id}\" requires minimum shovel class of: {selectedGround.ReqShovelClass}");
}
else { // selectedGround.ReqSHovelClass < 0
- LogController.AddMessage($"This ground cannot be destroyed.");
+ GameEventLogController.AddMessage($"This ground cannot be destroyed.");
}
return false;
}
private static bool PlayerTryDestroyStructureAt(int mapYPos, int mapXPos, Tool tool) {
- var selStructure = MI.Player.CurrSuperLayer.GetStructureLayerTile(mapYPos, mapXPos);
+ var selStructure = StructurePresets.GetFromStock(MI.Player.CurrSuperLayer.GetStructureLayerStock(mapYPos, mapXPos));
if (selStructure.ReqToolType == tool.Type && selStructure.ReqToolClass <= tool.Class) {
int damagePoints = 1 + (tool.Class - selStructure.ReqToolClass);
@@ -126,41 +127,41 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
if (!selStructure.TakeDamage(damagePoints)) {
MI.Player.CurrSuperLayer.SetStructureAtPosition(null, mapYPos, mapXPos);
- LogController.AddMessage($"Player destroyed \"{selStructure.stock_id}\" from layer \"{MI.Player.CurrSuperLayer}\" at Y:{mapYPos}, X:{mapXPos}");
+ GameEventLogController.AddMessage($"Player destroyed \"{selStructure.stock_id}\" from layer \"{MI.Player.CurrSuperLayer}\" at Y:{mapYPos}, X:{mapXPos}");
}
else {
- LogController.AddMessage($"Player did {damagePoints} damage to \"{selStructure.stock_id}\" (H:{selStructure.Health})");
+ GameEventLogController.AddMessage($"Player did {damagePoints} damage to \"{selStructure.stock_id}\" (H:{selStructure.Health})");
}
return true;
}
else if (selStructure.ReqToolType != tool.Type) {
- LogController.AddMessage($"Structure \"{selStructure.stock_id}\" requires tool type: {selStructure.ReqToolType}");
+ GameEventLogController.AddMessage($"Structure \"{selStructure.stock_id}\" requires tool type: {selStructure.ReqToolType}");
}
else { // selStructure.ReqToolClass > tool.Class
- LogController.AddMessage($"Structure \"{selStructure.stock_id}\" requires minimum tool class of: {selStructure.ReqToolClass}");
+ GameEventLogController.AddMessage($"Structure \"{selStructure.stock_id}\" requires minimum tool class of: {selStructure.ReqToolClass}");
}
return false;
}
// Ground can be placed if there isnt a structure on an empty ground layer spot
private static bool PlayerCanPlaceGroundAt(int yPos, int xPos) {
- return MI.Player.CurrSuperLayer.GetGroundLayerTile(yPos, xPos) == null &&
- MI.Player.CurrSuperLayer.GetStructureLayerTile(yPos, xPos) == null;
+ return MI.Player.CurrSuperLayer.GetGroundLayerStock(yPos, xPos) == null &&
+ MI.Player.CurrSuperLayer.GetStructureLayerStock(yPos, xPos) == null;
}
private const double ENERGY_TAKEN_FROM_PLACING_GROUND = 0.4;
private static void PlayerPlaceGroundAt(int yPos, int xPos, string inventoryPlace, int inventoryIndex) {
GroundTile toPlace = (GroundTile)MI.Player.Inventory.GetItemTile(inventoryPlace, inventoryIndex);
- MI.Player.CurrSuperLayer.SetGroundAtPosition(toPlace, yPos, xPos);
- MI.Player.DrainEnergy(ENERGY_TAKEN_FROM_PLACING_GROUND + Difficulty.ValueModifier());
+ MI.Player.CurrSuperLayer.SetGroundAtPosition(toPlace.stock_id, yPos, xPos);
+ MI.Player.DrainEnergy(ENERGY_TAKEN_FROM_PLACING_GROUND + Values.DifficultyValueModifier());
- LogController.AddMessage($"Set ground \"{toPlace.stock_id}\" on layer \"{MI.Player.CurrSuperLayer}\" at Y:{yPos}, X:{xPos}");
+ GameEventLogController.AddMessage($"Set ground \"{toPlace.stock_id}\" on layer \"{MI.Player.CurrSuperLayer}\" at Y:{yPos}, X:{xPos}");
}
private static bool PlayerCanBuildStructureAt(int yPos, int xPos) {
- return MI.Player.CurrSuperLayer.GetStructureLayerTile(yPos, xPos) == null;
+ return MI.Player.CurrSuperLayer.GetStructureLayerStock(yPos, xPos) == null;
}
private const double ENERGY_TAKEN_FROM_BUILDING_STRUCTURE = 0.5;
@@ -169,20 +170,20 @@ namespace Mundus.Service.Tiles.Mobs.Controllers {
// Climable structures will be placed under a hole (if they can be).
// Non climable structures won't be placed anywhere if there is a hole.
- if (toBuild.IsClimable && MI.Player.CurrSuperLayer.GetGroundLayerTile(yPos, xPos) == null &&
- HeightController.GetLayerUnderneathMob(MI.Player).GetStructureLayerTile(yPos, xPos) == null)
+ if (toBuild.IsClimable && MI.Player.CurrSuperLayer.GetGroundLayerStock(yPos, xPos) == null &&
+ HeightController.GetLayerUnderneathMob(MI.Player).GetStructureLayerStock(yPos, xPos) == null)
{
- HeightController.GetLayerUnderneathMob(MI.Player).SetStructureAtPosition(toBuild, yPos, xPos);
+ HeightController.GetLayerUnderneathMob(MI.Player).SetStructureAtPosition(toBuild.stock_id, yPos, xPos);
- LogController.AddMessage($"Set structure \"{toBuild.stock_id}\" on layer \"{HeightController.GetLayerUnderneathMob(MI.Player)}\" at Y:{yPos}, X:{xPos}");
+ GameEventLogController.AddMessage($"Set structure \"{toBuild.stock_id}\" on layer \"{HeightController.GetLayerUnderneathMob(MI.Player)}\" at Y:{yPos}, X:{xPos}");
}
- else if (MI.Player.CurrSuperLayer.GetGroundLayerTile(yPos, xPos) != null) {
- MI.Player.CurrSuperLayer.SetStructureAtPosition(toBuild, yPos, xPos);
+ else if (MI.Player.CurrSuperLayer.GetGroundLayerStock(yPos, xPos) != null) {
+ MI.Player.CurrSuperLayer.SetStructureAtPosition(toBuild.stock_id, yPos, xPos);
- LogController.AddMessage($"Set structure \"{toBuild.stock_id}\" on layer \"{MI.Player.CurrSuperLayer}\" at Y:{yPos}, X:{xPos}");
+ GameEventLogController.AddMessage($"Set structure \"{toBuild.stock_id}\" on layer \"{MI.Player.CurrSuperLayer}\" at Y:{yPos}, X:{xPos}");
}
- MI.Player.DrainEnergy(ENERGY_TAKEN_FROM_BUILDING_STRUCTURE + Difficulty.ValueModifier());
+ MI.Player.DrainEnergy(ENERGY_TAKEN_FROM_BUILDING_STRUCTURE + Values.DifficultyValueModifier());
}
}
}
diff --git a/Mundus/Service/Tiles/Mobs/LandMobs/LandMobsPresets.cs b/Mundus/Service/Tiles/Mobs/LandMobs/LandMobsPresets.cs
index ddf0daa..eb1c7f4 100644
--- a/Mundus/Service/Tiles/Mobs/LandMobs/LandMobsPresets.cs
+++ b/Mundus/Service/Tiles/Mobs/LandMobs/LandMobsPresets.cs
@@ -1,4 +1,6 @@
-using Mundus.Data.SuperLayers;
+using Mundus.Data;
+using Mundus.Data.Superlayers.Mobs;
+using Mundus.Data.SuperLayers;
using Mundus.Service.Tiles.Items.Presets;
namespace Mundus.Service.Tiles.Mobs.LandMobs {
@@ -7,11 +9,20 @@ namespace Mundus.Service.Tiles.Mobs.LandMobs {
/// Returns a new instance of the cow mob tile
/// </summary>
public static MobTile GetACow() {
- return new MobTile("L_cow", 10, 1, LI.Land, 1, MaterialPresets.GetALandBeefSteak());
+ return new MobTile("L_cow", 10, 1, DataBaseContexts.LContext, 1, MaterialPresets.GetALandBeefSteak());
}
public static MobTile GetASheep() {
- return new MobTile("L_sheep", 8, 1, LI.Land, 1, MaterialPresets.GetALandMuttonSteak());
+ return new MobTile("L_sheep", 8, 1, DataBaseContexts.LContext, 1, MaterialPresets.GetALandMuttonSteak());
+ }
+
+ public static MobTile GetFromStock(string stock_id) {
+ switch(stock_id) {
+ case "L_cow": return GetACow();
+ case "L_sheep": return GetASheep();
+ case "player": return MI.Player;
+ default: return null;
+ }
}
}
}
diff --git a/Mundus/Service/Tiles/Mobs/LandMobs/Player.cs b/Mundus/Service/Tiles/Mobs/LandMobs/Player.cs
index ddec45a..80c10d9 100644
--- a/Mundus/Service/Tiles/Mobs/LandMobs/Player.cs
+++ b/Mundus/Service/Tiles/Mobs/LandMobs/Player.cs
@@ -10,7 +10,7 @@ namespace Mundus.Service.Tiles.Mobs.LandMobs {
/// <summary>
/// Note: player has an rndMovementQualifier of -1 and drops first item in the hotbar
/// </summary>
- public Player(string stock_id, int defence, ISuperLayer currentSuperLayer)
+ public Player(string stock_id, int defence, ISuperLayerContext currentSuperLayer)
: base(stock_id, WI.SelWin.Size * 4, defence, currentSuperLayer, WI.SelWin.Size, null, -1)
{
this.Energy = WI.SelWin.Size * 6;
diff --git a/Mundus/Service/Tiles/Mobs/MobTile.cs b/Mundus/Service/Tiles/Mobs/MobTile.cs
index 66f6793..a3702af 100644
--- a/Mundus/Service/Tiles/Mobs/MobTile.cs
+++ b/Mundus/Service/Tiles/Mobs/MobTile.cs
@@ -9,7 +9,7 @@ namespace Mundus.Service.Tiles.Mobs {
public string stock_id { get; private set; }
public Image Texture { get; private set; }
- public ISuperLayer CurrSuperLayer { get; set; }
+ public ISuperLayerContext CurrSuperLayer { get; set; }
public int YPos { get; set; }
public int XPos { get; set; }
public int Health { get; private set; }
@@ -23,7 +23,7 @@ namespace Mundus.Service.Tiles.Mobs {
/// </summary>
public int RndMovementRate { get; protected set; }
- public MobTile(string stock_id, int health, int defence, ISuperLayer currentSuperLayer, int inventorySize = 5, Material droppedUponDeath = null, int rndMovementQualifier = 3) {
+ public MobTile(string stock_id, int health, int defence, ISuperLayerContext currentSuperLayer, int inventorySize = 5, Material droppedUponDeath = null, int rndMovementQualifier = 3) {
this.stock_id = stock_id;
this.Texture = new Image(stock_id, IconSize.Dnd);
this.Health = health;
diff --git a/Mundus/Views/Windows/GameWindows/LargeGameWindow.cs b/Mundus/Views/Windows/GameWindows/LargeGameWindow.cs
index b511fb6..b50ef41 100644
--- a/Mundus/Views/Windows/GameWindows/LargeGameWindow.cs
+++ b/Mundus/Views/Windows/GameWindows/LargeGameWindow.cs
@@ -255,8 +255,8 @@ namespace Mundus.Views.Windows {
}
//Prints log
- for (int i = 0, mIndex = LogController.GetCount() - 1; i < Size; mIndex--, i++) {
- string msg = LogController.GetMessagage(mIndex);
+ for (int i = 0, mIndex = GameEventLogController.GetCount() - 1; i < Size; mIndex--, i++) {
+ string msg = GameEventLogController.GetMessagage(mIndex);
switch (i) {
case 0: lblLog1.Text = msg; break;
diff --git a/Mundus/Views/Windows/GameWindows/MediumGameWindow.cs b/Mundus/Views/Windows/GameWindows/MediumGameWindow.cs
index 9790425..12e8ac1 100644
--- a/Mundus/Views/Windows/GameWindows/MediumGameWindow.cs
+++ b/Mundus/Views/Windows/GameWindows/MediumGameWindow.cs
@@ -220,8 +220,8 @@ namespace Mundus.Views.Windows {
}
//Prints log
- for (int i = 0, mIndex = LogController.GetCount() - 1; i < Size; mIndex--, i++) {
- string msg = LogController.GetMessagage(mIndex);
+ for (int i = 0, mIndex = GameEventLogController.GetCount() - 1; i < Size; mIndex--, i++) {
+ string msg = GameEventLogController.GetMessagage(mIndex);
switch (i) {
case 0: lblLog1.Text = msg; break;
diff --git a/Mundus/Views/Windows/GameWindows/SmallGameWindow.cs b/Mundus/Views/Windows/GameWindows/SmallGameWindow.cs
index 5b1f126..730a7d8 100644
--- a/Mundus/Views/Windows/GameWindows/SmallGameWindow.cs
+++ b/Mundus/Views/Windows/GameWindows/SmallGameWindow.cs
@@ -210,8 +210,8 @@ namespace Mundus.Views.Windows {
}
//Prints log
- for (int i = 0, mIndex = LogController.GetCount() - 1; i < Size; mIndex--, i++) {
- string msg = LogController.GetMessagage(mIndex);
+ for (int i = 0, mIndex = GameEventLogController.GetCount() - 1; i < Size; mIndex--, i++) {
+ string msg = GameEventLogController.GetMessagage(mIndex);
switch(i) {
case 0: lblLog1.Text = msg; break;
diff --git a/Mundus/Views/Windows/LogWindow.cs b/Mundus/Views/Windows/LogWindow.cs
index cf074b6..44f7f95 100644
--- a/Mundus/Views/Windows/LogWindow.cs
+++ b/Mundus/Views/Windows/LogWindow.cs
@@ -22,8 +22,8 @@ namespace Mundus.Views.Windows {
private int scroll = 0;
public void PrintLogs() {
- for (int i = LogController.GetCount() - 1 - scroll, logIndex = 0; logIndex < 9; logIndex++, i--) {
- string msg = LogController.GetMessagage(i);
+ for (int i = GameEventLogController.GetCount() - 1 - scroll, logIndex = 0; logIndex < 9; logIndex++, i--) {
+ string msg = GameEventLogController.GetMessagage(i);
switch (logIndex) {
case 0: lblLog1.Text = msg; break;
@@ -53,7 +53,7 @@ namespace Mundus.Views.Windows {
private void UpdateButtons() {
btnNewer.Sensitive = scroll > 0;
- btnOlder.Sensitive = scroll < LogController.GetCount() - 9;
+ btnOlder.Sensitive = scroll < GameEventLogController.GetCount() - 9;
}
}
}
diff --git a/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs b/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs
index 37b236b..2121a53 100644
--- a/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs
+++ b/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs
@@ -91,6 +91,7 @@ namespace Mundus.Views.Windows
this.btnTutorial = new global::Gtk.Button();
this.btnTutorial.WidthRequest = 300;
this.btnTutorial.HeightRequest = 90;
+ this.btnTutorial.Sensitive = false;
this.btnTutorial.CanFocus = true;
this.btnTutorial.Name = "btnTutorial";
this.btnTutorial.UseUnderline = true;
diff --git a/Mundus/gtk-gui/Mundus.Views.Windows.NewGameWindow.cs b/Mundus/gtk-gui/Mundus.Views.Windows.NewGameWindow.cs
index 13f023a..2ea610e 100644
--- a/Mundus/gtk-gui/Mundus.Views.Windows.NewGameWindow.cs
+++ b/Mundus/gtk-gui/Mundus.Views.Windows.NewGameWindow.cs
@@ -244,8 +244,10 @@ namespace Mundus.Views.Windows
// Container child tbUI.Gtk.Table+TableChild
this.rbCreative = new global::Gtk.RadioButton("Creative");
this.rbCreative.WidthRequest = 90;
+ this.rbCreative.Sensitive = false;
this.rbCreative.CanFocus = true;
this.rbCreative.Name = "rbCreative";
+ this.rbCreative.Active = true;
this.rbCreative.DrawIndicator = true;
this.rbCreative.UseUnderline = true;
this.rbCreative.Group = new global::GLib.SList(global::System.IntPtr.Zero);
@@ -262,6 +264,7 @@ namespace Mundus.Views.Windows
this.rbEasy.WidthRequest = 90;
this.rbEasy.CanFocus = true;
this.rbEasy.Name = "rbEasy";
+ this.rbEasy.Active = true;
this.rbEasy.DrawIndicator = true;
this.rbEasy.UseUnderline = true;
this.rbEasy.Group = new global::GLib.SList(global::System.IntPtr.Zero);
@@ -310,6 +313,7 @@ namespace Mundus.Views.Windows
this.rbLarge.WidthRequest = 90;
this.rbLarge.CanFocus = true;
this.rbLarge.Name = "rbLarge";
+ this.rbLarge.Active = true;
this.rbLarge.DrawIndicator = true;
this.rbLarge.UseUnderline = true;
this.rbLarge.Group = new global::GLib.SList(global::System.IntPtr.Zero);
@@ -341,6 +345,7 @@ namespace Mundus.Views.Windows
this.rbMLarge = new global::Gtk.RadioButton("Large");
this.rbMLarge.CanFocus = true;
this.rbMLarge.Name = "rbMLarge";
+ this.rbMLarge.Active = true;
this.rbMLarge.DrawIndicator = true;
this.rbMLarge.UseUnderline = true;
this.rbMLarge.Group = new global::GLib.SList(global::System.IntPtr.Zero);
diff --git a/Mundus/gtk-gui/gui.stetic b/Mundus/gtk-gui/gui.stetic
index d66e494..9807d52 100644
--- a/Mundus/gtk-gui/gui.stetic
+++ b/Mundus/gtk-gui/gui.stetic
@@ -587,8 +587,10 @@
<widget class="Gtk.RadioButton" id="rbCreative">
<property name="MemberName" />
<property name="WidthRequest">90</property>
+ <property name="Sensitive">False</property>
<property name="CanFocus">True</property>
<property name="Label">Creative</property>
+ <property name="Active">True</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
@@ -617,6 +619,7 @@
<property name="WidthRequest">90</property>
<property name="CanFocus">True</property>
<property name="Label">Easy</property>
+ <property name="Active">True</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
@@ -701,6 +704,7 @@
<property name="WidthRequest">90</property>
<property name="CanFocus">True</property>
<property name="Label">Large</property>
+ <property name="Active">True</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
@@ -756,6 +760,7 @@
<property name="MemberName" />
<property name="CanFocus">True</property>
<property name="Label">Large</property>
+ <property name="Active">True</property>
<property name="DrawIndicator">True</property>
<property name="HasLabel">True</property>
<property name="UseUnderline">True</property>
@@ -25257,6 +25262,7 @@
<property name="MemberName" />
<property name="WidthRequest">300</property>
<property name="HeightRequest">90</property>
+ <property name="Sensitive">False</property>
<property name="CanFocus">True</property>
<property name="Type">TextOnly</property>
<property name="Label">Tutorial</property>