aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2020-03-15 20:47:15 +0200
committerSyndamia <kamen.d.mladenov@protonmail.com>2020-03-15 20:47:15 +0200
commitec80fa835ad90588de95a5c34b395b42daaf4b77 (patch)
tree1504c88df051d67bee1479c242c6579fe7cd519d
parent37e3abdf91830cbec3664232f3ed1fad9b317dde (diff)
downloadMundus-ec80fa835ad90588de95a5c34b395b42daaf4b77.tar
Mundus-ec80fa835ad90588de95a5c34b395b42daaf4b77.tar.gz
Mundus-ec80fa835ad90588de95a5c34b395b42daaf4b77.zip
Did minor bug fixes
-rw-r--r--Mundus/Service/GameGenerator.cs2
-rw-r--r--Mundus/Service/Mobs/MobTerraforming.cs11
-rw-r--r--Mundus/Views/Windows/IGameWindow.cs2
-rw-r--r--Mundus/Views/Windows/LargeGameWindow.cs2
-rw-r--r--Mundus/Views/Windows/MediumGameWindow.cs2
-rw-r--r--Mundus/Views/Windows/SmallGameWindow.cs52
6 files changed, 42 insertions, 29 deletions
diff --git a/Mundus/Service/GameGenerator.cs b/Mundus/Service/GameGenerator.cs
index 4925757..2479a43 100644
--- a/Mundus/Service/GameGenerator.cs
+++ b/Mundus/Service/GameGenerator.cs
@@ -33,7 +33,7 @@ namespace Mundus.Service {
WI.WPause.GameWindow = gameWindow;
LMI.CreateInventories(gameWindow.Size);
gameWindow.PrintScreen();
- gameWindow.PrintInventory();
+ gameWindow.PrintMainMenu();
gameWindow.Show();
}
}
diff --git a/Mundus/Service/Mobs/MobTerraforming.cs b/Mundus/Service/Mobs/MobTerraforming.cs
index e80f7cb..1dc51cf 100644
--- a/Mundus/Service/Mobs/MobTerraforming.cs
+++ b/Mundus/Service/Mobs/MobTerraforming.cs
@@ -16,20 +16,21 @@ namespace Mundus.Service.Mobs {
public static void PlayerBuildAt(int mapYPos, int mapXPos, string inventoryPlace, int inventoryPlaceIndex) {
if (PlayerCanBuildAt(mapYPos, mapXPos)) {
- Structure toPlace = null;
+ ItemTile[] toPlace = null;
switch (inventoryPlace) {
- case "hotbar": toPlace = (Structure)LMI.Player.Inventory.Hotbar[inventoryPlaceIndex]; break;
- case "items": toPlace = (Structure)LMI.Player.Inventory.Items[inventoryPlaceIndex]; break;
+ case "hotbar": toPlace = LMI.Player.Inventory.Hotbar; break;
+ case "items": toPlace = LMI.Player.Inventory.Items; break;
}
if (toPlace != null) {
- PlayerBuildAt(mapYPos, mapXPos, toPlace);
+ PlayerBuildAt(mapYPos, mapXPos, (Structure)toPlace[inventoryPlaceIndex]);
+ toPlace[inventoryPlaceIndex] = null;
}
}
}
- public static void PlayerBuildAt(int mapYPos, int mapXPos, Structure toPlace) {
+ private static void PlayerBuildAt(int mapYPos, int mapXPos, Structure toPlace) {
LMI.Player.CurrSuperLayer.SetStructureAtPosition(toPlace, mapYPos, mapXPos);
}
diff --git a/Mundus/Views/Windows/IGameWindow.cs b/Mundus/Views/Windows/IGameWindow.cs
index 98c2997..1db6fc9 100644
--- a/Mundus/Views/Windows/IGameWindow.cs
+++ b/Mundus/Views/Windows/IGameWindow.cs
@@ -8,7 +8,7 @@
void SetDefaults();
void PrintScreen();
void PrintMap();
- void PrintInventory();
+ void PrintMainMenu();
//Stuff that are in Gtk.Window class
void Show();
diff --git a/Mundus/Views/Windows/LargeGameWindow.cs b/Mundus/Views/Windows/LargeGameWindow.cs
index 746c679..dc1b394 100644
--- a/Mundus/Views/Windows/LargeGameWindow.cs
+++ b/Mundus/Views/Windows/LargeGameWindow.cs
@@ -17,7 +17,7 @@ namespace Mundus.Views.Windows {
throw new NotImplementedException();
}
- public void PrintInventory() {
+ public void PrintMainMenu() {
throw new NotImplementedException();
}
diff --git a/Mundus/Views/Windows/MediumGameWindow.cs b/Mundus/Views/Windows/MediumGameWindow.cs
index d1cd5df..b99d82e 100644
--- a/Mundus/Views/Windows/MediumGameWindow.cs
+++ b/Mundus/Views/Windows/MediumGameWindow.cs
@@ -17,7 +17,7 @@ namespace Mundus.Views.Windows {
throw new NotImplementedException();
}
- public void PrintInventory() {
+ public void PrintMainMenu() {
throw new NotImplementedException();
}
diff --git a/Mundus/Views/Windows/SmallGameWindow.cs b/Mundus/Views/Windows/SmallGameWindow.cs
index b4a8ca9..a92ec07 100644
--- a/Mundus/Views/Windows/SmallGameWindow.cs
+++ b/Mundus/Views/Windows/SmallGameWindow.cs
@@ -250,6 +250,25 @@ namespace Mundus.Views.Windows {
}
}
+ public void PrintMainMenu() {
+ //Print stats
+
+ //Prints hotbar
+ for (int i = 0; i < Size; i++) {
+ Image img = ImageController.GetHotbarImage(i);
+
+ switch (i + 1) {
+ case 1: btnH1.Image = img; break;
+ case 2: btnH2.Image = img; break;
+ case 3: btnH3.Image = img; break;
+ case 4: btnH4.Image = img; break;
+ case 5: btnH5.Image = img; break;
+ }
+ }
+
+ //Print log
+ }
+
public void PrintMap() {
//Prints the "Ground layer" in map menu
for (int row = Calculate.CalculateStartY(Size), maxY = Calculate.CalculateMaxY(Size), img = 1; row <= maxY; row++) {
@@ -323,19 +342,6 @@ namespace Mundus.Views.Windows {
}
public void PrintInventory() {
- //Prints hotbar
- for (int i = 0; i < Size; i++) {
- Image img = ImageController.GetHotbarImage(i);
-
- switch (i + 1) {
- case 1: btnH1.Image = img; break;
- case 2: btnH2.Image = img; break;
- case 3: btnH3.Image = img; break;
- case 4: btnH4.Image = img; break;
- case 5: btnH5.Image = img; break;
- }
- }
-
//Prints the actual inventory (items)
for (int row = 0; row < Size; row++) {
for (int col = 0; col < Size; col++) {
@@ -543,22 +549,28 @@ namespace Mundus.Views.Windows {
MobMoving.MovePlayer(mapYPos, mapXPos, Size);
}
else {
- var selType = Inventory.GetPlayerItem(selPlace, selIndex).GetType();
- //try to do MobFighting
- if (selType == typeof(Structure) && MobTerraforming.PlayerCanBuildAt(mapYPos, mapXPos)) {
- MobTerraforming.PlayerBuildAt(mapYPos, mapXPos, selPlace, selIndex);
+ if (Inventory.GetPlayerItem(selPlace, selIndex) != null) {
+ var selType = Inventory.GetPlayerItem(selPlace, selIndex).GetType();
+ //try to do MobFighting
+ if (selType == typeof(Structure) && MobTerraforming.PlayerCanBuildAt(mapYPos, mapXPos)) {
+ MobTerraforming.PlayerBuildAt(mapYPos, mapXPos, selPlace, selIndex);
- }
- else if (selType == typeof(Tool) && MobTerraforming.PlayerCanDestroyAt(mapYPos, mapXPos)) {
- MobTerraforming.PlayerDestroyAt(mapYPos, mapXPos, selPlace, selIndex);
+ }
+ else if (selType == typeof(Tool) && MobTerraforming.PlayerCanDestroyAt(mapYPos, mapXPos)) {
+ MobTerraforming.PlayerDestroyAt(mapYPos, mapXPos, selPlace, selIndex);
+ }
}
ResetSelection();
}
this.PrintScreen();
+ this.PrintMainMenu();
if (this.MapMenuIsVisible()) {
this.PrintMap();
}
+ else if (this.InvMenuIsVisible()) {
+ this.PrintInventory();
+ }
}
//Hotbar buttons