From 2303a769b1b8d8f710b1796696117070dc1cb155 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 30 Apr 2020 17:31:39 +0300 Subject: Changed file/namespace stucture slightly. Updated executable. Mobs are now in Tiles, Inventory in Mobs, SwitchItems in Items, Crafting in Tiles, ItemPresets are now just Presets and are located in Items, Small, Medium, Game and I Window are now in Windows/GameWindows --- Mundus Build 30-04-2020 No2.exe | Bin 1607680 -> 0 bytes Mundus Build 30-04-2020 No3.exe | Bin 0 -> 1608192 bytes Mundus/Data/Crafting/RI.cs | 4 +- Mundus/Data/SuperLayers/ISuperLayer.cs | 2 +- Mundus/Data/SuperLayers/Land.cs | 2 +- Mundus/Data/SuperLayers/Mobs/MI.cs | 4 +- Mundus/Data/SuperLayers/Sky.cs | 2 +- Mundus/Data/SuperLayers/Underground.cs | 2 +- Mundus/Data/Windows/WI.cs | 3 +- Mundus/Mundus.csproj | 51 +- Mundus/Service/Crafting/CraftingController.cs | 85 - Mundus/Service/Crafting/CraftingRecipe.cs | 163 -- Mundus/Service/Inventory.cs | 120 -- Mundus/Service/Mobs/Controllers/MobFighting.cs | 91 - Mundus/Service/Mobs/Controllers/MobMovement.cs | 146 -- .../Service/Mobs/Controllers/MobStatsController.cs | 78 - Mundus/Service/Mobs/Controllers/MobTerraforming.cs | 173 -- Mundus/Service/Mobs/LandMobs/LandMobsPresets.cs | 15 - Mundus/Service/Mobs/LandMobs/Player.cs | 17 - Mundus/Service/Mobs/MobTile.cs | 60 - .../Generators/LandSuperLayerGenerator.cs | 6 +- .../Generators/SkySuperLayerGenerator.cs | 4 +- .../Generators/UndergroundSuperLayerGenerator.cs | 5 +- Mundus/Service/SuperLayers/HeightController.cs | 2 +- Mundus/Service/SwitchItems.cs | 71 - .../Service/Tiles/Crafting/CraftingController.cs | 85 + Mundus/Service/Tiles/Crafting/CraftingRecipe.cs | 163 ++ Mundus/Service/Tiles/ItemPresets/GroundPresets.cs | 28 - .../Service/Tiles/ItemPresets/MaterialPresets.cs | 34 - .../Service/Tiles/ItemPresets/StructurePresets.cs | 32 - Mundus/Service/Tiles/ItemPresets/ToolPresets.cs | 39 - .../Service/Tiles/Items/Presets/GroundPresets.cs | 24 + .../Service/Tiles/Items/Presets/MaterialPresets.cs | 31 + .../Tiles/Items/Presets/StructurePresets.cs | 30 + Mundus/Service/Tiles/Items/Presets/ToolPresets.cs | 37 + Mundus/Service/Tiles/Items/SwitchItems.cs | 69 + .../Service/Tiles/Mobs/Controllers/MobFighting.cs | 90 + .../Service/Tiles/Mobs/Controllers/MobMovement.cs | 146 ++ .../Tiles/Mobs/Controllers/MobStatsController.cs | 78 + .../Tiles/Mobs/Controllers/MobTerraforming.cs | 173 ++ Mundus/Service/Tiles/Mobs/Inventory.cs | 120 ++ .../Service/Tiles/Mobs/LandMobs/LandMobsPresets.cs | 13 + Mundus/Service/Tiles/Mobs/LandMobs/Player.cs | 15 + Mundus/Service/Tiles/Mobs/MobTile.cs | 57 + Mundus/Views/Windows/CraftingWindow.cs | 2 +- Mundus/Views/Windows/GameWindows/IGameWindow.cs | 19 + .../Views/Windows/GameWindows/LargeGameWindow.cs | 2246 ++++++++++++++++++++ .../Views/Windows/GameWindows/MediumGameWindow.cs | 1536 +++++++++++++ .../Views/Windows/GameWindows/SmallGameWindow.cs | 959 +++++++++ Mundus/Views/Windows/IGameWindow.cs | 19 - Mundus/Views/Windows/LargeGameWindow.cs | 2246 -------------------- Mundus/Views/Windows/MediumGameWindow.cs | 1536 ------------- Mundus/Views/Windows/PauseWindow.cs | 1 + Mundus/Views/Windows/SmallGameWindow.cs | 960 --------- .../Mundus.Views.Windows.LargeGameWindow.cs | 2 +- .../Mundus.Views.Windows.MediumGameWindow.cs | 2 +- .../Mundus.Views.Windows.SmallGameWindow.cs | 2 +- 57 files changed, 5939 insertions(+), 5961 deletions(-) delete mode 100644 Mundus Build 30-04-2020 No2.exe create mode 100644 Mundus Build 30-04-2020 No3.exe delete mode 100644 Mundus/Service/Crafting/CraftingController.cs delete mode 100644 Mundus/Service/Crafting/CraftingRecipe.cs delete mode 100644 Mundus/Service/Inventory.cs delete mode 100644 Mundus/Service/Mobs/Controllers/MobFighting.cs delete mode 100644 Mundus/Service/Mobs/Controllers/MobMovement.cs delete mode 100644 Mundus/Service/Mobs/Controllers/MobStatsController.cs delete mode 100644 Mundus/Service/Mobs/Controllers/MobTerraforming.cs delete mode 100644 Mundus/Service/Mobs/LandMobs/LandMobsPresets.cs delete mode 100644 Mundus/Service/Mobs/LandMobs/Player.cs delete mode 100644 Mundus/Service/Mobs/MobTile.cs delete mode 100644 Mundus/Service/SwitchItems.cs create mode 100644 Mundus/Service/Tiles/Crafting/CraftingController.cs create mode 100644 Mundus/Service/Tiles/Crafting/CraftingRecipe.cs delete mode 100644 Mundus/Service/Tiles/ItemPresets/GroundPresets.cs delete mode 100644 Mundus/Service/Tiles/ItemPresets/MaterialPresets.cs delete mode 100644 Mundus/Service/Tiles/ItemPresets/StructurePresets.cs delete mode 100644 Mundus/Service/Tiles/ItemPresets/ToolPresets.cs create mode 100644 Mundus/Service/Tiles/Items/Presets/GroundPresets.cs create mode 100644 Mundus/Service/Tiles/Items/Presets/MaterialPresets.cs create mode 100644 Mundus/Service/Tiles/Items/Presets/StructurePresets.cs create mode 100644 Mundus/Service/Tiles/Items/Presets/ToolPresets.cs create mode 100644 Mundus/Service/Tiles/Items/SwitchItems.cs create mode 100644 Mundus/Service/Tiles/Mobs/Controllers/MobFighting.cs create mode 100644 Mundus/Service/Tiles/Mobs/Controllers/MobMovement.cs create mode 100644 Mundus/Service/Tiles/Mobs/Controllers/MobStatsController.cs create mode 100644 Mundus/Service/Tiles/Mobs/Controllers/MobTerraforming.cs create mode 100644 Mundus/Service/Tiles/Mobs/Inventory.cs create mode 100644 Mundus/Service/Tiles/Mobs/LandMobs/LandMobsPresets.cs create mode 100644 Mundus/Service/Tiles/Mobs/LandMobs/Player.cs create mode 100644 Mundus/Service/Tiles/Mobs/MobTile.cs create mode 100644 Mundus/Views/Windows/GameWindows/IGameWindow.cs create mode 100644 Mundus/Views/Windows/GameWindows/LargeGameWindow.cs create mode 100644 Mundus/Views/Windows/GameWindows/MediumGameWindow.cs create mode 100644 Mundus/Views/Windows/GameWindows/SmallGameWindow.cs delete mode 100644 Mundus/Views/Windows/IGameWindow.cs delete mode 100644 Mundus/Views/Windows/LargeGameWindow.cs delete mode 100644 Mundus/Views/Windows/MediumGameWindow.cs delete mode 100644 Mundus/Views/Windows/SmallGameWindow.cs diff --git a/Mundus Build 30-04-2020 No2.exe b/Mundus Build 30-04-2020 No2.exe deleted file mode 100644 index abce32f..0000000 Binary files a/Mundus Build 30-04-2020 No2.exe and /dev/null differ diff --git a/Mundus Build 30-04-2020 No3.exe b/Mundus Build 30-04-2020 No3.exe new file mode 100644 index 0000000..825b500 Binary files /dev/null and b/Mundus Build 30-04-2020 No3.exe differ diff --git a/Mundus/Data/Crafting/RI.cs b/Mundus/Data/Crafting/RI.cs index b24eea5..10a8b89 100644 --- a/Mundus/Data/Crafting/RI.cs +++ b/Mundus/Data/Crafting/RI.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -using Mundus.Service.Crafting; -using Mundus.Service.Tiles.ItemPresets; +using Mundus.Service.Tiles.Crafting; +using Mundus.Service.Tiles.Items.Presets; namespace Mundus.Data.Crafting { public static class RI { //short for Recipe Instances diff --git a/Mundus/Data/SuperLayers/ISuperLayer.cs b/Mundus/Data/SuperLayers/ISuperLayer.cs index 733df32..8f140ad 100644 --- a/Mundus/Data/SuperLayers/ISuperLayer.cs +++ b/Mundus/Data/SuperLayers/ISuperLayer.cs @@ -1,4 +1,4 @@ -using Mundus.Service.Tiles; +using Mundus.Service.Tiles.Mobs; using Mundus.Service.Tiles.Items; namespace Mundus.Data.SuperLayers { diff --git a/Mundus/Data/SuperLayers/Land.cs b/Mundus/Data/SuperLayers/Land.cs index 2f4e16c..73ffd17 100644 --- a/Mundus/Data/SuperLayers/Land.cs +++ b/Mundus/Data/SuperLayers/Land.cs @@ -1,4 +1,4 @@ -using Mundus.Service.Tiles; +using Mundus.Service.Tiles.Mobs; using Mundus.Service.Tiles.Items; namespace Mundus.Data.SuperLayers { diff --git a/Mundus/Data/SuperLayers/Mobs/MI.cs b/Mundus/Data/SuperLayers/Mobs/MI.cs index fa498a9..45cf99a 100644 --- a/Mundus/Data/SuperLayers/Mobs/MI.cs +++ b/Mundus/Data/SuperLayers/Mobs/MI.cs @@ -1,6 +1,6 @@ using Mundus.Data.SuperLayers; -using Mundus.Service.Mobs.LandMobs; -using Mundus.Service.Tiles.ItemPresets; +using Mundus.Service.Tiles.Mobs.LandMobs; +using Mundus.Service.Tiles.Items.Presets; namespace Mundus.Data.Superlayers.Mobs { public static class MI { //stands for Mob Instances diff --git a/Mundus/Data/SuperLayers/Sky.cs b/Mundus/Data/SuperLayers/Sky.cs index ee408c0..cb4343d 100644 --- a/Mundus/Data/SuperLayers/Sky.cs +++ b/Mundus/Data/SuperLayers/Sky.cs @@ -1,5 +1,5 @@ using System; -using Mundus.Service.Tiles; +using Mundus.Service.Tiles.Mobs; using Mundus.Service.Tiles.Items; namespace Mundus.Data.SuperLayers { diff --git a/Mundus/Data/SuperLayers/Underground.cs b/Mundus/Data/SuperLayers/Underground.cs index 22d13c0..d78930a 100644 --- a/Mundus/Data/SuperLayers/Underground.cs +++ b/Mundus/Data/SuperLayers/Underground.cs @@ -1,5 +1,5 @@ using System; -using Mundus.Service.Tiles; +using Mundus.Service.Tiles.Mobs; using Mundus.Service.Tiles.Items; namespace Mundus.Data.SuperLayers { diff --git a/Mundus/Data/Windows/WI.cs b/Mundus/Data/Windows/WI.cs index 0f064fb..566539c 100644 --- a/Mundus/Data/Windows/WI.cs +++ b/Mundus/Data/Windows/WI.cs @@ -1,8 +1,9 @@ using Mundus.Views.Windows; +using Mundus.Views.Windows.GameWindows; namespace Mundus.Data.Windows { public static class WI { //stands for Window Instances - public const string BuildName = "Build 30-04-2020 No2"; + public const string BuildName = "Build 30-04-2020 No3"; public static IGameWindow SelWin { get; set; } diff --git a/Mundus/Mundus.csproj b/Mundus/Mundus.csproj index 6ccae13..4e8894b 100644 --- a/Mundus/Mundus.csproj +++ b/Mundus/Mundus.csproj @@ -91,11 +91,8 @@ - - - @@ -110,12 +107,7 @@ - - - - true - @@ -132,32 +124,40 @@ - - - - - - - - - - - - - + + + + + + + + + + true + + + + + + + + + + + @@ -168,21 +168,20 @@ - - - - - + + + + diff --git a/Mundus/Service/Crafting/CraftingController.cs b/Mundus/Service/Crafting/CraftingController.cs deleted file mode 100644 index a9aee09..0000000 --- a/Mundus/Service/Crafting/CraftingController.cs +++ /dev/null @@ -1,85 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Mundus.Data.Crafting; -using Mundus.Data.Superlayers.Mobs; -using Mundus.Service.Tiles; -using Mundus.Service.Tiles.Items; - -namespace Mundus.Service.Crafting { - public static class CraftingController { - private static Dictionary avalableItems; - - /// - /// Returns all recipes that can be executed with the current items in the player inventory (Inventory.Items) - /// - /// All avalable recipies. - public static CraftingRecipe[] GetAvalableRecipes() { - FindAvalableItems(); - - List recipes = new List(); - - foreach (var recipe in RI.AllRecipies) { - if (recipe.HasEnoughItems(avalableItems)) { - recipes.Add(recipe); - } - } - - return recipes.ToArray(); - } - - // Sets avalableItems to all items in the player inventory (Inventory.Items) - private static void FindAvalableItems() { - avalableItems = MI.Player.Inventory.Items.Where(x => x != null) - //Can't use distinct on non primative types, beause they also hold their memory location info (I think). - //This is my way of getting only the "unique" item tiles. - .Select(x => x.stock_id).Distinct().Select(x => MI.Player.Inventory.Items.Where(y => y != null).First(y => y.stock_id == x)) - //For each "unique" item tile (key), get how many there are of it in the player inventory (value) - .Select(x => new KeyValuePair(x, MI.Player.Inventory.Items.Where(y => y != null).Count(i => i.stock_id == x.stock_id))) - .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); - } - - /// - /// Removes items, used for crafting and adds the result item to the inventory - /// - /// CraftingRecipie of the item that will be crafted - public static void CraftItem(CraftingRecipe itemRecipe, MobTile mob) { - // Removes all items that are used to craft the result item - foreach (var itemAndCount in itemRecipe.GetRequiredItemsAndCounts()) { - for(int i = 0, removedItems = 0; i < mob.Inventory.Items.Length && removedItems < itemAndCount.Value; i++) { - if (MI.Player.Inventory.Items[i] != null) { - if (MI.Player.Inventory.Items[i].stock_id == itemAndCount.Key.stock_id) { - MI.Player.Inventory.Items[i] = null; - removedItems++; - } - } - } - } - ItemTile tmp = null; - - // Adds the result item to the inventory (in the correct data type) - if (itemRecipe.ResultItem.GetType() == typeof(Material)) { - tmp = new Material((Material)itemRecipe.ResultItem); - } - if (itemRecipe.ResultItem.GetType() == typeof(Tool)) { - tmp = new Tool((Tool)itemRecipe.ResultItem); - } - if (itemRecipe.ResultItem.GetType() == typeof(Gear)) { - tmp = new Gear((Gear)itemRecipe.ResultItem); - } - if (itemRecipe.ResultItem.GetType() == typeof(Structure)) { - tmp = new Structure((Structure)itemRecipe.ResultItem); - } - MI.Player.Inventory.AppendToItems(tmp); - - Data.Windows.WI.SelWin.PrintInventory(); - } - - /// - /// Does CraftItem method for the player - /// - /// CraftingRecipie of the item that will be crafted - public static void CraftItemPlayer(CraftingRecipe itemRecipe) { - CraftItem(itemRecipe, MI.Player); - } - } -} \ No newline at end of file diff --git a/Mundus/Service/Crafting/CraftingRecipe.cs b/Mundus/Service/Crafting/CraftingRecipe.cs deleted file mode 100644 index d3829d0..0000000 --- a/Mundus/Service/Crafting/CraftingRecipe.cs +++ /dev/null @@ -1,163 +0,0 @@ -using System.Collections.Generic; -using System.Linq; -using Mundus.Service.Tiles.Items; - -namespace Mundus.Service.Crafting { - public class CraftingRecipe { - /// - /// Item that will be added to the inventory after crafting - /// - /// The result item. - public ItemTile ResultItem { get; private set; } - - /// - /// Required amount of the first item - /// - public int Count1 { get; private set; } - /// - /// Required first item - /// - public ItemTile ReqItem1 { get; private set; } - - /// - /// Required amount of the second item - /// - public int Count2 { get; private set; } - /// - /// Required second item - /// - public ItemTile ReqItem2 { get; private set; } - - /// - /// Required amount of the third item - /// - public int Count3 { get; private set; } - /// - /// Required third item - /// - public ItemTile ReqItem3 { get; private set; } - - /// - /// Required amount of the fourth item - /// - public int Count4 { get; private set; } - /// - /// Required fourth item - /// - public ItemTile ReqItem4 { get; private set; } - - /// - /// Required amount of the fifth item - /// - public int Count5 { get; private set; } - /// - /// Required fifth item - /// - public ItemTile ReqItem5 { get; private set; } - - public CraftingRecipe(ItemTile resultItem, int count1, ItemTile reqItem1) :this(resultItem, count1, reqItem1, 0, null, 0, null, 0, null, 0, null) - { } - - public CraftingRecipe(ItemTile resultItem, int count1, ItemTile reqItem1, int count2, ItemTile reqItem2) : this(resultItem, count1, reqItem1, count2, reqItem2, 0, null, 0, null, 0, null) - { } - - public CraftingRecipe(ItemTile resultItem, int count1, ItemTile reqItem1, int count2, ItemTile reqItem2, int count3, ItemTile reqItem3) : this(resultItem, count1, reqItem1, count2, reqItem2, count3, reqItem3, 0, null, 0, null) - { } - - public CraftingRecipe(ItemTile resultItem, int count1, ItemTile reqItem1, int count2, ItemTile reqItem2, int count3, ItemTile reqItem3, int count4, ItemTile reqItem4) : this(resultItem, count1, reqItem1, count2, reqItem2, count3, reqItem3, count4, reqItem4, 0, null) - { } - - public CraftingRecipe(ItemTile resultItem, int count1, ItemTile reqItem1, int count2, ItemTile reqItem2, int count3, ItemTile reqItem3, int count4, ItemTile reqItem4, int count5, ItemTile reqItem5) { - this.ResultItem = resultItem; - - this.Count1 = count1; - this.ReqItem1 = reqItem1; - - this.Count2 = count2; - this.ReqItem2 = reqItem2; - - this.Count3 = count3; - this.ReqItem3 = reqItem3; - - this.Count4 = count4; - this.ReqItem4 = reqItem4; - - this.Count5 = count5; - this.ReqItem5 = reqItem5; - } - - //ugly af, but will rewrite when I imntegrade data bases - /// - /// Checks if the parameter has enough of every requried item - /// - /// trueIf has enoughfalseotherwise - /// Dictionary that has the items and their respective amounts (that will be checked) - public bool HasEnoughItems(Dictionary itemsAndCounts) { - bool hasEnough = true; - - if (ReqItem1 != null && hasEnough) { - if (itemsAndCounts.Keys.Any(k => k.stock_id == ReqItem1.stock_id)) { - hasEnough = itemsAndCounts.First(x => x.Key.stock_id == ReqItem1.stock_id).Value >= Count1; - } - else hasEnough = false; - } - - if (ReqItem2 != null && hasEnough) { - if (itemsAndCounts.Keys.Any(k => k.stock_id == ReqItem2.stock_id)) { - hasEnough = itemsAndCounts.First(x => x.Key.stock_id == ReqItem2.stock_id).Value >= Count2; - } - else hasEnough = false; - } - - if (ReqItem3 != null && hasEnough) { - if (itemsAndCounts.Keys.Any(k => k.stock_id == ReqItem3.stock_id)) { - hasEnough = itemsAndCounts.First(x => x.Key.stock_id == ReqItem3.stock_id).Value >= Count3; - } - else hasEnough = false; - } - - if (ReqItem4 != null && hasEnough) { - if (itemsAndCounts.Keys.Any(k => k.stock_id == ReqItem4.stock_id)) { - hasEnough = itemsAndCounts.First(x => x.Key.stock_id == ReqItem4.stock_id).Value >= Count4; - } - else hasEnough = false; - } - - if (ReqItem5 != null && hasEnough) { - if (itemsAndCounts.Keys.Any(k => k.stock_id == ReqItem5.stock_id)) { - hasEnough = itemsAndCounts.First(x => x.Key.stock_id == ReqItem5.stock_id).Value >= Count5; - } - else hasEnough = false; - } - - return hasEnough; - } - - /// - /// Checks if the given item (and amount) is enough for the recipe - /// - public bool HasEnoughOfItem(ItemTile item, int count) { - if (ReqItem1.stock_id == item.stock_id) return count >= Count1; - if (ReqItem2.stock_id == item.stock_id) return count >= Count2; - if (ReqItem3.stock_id == item.stock_id) return count >= Count3; - if (ReqItem4.stock_id == item.stock_id) return count >= Count4; - if (ReqItem5.stock_id == item.stock_id) return count >= Count5; - return false; - } - - /// - /// Returns a dictionary of every required item and their respective amount - /// - public Dictionary GetRequiredItemsAndCounts() { - Dictionary req = new Dictionary(); - - req.Add(ReqItem1, Count1); - if (ReqItem2 != null) req.Add(ReqItem2, Count2); - if (ReqItem3 != null) req.Add(ReqItem3, Count3); - if (ReqItem4 != null) req.Add(ReqItem4, Count4); - if (ReqItem5 != null) req.Add(ReqItem5, Count5); - - return req; - } - } -} diff --git a/Mundus/Service/Inventory.cs b/Mundus/Service/Inventory.cs deleted file mode 100644 index de9c3ac..0000000 --- a/Mundus/Service/Inventory.cs +++ /dev/null @@ -1,120 +0,0 @@ -using Mundus.Service.Tiles.Items; -using System; -using System.Linq; - -namespace Mundus.Service { - public class Inventory { - /// - /// Has a size of "Screen and Inventory" and can hold Tools, Materials, Structures and Gear - /// - public ItemTile[] Hotbar { get; set; } - /// - /// Has a size of the "Screen and Inventory" squared and can hold Tools, Materials, Structures and Gear - /// - public ItemTile[] Items { get; set; } - /// - /// Has a size of double the "Screen and Inventory" and can only hold Gear - /// - public Gear[] Accessories { get; set; } - /// - /// Has a size of "Screen and Inventory" and can only hold Gear - /// - public Gear[] Gear { get; set; } - - public Inventory(int screenInvSize) { - this.SetSizes(screenInvSize); - } - - public void SetSizes(int screenInvSize) { - this.Hotbar = new ItemTile[screenInvSize]; - this.Items = new ItemTile[screenInvSize * screenInvSize]; - this.Accessories = new Gear[screenInvSize * 2]; - this.Gear = new Gear[screenInvSize]; - } - - public void AppendToHotbar(ItemTile itemTile) { - this.AddToHotbar(itemTile, Array.IndexOf(this.Hotbar, this.Hotbar.First(x => x == null))); - } - - public void AddToHotbar(ItemTile itemTile, int index) { - this.Hotbar[index] = itemTile; - } - - public void DeleteFromHotbar(int index) { - this.Hotbar[index] = null; - } - - public void AppendToItems(ItemTile itemTile) { - this.AddToItems(itemTile, Array.IndexOf(this.Items, this.Items.First(x => x == null))); - } - - public void AddToItems(ItemTile itemTile, int index) { - this.Items[index] = itemTile; - } - - public void DeleteFromItems(int index) { - this.Items[index] = null; - } - - public void EquipAccessory(Gear accessory, int index) { - this.Accessories[index] = accessory; - } - - public void AppendAccessories(Gear accessory) { - this.EquipAccessory(accessory, Array.IndexOf(this.Accessories, this.Accessories.First(x => x == null))); - } - - public void DeleteAccessory(int index) { - this.Accessories[index] = null; - } - - public void EquipGear(Gear gear, int index) { - this.Gear[index] = gear; - } - - public void AppendGear(Gear gear) { - this.EquipGear(gear, Array.IndexOf(this.Gear, this.Gear.First(x => x == null))); - } - - public void DeleteGear(int index) { - this.Gear[index] = null; - } - - /// - /// Returns an ItemTile depending on specified place ("hotbar", "items", "accessories" or "gear") - /// and specified index - /// - public ItemTile GetItemTile(string place, int index) { - ItemTile toReturn = null; - - switch (place.ToLower()) { - case "hotbar": toReturn = this.Hotbar[index]; break; - case "items": toReturn = this.Items[index]; break; - case "accessories": toReturn = this.Accessories[index]; break; - case "gear": toReturn = this.Gear[index]; break; - } - return toReturn; - } - - /// - /// Deletes an ItemTile depending on specified place ("hotbar", "items", "accessories" or "gear") - /// and specified index - /// - public void DeleteItemTile(string place, int index) { - switch (place.ToLower()) { - case "hotbar": this.Hotbar[index] = null; break; - case "items": this.Items[index] = null; break; - case "accessories": this.Accessories[index] = null; break; - case "gear": this.Gear[index] = null; break; - } - } - - /// - /// Returns an ItemTile depending on specified place ("hotbar", "items", "accessories" or "gear") - /// and specified index in player's inventory - /// - public static ItemTile GetPlayerItem(string place, int index) { - return Data.Superlayers.Mobs.MI.Player.Inventory.GetItemTile(place, index); - } - } -} diff --git a/Mundus/Service/Mobs/Controllers/MobFighting.cs b/Mundus/Service/Mobs/Controllers/MobFighting.cs deleted file mode 100644 index aa937cd..0000000 --- a/Mundus/Service/Mobs/Controllers/MobFighting.cs +++ /dev/null @@ -1,91 +0,0 @@ -using System.Linq; -using Mundus.Data.Superlayers.Mobs; -using Mundus.Data.Tiles; -using Mundus.Service.Mobs.LandMobs; -using Mundus.Service.Tiles; -using Mundus.Service.Tiles.Items; - -namespace Mundus.Service.Mobs.Controllers { - public static class MobFighting { - /// - /// Returns if for the specified position in the superlayer the payer is in, there exists a mob - /// - /// YPos of target mob - /// XPos of target mob - public static bool ExistsFightTargetForPlayer(int mapYPos, int mapXPos) { - return ExistsFightTargetForMob(MI.Player, mapYPos, mapXPos); - } - - /// - /// Returns if for the specified position in the superlayer the given mob is in, there exists a mob - /// - /// YPos of target mob - /// XPos of target mob - public static bool ExistsFightTargetForMob(MobTile mob, int mapYPos, int mapXPos) { - return mob.CurrSuperLayer.GetMobLayerTile(mapYPos, mapXPos) != null; - } - - - /// - /// The player tries to damage (or kill) mob on the specified map position - /// Note: will fail of the player uses an invalid item - /// - /// Inventory place of the selected item (item will be checked if its a valid tool) - /// Inventory index of the selected item place (item will be checked if its a valid tool) - /// YPos of target mob - /// XPos of target mob - public static void PlayerTryFight(string selPlace, int selIndex, int mapYPos, int mapXPos) { - MobTryFight(MI.Player, selPlace, selIndex, mapYPos, mapXPos); - } - - // 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; - } - - /// - /// The given mob tries to damage (or kill) mob on the specified map position - /// Note: will fail of the given mob uses an invalid item - /// - /// Mob that will fight - /// Inventory place of the selected item (item will be checked if its a valid tool) - /// Inventory index of the selected item place (item will be checked if its a valid tool) - /// YPos of target mob - /// XPos of target mob - public static void 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); - - if (selTool.Class >= targetMob.Defense) { - int damagePoints = 1 + (selTool.Class - targetMob.Defense); - - if (!targetMob.TakeDamage(damagePoints)) { - mob.CurrSuperLayer.SetMobAtPosition(null, mapYPos, mapXPos); - - if (mob.Inventory.Items.Contains(null)) { - mob.Inventory.AppendToItems(targetMob.DroppedUponDeath); - } - - if (mob.GetType() == typeof(Player)) { - LogController.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}) "); - } - } - else if (mob.GetType() == typeof(Player)) { - LogController.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.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"); - } - } - } -} diff --git a/Mundus/Service/Mobs/Controllers/MobMovement.cs b/Mundus/Service/Mobs/Controllers/MobMovement.cs deleted file mode 100644 index a26fc27..0000000 --- a/Mundus/Service/Mobs/Controllers/MobMovement.cs +++ /dev/null @@ -1,146 +0,0 @@ -using System; -using Mundus.Data; -using Mundus.Data.Superlayers.Mobs; -using Mundus.Data.SuperLayers; -using Mundus.Service.Mobs.LandMobs; -using Mundus.Service.SuperLayers; -using Mundus.Service.Tiles; - -namespace Mundus.Service.Mobs.Controllers { - public static class MobMovement { - private static Random rnd = new Random(); - - /// - /// Moves all mobs that have a RndMovementRate of more than one on a random tile - /// in a 3x3 radius (including the tile they are currently on) - /// - public static void MoveRandomlyAllMobs() { - foreach(var superLayer in LI.AllSuperLayers()) - { - for (int y = 0; y < MapSizes.CurrSize; y++) - { - for (int x = 0; x < MapSizes.CurrSize; x++) - { - MobTile mob = superLayer.GetMobLayerTile(y, x); - - if (mob != null) { - // Checks validity of RndMovementRate and descides if a mob will move to another tile - if (mob.RndMovementRate > 0 && rnd.Next(0, mob.RndMovementRate) == 1) - { - 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); - } - } - } - } - } - } - - public static void ChangeMobPosition(MobTile mob, int yPos, int xPos, int mapSize) { - if (InBoundaries(yPos, xPos)) { - if (CanWalkTo(mob, yPos, xPos)) { - ChangeMobPosition(mob, yPos, xPos); - } - else if (mob.GetType() == typeof(Player)) { - LogController.AddMessage($"Cannot walk to Y:{yPos}, X:{xPos}"); - } - } - } - - public static void MovePlayer(int yPos, int xPos, int mapSize) { - ChangeMobPosition(MI.Player, yPos, xPos, mapSize); - } - - private static void ChangeMobPosition(MobTile mob, int yPos, int xPos) { - // Mob is removed from his current superlayer and in the end is added to the new one - // Note: mob could not move, but will still be removed and readded to the superlayer - mob.CurrSuperLayer.RemoveMobFromPosition(mob.YPos, mob.XPos); - - // If mob can go down a layer from a hole - if (mob.CurrSuperLayer.GetGroundLayerTile(yPos, xPos) == null && - HeightController.GetLayerUnderneathMob(mob) != null) - { - if (HeightController.GetLayerUnderneathMob(mob).GetMobLayerTile(yPos, xPos) == null) - { - mob.CurrSuperLayer = HeightController.GetLayerUnderneathMob(mob); - - if (mob.GetType() == typeof(Player)) { - LogController.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}"); - } - } - // If mob can go down a layer from non-solid ground - else if (!mob.CurrSuperLayer.GetGroundLayerTile(yPos, xPos).Solid && - HeightController.GetLayerUnderneathMob(mob) != null) - { - - if (HeightController.GetLayerUnderneathMob(mob).GetMobLayerTile(yPos, xPos) == null) - { - mob.CurrSuperLayer = HeightController.GetLayerUnderneathMob(mob); - - if (mob.GetType() == typeof(Player)) { - LogController.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}"); - } - } - // If mob can climb up - else if (mob.CurrSuperLayer.GetStructureLayerTile(yPos, xPos) != null && - HeightController.GetLayerAboveMob(mob).GetMobLayerTile(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 && - 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) - { - mob.CurrSuperLayer = HeightController.GetLayerAboveMob(mob); - - if (mob.GetType() == typeof(Player)) { - LogController.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 (!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 (HeightController.GetLayerAboveMob(mob) == null && mob.GetType() == typeof(Player)) { - LogController.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"); - } - - mob.YPos = yPos; - mob.XPos = xPos; - mob.CurrSuperLayer.SetMobAtPosition(mob, yPos, 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); - } - - // 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; - } - } -} diff --git a/Mundus/Service/Mobs/Controllers/MobStatsController.cs b/Mundus/Service/Mobs/Controllers/MobStatsController.cs deleted file mode 100644 index c8f37d1..0000000 --- a/Mundus/Service/Mobs/Controllers/MobStatsController.cs +++ /dev/null @@ -1,78 +0,0 @@ -using Gtk; -using Mundus.Data; -using Mundus.Data.Superlayers.Mobs; -using Mundus.Service.SuperLayers; - -namespace Mundus.Service.Mob.Controllers { - public static class MobStatsController { - public static int GetPlayerHealth() { - return MI.Player.Health; - } - - /// - /// Returns the stock_id of the hearth icon that must be used on the given position of the health bar - /// - /// stock_id of hearth icon - /// Health bar index - public static string GetPlayerHearth(int index) { - string stock_id = "empty"; - - int diff = GetPlayerHealth() - index * 4; - if (diff >= 4) stock_id = "hearth_4-4"; - else if (diff == 1) stock_id = "hearth_1-4"; - else if (diff == 2) stock_id = "hearth_2-4"; - else if (diff == 3) stock_id = "hearth_3-4"; - - return stock_id; - } - - public static void DamagePlayer(int damagePoints) { - if (!MI.Player.TakeDamage(damagePoints)) { - //do smth - } - } - - /// - /// Heals the player (unless/until he has full health) - /// - /// Health points to heal with - public static void HealPlayer(int healthPoints) { - MI.Player.Heal(healthPoints); - } - - /// - /// Returns the name of the superlayer the player is curently on - /// - public static string GetPlayerSuperLayerName() { - return MI.Player.CurrSuperLayer.ToString(); - } - - /// - /// Returns the player's horizontal (X) coordinates - /// - /// Player.XPos - public static int GetPlayerXCoord() { - return MI.Player.XPos; - } - - /// - /// Returns the player's vertical (Y) coordinates - /// - /// Player.YPos - public static int GetPlayerYCoord() { - return MI.Player.YPos; - } - - /// - /// Checks if the player has an an empty/non-solid tile directly on the superlayer above him - /// - public static bool ExistsHoleOnTopOfPlayer() { - //There can't be a hole if there isn't a layer above the player - 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; - } - } -} diff --git a/Mundus/Service/Mobs/Controllers/MobTerraforming.cs b/Mundus/Service/Mobs/Controllers/MobTerraforming.cs deleted file mode 100644 index bbbb15a..0000000 --- a/Mundus/Service/Mobs/Controllers/MobTerraforming.cs +++ /dev/null @@ -1,173 +0,0 @@ -using System.Linq; -using Mundus.Data.Superlayers.Mobs; -using Mundus.Data.SuperLayers; -using Mundus.Data.Tiles; -using Mundus.Service.SuperLayers; -using Mundus.Service.Tiles.Items; - -namespace Mundus.Service.Mobs.Controllers { - public static class MobTerraforming { - /// - /// Tries to place a selected structure/ground tile or to mine/dig (destroy) at the selected location - /// - /// Place where the selected item is located ("hotbar", "items", ...) - /// Index of the place where the item is located - public static void PlayerTerraformAt(int mapYPos, int mapXPos, string inventoryPlace, int inventoryIndex) { - var selectedItemType = Inventory.GetPlayerItem(inventoryPlace, inventoryIndex).GetType(); - - // If player can place strucure - if (selectedItemType == typeof(Structure)) { - if (PlayerCanBuildStructureAt(mapYPos, mapXPos)) { - PlayerBuildStructureAt(mapYPos, mapXPos, inventoryPlace, inventoryIndex); - MI.Player.Inventory.DeleteItemTile(inventoryPlace, inventoryIndex); - } - else { - LogController.AddMessage($"Cannot build structure at Y:{mapYPos}, X:{mapXPos}"); - } - - } - // If Player can place ground - else if (selectedItemType == typeof(GroundTile)) { - if (PlayerCanPlaceGroundAt(mapYPos, mapXPos)) { - PlayerPlaceGroundAt(mapYPos, mapXPos, inventoryPlace, inventoryIndex); - MI.Player.Inventory.DeleteItemTile(inventoryPlace, inventoryIndex); - } - else { - LogController.AddMessage($"Cannot place ground at Y:{mapYPos}, X:{mapXPos}"); - } - } - // If player can mine/dig - else if (selectedItemType == typeof(Tool)) { - if (PlayerCanDestroyAt(mapYPos, mapXPos)) { - PlayerDestroyAt(mapYPos, mapXPos, inventoryPlace, inventoryIndex); - } - else { - LogController.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; - } - - private static void PlayerDestroyAt(int mapYPos, int mapXPos, string place, int index) { - 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) { - PlayerTryDestroyGroundAt(mapYPos, mapXPos, selectedTool); - } - // Don't try to destroy structure if there is no structure - else if (MI.Player.CurrSuperLayer.GetStructureLayerTile(mapYPos, mapXPos) != null) { - PlayerTryDestroyStructureAt(mapYPos, mapXPos, selectedTool); - } - } - - private static void PlayerTryDestroyGroundAt(int mapYPos, int mapXPos, Tool shovel) { - var selectedGround = MI.Player.CurrSuperLayer.GetGroundLayerTile(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); - // 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) { - under.RemoveStructureFromPosition(mapYPos, mapXPos); - } - } - - if (MI.Player.Inventory.Items.Contains(null)) { - MI.Player.Inventory.AppendToItems(new GroundTile(selectedGround)); - } - - LogController.AddMessage($"Player destroyed \"{selectedGround.stock_id}\" from layer \"{MI.Player.CurrSuperLayer}\" at Y:{mapYPos}, X:{mapXPos}"); - } - else if (selectedGround.ReqShovelClass > shovel.Class) { - LogController.AddMessage($"Ground \"{selectedGround.stock_id}\" requires minimum shovel class of: {selectedGround.ReqShovelClass}"); - } - else { // selectedGround.ReqSHovelClass < 0 - LogController.AddMessage($"This ground cannot be destroyed."); - } - } - - private static void PlayerTryDestroyStructureAt(int mapYPos, int mapXPos, Tool tool) { - var selStructure = MI.Player.CurrSuperLayer.GetStructureLayerTile(mapYPos, mapXPos); - - if (selStructure.ReqToolType == tool.Type && selStructure.ReqToolClass <= tool.Class) { - int damagePoints = 1 + (tool.Class - selStructure.ReqToolClass); - - // Some structures have a "drop", a specific item that they give upon being damaged. - // Other structures drop themselves (you "pick up" the structure after breaking it). - if (selStructure.GetDrop() != selStructure) { - // The amount of dropped items it adds to inventory is that of the damage points. - // If the structure will "die" (health <= 0) before giving all items, it stops giving items. - for (int i = 0; i < damagePoints && i < selStructure.Health && MI.Player.Inventory.Items.Contains(null); i++) { - MI.Player.Inventory.AppendToItems(new Material((Material)selStructure.GetDrop())); - } - } - else if (MI.Player.Inventory.Items.Contains(null)) { - MI.Player.Inventory.AppendToItems((Structure)selStructure.GetDrop()); - } - - // Damage to the structure is done after adding the dropped item/items. - 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}"); - } - else { - LogController.AddMessage($"Player did {damagePoints} damage to \"{selStructure.stock_id}\" (H:{selStructure.Health})"); - } - } - else if (selStructure.ReqToolType != tool.Type) { - LogController.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}"); - } - } - - // 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; - } - - 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); - - LogController.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; - } - - private static void PlayerBuildStructureAt(int yPos, int xPos, string inventoryPlace, int inventoryIndex) { - Structure toBuild = (Structure)MI.Player.Inventory.GetItemTile(inventoryPlace, inventoryIndex); - - // 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) - { - HeightController.GetLayerUnderneathMob(MI.Player).SetStructureAtPosition(toBuild, yPos, xPos); - - LogController.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); - - LogController.AddMessage($"Set structure \"{toBuild.stock_id}\" on layer \"{MI.Player.CurrSuperLayer}\" at Y:{yPos}, X:{xPos}"); - } - } - } -} diff --git a/Mundus/Service/Mobs/LandMobs/LandMobsPresets.cs b/Mundus/Service/Mobs/LandMobs/LandMobsPresets.cs deleted file mode 100644 index bb3882b..0000000 --- a/Mundus/Service/Mobs/LandMobs/LandMobsPresets.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using Mundus.Data.SuperLayers; -using Mundus.Service.Tiles; -using Mundus.Service.Tiles.ItemPresets; - -namespace Mundus.Service.Mobs.LandMobs { - public static class LandMobsPresets { - /// - /// Returns a new instance of the cow mob tile - /// - public static MobTile GetACow() { - return new MobTile("L_cow", 10, 1, LI.Land, 1, MaterialPresets.GetAGrass()); - } - } -} diff --git a/Mundus/Service/Mobs/LandMobs/Player.cs b/Mundus/Service/Mobs/LandMobs/Player.cs deleted file mode 100644 index d7c8e06..0000000 --- a/Mundus/Service/Mobs/LandMobs/Player.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.Linq; -using Mundus.Data.SuperLayers; -using Mundus.Service.Tiles; -using Mundus.Service.Tiles.Items; - -namespace Mundus.Service.Mobs.LandMobs { - public class Player : MobTile { - /// - /// Note: player has an rndMovementQualifier of -1 and drops first item in the hotbar - /// - public Player(string stock_id, int health, int defence, ISuperLayer currentSuperLayer, int inventorySize) - : base(stock_id, health, defence, currentSuperLayer, inventorySize, null, -1) - { - this.DroppedUponDeath = (Material)this.Inventory.Hotbar[0]; - } - } -} diff --git a/Mundus/Service/Mobs/MobTile.cs b/Mundus/Service/Mobs/MobTile.cs deleted file mode 100644 index 6167a40..0000000 --- a/Mundus/Service/Mobs/MobTile.cs +++ /dev/null @@ -1,60 +0,0 @@ -using System; -using Gtk; -using Mundus.Data; -using Mundus.Data.SuperLayers; -using Mundus.Service.Mobs; -using Mundus.Service.Mobs.Controllers; -using Mundus.Service.Tiles.Items; - -namespace Mundus.Service.Tiles { - public class MobTile : ITile { - public string stock_id { get; private set; } - public Image Texture { get; private set; } - - public ISuperLayer CurrSuperLayer { get; set; } - public int YPos { get; set; } - public int XPos { get; set; } - public int Health { get; private set; } - public int Defense { get; set; } - public Material DroppedUponDeath { get; protected set; } - public Inventory Inventory { get; set; } - - /// - /// Specifies how big the chance of a mob moving (randomly) is. Lower the value, higher the chance for movement. - /// Note: negative values (or 0) means the mob won't move randomly - /// - 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) { - this.stock_id = stock_id; - this.Texture = new Image(stock_id, IconSize.Dnd); - this.Health = health; - this.Defense = defence; - this.CurrSuperLayer = currentSuperLayer; - this.RndMovementRate = rndMovementQualifier; - this.DroppedUponDeath = droppedUponDeath; - this.Inventory = new Inventory(inventorySize); - } - - /// - /// Removes health from structure - /// - /// Whether the mobtile can still be damaged - public bool TakeDamage(int damagePoints) { - this.Health -= damagePoints; - return this.Health > 0; - } - - /// - /// Heals the mobtile (unless/until it has full health (4 * inventorySize)) - /// - /// Health points to heal with - public void Heal(int healthPoints) { - this.Health += healthPoints; - - if (this.Health > MapSizes.CurrSize / 5 * 4) { - this.Health = MapSizes.CurrSize / 5 * 4; - } - } - } -} \ No newline at end of file diff --git a/Mundus/Service/SuperLayers/Generators/LandSuperLayerGenerator.cs b/Mundus/Service/SuperLayers/Generators/LandSuperLayerGenerator.cs index b073fb3..d5412f1 100644 --- a/Mundus/Service/SuperLayers/Generators/LandSuperLayerGenerator.cs +++ b/Mundus/Service/SuperLayers/Generators/LandSuperLayerGenerator.cs @@ -2,9 +2,9 @@ using Mundus.Data; using Mundus.Data.Superlayers.Mobs; using Mundus.Data.SuperLayers; -using Mundus.Service.Mobs.LandMobs; -using Mundus.Service.Tiles; -using Mundus.Service.Tiles.ItemPresets; +using Mundus.Service.Tiles.Mobs.LandMobs; +using Mundus.Service.Tiles.Mobs; +using Mundus.Service.Tiles.Items.Presets; using Mundus.Service.Tiles.Items; namespace Mundus.Service.SuperLayers.Generators { diff --git a/Mundus/Service/SuperLayers/Generators/SkySuperLayerGenerator.cs b/Mundus/Service/SuperLayers/Generators/SkySuperLayerGenerator.cs index 37a9978..4420d06 100644 --- a/Mundus/Service/SuperLayers/Generators/SkySuperLayerGenerator.cs +++ b/Mundus/Service/SuperLayers/Generators/SkySuperLayerGenerator.cs @@ -1,7 +1,7 @@ using System; using Mundus.Data.SuperLayers; -using Mundus.Service.Tiles; -using Mundus.Service.Tiles.ItemPresets; +using Mundus.Service.Tiles.Mobs; +using Mundus.Service.Tiles.Items.Presets; using Mundus.Service.Tiles.Items; namespace Mundus.Service.SuperLayers.Generators { diff --git a/Mundus/Service/SuperLayers/Generators/UndergroundSuperLayerGenerator.cs b/Mundus/Service/SuperLayers/Generators/UndergroundSuperLayerGenerator.cs index cb831ab..31cc38f 100644 --- a/Mundus/Service/SuperLayers/Generators/UndergroundSuperLayerGenerator.cs +++ b/Mundus/Service/SuperLayers/Generators/UndergroundSuperLayerGenerator.cs @@ -1,8 +1,7 @@ using System; -using Mundus.Data.Superlayers.Mobs; using Mundus.Data.SuperLayers; -using Mundus.Service.Tiles; -using Mundus.Service.Tiles.ItemPresets; +using Mundus.Service.Tiles.Mobs; +using Mundus.Service.Tiles.Items.Presets; using Mundus.Service.Tiles.Items; namespace Mundus.Service.SuperLayers.Generators { diff --git a/Mundus/Service/SuperLayers/HeightController.cs b/Mundus/Service/SuperLayers/HeightController.cs index b6d33ba..8a3ab6b 100644 --- a/Mundus/Service/SuperLayers/HeightController.cs +++ b/Mundus/Service/SuperLayers/HeightController.cs @@ -1,5 +1,5 @@ using Mundus.Data.SuperLayers; -using Mundus.Service.Tiles; +using Mundus.Service.Tiles.Mobs; namespace Mundus.Service.SuperLayers { public static class HeightController { diff --git a/Mundus/Service/SwitchItems.cs b/Mundus/Service/SwitchItems.cs deleted file mode 100644 index e44a02b..0000000 --- a/Mundus/Service/SwitchItems.cs +++ /dev/null @@ -1,71 +0,0 @@ -using Mundus.Data.Superlayers.Mobs; -using Mundus.Data.Windows; -using Mundus.Service.Tiles; -using Mundus.Service.Tiles.Items; - -namespace Mundus.Service { - public static class SwitchItems { - private static ItemTile[] origin = null; - private static int oIndex = -1; - - /// - /// Sets the item that will be moved (switched) - /// - /// Name of the inventory location of the item ("hotbar", "items", "accessories" or "gear") - /// Index of the inventory location of the item - public static void SetOrigin(string originName, int originIndex) { - // This method overload only extracts the inventory location as an array - ItemTile[] newOrigin = null; - - switch (originName.ToLower()) { - case "hotbar": newOrigin = MI.Player.Inventory.Hotbar; break; - case "items": newOrigin = MI.Player.Inventory.Items; break; - case "accessories": newOrigin = MI.Player.Inventory.Accessories; break; - case "gear": newOrigin = MI.Player.Inventory.Gear; break; - } - SetOrigin(newOrigin, originIndex); - } - - private static void SetOrigin(ItemTile[] newOrigin, int originIndex) { - origin = newOrigin; - oIndex = originIndex; - WI.SelWin.PrintSelectedItemInfo(newOrigin[originIndex]); - } - - /// - /// Tries to switch the location of the originally selected item (origin) with the currently selected item - /// - /// Name of the inventory location of the currently selected item ("hotbar", "items", "accessories" or "gear") - /// Index of the inventory location of the currently selected item - public static void ReplaceItems(string destination, int destinationIndex) { - ItemTile[] destinationLocation = null; - - switch (destination.ToLower()) { - case "hotbar": destinationLocation = MI.Player.Inventory.Hotbar; break; - case "items": destinationLocation = MI.Player.Inventory.Items; break; - case "accessories": destinationLocation = MI.Player.Inventory.Accessories; break; - case "gear": destinationLocation = MI.Player.Inventory.Gear; break; - } - - var toTransfer = origin[oIndex]; - - if (toTransfer != null) { - // Certain item types can only be placed inside certain inventory places. - if (((toTransfer.GetType() == typeof(Tool) || toTransfer.GetType() == typeof(GroundTile)) && (destination == "hotbar" || destination == "items")) || - ((toTransfer.GetType() == typeof(Material) || toTransfer.GetType() == typeof(Structure)) && (destination == "hotbar" || destination == "items")) || - (toTransfer.GetType() == typeof(Gear) && (destination == "hotbar" || destination == "items" || destination == "accessories" || destination == "gear"))) { - - origin[oIndex] = destinationLocation[destinationIndex]; - destinationLocation[destinationIndex] = toTransfer; - } - } - - origin = null; - oIndex = -1; - } - - public static bool HasOrigin() { - return origin != null && oIndex != -1; - } - } -} diff --git a/Mundus/Service/Tiles/Crafting/CraftingController.cs b/Mundus/Service/Tiles/Crafting/CraftingController.cs new file mode 100644 index 0000000..61bc897 --- /dev/null +++ b/Mundus/Service/Tiles/Crafting/CraftingController.cs @@ -0,0 +1,85 @@ +using System.Collections.Generic; +using System.Linq; +using Mundus.Data.Crafting; +using Mundus.Data.Superlayers.Mobs; +using Mundus.Service.Tiles.Mobs; +using Mundus.Service.Tiles.Items; + +namespace Mundus.Service.Tiles.Crafting { + public static class CraftingController { + private static Dictionary avalableItems; + + /// + /// Returns all recipes that can be executed with the current items in the player inventory (Inventory.Items) + /// + /// All avalable recipies. + public static CraftingRecipe[] GetAvalableRecipes() { + FindAvalableItems(); + + List recipes = new List(); + + foreach (var recipe in RI.AllRecipies) { + if (recipe.HasEnoughItems(avalableItems)) { + recipes.Add(recipe); + } + } + + return recipes.ToArray(); + } + + // Sets avalableItems to all items in the player inventory (Inventory.Items) + private static void FindAvalableItems() { + avalableItems = MI.Player.Inventory.Items.Where(x => x != null) + //Can't use distinct on non primative types, beause they also hold their memory location info (I think). + //This is my way of getting only the "unique" item tiles. + .Select(x => x.stock_id).Distinct().Select(x => MI.Player.Inventory.Items.Where(y => y != null).First(y => y.stock_id == x)) + //For each "unique" item tile (key), get how many there are of it in the player inventory (value) + .Select(x => new KeyValuePair(x, MI.Player.Inventory.Items.Where(y => y != null).Count(i => i.stock_id == x.stock_id))) + .ToDictionary(kvp => kvp.Key, kvp => kvp.Value); + } + + /// + /// Removes items, used for crafting and adds the result item to the inventory + /// + /// CraftingRecipie of the item that will be crafted + public static void CraftItem(CraftingRecipe itemRecipe, MobTile mob) { + // Removes all items that are used to craft the result item + foreach (var itemAndCount in itemRecipe.GetRequiredItemsAndCounts()) { + for(int i = 0, removedItems = 0; i < mob.Inventory.Items.Length && removedItems < itemAndCount.Value; i++) { + if (MI.Player.Inventory.Items[i] != null) { + if (MI.Player.Inventory.Items[i].stock_id == itemAndCount.Key.stock_id) { + MI.Player.Inventory.Items[i] = null; + removedItems++; + } + } + } + } + ItemTile tmp = null; + + // Adds the result item to the inventory (in the correct data type) + if (itemRecipe.ResultItem.GetType() == typeof(Material)) { + tmp = new Material((Material)itemRecipe.ResultItem); + } + if (itemRecipe.ResultItem.GetType() == typeof(Tool)) { + tmp = new Tool((Tool)itemRecipe.ResultItem); + } + if (itemRecipe.ResultItem.GetType() == typeof(Gear)) { + tmp = new Gear((Gear)itemRecipe.ResultItem); + } + if (itemRecipe.ResultItem.GetType() == typeof(Structure)) { + tmp = new Structure((Structure)itemRecipe.ResultItem); + } + MI.Player.Inventory.AppendToItems(tmp); + + Data.Windows.WI.SelWin.PrintInventory(); + } + + /// + /// Does CraftItem method for the player + /// + /// CraftingRecipie of the item that will be crafted + public static void CraftItemPlayer(CraftingRecipe itemRecipe) { + CraftItem(itemRecipe, MI.Player); + } + } +} \ No newline at end of file diff --git a/Mundus/Service/Tiles/Crafting/CraftingRecipe.cs b/Mundus/Service/Tiles/Crafting/CraftingRecipe.cs new file mode 100644 index 0000000..af7ec7e --- /dev/null +++ b/Mundus/Service/Tiles/Crafting/CraftingRecipe.cs @@ -0,0 +1,163 @@ +using System.Collections.Generic; +using System.Linq; +using Mundus.Service.Tiles.Items; + +namespace Mundus.Service.Tiles.Crafting { + public class CraftingRecipe { + /// + /// Item that will be added to the inventory after crafting + /// + /// The result item. + public ItemTile ResultItem { get; private set; } + + /// + /// Required amount of the first item + /// + public int Count1 { get; private set; } + /// + /// Required first item + /// + public ItemTile ReqItem1 { get; private set; } + + /// + /// Required amount of the second item + /// + public int Count2 { get; private set; } + /// + /// Required second item + /// + public ItemTile ReqItem2 { get; private set; } + + /// + /// Required amount of the third item + /// + public int Count3 { get; private set; } + /// + /// Required third item + /// + public ItemTile ReqItem3 { get; private set; } + + /// + /// Required amount of the fourth item + /// + public int Count4 { get; private set; } + /// + /// Required fourth item + /// + public ItemTile ReqItem4 { get; private set; } + + /// + /// Required amount of the fifth item + /// + public int Count5 { get; private set; } + /// + /// Required fifth item + /// + public ItemTile ReqItem5 { get; private set; } + + public CraftingRecipe(ItemTile resultItem, int count1, ItemTile reqItem1) :this(resultItem, count1, reqItem1, 0, null, 0, null, 0, null, 0, null) + { } + + public CraftingRecipe(ItemTile resultItem, int count1, ItemTile reqItem1, int count2, ItemTile reqItem2) : this(resultItem, count1, reqItem1, count2, reqItem2, 0, null, 0, null, 0, null) + { } + + public CraftingRecipe(ItemTile resultItem, int count1, ItemTile reqItem1, int count2, ItemTile reqItem2, int count3, ItemTile reqItem3) : this(resultItem, count1, reqItem1, count2, reqItem2, count3, reqItem3, 0, null, 0, null) + { } + + public CraftingRecipe(ItemTile resultItem, int count1, ItemTile reqItem1, int count2, ItemTile reqItem2, int count3, ItemTile reqItem3, int count4, ItemTile reqItem4) : this(resultItem, count1, reqItem1, count2, reqItem2, count3, reqItem3, count4, reqItem4, 0, null) + { } + + public CraftingRecipe(ItemTile resultItem, int count1, ItemTile reqItem1, int count2, ItemTile reqItem2, int count3, ItemTile reqItem3, int count4, ItemTile reqItem4, int count5, ItemTile reqItem5) { + this.ResultItem = resultItem; + + this.Count1 = count1; + this.ReqItem1 = reqItem1; + + this.Count2 = count2; + this.ReqItem2 = reqItem2; + + this.Count3 = count3; + this.ReqItem3 = reqItem3; + + this.Count4 = count4; + this.ReqItem4 = reqItem4; + + this.Count5 = count5; + this.ReqItem5 = reqItem5; + } + + //ugly af, but will rewrite when I imntegrade data bases + /// + /// Checks if the parameter has enough of every requried item + /// + /// trueIf has enoughfalseotherwise + /// Dictionary that has the items and their respective amounts (that will be checked) + public bool HasEnoughItems(Dictionary itemsAndCounts) { + bool hasEnough = true; + + if (ReqItem1 != null && hasEnough) { + if (itemsAndCounts.Keys.Any(k => k.stock_id == ReqItem1.stock_id)) { + hasEnough = itemsAndCounts.First(x => x.Key.stock_id == ReqItem1.stock_id).Value >= Count1; + } + else hasEnough = false; + } + + if (ReqItem2 != null && hasEnough) { + if (itemsAndCounts.Keys.Any(k => k.stock_id == ReqItem2.stock_id)) { + hasEnough = itemsAndCounts.First(x => x.Key.stock_id == ReqItem2.stock_id).Value >= Count2; + } + else hasEnough = false; + } + + if (ReqItem3 != null && hasEnough) { + if (itemsAndCounts.Keys.Any(k => k.stock_id == ReqItem3.stock_id)) { + hasEnough = itemsAndCounts.First(x => x.Key.stock_id == ReqItem3.stock_id).Value >= Count3; + } + else hasEnough = false; + } + + if (ReqItem4 != null && hasEnough) { + if (itemsAndCounts.Keys.Any(k => k.stock_id == ReqItem4.stock_id)) { + hasEnough = itemsAndCounts.First(x => x.Key.stock_id == ReqItem4.stock_id).Value >= Count4; + } + else hasEnough = false; + } + + if (ReqItem5 != null && hasEnough) { + if (itemsAndCounts.Keys.Any(k => k.stock_id == ReqItem5.stock_id)) { + hasEnough = itemsAndCounts.First(x => x.Key.stock_id == ReqItem5.stock_id).Value >= Count5; + } + else hasEnough = false; + } + + return hasEnough; + } + + /// + /// Checks if the given item (and amount) is enough for the recipe + /// + public bool HasEnoughOfItem(ItemTile item, int count) { + if (ReqItem1.stock_id == item.stock_id) return count >= Count1; + if (ReqItem2.stock_id == item.stock_id) return count >= Count2; + if (ReqItem3.stock_id == item.stock_id) return count >= Count3; + if (ReqItem4.stock_id == item.stock_id) return count >= Count4; + if (ReqItem5.stock_id == item.stock_id) return count >= Count5; + return false; + } + + /// + /// Returns a dictionary of every required item and their respective amount + /// + public Dictionary GetRequiredItemsAndCounts() { + Dictionary req = new Dictionary(); + + req.Add(ReqItem1, Count1); + if (ReqItem2 != null) req.Add(ReqItem2, Count2); + if (ReqItem3 != null) req.Add(ReqItem3, Count3); + if (ReqItem4 != null) req.Add(ReqItem4, Count4); + if (ReqItem5 != null) req.Add(ReqItem5, Count5); + + return req; + } + } +} diff --git a/Mundus/Service/Tiles/ItemPresets/GroundPresets.cs b/Mundus/Service/Tiles/ItemPresets/GroundPresets.cs deleted file mode 100644 index 76e5d01..0000000 --- a/Mundus/Service/Tiles/ItemPresets/GroundPresets.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; -using Mundus.Service.Tiles.Items; -using Mundus.Service.Tiles.ItemPresets; - -namespace Mundus.Service.Tiles.ItemPresets { - public static class GroundPresets { - /// - /// Returns a new instance of the sky ground tile - /// - public static GroundTile GetASSky() { - return new GroundTile("S_sky", -1, false); - } - - /// - /// Returns a new instance of the land grass ground tile - /// - public static GroundTile GetALGrass() { - return new GroundTile("L_grass", 1); - } - - /// - /// Returns a new instance of the underground roche ground tile - /// - public static GroundTile GetAURoche() { - return new GroundTile("U_roche", 10); - } - } -} diff --git a/Mundus/Service/Tiles/ItemPresets/MaterialPresets.cs b/Mundus/Service/Tiles/ItemPresets/MaterialPresets.cs deleted file mode 100644 index e55fbf1..0000000 --- a/Mundus/Service/Tiles/ItemPresets/MaterialPresets.cs +++ /dev/null @@ -1,34 +0,0 @@ -using System; -using Mundus.Service.Tiles.Items; - -namespace Mundus.Service.Tiles.ItemPresets { - public static class MaterialPresets { - /// - /// Returns a new instance of the land rock material tile - /// - public static Material GetALandRock() { - return new Material("L_rock"); - } - - /// - /// Returns a new instance of the stick material tile - /// - public static Material GetAStick() { - return new Material("L_stick"); - } - - /// - /// (TEMPORARY) - /// - public static Material GetAGrass() { - return new Material("L_grass"); - } - - /// - /// (TEMPORARY) - /// - public static Material GetAStone() { - return new Material("U_stone"); - } - } -} diff --git a/Mundus/Service/Tiles/ItemPresets/StructurePresets.cs b/Mundus/Service/Tiles/ItemPresets/StructurePresets.cs deleted file mode 100644 index 5a9a739..0000000 --- a/Mundus/Service/Tiles/ItemPresets/StructurePresets.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using Mundus.Data.Tiles; -using Mundus.Service.Tiles.Items; - -namespace Mundus.Service.Tiles.ItemPresets { - public static class StructurePresets { - /// - /// Returns a new instance of the land boulder structure - /// - public static Structure GetALBoulder() { - return new Structure("L_boulder", "L_boulder_inventory", 7, ToolTypes.Pickaxe, 1, false, false, MaterialPresets.GetALandRock()); - } - - /// - /// Returns a new instance of the land tree structure - /// - public static Structure GetALTree() { - return new Structure("L_tree", "L_tree_inventory", 5, ToolTypes.Axe, 1, false, false, MaterialPresets.GetAStick()); - } - - /// - /// Returns a new instance of the underground rock structure - /// - public static Structure GetAURock() { - return new Structure("U_rock", "U_rock", 10, ToolTypes.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); - } - } -} diff --git a/Mundus/Service/Tiles/ItemPresets/ToolPresets.cs b/Mundus/Service/Tiles/ItemPresets/ToolPresets.cs deleted file mode 100644 index af9abfe..0000000 --- a/Mundus/Service/Tiles/ItemPresets/ToolPresets.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using Mundus.Data.Tiles; -using Mundus.Service.Tiles.Items; - -namespace Mundus.Service.Tiles.ItemPresets { - public static class ToolPresets { - public static Tool GetAWoodenPickaxe() { - return new Tool("wooden_pickaxe", ToolTypes.Pickaxe, 1); - } - - public static Tool GetAWoodenAxe() { - return new Tool("wooden_axe", ToolTypes.Axe, 1); - } - - public static Tool GetAWoodenShovel() { - return new Tool("wooden_shovel", ToolTypes.Shovel, 1); - } - - public static Tool GetAWoodenLongsword() { - return new Tool("wooden_longsword", ToolTypes.Sword, 2); - } - - public static Tool GetARockPickaxe() { - return new Tool("rock_pickaxe", ToolTypes.Pickaxe, 2); - } - - public static Tool GetARockAxe() { - return new Tool("rock_axe", ToolTypes.Axe, 2); - } - - public static Tool GetARockShovel() { - return new Tool("rock_shovel", ToolTypes.Shovel, 2); - } - - public static Tool GetARockLongsword() { - return new Tool("rock_longsword", ToolTypes.Sword, 4); - } - } -} diff --git a/Mundus/Service/Tiles/Items/Presets/GroundPresets.cs b/Mundus/Service/Tiles/Items/Presets/GroundPresets.cs new file mode 100644 index 0000000..5d280eb --- /dev/null +++ b/Mundus/Service/Tiles/Items/Presets/GroundPresets.cs @@ -0,0 +1,24 @@ +namespace Mundus.Service.Tiles.Items.Presets { + public static class GroundPresets { + /// + /// Returns a new instance of the sky ground tile + /// + public static GroundTile GetASSky() { + return new GroundTile("S_sky", -1, false); + } + + /// + /// Returns a new instance of the land grass ground tile + /// + public static GroundTile GetALGrass() { + return new GroundTile("L_grass", 1); + } + + /// + /// Returns a new instance of the underground roche ground tile + /// + public static GroundTile GetAURoche() { + return new GroundTile("U_roche", 10); + } + } +} diff --git a/Mundus/Service/Tiles/Items/Presets/MaterialPresets.cs b/Mundus/Service/Tiles/Items/Presets/MaterialPresets.cs new file mode 100644 index 0000000..24e2597 --- /dev/null +++ b/Mundus/Service/Tiles/Items/Presets/MaterialPresets.cs @@ -0,0 +1,31 @@ +namespace Mundus.Service.Tiles.Items.Presets { + public static class MaterialPresets { + /// + /// Returns a new instance of the land rock material tile + /// + public static Material GetALandRock() { + return new Material("L_rock"); + } + + /// + /// Returns a new instance of the stick material tile + /// + public static Material GetAStick() { + return new Material("L_stick"); + } + + /// + /// (TEMPORARY) + /// + public static Material GetAGrass() { + return new Material("L_grass"); + } + + /// + /// (TEMPORARY) + /// + public static Material GetAStone() { + return new Material("U_stone"); + } + } +} diff --git a/Mundus/Service/Tiles/Items/Presets/StructurePresets.cs b/Mundus/Service/Tiles/Items/Presets/StructurePresets.cs new file mode 100644 index 0000000..7736005 --- /dev/null +++ b/Mundus/Service/Tiles/Items/Presets/StructurePresets.cs @@ -0,0 +1,30 @@ +using Mundus.Data.Tiles; + +namespace Mundus.Service.Tiles.Items.Presets { + public static class StructurePresets { + /// + /// Returns a new instance of the land boulder structure + /// + public static Structure GetALBoulder() { + return new Structure("L_boulder", "L_boulder_inventory", 7, ToolTypes.Pickaxe, 1, false, false, MaterialPresets.GetALandRock()); + } + + /// + /// Returns a new instance of the land tree structure + /// + public static Structure GetALTree() { + return new Structure("L_tree", "L_tree_inventory", 5, ToolTypes.Axe, 1, false, false, MaterialPresets.GetAStick()); + } + + /// + /// Returns a new instance of the underground rock structure + /// + public static Structure GetAURock() { + return new Structure("U_rock", "U_rock", 10, ToolTypes.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); + } + } +} diff --git a/Mundus/Service/Tiles/Items/Presets/ToolPresets.cs b/Mundus/Service/Tiles/Items/Presets/ToolPresets.cs new file mode 100644 index 0000000..d18f089 --- /dev/null +++ b/Mundus/Service/Tiles/Items/Presets/ToolPresets.cs @@ -0,0 +1,37 @@ +using Mundus.Data.Tiles; + +namespace Mundus.Service.Tiles.Items.Presets { + public static class ToolPresets { + public static Tool GetAWoodenPickaxe() { + return new Tool("wooden_pickaxe", ToolTypes.Pickaxe, 1); + } + + public static Tool GetAWoodenAxe() { + return new Tool("wooden_axe", ToolTypes.Axe, 1); + } + + public static Tool GetAWoodenShovel() { + return new Tool("wooden_shovel", ToolTypes.Shovel, 1); + } + + public static Tool GetAWoodenLongsword() { + return new Tool("wooden_longsword", ToolTypes.Sword, 2); + } + + public static Tool GetARockPickaxe() { + return new Tool("rock_pickaxe", ToolTypes.Pickaxe, 2); + } + + public static Tool GetARockAxe() { + return new Tool("rock_axe", ToolTypes.Axe, 2); + } + + public static Tool GetARockShovel() { + return new Tool("rock_shovel", ToolTypes.Shovel, 2); + } + + public static Tool GetARockLongsword() { + return new Tool("rock_longsword", ToolTypes.Sword, 4); + } + } +} diff --git a/Mundus/Service/Tiles/Items/SwitchItems.cs b/Mundus/Service/Tiles/Items/SwitchItems.cs new file mode 100644 index 0000000..ef65a62 --- /dev/null +++ b/Mundus/Service/Tiles/Items/SwitchItems.cs @@ -0,0 +1,69 @@ +using Mundus.Data.Superlayers.Mobs; +using Mundus.Data.Windows; + +namespace Mundus.Service.Tiles.Items { + public static class SwitchItems { + private static ItemTile[] origin = null; + private static int oIndex = -1; + + /// + /// Sets the item that will be moved (switched) + /// + /// Name of the inventory location of the item ("hotbar", "items", "accessories" or "gear") + /// Index of the inventory location of the item + public static void SetOrigin(string originName, int originIndex) { + // This method overload only extracts the inventory location as an array + ItemTile[] newOrigin = null; + + switch (originName.ToLower()) { + case "hotbar": newOrigin = MI.Player.Inventory.Hotbar; break; + case "items": newOrigin = MI.Player.Inventory.Items; break; + case "accessories": newOrigin = MI.Player.Inventory.Accessories; break; + case "gear": newOrigin = MI.Player.Inventory.Gear; break; + } + SetOrigin(newOrigin, originIndex); + } + + private static void SetOrigin(ItemTile[] newOrigin, int originIndex) { + origin = newOrigin; + oIndex = originIndex; + WI.SelWin.PrintSelectedItemInfo(newOrigin[originIndex]); + } + + /// + /// Tries to switch the location of the originally selected item (origin) with the currently selected item + /// + /// Name of the inventory location of the currently selected item ("hotbar", "items", "accessories" or "gear") + /// Index of the inventory location of the currently selected item + public static void ReplaceItems(string destination, int destinationIndex) { + ItemTile[] destinationLocation = null; + + switch (destination.ToLower()) { + case "hotbar": destinationLocation = MI.Player.Inventory.Hotbar; break; + case "items": destinationLocation = MI.Player.Inventory.Items; break; + case "accessories": destinationLocation = MI.Player.Inventory.Accessories; break; + case "gear": destinationLocation = MI.Player.Inventory.Gear; break; + } + + var toTransfer = origin[oIndex]; + + if (toTransfer != null) { + // Certain item types can only be placed inside certain inventory places. + if (((toTransfer.GetType() == typeof(Tool) || toTransfer.GetType() == typeof(GroundTile)) && (destination == "hotbar" || destination == "items")) || + ((toTransfer.GetType() == typeof(Material) || toTransfer.GetType() == typeof(Structure)) && (destination == "hotbar" || destination == "items")) || + (toTransfer.GetType() == typeof(Gear) && (destination == "hotbar" || destination == "items" || destination == "accessories" || destination == "gear"))) { + + origin[oIndex] = destinationLocation[destinationIndex]; + destinationLocation[destinationIndex] = toTransfer; + } + } + + origin = null; + oIndex = -1; + } + + public static bool HasOrigin() { + return origin != null && oIndex != -1; + } + } +} diff --git a/Mundus/Service/Tiles/Mobs/Controllers/MobFighting.cs b/Mundus/Service/Tiles/Mobs/Controllers/MobFighting.cs new file mode 100644 index 0000000..f5ea123 --- /dev/null +++ b/Mundus/Service/Tiles/Mobs/Controllers/MobFighting.cs @@ -0,0 +1,90 @@ +using System.Linq; +using Mundus.Data.Superlayers.Mobs; +using Mundus.Data.Tiles; +using Mundus.Service.Tiles.Items; +using Mundus.Service.Tiles.Mobs.LandMobs; + +namespace Mundus.Service.Tiles.Mobs.Controllers { + public static class MobFighting { + /// + /// Returns if for the specified position in the superlayer the payer is in, there exists a mob + /// + /// YPos of target mob + /// XPos of target mob + public static bool ExistsFightTargetForPlayer(int mapYPos, int mapXPos) { + return ExistsFightTargetForMob(MI.Player, mapYPos, mapXPos); + } + + /// + /// Returns if for the specified position in the superlayer the given mob is in, there exists a mob + /// + /// YPos of target mob + /// XPos of target mob + public static bool ExistsFightTargetForMob(MobTile mob, int mapYPos, int mapXPos) { + return mob.CurrSuperLayer.GetMobLayerTile(mapYPos, mapXPos) != null; + } + + + /// + /// The player tries to damage (or kill) mob on the specified map position + /// Note: will fail of the player uses an invalid item + /// + /// Inventory place of the selected item (item will be checked if its a valid tool) + /// Inventory index of the selected item place (item will be checked if its a valid tool) + /// YPos of target mob + /// XPos of target mob + public static void PlayerTryFight(string selPlace, int selIndex, int mapYPos, int mapXPos) { + MobTryFight(MI.Player, selPlace, selIndex, mapYPos, mapXPos); + } + + // 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; + } + + /// + /// The given mob tries to damage (or kill) mob on the specified map position + /// Note: will fail of the given mob uses an invalid item + /// + /// Mob that will fight + /// Inventory place of the selected item (item will be checked if its a valid tool) + /// Inventory index of the selected item place (item will be checked if its a valid tool) + /// YPos of target mob + /// XPos of target mob + public static void 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); + + if (selTool.Class >= targetMob.Defense) { + int damagePoints = 1 + (selTool.Class - targetMob.Defense); + + if (!targetMob.TakeDamage(damagePoints)) { + mob.CurrSuperLayer.SetMobAtPosition(null, mapYPos, mapXPos); + + if (mob.Inventory.Items.Contains(null)) { + mob.Inventory.AppendToItems(targetMob.DroppedUponDeath); + } + + if (mob.GetType() == typeof(Player)) { + LogController.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}) "); + } + } + else if (mob.GetType() == typeof(Player)) { + LogController.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.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"); + } + } + } +} diff --git a/Mundus/Service/Tiles/Mobs/Controllers/MobMovement.cs b/Mundus/Service/Tiles/Mobs/Controllers/MobMovement.cs new file mode 100644 index 0000000..1a92e51 --- /dev/null +++ b/Mundus/Service/Tiles/Mobs/Controllers/MobMovement.cs @@ -0,0 +1,146 @@ +using System; +using Mundus.Data; +using Mundus.Data.Superlayers.Mobs; +using Mundus.Data.SuperLayers; +using Mundus.Service.SuperLayers; +using Mundus.Service.Tiles.Mobs; +using Mundus.Service.Tiles.Mobs.LandMobs; + +namespace Mundus.Service.Tiles.Mobs.Controllers { + public static class MobMovement { + private static Random rnd = new Random(); + + /// + /// Moves all mobs that have a RndMovementRate of more than one on a random tile + /// in a 3x3 radius (including the tile they are currently on) + /// + public static void MoveRandomlyAllMobs() { + foreach(var superLayer in LI.AllSuperLayers()) + { + for (int y = 0; y < MapSizes.CurrSize; y++) + { + for (int x = 0; x < MapSizes.CurrSize; x++) + { + MobTile mob = superLayer.GetMobLayerTile(y, x); + + if (mob != null) { + // Checks validity of RndMovementRate and descides if a mob will move to another tile + if (mob.RndMovementRate > 0 && rnd.Next(0, mob.RndMovementRate) == 1) + { + 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); + } + } + } + } + } + } + + public static void ChangeMobPosition(MobTile mob, int yPos, int xPos, int mapSize) { + if (InBoundaries(yPos, xPos)) { + if (CanWalkTo(mob, yPos, xPos)) { + ChangeMobPosition(mob, yPos, xPos); + } + else if (mob.GetType() == typeof(Player)) { + LogController.AddMessage($"Cannot walk to Y:{yPos}, X:{xPos}"); + } + } + } + + public static void MovePlayer(int yPos, int xPos, int mapSize) { + ChangeMobPosition(MI.Player, yPos, xPos, mapSize); + } + + private static void ChangeMobPosition(MobTile mob, int yPos, int xPos) { + // Mob is removed from his current superlayer and in the end is added to the new one + // Note: mob could not move, but will still be removed and readded to the superlayer + mob.CurrSuperLayer.RemoveMobFromPosition(mob.YPos, mob.XPos); + + // If mob can go down a layer from a hole + if (mob.CurrSuperLayer.GetGroundLayerTile(yPos, xPos) == null && + HeightController.GetLayerUnderneathMob(mob) != null) + { + if (HeightController.GetLayerUnderneathMob(mob).GetMobLayerTile(yPos, xPos) == null) + { + mob.CurrSuperLayer = HeightController.GetLayerUnderneathMob(mob); + + if (mob.GetType() == typeof(Player)) { + LogController.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}"); + } + } + // If mob can go down a layer from non-solid ground + else if (!mob.CurrSuperLayer.GetGroundLayerTile(yPos, xPos).Solid && + HeightController.GetLayerUnderneathMob(mob) != null) + { + + if (HeightController.GetLayerUnderneathMob(mob).GetMobLayerTile(yPos, xPos) == null) + { + mob.CurrSuperLayer = HeightController.GetLayerUnderneathMob(mob); + + if (mob.GetType() == typeof(Player)) { + LogController.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}"); + } + } + // If mob can climb up + else if (mob.CurrSuperLayer.GetStructureLayerTile(yPos, xPos) != null && + HeightController.GetLayerAboveMob(mob).GetMobLayerTile(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 && + 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) + { + mob.CurrSuperLayer = HeightController.GetLayerAboveMob(mob); + + if (mob.GetType() == typeof(Player)) { + LogController.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 (!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 (HeightController.GetLayerAboveMob(mob) == null && mob.GetType() == typeof(Player)) { + LogController.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"); + } + + mob.YPos = yPos; + mob.XPos = xPos; + mob.CurrSuperLayer.SetMobAtPosition(mob, yPos, 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); + } + + // 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; + } + } +} diff --git a/Mundus/Service/Tiles/Mobs/Controllers/MobStatsController.cs b/Mundus/Service/Tiles/Mobs/Controllers/MobStatsController.cs new file mode 100644 index 0000000..6a47ca2 --- /dev/null +++ b/Mundus/Service/Tiles/Mobs/Controllers/MobStatsController.cs @@ -0,0 +1,78 @@ +using Gtk; +using Mundus.Data; +using Mundus.Data.Superlayers.Mobs; +using Mundus.Service.SuperLayers; + +namespace Mundus.Service.Tiles.Mobs.Controllers { + public static class MobStatsController { + public static int GetPlayerHealth() { + return MI.Player.Health; + } + + /// + /// Returns the stock_id of the hearth icon that must be used on the given position of the health bar + /// + /// stock_id of hearth icon + /// Health bar index + public static string GetPlayerHearth(int index) { + string stock_id = "empty"; + + int diff = GetPlayerHealth() - index * 4; + if (diff >= 4) stock_id = "hearth_4-4"; + else if (diff == 1) stock_id = "hearth_1-4"; + else if (diff == 2) stock_id = "hearth_2-4"; + else if (diff == 3) stock_id = "hearth_3-4"; + + return stock_id; + } + + public static void DamagePlayer(int damagePoints) { + if (!MI.Player.TakeDamage(damagePoints)) { + //do smth + } + } + + /// + /// Heals the player (unless/until he has full health) + /// + /// Health points to heal with + public static void HealPlayer(int healthPoints) { + MI.Player.Heal(healthPoints); + } + + /// + /// Returns the name of the superlayer the player is curently on + /// + public static string GetPlayerSuperLayerName() { + return MI.Player.CurrSuperLayer.ToString(); + } + + /// + /// Returns the player's horizontal (X) coordinates + /// + /// Player.XPos + public static int GetPlayerXCoord() { + return MI.Player.XPos; + } + + /// + /// Returns the player's vertical (Y) coordinates + /// + /// Player.YPos + public static int GetPlayerYCoord() { + return MI.Player.YPos; + } + + /// + /// Checks if the player has an an empty/non-solid tile directly on the superlayer above him + /// + public static bool ExistsHoleOnTopOfPlayer() { + //There can't be a hole if there isn't a layer above the player + 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; + } + } +} diff --git a/Mundus/Service/Tiles/Mobs/Controllers/MobTerraforming.cs b/Mundus/Service/Tiles/Mobs/Controllers/MobTerraforming.cs new file mode 100644 index 0000000..fc2ea32 --- /dev/null +++ b/Mundus/Service/Tiles/Mobs/Controllers/MobTerraforming.cs @@ -0,0 +1,173 @@ +using System.Linq; +using Mundus.Data.Superlayers.Mobs; +using Mundus.Data.SuperLayers; +using Mundus.Data.Tiles; +using Mundus.Service.SuperLayers; +using Mundus.Service.Tiles.Items; + +namespace Mundus.Service.Tiles.Mobs.Controllers { + public static class MobTerraforming { + /// + /// Tries to place a selected structure/ground tile or to mine/dig (destroy) at the selected location + /// + /// Place where the selected item is located ("hotbar", "items", ...) + /// Index of the place where the item is located + public static void PlayerTerraformAt(int mapYPos, int mapXPos, string inventoryPlace, int inventoryIndex) { + var selectedItemType = Inventory.GetPlayerItem(inventoryPlace, inventoryIndex).GetType(); + + // If player can place strucure + if (selectedItemType == typeof(Structure)) { + if (PlayerCanBuildStructureAt(mapYPos, mapXPos)) { + PlayerBuildStructureAt(mapYPos, mapXPos, inventoryPlace, inventoryIndex); + MI.Player.Inventory.DeleteItemTile(inventoryPlace, inventoryIndex); + } + else { + LogController.AddMessage($"Cannot build structure at Y:{mapYPos}, X:{mapXPos}"); + } + + } + // If Player can place ground + else if (selectedItemType == typeof(GroundTile)) { + if (PlayerCanPlaceGroundAt(mapYPos, mapXPos)) { + PlayerPlaceGroundAt(mapYPos, mapXPos, inventoryPlace, inventoryIndex); + MI.Player.Inventory.DeleteItemTile(inventoryPlace, inventoryIndex); + } + else { + LogController.AddMessage($"Cannot place ground at Y:{mapYPos}, X:{mapXPos}"); + } + } + // If player can mine/dig + else if (selectedItemType == typeof(Tool)) { + if (PlayerCanDestroyAt(mapYPos, mapXPos)) { + PlayerDestroyAt(mapYPos, mapXPos, inventoryPlace, inventoryIndex); + } + else { + LogController.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; + } + + private static void PlayerDestroyAt(int mapYPos, int mapXPos, string place, int index) { + 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) { + PlayerTryDestroyGroundAt(mapYPos, mapXPos, selectedTool); + } + // Don't try to destroy structure if there is no structure + else if (MI.Player.CurrSuperLayer.GetStructureLayerTile(mapYPos, mapXPos) != null) { + PlayerTryDestroyStructureAt(mapYPos, mapXPos, selectedTool); + } + } + + private static void PlayerTryDestroyGroundAt(int mapYPos, int mapXPos, Tool shovel) { + var selectedGround = MI.Player.CurrSuperLayer.GetGroundLayerTile(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); + // 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) { + under.RemoveStructureFromPosition(mapYPos, mapXPos); + } + } + + if (MI.Player.Inventory.Items.Contains(null)) { + MI.Player.Inventory.AppendToItems(new GroundTile(selectedGround)); + } + + LogController.AddMessage($"Player destroyed \"{selectedGround.stock_id}\" from layer \"{MI.Player.CurrSuperLayer}\" at Y:{mapYPos}, X:{mapXPos}"); + } + else if (selectedGround.ReqShovelClass > shovel.Class) { + LogController.AddMessage($"Ground \"{selectedGround.stock_id}\" requires minimum shovel class of: {selectedGround.ReqShovelClass}"); + } + else { // selectedGround.ReqSHovelClass < 0 + LogController.AddMessage($"This ground cannot be destroyed."); + } + } + + private static void PlayerTryDestroyStructureAt(int mapYPos, int mapXPos, Tool tool) { + var selStructure = MI.Player.CurrSuperLayer.GetStructureLayerTile(mapYPos, mapXPos); + + if (selStructure.ReqToolType == tool.Type && selStructure.ReqToolClass <= tool.Class) { + int damagePoints = 1 + (tool.Class - selStructure.ReqToolClass); + + // Some structures have a "drop", a specific item that they give upon being damaged. + // Other structures drop themselves (you "pick up" the structure after breaking it). + if (selStructure.GetDrop() != selStructure) { + // The amount of dropped items it adds to inventory is that of the damage points. + // If the structure will "die" (health <= 0) before giving all items, it stops giving items. + for (int i = 0; i < damagePoints && i < selStructure.Health && MI.Player.Inventory.Items.Contains(null); i++) { + MI.Player.Inventory.AppendToItems(new Material((Material)selStructure.GetDrop())); + } + } + else if (MI.Player.Inventory.Items.Contains(null)) { + MI.Player.Inventory.AppendToItems((Structure)selStructure.GetDrop()); + } + + // Damage to the structure is done after adding the dropped item/items. + 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}"); + } + else { + LogController.AddMessage($"Player did {damagePoints} damage to \"{selStructure.stock_id}\" (H:{selStructure.Health})"); + } + } + else if (selStructure.ReqToolType != tool.Type) { + LogController.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}"); + } + } + + // 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; + } + + 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); + + LogController.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; + } + + private static void PlayerBuildStructureAt(int yPos, int xPos, string inventoryPlace, int inventoryIndex) { + Structure toBuild = (Structure)MI.Player.Inventory.GetItemTile(inventoryPlace, inventoryIndex); + + // 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) + { + HeightController.GetLayerUnderneathMob(MI.Player).SetStructureAtPosition(toBuild, yPos, xPos); + + LogController.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); + + LogController.AddMessage($"Set structure \"{toBuild.stock_id}\" on layer \"{MI.Player.CurrSuperLayer}\" at Y:{yPos}, X:{xPos}"); + } + } + } +} diff --git a/Mundus/Service/Tiles/Mobs/Inventory.cs b/Mundus/Service/Tiles/Mobs/Inventory.cs new file mode 100644 index 0000000..58e1767 --- /dev/null +++ b/Mundus/Service/Tiles/Mobs/Inventory.cs @@ -0,0 +1,120 @@ +using Mundus.Service.Tiles.Items; +using System; +using System.Linq; + +namespace Mundus.Service.Tiles.Mobs { + public class Inventory { + /// + /// Has a size of "Screen and Inventory" and can hold Tools, Materials, Structures and Gear + /// + public ItemTile[] Hotbar { get; set; } + /// + /// Has a size of the "Screen and Inventory" squared and can hold Tools, Materials, Structures and Gear + /// + public ItemTile[] Items { get; set; } + /// + /// Has a size of double the "Screen and Inventory" and can only hold Gear + /// + public Gear[] Accessories { get; set; } + /// + /// Has a size of "Screen and Inventory" and can only hold Gear + /// + public Gear[] Gear { get; set; } + + public Inventory(int screenInvSize) { + this.SetSizes(screenInvSize); + } + + public void SetSizes(int screenInvSize) { + this.Hotbar = new ItemTile[screenInvSize]; + this.Items = new ItemTile[screenInvSize * screenInvSize]; + this.Accessories = new Gear[screenInvSize * 2]; + this.Gear = new Gear[screenInvSize]; + } + + public void AppendToHotbar(ItemTile itemTile) { + this.AddToHotbar(itemTile, Array.IndexOf(this.Hotbar, this.Hotbar.First(x => x == null))); + } + + public void AddToHotbar(ItemTile itemTile, int index) { + this.Hotbar[index] = itemTile; + } + + public void DeleteFromHotbar(int index) { + this.Hotbar[index] = null; + } + + public void AppendToItems(ItemTile itemTile) { + this.AddToItems(itemTile, Array.IndexOf(this.Items, this.Items.First(x => x == null))); + } + + public void AddToItems(ItemTile itemTile, int index) { + this.Items[index] = itemTile; + } + + public void DeleteFromItems(int index) { + this.Items[index] = null; + } + + public void EquipAccessory(Gear accessory, int index) { + this.Accessories[index] = accessory; + } + + public void AppendAccessories(Gear accessory) { + this.EquipAccessory(accessory, Array.IndexOf(this.Accessories, this.Accessories.First(x => x == null))); + } + + public void DeleteAccessory(int index) { + this.Accessories[index] = null; + } + + public void EquipGear(Gear gear, int index) { + this.Gear[index] = gear; + } + + public void AppendGear(Gear gear) { + this.EquipGear(gear, Array.IndexOf(this.Gear, this.Gear.First(x => x == null))); + } + + public void DeleteGear(int index) { + this.Gear[index] = null; + } + + /// + /// Returns an ItemTile depending on specified place ("hotbar", "items", "accessories" or "gear") + /// and specified index + /// + public ItemTile GetItemTile(string place, int index) { + ItemTile toReturn = null; + + switch (place.ToLower()) { + case "hotbar": toReturn = this.Hotbar[index]; break; + case "items": toReturn = this.Items[index]; break; + case "accessories": toReturn = this.Accessories[index]; break; + case "gear": toReturn = this.Gear[index]; break; + } + return toReturn; + } + + /// + /// Deletes an ItemTile depending on specified place ("hotbar", "items", "accessories" or "gear") + /// and specified index + /// + public void DeleteItemTile(string place, int index) { + switch (place.ToLower()) { + case "hotbar": this.Hotbar[index] = null; break; + case "items": this.Items[index] = null; break; + case "accessories": this.Accessories[index] = null; break; + case "gear": this.Gear[index] = null; break; + } + } + + /// + /// Returns an ItemTile depending on specified place ("hotbar", "items", "accessories" or "gear") + /// and specified index in player's inventory + /// + public static ItemTile GetPlayerItem(string place, int index) { + return Data.Superlayers.Mobs.MI.Player.Inventory.GetItemTile(place, index); + } + } +} diff --git a/Mundus/Service/Tiles/Mobs/LandMobs/LandMobsPresets.cs b/Mundus/Service/Tiles/Mobs/LandMobs/LandMobsPresets.cs new file mode 100644 index 0000000..ef4a2d4 --- /dev/null +++ b/Mundus/Service/Tiles/Mobs/LandMobs/LandMobsPresets.cs @@ -0,0 +1,13 @@ +using Mundus.Data.SuperLayers; +using Mundus.Service.Tiles.Items.Presets; + +namespace Mundus.Service.Tiles.Mobs.LandMobs { + public static class LandMobsPresets { + /// + /// Returns a new instance of the cow mob tile + /// + public static MobTile GetACow() { + return new MobTile("L_cow", 10, 1, LI.Land, 1, MaterialPresets.GetAGrass()); + } + } +} diff --git a/Mundus/Service/Tiles/Mobs/LandMobs/Player.cs b/Mundus/Service/Tiles/Mobs/LandMobs/Player.cs new file mode 100644 index 0000000..bf102e4 --- /dev/null +++ b/Mundus/Service/Tiles/Mobs/LandMobs/Player.cs @@ -0,0 +1,15 @@ +using Mundus.Data.SuperLayers; +using Mundus.Service.Tiles.Items; + +namespace Mundus.Service.Tiles.Mobs.LandMobs { + public class Player : MobTile { + /// + /// Note: player has an rndMovementQualifier of -1 and drops first item in the hotbar + /// + public Player(string stock_id, int health, int defence, ISuperLayer currentSuperLayer, int inventorySize) + : base(stock_id, health, defence, currentSuperLayer, inventorySize, null, -1) + { + this.DroppedUponDeath = (Material)this.Inventory.Hotbar[0]; + } + } +} diff --git a/Mundus/Service/Tiles/Mobs/MobTile.cs b/Mundus/Service/Tiles/Mobs/MobTile.cs new file mode 100644 index 0000000..ed2d5fe --- /dev/null +++ b/Mundus/Service/Tiles/Mobs/MobTile.cs @@ -0,0 +1,57 @@ +using Gtk; +using Mundus.Data; +using Mundus.Data.SuperLayers; +using Mundus.Service.Tiles.Items; + +namespace Mundus.Service.Tiles.Mobs { + public class MobTile : ITile { + public string stock_id { get; private set; } + public Image Texture { get; private set; } + + public ISuperLayer CurrSuperLayer { get; set; } + public int YPos { get; set; } + public int XPos { get; set; } + public int Health { get; private set; } + public int Defense { get; set; } + public Material DroppedUponDeath { get; protected set; } + public Inventory Inventory { get; set; } + + /// + /// Specifies how big the chance of a mob moving (randomly) is. Lower the value, higher the chance for movement. + /// Note: negative values (or 0) means the mob won't move randomly + /// + 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) { + this.stock_id = stock_id; + this.Texture = new Image(stock_id, IconSize.Dnd); + this.Health = health; + this.Defense = defence; + this.CurrSuperLayer = currentSuperLayer; + this.RndMovementRate = rndMovementQualifier; + this.DroppedUponDeath = droppedUponDeath; + this.Inventory = new Inventory(inventorySize); + } + + /// + /// Removes health from structure + /// + /// Whether the mobtile can still be damaged + public bool TakeDamage(int damagePoints) { + this.Health -= damagePoints; + return this.Health > 0; + } + + /// + /// Heals the mobtile (unless/until it has full health (4 * inventorySize)) + /// + /// Health points to heal with + public void Heal(int healthPoints) { + this.Health += healthPoints; + + if (this.Health > MapSizes.CurrSize / 5 * 4) { + this.Health = MapSizes.CurrSize / 5 * 4; + } + } + } +} \ No newline at end of file diff --git a/Mundus/Views/Windows/CraftingWindow.cs b/Mundus/Views/Windows/CraftingWindow.cs index 0a087a4..56d9549 100644 --- a/Mundus/Views/Windows/CraftingWindow.cs +++ b/Mundus/Views/Windows/CraftingWindow.cs @@ -1,6 +1,6 @@ using Gtk; using System; -using Mundus.Service.Crafting; +using Mundus.Service.Tiles.Crafting; using Mundus.Service.Tiles.Items; namespace Mundus.Views.Windows { diff --git a/Mundus/Views/Windows/GameWindows/IGameWindow.cs b/Mundus/Views/Windows/GameWindows/IGameWindow.cs new file mode 100644 index 0000000..21c329f --- /dev/null +++ b/Mundus/Views/Windows/GameWindows/IGameWindow.cs @@ -0,0 +1,19 @@ +using Mundus.Service.Tiles.Items; + +namespace Mundus.Views.Windows.GameWindows { + public interface IGameWindow { + int Size { get; } + + //Events that are generated from designer window + void OnDeleteEvent(object o, Gtk.DeleteEventArgs args); + void SetDefaults(); + void PrintScreen(); + void PrintMap(); + void PrintMainMenu(); + void PrintInventory(); + void PrintSelectedItemInfo(ItemTile itemTile); + + //Stuff that are in Gtk.Window class + void Show(); + } +} diff --git a/Mundus/Views/Windows/GameWindows/LargeGameWindow.cs b/Mundus/Views/Windows/GameWindows/LargeGameWindow.cs new file mode 100644 index 0000000..abe4913 --- /dev/null +++ b/Mundus/Views/Windows/GameWindows/LargeGameWindow.cs @@ -0,0 +1,2246 @@ +using System; +using Gtk; +using Mundus.Service; +using Mundus.Service.Tiles.Mobs.Controllers; +using Mundus.Service.SuperLayers; +using Mundus.Service.Tiles.Items; +using Mundus.Service.Tiles.Mobs; + +namespace Mundus.Views.Windows.GameWindows { + public partial class LargeGameWindow : Gtk.Window, IGameWindow { + public int Size { get; private set; } + + public LargeGameWindow() : base( Gtk.WindowType.Toplevel ) { + this.Build(); + } + + public void OnDeleteEvent(object o, DeleteEventArgs args) { + Application.Quit(); + } + + public void SetDefaults() { + this.Size = 9; + this.SetMapMenuVisibility(false); + this.SetInvMenuVisibility(false); + } + + private void SelectItem(string place, int index) { + if (HasSelection()) { + ResetSelection(); + SwitchItems.ReplaceItems(place, index); + } + else { + selPlace = place; + selIndex = index; + SwitchItems.SetOrigin(place, index); + } + + this.PrintMainMenu(); + this.PrintInventory(); + } + + private void React(int button) { + int buttonYPos = (button - 1) / Size; + int buttonXPos = (button - (buttonYPos * Size)) - 1; + + int mapXPos = Calculate.CalculateXFromButton(buttonXPos, Size); + int mapYPos = Calculate.CalculateYFromButton(buttonYPos, Size); + + if (!HasSelection()) { + MobMovement.MovePlayer(mapYPos, mapXPos, Size); + MobMovement.MoveRandomlyAllMobs(); + } + else { + if (Inventory.GetPlayerItem(selPlace, selIndex) != null) { + if (MobFighting.ExistsFightTargetForPlayer(mapYPos, mapXPos)) { + MobFighting.PlayerTryFight(selPlace, selIndex, mapYPos, mapXPos); + } + else { + MobTerraforming.PlayerTerraformAt(mapYPos, mapXPos, selPlace, selIndex); + } + } + ResetSelection(); + } + + this.PrintScreen(); + this.PrintMainMenu(); + + if (this.MapMenuIsVisible()) { + this.PrintMap(); + } + else if (this.InvMenuIsVisible()) { + this.PrintInventory(); + } + } + + private static string selPlace = null; + private static int selIndex = -1; + private static void ResetSelection() { + selPlace = null; + selIndex = -1; + } + private static bool HasSelection() { + return selPlace != null; + } + + private bool InvMenuIsVisible() { + return btnI1.Visible; + } + + private bool MapMenuIsVisible() { + return imgG1.Visible; + } + + // + // PRINTING + // + + public void PrintSelectedItemInfo(ItemTile itemTile) { + if (itemTile != null) { + imgInfo.SetFromStock(itemTile.stock_id, IconSize.Dnd); + lblInfo.Text = itemTile.ToString(); + } + else { + imgInfo.SetFromImage(null, null); + lblInfo.Text = null; + } + } + + public void PrintScreen() { + for (int layer = 0; layer < 3; layer++) { + for (int row = Calculate.CalculateStartY(Size), maxY = Calculate.CalculateMaxY(Size), btn = 1; row <= maxY; row++) { + for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, btn++) { + Image img = ImageController.GetScreenImage(row, col, layer); + + if (img == null) continue; + + switch (btn) { + case 1: btnP1.Image = img; break; + case 2: btnP2.Image = img; break; + case 3: btnP3.Image = img; break; + case 4: btnP4.Image = img; break; + case 5: btnP5.Image = img; break; + case 6: btnP6.Image = img; break; + case 7: btnP7.Image = img; break; + case 8: btnP8.Image = img; break; + case 9: btnP9.Image = img; break; + case 10: btnP10.Image = img; break; + case 11: btnP11.Image = img; break; + case 12: btnP12.Image = img; break; + case 13: btnP13.Image = img; break; + case 14: btnP14.Image = img; break; + case 15: btnP15.Image = img; break; + case 16: btnP16.Image = img; break; + case 17: btnP17.Image = img; break; + case 18: btnP18.Image = img; break; + case 19: btnP19.Image = img; break; + case 20: btnP20.Image = img; break; + case 21: btnP21.Image = img; break; + case 22: btnP22.Image = img; break; + case 23: btnP23.Image = img; break; + case 24: btnP24.Image = img; break; + case 25: btnP25.Image = img; break; + case 26: btnP26.Image = img; break; + case 27: btnP27.Image = img; break; + case 28: btnP28.Image = img; break; + case 29: btnP29.Image = img; break; + case 30: btnP30.Image = img; break; + case 31: btnP31.Image = img; break; + case 32: btnP32.Image = img; break; + case 33: btnP33.Image = img; break; + case 34: btnP34.Image = img; break; + case 35: btnP35.Image = img; break; + case 36: btnP36.Image = img; break; + case 37: btnP37.Image = img; break; + case 38: btnP38.Image = img; break; + case 39: btnP39.Image = img; break; + case 40: btnP40.Image = img; break; + case 41: btnP41.Image = img; break; + case 42: btnP42.Image = img; break; + case 43: btnP43.Image = img; break; + case 44: btnP44.Image = img; break; + case 45: btnP45.Image = img; break; + case 46: btnP46.Image = img; break; + case 47: btnP47.Image = img; break; + case 48: btnP48.Image = img; break; + case 49: btnP49.Image = img; break; + case 50: btnP50.Image = img; break; + case 51: btnP51.Image = img; break; + case 52: btnP52.Image = img; break; + case 53: btnP53.Image = img; break; + case 54: btnP54.Image = img; break; + case 55: btnP55.Image = img; break; + case 56: btnP56.Image = img; break; + case 57: btnP57.Image = img; break; + case 58: btnP58.Image = img; break; + case 59: btnP59.Image = img; break; + case 60: btnP60.Image = img; break; + case 61: btnP61.Image = img; break; + case 62: btnP62.Image = img; break; + case 63: btnP63.Image = img; break; + case 64: btnP64.Image = img; break; + case 65: btnP65.Image = img; break; + case 66: btnP66.Image = img; break; + case 67: btnP67.Image = img; break; + case 68: btnP68.Image = img; break; + case 69: btnP69.Image = img; break; + case 70: btnP70.Image = img; break; + case 71: btnP71.Image = img; break; + case 72: btnP72.Image = img; break; + case 73: btnP73.Image = img; break; + case 74: btnP74.Image = img; break; + case 75: btnP75.Image = img; break; + case 76: btnP76.Image = img; break; + case 77: btnP77.Image = img; break; + case 78: btnP78.Image = img; break; + case 79: btnP79.Image = img; break; + case 80: btnP80.Image = img; break; + case 81: btnP81.Image = img; break; + } + } + } + } + } + + public void PrintMainMenu() { + //Print lungs + + //Print health + for (int i = 0; i < Size; i++) { + string iName = MobStatsController.GetPlayerHearth(i); + + switch (i) { + case 0: imgS10.SetFromStock(iName, IconSize.Dnd); break; + case 1: imgS11.SetFromStock(iName, IconSize.Dnd); break; + case 2: imgS12.SetFromStock(iName, IconSize.Dnd); break; + case 3: imgS13.SetFromStock(iName, IconSize.Dnd); break; + case 4: imgS14.SetFromStock(iName, IconSize.Dnd); break; + case 5: imgS15.SetFromStock(iName, IconSize.Dnd); break; + case 6: imgS16.SetFromStock(iName, IconSize.Dnd); break; + case 7: imgS17.SetFromStock(iName, IconSize.Dnd); break; + case 8: imgS18.SetFromStock(iName, IconSize.Dnd); break; + } + } + + //Prints hotbar + for (int i = 0; i < Size; i++) { + Image img = ImageController.GetPlayerHotbarImage(i); + + switch (i) { + case 0: btnH1.Image = img; break; + case 1: btnH2.Image = img; break; + case 2: btnH3.Image = img; break; + case 3: btnH4.Image = img; break; + case 4: btnH5.Image = img; break; + case 5: btnH6.Image = img; break; + case 6: btnH7.Image = img; break; + case 7: btnH8.Image = img; break; + case 8: btnH9.Image = img; break; + } + } + + //Prints log + for (int i = 0, mIndex = LogController.GetCount() - 1; i < Size; mIndex--, i++) { + string msg = LogController.GetMessagage(mIndex); + + switch (i) { + case 0: lblLog1.Text = msg; break; + case 1: lblLog2.Text = msg; break; + case 2: lblLog3.Text = msg; break; + case 3: lblLog4.Text = msg; break; + case 4: lblLog5.Text = msg; break; + case 5: lblLog6.Text = msg; break; + case 7: lblLog7.Text = msg; break; + case 8: lblLog8.Text = msg; break; + } + } + } + + 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++) { + for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, img++) { + string sName = ImageController.GetPlayerGroundImage(row, col).Stock; + + switch (img) { + case 1: imgG1.SetFromStock(sName, IconSize.Dnd); break; + case 2: imgG2.SetFromStock(sName, IconSize.Dnd); break; + case 3: imgG3.SetFromStock(sName, IconSize.Dnd); break; + case 4: imgG4.SetFromStock(sName, IconSize.Dnd); break; + case 5: imgG5.SetFromStock(sName, IconSize.Dnd); break; + case 6: imgG6.SetFromStock(sName, IconSize.Dnd); break; + case 7: imgG7.SetFromStock(sName, IconSize.Dnd); break; + case 8: imgG8.SetFromStock(sName, IconSize.Dnd); break; + case 9: imgG9.SetFromStock(sName, IconSize.Dnd); break; + case 10: imgG10.SetFromStock(sName, IconSize.Dnd); break; + case 11: imgG11.SetFromStock(sName, IconSize.Dnd); break; + case 12: imgG12.SetFromStock(sName, IconSize.Dnd); break; + case 13: imgG13.SetFromStock(sName, IconSize.Dnd); break; + case 14: imgG14.SetFromStock(sName, IconSize.Dnd); break; + case 15: imgG15.SetFromStock(sName, IconSize.Dnd); break; + case 16: imgG16.SetFromStock(sName, IconSize.Dnd); break; + case 17: imgG17.SetFromStock(sName, IconSize.Dnd); break; + case 18: imgG18.SetFromStock(sName, IconSize.Dnd); break; + case 19: imgG19.SetFromStock(sName, IconSize.Dnd); break; + case 20: imgG20.SetFromStock(sName, IconSize.Dnd); break; + case 21: imgG21.SetFromStock(sName, IconSize.Dnd); break; + case 22: imgG22.SetFromStock(sName, IconSize.Dnd); break; + case 23: imgG23.SetFromStock(sName, IconSize.Dnd); break; + case 24: imgG24.SetFromStock(sName, IconSize.Dnd); break; + case 25: imgG25.SetFromStock(sName, IconSize.Dnd); break; + case 26: imgG26.SetFromStock(sName, IconSize.Dnd); break; + case 27: imgG27.SetFromStock(sName, IconSize.Dnd); break; + case 28: imgG28.SetFromStock(sName, IconSize.Dnd); break; + case 29: imgG29.SetFromStock(sName, IconSize.Dnd); break; + case 30: imgG30.SetFromStock(sName, IconSize.Dnd); break; + case 31: imgG31.SetFromStock(sName, IconSize.Dnd); break; + case 32: imgG32.SetFromStock(sName, IconSize.Dnd); break; + case 33: imgG33.SetFromStock(sName, IconSize.Dnd); break; + case 34: imgG34.SetFromStock(sName, IconSize.Dnd); break; + case 35: imgG35.SetFromStock(sName, IconSize.Dnd); break; + case 36: imgG36.SetFromStock(sName, IconSize.Dnd); break; + case 37: imgG37.SetFromStock(sName, IconSize.Dnd); break; + case 38: imgG38.SetFromStock(sName, IconSize.Dnd); break; + case 39: imgG39.SetFromStock(sName, IconSize.Dnd); break; + case 40: imgG40.SetFromStock(sName, IconSize.Dnd); break; + case 41: imgG41.SetFromStock(sName, IconSize.Dnd); break; + case 42: imgG42.SetFromStock(sName, IconSize.Dnd); break; + case 43: imgG43.SetFromStock(sName, IconSize.Dnd); break; + case 44: imgG44.SetFromStock(sName, IconSize.Dnd); break; + case 45: imgG45.SetFromStock(sName, IconSize.Dnd); break; + case 46: imgG46.SetFromStock(sName, IconSize.Dnd); break; + case 47: imgG47.SetFromStock(sName, IconSize.Dnd); break; + case 48: imgG48.SetFromStock(sName, IconSize.Dnd); break; + case 49: imgG49.SetFromStock(sName, IconSize.Dnd); break; + case 50: imgG50.SetFromStock(sName, IconSize.Dnd); break; + case 51: imgG51.SetFromStock(sName, IconSize.Dnd); break; + case 52: imgG52.SetFromStock(sName, IconSize.Dnd); break; + case 53: imgG53.SetFromStock(sName, IconSize.Dnd); break; + case 54: imgG54.SetFromStock(sName, IconSize.Dnd); break; + case 55: imgG55.SetFromStock(sName, IconSize.Dnd); break; + case 56: imgG56.SetFromStock(sName, IconSize.Dnd); break; + case 57: imgG57.SetFromStock(sName, IconSize.Dnd); break; + case 58: imgG58.SetFromStock(sName, IconSize.Dnd); break; + case 59: imgG59.SetFromStock(sName, IconSize.Dnd); break; + case 60: imgG60.SetFromStock(sName, IconSize.Dnd); break; + case 61: imgG61.SetFromStock(sName, IconSize.Dnd); break; + case 62: imgG62.SetFromStock(sName, IconSize.Dnd); break; + case 63: imgG63.SetFromStock(sName, IconSize.Dnd); break; + case 64: imgG64.SetFromStock(sName, IconSize.Dnd); break; + case 65: imgG65.SetFromStock(sName, IconSize.Dnd); break; + case 66: imgG66.SetFromStock(sName, IconSize.Dnd); break; + case 67: imgG67.SetFromStock(sName, IconSize.Dnd); break; + case 68: imgG68.SetFromStock(sName, IconSize.Dnd); break; + case 69: imgG69.SetFromStock(sName, IconSize.Dnd); break; + case 70: imgG70.SetFromStock(sName, IconSize.Dnd); break; + case 71: imgG71.SetFromStock(sName, IconSize.Dnd); break; + case 72: imgG72.SetFromStock(sName, IconSize.Dnd); break; + case 73: imgG73.SetFromStock(sName, IconSize.Dnd); break; + case 74: imgG74.SetFromStock(sName, IconSize.Dnd); break; + case 75: imgG75.SetFromStock(sName, IconSize.Dnd); break; + case 76: imgG76.SetFromStock(sName, IconSize.Dnd); break; + case 77: imgG77.SetFromStock(sName, IconSize.Dnd); break; + case 78: imgG78.SetFromStock(sName, IconSize.Dnd); break; + case 79: imgG79.SetFromStock(sName, IconSize.Dnd); break; + case 80: imgG80.SetFromStock(sName, IconSize.Dnd); break; + case 81: imgG81.SetFromStock(sName, IconSize.Dnd); break; + } + } + } + + lblSuperLayer.Text = MobStatsController.GetPlayerSuperLayerName(); + lblCoord1.Text = "X: " + MobStatsController.GetPlayerXCoord(); + lblCoord2.Text = "Y: " + MobStatsController.GetPlayerYCoord(); + + //Prints the "Item layer" in map menu + for (int row = Calculate.CalculateStartY(Size), maxY = Calculate.CalculateMaxY(Size), img = 1; row <= maxY; row++) { + for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, img++) { + string sName = ImageController.GetPlayerStructureImage(row, col).Stock; + + switch (img) { + case 1: imgI1.SetFromStock(sName, IconSize.Dnd); break; + case 2: imgI2.SetFromStock(sName, IconSize.Dnd); break; + case 3: imgI3.SetFromStock(sName, IconSize.Dnd); break; + case 4: imgI4.SetFromStock(sName, IconSize.Dnd); break; + case 5: imgI5.SetFromStock(sName, IconSize.Dnd); break; + case 6: imgI6.SetFromStock(sName, IconSize.Dnd); break; + case 7: imgI7.SetFromStock(sName, IconSize.Dnd); break; + case 8: imgI8.SetFromStock(sName, IconSize.Dnd); break; + case 9: imgI9.SetFromStock(sName, IconSize.Dnd); break; + case 10: imgI10.SetFromStock(sName, IconSize.Dnd); break; + case 11: imgI11.SetFromStock(sName, IconSize.Dnd); break; + case 12: imgI12.SetFromStock(sName, IconSize.Dnd); break; + case 13: imgI13.SetFromStock(sName, IconSize.Dnd); break; + case 14: imgI14.SetFromStock(sName, IconSize.Dnd); break; + case 15: imgI15.SetFromStock(sName, IconSize.Dnd); break; + case 16: imgI16.SetFromStock(sName, IconSize.Dnd); break; + case 17: imgI17.SetFromStock(sName, IconSize.Dnd); break; + case 18: imgI18.SetFromStock(sName, IconSize.Dnd); break; + case 19: imgI19.SetFromStock(sName, IconSize.Dnd); break; + case 20: imgI20.SetFromStock(sName, IconSize.Dnd); break; + case 21: imgI21.SetFromStock(sName, IconSize.Dnd); break; + case 22: imgI22.SetFromStock(sName, IconSize.Dnd); break; + case 23: imgI23.SetFromStock(sName, IconSize.Dnd); break; + case 24: imgI24.SetFromStock(sName, IconSize.Dnd); break; + case 25: imgI25.SetFromStock(sName, IconSize.Dnd); break; + case 26: imgI26.SetFromStock(sName, IconSize.Dnd); break; + case 27: imgI27.SetFromStock(sName, IconSize.Dnd); break; + case 28: imgI28.SetFromStock(sName, IconSize.Dnd); break; + case 29: imgI29.SetFromStock(sName, IconSize.Dnd); break; + case 30: imgI30.SetFromStock(sName, IconSize.Dnd); break; + case 31: imgI31.SetFromStock(sName, IconSize.Dnd); break; + case 32: imgI32.SetFromStock(sName, IconSize.Dnd); break; + case 33: imgI33.SetFromStock(sName, IconSize.Dnd); break; + case 34: imgI34.SetFromStock(sName, IconSize.Dnd); break; + case 35: imgI35.SetFromStock(sName, IconSize.Dnd); break; + case 36: imgI36.SetFromStock(sName, IconSize.Dnd); break; + case 37: imgI37.SetFromStock(sName, IconSize.Dnd); break; + case 38: imgI38.SetFromStock(sName, IconSize.Dnd); break; + case 39: imgI39.SetFromStock(sName, IconSize.Dnd); break; + case 40: imgI40.SetFromStock(sName, IconSize.Dnd); break; + case 41: imgI41.SetFromStock(sName, IconSize.Dnd); break; + case 42: imgI42.SetFromStock(sName, IconSize.Dnd); break; + case 43: imgI43.SetFromStock(sName, IconSize.Dnd); break; + case 44: imgI44.SetFromStock(sName, IconSize.Dnd); break; + case 45: imgI45.SetFromStock(sName, IconSize.Dnd); break; + case 46: imgI46.SetFromStock(sName, IconSize.Dnd); break; + case 47: imgI47.SetFromStock(sName, IconSize.Dnd); break; + case 48: imgI48.SetFromStock(sName, IconSize.Dnd); break; + case 49: imgI49.SetFromStock(sName, IconSize.Dnd); break; + case 50: imgI50.SetFromStock(sName, IconSize.Dnd); break; + case 51: imgI51.SetFromStock(sName, IconSize.Dnd); break; + case 52: imgI52.SetFromStock(sName, IconSize.Dnd); break; + case 53: imgI53.SetFromStock(sName, IconSize.Dnd); break; + case 54: imgI54.SetFromStock(sName, IconSize.Dnd); break; + case 55: imgI55.SetFromStock(sName, IconSize.Dnd); break; + case 56: imgI56.SetFromStock(sName, IconSize.Dnd); break; + case 57: imgI57.SetFromStock(sName, IconSize.Dnd); break; + case 58: imgI58.SetFromStock(sName, IconSize.Dnd); break; + case 59: imgI59.SetFromStock(sName, IconSize.Dnd); break; + case 60: imgI60.SetFromStock(sName, IconSize.Dnd); break; + case 61: imgI61.SetFromStock(sName, IconSize.Dnd); break; + case 62: imgI62.SetFromStock(sName, IconSize.Dnd); break; + case 63: imgI63.SetFromStock(sName, IconSize.Dnd); break; + case 64: imgI64.SetFromStock(sName, IconSize.Dnd); break; + case 65: imgI65.SetFromStock(sName, IconSize.Dnd); break; + case 66: imgI66.SetFromStock(sName, IconSize.Dnd); break; + case 67: imgI67.SetFromStock(sName, IconSize.Dnd); break; + case 68: imgI68.SetFromStock(sName, IconSize.Dnd); break; + case 69: imgI69.SetFromStock(sName, IconSize.Dnd); break; + case 70: imgI70.SetFromStock(sName, IconSize.Dnd); break; + case 71: imgI71.SetFromStock(sName, IconSize.Dnd); break; + case 72: imgI72.SetFromStock(sName, IconSize.Dnd); break; + case 73: imgI73.SetFromStock(sName, IconSize.Dnd); break; + case 74: imgI74.SetFromStock(sName, IconSize.Dnd); break; + case 75: imgI75.SetFromStock(sName, IconSize.Dnd); break; + case 76: imgI76.SetFromStock(sName, IconSize.Dnd); break; + case 77: imgI77.SetFromStock(sName, IconSize.Dnd); break; + case 78: imgI78.SetFromStock(sName, IconSize.Dnd); break; + case 79: imgI79.SetFromStock(sName, IconSize.Dnd); break; + case 80: imgI80.SetFromStock(sName, IconSize.Dnd); break; + case 81: imgI81.SetFromStock(sName, IconSize.Dnd); break; + } + } + } + + lblHoleOnTop.Text = MobStatsController.ExistsHoleOnTopOfPlayer() + ""; + } + + public void PrintInventory() { + //Prints the actual inventory (items) + for (int row = 0; row < Size; row++) { + for (int col = 0; col < Size; col++) { + Image img = ImageController.GetPlayerInventoryItemImage(row * Size + col); + + switch (row * Size + col + 1) { + case 1: btnI1.Image = img; break; + case 2: btnI2.Image = img; break; + case 3: btnI3.Image = img; break; + case 4: btnI4.Image = img; break; + case 5: btnI5.Image = img; break; + case 6: btnI6.Image = img; break; + case 7: btnI7.Image = img; break; + case 8: btnI8.Image = img; break; + case 9: btnI9.Image = img; break; + case 10: btnI10.Image = img; break; + case 11: btnI11.Image = img; break; + case 12: btnI12.Image = img; break; + case 13: btnI13.Image = img; break; + case 14: btnI14.Image = img; break; + case 15: btnI15.Image = img; break; + case 16: btnI16.Image = img; break; + case 17: btnI17.Image = img; break; + case 18: btnI18.Image = img; break; + case 19: btnI19.Image = img; break; + case 20: btnI20.Image = img; break; + case 21: btnI21.Image = img; break; + case 22: btnI22.Image = img; break; + case 23: btnI23.Image = img; break; + case 24: btnI24.Image = img; break; + case 25: btnI25.Image = img; break; + case 26: btnI26.Image = img; break; + case 27: btnI27.Image = img; break; + case 28: btnI28.Image = img; break; + case 29: btnI29.Image = img; break; + case 30: btnI30.Image = img; break; + case 31: btnI31.Image = img; break; + case 32: btnI32.Image = img; break; + case 33: btnI33.Image = img; break; + case 34: btnI34.Image = img; break; + case 35: btnI35.Image = img; break; + case 36: btnI36.Image = img; break; + case 37: btnI37.Image = img; break; + case 38: btnI38.Image = img; break; + case 39: btnI39.Image = img; break; + case 40: btnI40.Image = img; break; + case 41: btnI41.Image = img; break; + case 42: btnI42.Image = img; break; + case 43: btnI43.Image = img; break; + case 44: btnI44.Image = img; break; + case 45: btnI45.Image = img; break; + case 46: btnI46.Image = img; break; + case 47: btnI47.Image = img; break; + case 48: btnI48.Image = img; break; + case 49: btnI49.Image = img; break; + case 50: btnI50.Image = img; break; + case 51: btnI51.Image = img; break; + case 52: btnI52.Image = img; break; + case 53: btnI53.Image = img; break; + case 54: btnI54.Image = img; break; + case 55: btnI55.Image = img; break; + case 56: btnI56.Image = img; break; + case 57: btnI57.Image = img; break; + case 58: btnI58.Image = img; break; + case 59: btnI59.Image = img; break; + case 60: btnI60.Image = img; break; + case 61: btnI61.Image = img; break; + case 62: btnI62.Image = img; break; + case 63: btnI63.Image = img; break; + case 64: btnI64.Image = img; break; + case 65: btnI65.Image = img; break; + case 66: btnI66.Image = img; break; + case 67: btnI67.Image = img; break; + case 68: btnI68.Image = img; break; + case 69: btnI69.Image = img; break; + case 70: btnI70.Image = img; break; + case 71: btnI71.Image = img; break; + case 72: btnI72.Image = img; break; + case 73: btnI73.Image = img; break; + case 74: btnI74.Image = img; break; + case 75: btnI75.Image = img; break; + case 76: btnI76.Image = img; break; + case 77: btnI77.Image = img; break; + case 78: btnI78.Image = img; break; + case 79: btnI79.Image = img; break; + case 80: btnI80.Image = img; break; + case 81: btnI81.Image = img; break; + } + } + } + + //Prints accessories + for (int row = 0; row < 2; row++) { + for (int col = 0; col < Size; col++) { + Image img = ImageController.GetPlayerAccessoryImage(row * Size + col); + + switch (row * Size + col + 1) { + case 1: btnA1.Image = img; break; + case 2: btnA2.Image = img; break; + case 3: btnA3.Image = img; break; + case 4: btnA4.Image = img; break; + case 5: btnA5.Image = img; break; + case 6: btnA6.Image = img; break; + case 7: btnA7.Image = img; break; + case 8: btnA8.Image = img; break; + case 9: btnA9.Image = img; break; + case 10: btnA10.Image = img; break; + case 11: btnA11.Image = img; break; + case 12: btnA12.Image = img; break; + case 13: btnA13.Image = img; break; + case 14: btnA14.Image = img; break; + case 15: btnA15.Image = img; break; + case 16: btnA16.Image = img; break; + case 17: btnA17.Image = img; break; + case 18: btnA18.Image = img; break; + } + } + } + + //Prints gear + for (int i = 0; i < Size; i++) { + Image img = ImageController.GetPlayerGearImage(i); + + switch (i + 1) { + case 1: btnG1.Image = img; break; + case 2: btnG2.Image = img; break; + case 3: btnG3.Image = img; break; + case 4: btnG4.Image = img; break; + case 5: btnG5.Image = img; break; + case 6: btnG6.Image = img; break; + case 7: btnG7.Image = img; break; + case 8: btnG8.Image = img; break; + case 9: btnG9.Image = img; break; + } + } + } + + // + // BUTTON CLICKED EVENTS + // + + protected void OnBtnMapClicked(object sender, EventArgs e) { + //Hide inv menu, if it is visible (so only one of the two is visible) + if (this.InvMenuIsVisible()) this.OnBtnInvClicked(this, null); + + if (this.MapMenuIsVisible()) { + this.SetMapMenuVisibility(false); + } + else { + this.PrintMap(); + this.SetMapMenuVisibility(true); + } + } + + protected void OnBtnInvClicked(object sender, EventArgs e) { + //Hide map menu, if it is visible (so only one of the two is visible) + if (this.MapMenuIsVisible()) this.OnBtnMapClicked(this, null); + + if (btnI1.Visible) { + this.SetInvMenuVisibility(false); + } + else { + this.PrintInventory(); + this.SetInvMenuVisibility(true); + } + } + + protected void OnBtnPauseClicked(object sender, EventArgs e) { + // Note: pause window blocks player input + WindowController.ShowPauseWindow(); + } + + protected void OnBtnMusicClicked(object sender, EventArgs e) { + WindowController.ShowMusicWindow(); + } + + protected void OnBtnCraftingClicked(object sender, EventArgs e) { + WindowController.ShowCraftingWindow(); + } + + // Screen buttons + protected void OnBtnP1Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(1); + } + } + + protected void OnBtnP2Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(2); + } + } + + protected void OnBtnP3Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(3); + } + } + + protected void OnBtnP4Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(4); + } + } + + protected void OnBtnP5Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(5); + } + } + + protected void OnBtnP6Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(6); + } + } + + protected void OnBtnP7Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(7); + } + } + + protected void OnBtnP8Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(8); + } + } + + protected void OnBtnP9Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(9); + } + } + + protected void OnBtnP10Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(10); + } + } + + protected void OnBtnP11Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(11); + } + } + + protected void OnBtnP12Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(12); + } + } + + protected void OnBtnP13Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(13); + } + } + + protected void OnBtnP14Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(14); + } + } + + protected void OnBtnP15Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(15); + } + } + + protected void OnBtnP16Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(16); + } + } + + protected void OnBtnP17Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(17); + } + } + + protected void OnBtnP18Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(18); + } + } + + protected void OnBtnP19Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(19); + } + } + + protected void OnBtnP20Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(20); + } + } + + protected void OnBtnP21Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(21); + } + } + + protected void OnBtnP22Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(22); + } + } + + protected void OnBtnP23Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(23); + } + } + + protected void OnBtnP24Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(24); + } + } + + protected void OnBtnP25Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(25); + } + } + + protected void OnBtnP26Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(26); + } + } + + protected void OnBtnP27Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(27); + } + } + + protected void OnBtnP28Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(28); + } + } + + protected void OnBtnP29Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(29); + } + } + + protected void OnBtnP30Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(30); + } + } + + protected void OnBtnP31Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(31); + } + } + + protected void OnBtnP32Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(32); + } + } + + protected void OnBtnP33Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(33); + } + } + + protected void OnBtnP34Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(34); + } + } + + protected void OnBtnP35Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(35); + } + } + + protected void OnBtnP36Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(36); + } + } + + protected void OnBtnP37Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(37); + } + } + + protected void OnBtnP38Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(38); + } + } + + protected void OnBtnP39Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(39); + } + } + + protected void OnBtnP40Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(40); + } + } + + protected void OnBtnP41Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(41); + } + } + + protected void OnBtnP42Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(42); + } + } + + protected void OnBtnP43Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(43); + } + } + + protected void OnBtnP44Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(44); + } + } + + protected void OnBtnP45Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(45); + } + } + + protected void OnBtnP46Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(46); + } + } + + protected void OnBtnP47Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(47); + } + } + + protected void OnBtnP48Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(48); + } + } + + protected void OnBtnP49Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(49); + } + } + + protected void OnBtnP50Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(50); + } + } + + protected void OnBtnP51Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(51); + } + } + + protected void OnBtnP52Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(52); + } + } + + protected void OnBtnP53Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(53); + } + } + + protected void OnBtnP54Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(54); + } + } + + protected void OnBtnP55Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(55); + } + } + + protected void OnBtnP56Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(56); + } + } + + protected void OnBtnP57Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(57); + } + } + + protected void OnBtnP58Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(58); + } + } + + protected void OnBtnP59Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(59); + } + } + + protected void OnBtnP60Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(60); + } + } + + protected void OnBtnP61Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(61); + } + } + + protected void OnBtnP62Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(62); + } + } + + protected void OnBtnP63Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(63); + } + } + + protected void OnBtnP64Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(64); + } + } + + protected void OnBtnP65Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(65); + } + } + + protected void OnBtnP66Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(66); + } + } + + protected void OnBtnP67Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(67); + } + } + + protected void OnBtnP68Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(68); + } + } + + protected void OnBtnP69Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(69); + } + } + + protected void OnBtnP70Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(70); + } + } + + protected void OnBtnP71Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(71); + } + } + + protected void OnBtnP72Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(72); + } + } + + protected void OnBtnP73Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(73); + } + } + + protected void OnBtnP74Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(74); + } + } + + protected void OnBtnP75Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(75); + } + } + + protected void OnBtnP76Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(76); + } + } + + protected void OnBtnP77Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(77); + } + } + + protected void OnBtnP78Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(78); + } + } + + protected void OnBtnP79Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(79); + } + } + + protected void OnBtnP80Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(80); + } + } + + protected void OnBtnP81Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(81); + } + } + + // Hotbar buttons + protected void OnBtnH1Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 0); + this.PrintMainMenu(); + } + } + + protected void OnBtnH2Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 1); + this.PrintMainMenu(); + } + } + + protected void OnBtnH3Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 2); + this.PrintMainMenu(); + } + } + + protected void OnBtnH4Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 3); + this.PrintMainMenu(); + } + } + + protected void OnBtnH5Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 4); + this.PrintMainMenu(); + } + } + + protected void OnBtnH6Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 5); + this.PrintMainMenu(); + } + } + + protected void OnBtnH7Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 6); + this.PrintMainMenu(); + } + } + + protected void OnBtnH8Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 7); + this.PrintMainMenu(); + } + } + + protected void OnBtnH9Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 8); + this.PrintMainMenu(); + } + } + + protected void OnBtnLogClicked(object sender, EventArgs e) { + WindowController.ShowLogWindow(); + } + + // Inventory (items) buttons + protected void OnBtnI1Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 0); + this.PrintInventory(); + } + } + + protected void OnBtnI2Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 1); + this.PrintInventory(); + } + } + + protected void OnBtnI3Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 2); + this.PrintInventory(); + } + } + + protected void OnBtnI4Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 3); + this.PrintInventory(); + } + } + + protected void OnBtnI5Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 4); + this.PrintInventory(); + } + } + + protected void OnBtnI6Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 5); + this.PrintInventory(); + } + } + + protected void OnBtnI7Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 6); + this.PrintInventory(); + } + } + + protected void OnBtnI8Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 7); + this.PrintInventory(); + } + } + + protected void OnBtnI9Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 8); + this.PrintInventory(); + } + } + + protected void OnBtnI10Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 9); + this.PrintInventory(); + } + } + + protected void OnBtnI11Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 10); + this.PrintInventory(); + } + } + + protected void OnBtnI12Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 11); + this.PrintInventory(); + } + } + + protected void OnBtnI13Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 12); + this.PrintInventory(); + } + } + + protected void OnBtnI14Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 13); + this.PrintInventory(); + } + } + + protected void OnBtnI15Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 14); + this.PrintInventory(); + } + } + + protected void OnBtnI16Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 15); + this.PrintInventory(); + } + } + + protected void OnBtnI17Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 16); + this.PrintInventory(); + } + } + + protected void OnBtnI18Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 17); + this.PrintInventory(); + } + } + + protected void OnBtnI19Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 18); + this.PrintInventory(); + } + } + + protected void OnBtnI20Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 19); + this.PrintInventory(); + } + } + + protected void OnBtnI21Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 20); + this.PrintInventory(); + } + } + + protected void OnBtnI22Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 21); + this.PrintInventory(); + } + } + + protected void OnBtnI23Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 22); + this.PrintInventory(); + } + } + + protected void OnBtnI24Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 23); + this.PrintInventory(); + } + } + + protected void OnBtnI25Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 24); + this.PrintInventory(); + } + } + + protected void OnBtnI26Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 25); + this.PrintInventory(); + } + } + + protected void OnBtnI27Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 26); + this.PrintInventory(); + } + } + + protected void OnBtnI28Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 27); + this.PrintInventory(); + } + } + + protected void OnBtnI29Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 28); + this.PrintInventory(); + } + } + + protected void OnBtnI30Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 29); + this.PrintInventory(); + } + } + + protected void OnBtnI31Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 30); + this.PrintInventory(); + } + } + + protected void OnBtnI32Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 31); + this.PrintInventory(); + } + } + + protected void OnBtnI33Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 32); + this.PrintInventory(); + } + } + + protected void OnBtnI34Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 33); + this.PrintInventory(); + } + } + + protected void OnBtnI35Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 34); + this.PrintInventory(); + } + } + + protected void OnBtnI36Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 35); + this.PrintInventory(); + } + } + + protected void OnBtnI37Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 36); + this.PrintInventory(); + } + } + + protected void OnBtnI38Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 37); + this.PrintInventory(); + } + } + + protected void OnBtnI39Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 38); + this.PrintInventory(); + } + } + + protected void OnBtnI40Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 39); + this.PrintInventory(); + } + } + + protected void OnBtnI41Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 40); + this.PrintInventory(); + } + } + + protected void OnBtnI42Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 41); + this.PrintInventory(); + } + } + + protected void OnBtnI43Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 42); + this.PrintInventory(); + } + } + + protected void OnBtnI44Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 43); + this.PrintInventory(); + } + } + + protected void OnBtnI45Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 44); + this.PrintInventory(); + } + } + + protected void OnBtnI46Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 45); + this.PrintInventory(); + } + } + + protected void OnBtnI47Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 46); + this.PrintInventory(); + } + } + + protected void OnBtnI48Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 47); + this.PrintInventory(); + } + } + + protected void OnBtnI49Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 48); + this.PrintInventory(); + } + } + + protected void OnBtnI50Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 49); + this.PrintInventory(); + } + } + + protected void OnBtnI51Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 50); + this.PrintInventory(); + } + } + + protected void OnBtnI52Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 51); + this.PrintInventory(); + } + } + + protected void OnBtnI53Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 52); + this.PrintInventory(); + } + } + + protected void OnBtnI54Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 53); + this.PrintInventory(); + } + } + + protected void OnBtnI55Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 54); + this.PrintInventory(); + } + } + + protected void OnBtnI56Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 55); + this.PrintInventory(); + } + } + + protected void OnBtnI57Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 56); + this.PrintInventory(); + } + } + + protected void OnBtnI58Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 57); + this.PrintInventory(); + } + } + + protected void OnBtnI59Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 58); + this.PrintInventory(); + } + } + + protected void OnBtnI60Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 59); + this.PrintInventory(); + } + } + + protected void OnBtnI61Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 60); + this.PrintInventory(); + } + } + + protected void OnBtnI62Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 61); + this.PrintInventory(); + } + } + + protected void OnBtnI63Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 62); + this.PrintInventory(); + } + } + + protected void OnBtnI64Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 63); + this.PrintInventory(); + } + } + + protected void OnBtnI65Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 64); + this.PrintInventory(); + } + } + + protected void OnBtnI66Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 65); + this.PrintInventory(); + } + } + + protected void OnBtnI67Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 66); + this.PrintInventory(); + } + } + + protected void OnBtnI68Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 67); + this.PrintInventory(); + } + } + + protected void OnBtnI69Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 68); + this.PrintInventory(); + } + } + + protected void OnBtnI70Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 69); + this.PrintInventory(); + } + } + + protected void OnBtnI71Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 70); + this.PrintInventory(); + } + } + + protected void OnBtnI72Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 71); + this.PrintInventory(); + } + } + + protected void OnBtnI73Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 72); + this.PrintInventory(); + } + } + + protected void OnBtnI74Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 73); + this.PrintInventory(); + } + } + + protected void OnBtnI75Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 74); + this.PrintInventory(); + } + } + + protected void OnBtnI76Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 75); + this.PrintInventory(); + } + } + + protected void OnBtnI77Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 76); + this.PrintInventory(); + } + } + + protected void OnBtnI78Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 77); + this.PrintInventory(); + } + } + + protected void OnBtnI79Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 78); + this.PrintInventory(); + } + } + + protected void OnBtnI80Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 79); + this.PrintInventory(); + } + } + + protected void OnBtnI81Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 80); + this.PrintInventory(); + } + } + + // Accessories buttons + protected void OnBtnA1Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 0); + this.PrintInventory(); + } + } + + protected void OnBtnA2Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 1); + this.PrintInventory(); + } + } + + protected void OnBtnA3Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 2); + this.PrintInventory(); + } + } + + protected void OnBtnA4Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 3); + this.PrintInventory(); + } + } + + protected void OnBtnA5Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 4); + this.PrintInventory(); + } + } + + protected void OnBtnA6Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 5); + this.PrintInventory(); + } + } + + protected void OnBtnA7Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 6); + this.PrintInventory(); + } + } + + protected void OnBtnA8Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 7); + this.PrintInventory(); + } + } + + protected void OnBtnA9Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 8); + this.PrintInventory(); + } + } + + protected void OnBtnA10Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 9); + this.PrintInventory(); + } + } + + protected void OnBtnA11Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 10); + this.PrintInventory(); + } + } + + protected void OnBtnA12Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 11); + this.PrintInventory(); + } + } + + protected void OnBtnA13Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 12); + this.PrintInventory(); + } + } + + protected void OnBtnA14Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 13); + this.PrintInventory(); + } + } + + protected void OnBtnA15Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 14); + this.PrintInventory(); + } + } + + protected void OnBtnA16Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 15); + this.PrintInventory(); + } + } + + protected void OnBtnA17Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 16); + this.PrintInventory(); + } + } + + protected void OnBtnA18Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 17); + this.PrintInventory(); + } + } + + // Gear buttons + protected void OnBtnG1Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 0); + this.PrintInventory(); + } + } + + protected void OnBtnG2Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 1); + this.PrintInventory(); + } + } + + protected void OnBtnG3Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 2); + this.PrintInventory(); + } + } + + protected void OnBtnG4Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 3); + this.PrintInventory(); + } + } + + protected void OnBtnG5Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 4); + this.PrintInventory(); + } + } + + protected void OnBtnG6Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 5); + this.PrintInventory(); + } + } + + protected void OnBtnG7Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 6); + this.PrintInventory(); + } + } + + protected void OnBtnG8Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 7); + this.PrintInventory(); + } + } + + protected void OnBtnG9Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 8); + this.PrintInventory(); + } + } + + // + // VISIBILITY + // + + private void SetMapMenuVisibility(bool isVisible) { + lblGroundLayer.Visible = isVisible; + imgG1.Visible = isVisible; + imgG2.Visible = isVisible; + imgG3.Visible = isVisible; + imgG4.Visible = isVisible; + imgG5.Visible = isVisible; + imgG6.Visible = isVisible; + imgG7.Visible = isVisible; + imgG8.Visible = isVisible; + imgG9.Visible = isVisible; + imgG10.Visible = isVisible; + imgG11.Visible = isVisible; + imgG12.Visible = isVisible; + imgG13.Visible = isVisible; + imgG14.Visible = isVisible; + imgG15.Visible = isVisible; + imgG16.Visible = isVisible; + imgG17.Visible = isVisible; + imgG18.Visible = isVisible; + imgG19.Visible = isVisible; + imgG20.Visible = isVisible; + imgG21.Visible = isVisible; + imgG22.Visible = isVisible; + imgG23.Visible = isVisible; + imgG24.Visible = isVisible; + imgG25.Visible = isVisible; + imgG26.Visible = isVisible; + imgG27.Visible = isVisible; + imgG28.Visible = isVisible; + imgG29.Visible = isVisible; + imgG30.Visible = isVisible; + imgG31.Visible = isVisible; + imgG32.Visible = isVisible; + imgG33.Visible = isVisible; + imgG34.Visible = isVisible; + imgG35.Visible = isVisible; + imgG36.Visible = isVisible; + imgG37.Visible = isVisible; + imgG38.Visible = isVisible; + imgG39.Visible = isVisible; + imgG40.Visible = isVisible; + imgG41.Visible = isVisible; + imgG42.Visible = isVisible; + imgG43.Visible = isVisible; + imgG44.Visible = isVisible; + imgG45.Visible = isVisible; + imgG46.Visible = isVisible; + imgG47.Visible = isVisible; + imgG48.Visible = isVisible; + imgG49.Visible = isVisible; + imgG50.Visible = isVisible; + imgG51.Visible = isVisible; + imgG52.Visible = isVisible; + imgG53.Visible = isVisible; + imgG54.Visible = isVisible; + imgG55.Visible = isVisible; + imgG56.Visible = isVisible; + imgG57.Visible = isVisible; + imgG58.Visible = isVisible; + imgG59.Visible = isVisible; + imgG60.Visible = isVisible; + imgG61.Visible = isVisible; + imgG62.Visible = isVisible; + imgG63.Visible = isVisible; + imgG64.Visible = isVisible; + imgG65.Visible = isVisible; + imgG66.Visible = isVisible; + imgG67.Visible = isVisible; + imgG68.Visible = isVisible; + imgG69.Visible = isVisible; + imgG70.Visible = isVisible; + imgG71.Visible = isVisible; + imgG72.Visible = isVisible; + imgG73.Visible = isVisible; + imgG74.Visible = isVisible; + imgG75.Visible = isVisible; + imgG76.Visible = isVisible; + imgG77.Visible = isVisible; + imgG78.Visible = isVisible; + imgG79.Visible = isVisible; + imgG80.Visible = isVisible; + imgG81.Visible = isVisible; + + lblSuperLayer.Visible = isVisible; + lblCoord1.Visible = isVisible; + lblCoord2.Visible = isVisible; + + lblItemLayer.Visible = isVisible; + imgI1.Visible = isVisible; + imgI2.Visible = isVisible; + imgI3.Visible = isVisible; + imgI4.Visible = isVisible; + imgI5.Visible = isVisible; + imgI6.Visible = isVisible; + imgI7.Visible = isVisible; + imgI8.Visible = isVisible; + imgI9.Visible = isVisible; + imgI10.Visible = isVisible; + imgI11.Visible = isVisible; + imgI12.Visible = isVisible; + imgI13.Visible = isVisible; + imgI14.Visible = isVisible; + imgI15.Visible = isVisible; + imgI16.Visible = isVisible; + imgI17.Visible = isVisible; + imgI18.Visible = isVisible; + imgI19.Visible = isVisible; + imgI20.Visible = isVisible; + imgI21.Visible = isVisible; + imgI22.Visible = isVisible; + imgI23.Visible = isVisible; + imgI24.Visible = isVisible; + imgI25.Visible = isVisible; + imgI26.Visible = isVisible; + imgI27.Visible = isVisible; + imgI28.Visible = isVisible; + imgI29.Visible = isVisible; + imgI30.Visible = isVisible; + imgI31.Visible = isVisible; + imgI32.Visible = isVisible; + imgI33.Visible = isVisible; + imgI34.Visible = isVisible; + imgI35.Visible = isVisible; + imgI36.Visible = isVisible; + imgI37.Visible = isVisible; + imgI38.Visible = isVisible; + imgI39.Visible = isVisible; + imgI40.Visible = isVisible; + imgI41.Visible = isVisible; + imgI42.Visible = isVisible; + imgI43.Visible = isVisible; + imgI44.Visible = isVisible; + imgI45.Visible = isVisible; + imgI46.Visible = isVisible; + imgI47.Visible = isVisible; + imgI48.Visible = isVisible; + imgI49.Visible = isVisible; + imgI50.Visible = isVisible; + imgI51.Visible = isVisible; + imgI52.Visible = isVisible; + imgI53.Visible = isVisible; + imgI54.Visible = isVisible; + imgI55.Visible = isVisible; + imgI56.Visible = isVisible; + imgI57.Visible = isVisible; + imgI58.Visible = isVisible; + imgI59.Visible = isVisible; + imgI60.Visible = isVisible; + imgI61.Visible = isVisible; + imgI62.Visible = isVisible; + imgI63.Visible = isVisible; + imgI64.Visible = isVisible; + imgI65.Visible = isVisible; + imgI66.Visible = isVisible; + imgI67.Visible = isVisible; + imgI68.Visible = isVisible; + imgI69.Visible = isVisible; + imgI70.Visible = isVisible; + imgI71.Visible = isVisible; + imgI72.Visible = isVisible; + imgI73.Visible = isVisible; + imgI74.Visible = isVisible; + imgI75.Visible = isVisible; + imgI76.Visible = isVisible; + imgI77.Visible = isVisible; + imgI78.Visible = isVisible; + imgI79.Visible = isVisible; + imgI80.Visible = isVisible; + imgI81.Visible = isVisible; + + lblHoleMsg.Visible = isVisible; + lblHoleOnTop.Visible = isVisible; + + lblBlank6.Visible = isVisible; + } + + private void SetInvMenuVisibility(bool isVisible) { + btnI1.Visible = isVisible; + btnI2.Visible = isVisible; + btnI3.Visible = isVisible; + btnI4.Visible = isVisible; + btnI5.Visible = isVisible; + btnI6.Visible = isVisible; + btnI7.Visible = isVisible; + btnI8.Visible = isVisible; + btnI9.Visible = isVisible; + btnI10.Visible = isVisible; + btnI11.Visible = isVisible; + btnI12.Visible = isVisible; + btnI13.Visible = isVisible; + btnI14.Visible = isVisible; + btnI15.Visible = isVisible; + btnI16.Visible = isVisible; + btnI17.Visible = isVisible; + btnI18.Visible = isVisible; + btnI19.Visible = isVisible; + btnI20.Visible = isVisible; + btnI21.Visible = isVisible; + btnI22.Visible = isVisible; + btnI23.Visible = isVisible; + btnI24.Visible = isVisible; + btnI25.Visible = isVisible; + btnI26.Visible = isVisible; + btnI27.Visible = isVisible; + btnI28.Visible = isVisible; + btnI29.Visible = isVisible; + btnI30.Visible = isVisible; + btnI31.Visible = isVisible; + btnI32.Visible = isVisible; + btnI33.Visible = isVisible; + btnI34.Visible = isVisible; + btnI35.Visible = isVisible; + btnI36.Visible = isVisible; + btnI37.Visible = isVisible; + btnI38.Visible = isVisible; + btnI39.Visible = isVisible; + btnI40.Visible = isVisible; + btnI41.Visible = isVisible; + btnI42.Visible = isVisible; + btnI43.Visible = isVisible; + btnI44.Visible = isVisible; + btnI45.Visible = isVisible; + btnI46.Visible = isVisible; + btnI47.Visible = isVisible; + btnI48.Visible = isVisible; + btnI49.Visible = isVisible; + btnI50.Visible = isVisible; + btnI51.Visible = isVisible; + btnI52.Visible = isVisible; + btnI53.Visible = isVisible; + btnI54.Visible = isVisible; + btnI55.Visible = isVisible; + btnI56.Visible = isVisible; + btnI57.Visible = isVisible; + btnI58.Visible = isVisible; + btnI59.Visible = isVisible; + btnI60.Visible = isVisible; + btnI61.Visible = isVisible; + btnI62.Visible = isVisible; + btnI63.Visible = isVisible; + btnI64.Visible = isVisible; + btnI65.Visible = isVisible; + btnI66.Visible = isVisible; + btnI67.Visible = isVisible; + btnI68.Visible = isVisible; + btnI69.Visible = isVisible; + btnI70.Visible = isVisible; + btnI71.Visible = isVisible; + btnI72.Visible = isVisible; + btnI73.Visible = isVisible; + btnI74.Visible = isVisible; + btnI75.Visible = isVisible; + btnI76.Visible = isVisible; + btnI77.Visible = isVisible; + btnI78.Visible = isVisible; + btnI79.Visible = isVisible; + btnI80.Visible = isVisible; + btnI81.Visible = isVisible; + btnCrafting.Visible = isVisible; + + lblAccessories.Visible = isVisible; + btnA1.Visible = isVisible; + btnA2.Visible = isVisible; + btnA3.Visible = isVisible; + btnA4.Visible = isVisible; + btnA5.Visible = isVisible; + btnA6.Visible = isVisible; + btnA7.Visible = isVisible; + btnA8.Visible = isVisible; + btnA9.Visible = isVisible; + btnA10.Visible = isVisible; + btnA11.Visible = isVisible; + btnA12.Visible = isVisible; + btnA13.Visible = isVisible; + btnA14.Visible = isVisible; + btnA15.Visible = isVisible; + btnA16.Visible = isVisible; + btnA17.Visible = isVisible; + btnA18.Visible = isVisible; + + lblGear.Visible = isVisible; + btnG1.Visible = isVisible; + btnG2.Visible = isVisible; + btnG3.Visible = isVisible; + btnG4.Visible = isVisible; + btnG5.Visible = isVisible; + btnG6.Visible = isVisible; + btnG7.Visible = isVisible; + btnG8.Visible = isVisible; + btnG9.Visible = isVisible; + + imgInfo.Visible = isVisible; + lblInfo.Visible = isVisible; + + lblBlank6.Visible = isVisible; + } + } +} diff --git a/Mundus/Views/Windows/GameWindows/MediumGameWindow.cs b/Mundus/Views/Windows/GameWindows/MediumGameWindow.cs new file mode 100644 index 0000000..6f52768 --- /dev/null +++ b/Mundus/Views/Windows/GameWindows/MediumGameWindow.cs @@ -0,0 +1,1536 @@ +using System; +using Gtk; +using Mundus.Service; +using Mundus.Service.Tiles.Mobs.Controllers; +using Mundus.Service.SuperLayers; +using Mundus.Service.Tiles.Items; +using Mundus.Service.Tiles.Mobs; + +namespace Mundus.Views.Windows.GameWindows { + public partial class MediumGameWindow : Gtk.Window, IGameWindow { + public int Size { get; private set; } + + public MediumGameWindow() : base( Gtk.WindowType.Toplevel ) { + this.Build(); + } + + public void OnDeleteEvent(object o, DeleteEventArgs args) { + //Open exit dialogue if you haven't saved in a while + Application.Quit(); + } + + public void SetDefaults() { + this.Size = 7; + this.SetMapMenuVisibility(false); + this.SetInvMenuVisibility(false); + } + + private void SelectItem(string place, int index) { + if (HasSelection()) { + ResetSelection(); + SwitchItems.ReplaceItems(place, index); + } + else { + selPlace = place; + selIndex = index; + SwitchItems.SetOrigin(place, index); + } + + this.PrintMainMenu(); + this.PrintInventory(); + } + + private void React(int button) { + int buttonYPos = (button - 1) / Size; + int buttonXPos = (button - (buttonYPos * Size)) - 1; + + int mapXPos = Calculate.CalculateXFromButton(buttonXPos, Size); + int mapYPos = Calculate.CalculateYFromButton(buttonYPos, Size); + + if (!HasSelection()) { + MobMovement.MovePlayer(mapYPos, mapXPos, Size); + MobMovement.MoveRandomlyAllMobs(); + } + else { + if (Inventory.GetPlayerItem(selPlace, selIndex) != null) { + if (MobFighting.ExistsFightTargetForPlayer(mapYPos, mapXPos)) { + MobFighting.PlayerTryFight(selPlace, selIndex, mapYPos, mapXPos); + } + else { + MobTerraforming.PlayerTerraformAt(mapYPos, mapXPos, selPlace, selIndex); + } + } + ResetSelection(); + } + + this.PrintScreen(); + this.PrintMainMenu(); + + if (this.MapMenuIsVisible()) { + this.PrintMap(); + } + else if (this.InvMenuIsVisible()) { + this.PrintInventory(); + } + } + + private static string selPlace = null; + private static int selIndex = -1; + private static void ResetSelection() { + selPlace = null; + selIndex = -1; + } + private static bool HasSelection() { + return selPlace != null; + } + + private bool InvMenuIsVisible() { + return btnI1.Visible; + } + + + + private bool MapMenuIsVisible() { + return imgG1.Visible; + } + + // + // PRINTING + // + + public void PrintSelectedItemInfo(ItemTile itemTile) { + if (itemTile != null) { + imgInfo.SetFromStock(itemTile.stock_id, IconSize.Dnd); + lblInfo.Text = itemTile.ToString(); + } + else { + imgInfo.SetFromImage(null, null); + lblInfo.Text = null; + } + } + + public void PrintScreen() { + for (int layer = 0; layer < 3; layer++) { + for (int row = Calculate.CalculateStartY(Size), maxY = Calculate.CalculateMaxY(Size), btn = 1; row <= maxY; row++) { + for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, btn++) { + Image img = ImageController.GetScreenImage(row, col, layer); + + if (img == null) continue; + + switch (btn) { + case 1: btnP1.Image = img; break; + case 2: btnP2.Image = img; break; + case 3: btnP3.Image = img; break; + case 4: btnP4.Image = img; break; + case 5: btnP5.Image = img; break; + case 6: btnP6.Image = img; break; + case 7: btnP7.Image = img; break; + case 8: btnP8.Image = img; break; + case 9: btnP9.Image = img; break; + case 10: btnP10.Image = img; break; + case 11: btnP11.Image = img; break; + case 12: btnP12.Image = img; break; + case 13: btnP13.Image = img; break; + case 14: btnP14.Image = img; break; + case 15: btnP15.Image = img; break; + case 16: btnP16.Image = img; break; + case 17: btnP17.Image = img; break; + case 18: btnP18.Image = img; break; + case 19: btnP19.Image = img; break; + case 20: btnP20.Image = img; break; + case 21: btnP21.Image = img; break; + case 22: btnP22.Image = img; break; + case 23: btnP23.Image = img; break; + case 24: btnP24.Image = img; break; + case 25: btnP25.Image = img; break; + case 26: btnP26.Image = img; break; + case 27: btnP27.Image = img; break; + case 28: btnP28.Image = img; break; + case 29: btnP29.Image = img; break; + case 30: btnP30.Image = img; break; + case 31: btnP31.Image = img; break; + case 32: btnP32.Image = img; break; + case 33: btnP33.Image = img; break; + case 34: btnP34.Image = img; break; + case 35: btnP35.Image = img; break; + case 36: btnP36.Image = img; break; + case 37: btnP37.Image = img; break; + case 38: btnP38.Image = img; break; + case 39: btnP39.Image = img; break; + case 40: btnP40.Image = img; break; + case 41: btnP41.Image = img; break; + case 42: btnP42.Image = img; break; + case 43: btnP43.Image = img; break; + case 44: btnP44.Image = img; break; + case 45: btnP45.Image = img; break; + case 46: btnP46.Image = img; break; + case 47: btnP47.Image = img; break; + case 48: btnP48.Image = img; break; + case 49: btnP49.Image = img; break; + } + } + } + } + } + + public void PrintMainMenu() { + //Print lungs + + //Print health + for (int i = 0; i < Size; i++) { + string iName = MobStatsController.GetPlayerHearth(i); + + switch (i) { + case 0: imgS8.SetFromStock(iName, IconSize.Dnd); break; + case 1: imgS9.SetFromStock(iName, IconSize.Dnd); break; + case 2: imgS10.SetFromStock(iName, IconSize.Dnd); break; + case 3: imgS11.SetFromStock(iName, IconSize.Dnd); break; + case 4: imgS12.SetFromStock(iName, IconSize.Dnd); break; + case 5: imgS13.SetFromStock(iName, IconSize.Dnd); break; + case 6: imgS14.SetFromStock(iName, IconSize.Dnd); break; + } + } + + //Prints hotbar + for (int i = 0; i < Size; i++) { + Image img = ImageController.GetPlayerHotbarImage(i); + + switch (i) { + case 0: btnH1.Image = img; break; + case 1: btnH2.Image = img; break; + case 2: btnH3.Image = img; break; + case 3: btnH4.Image = img; break; + case 4: btnH5.Image = img; break; + case 5: btnH6.Image = img; break; + case 6: btnH7.Image = img; break; + } + } + + //Prints log + for (int i = 0, mIndex = LogController.GetCount() - 1; i < Size; mIndex--, i++) { + string msg = LogController.GetMessagage(mIndex); + + switch (i) { + case 0: lblLog1.Text = msg; break; + case 1: lblLog2.Text = msg; break; + case 2: lblLog3.Text = msg; break; + case 3: lblLog4.Text = msg; break; + case 4: lblLog5.Text = msg; break; + case 5: lblLog6.Text = msg; break; + } + } + } + + 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++) { + for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, img++) { + string sName = ImageController.GetPlayerGroundImage(row, col).Stock; + + switch (img) { + case 1: imgG1.SetFromStock(sName, IconSize.Dnd); break; + case 2: imgG2.SetFromStock(sName, IconSize.Dnd); break; + case 3: imgG3.SetFromStock(sName, IconSize.Dnd); break; + case 4: imgG4.SetFromStock(sName, IconSize.Dnd); break; + case 5: imgG5.SetFromStock(sName, IconSize.Dnd); break; + case 6: imgG6.SetFromStock(sName, IconSize.Dnd); break; + case 7: imgG7.SetFromStock(sName, IconSize.Dnd); break; + case 8: imgG8.SetFromStock(sName, IconSize.Dnd); break; + case 9: imgG9.SetFromStock(sName, IconSize.Dnd); break; + case 10: imgG10.SetFromStock(sName, IconSize.Dnd); break; + case 11: imgG11.SetFromStock(sName, IconSize.Dnd); break; + case 12: imgG12.SetFromStock(sName, IconSize.Dnd); break; + case 13: imgG13.SetFromStock(sName, IconSize.Dnd); break; + case 14: imgG14.SetFromStock(sName, IconSize.Dnd); break; + case 15: imgG15.SetFromStock(sName, IconSize.Dnd); break; + case 16: imgG16.SetFromStock(sName, IconSize.Dnd); break; + case 17: imgG17.SetFromStock(sName, IconSize.Dnd); break; + case 18: imgG18.SetFromStock(sName, IconSize.Dnd); break; + case 19: imgG19.SetFromStock(sName, IconSize.Dnd); break; + case 20: imgG20.SetFromStock(sName, IconSize.Dnd); break; + case 21: imgG21.SetFromStock(sName, IconSize.Dnd); break; + case 22: imgG22.SetFromStock(sName, IconSize.Dnd); break; + case 23: imgG23.SetFromStock(sName, IconSize.Dnd); break; + case 24: imgG24.SetFromStock(sName, IconSize.Dnd); break; + case 25: imgG25.SetFromStock(sName, IconSize.Dnd); break; + case 26: imgG26.SetFromStock(sName, IconSize.Dnd); break; + case 27: imgG27.SetFromStock(sName, IconSize.Dnd); break; + case 28: imgG28.SetFromStock(sName, IconSize.Dnd); break; + case 29: imgG29.SetFromStock(sName, IconSize.Dnd); break; + case 30: imgG30.SetFromStock(sName, IconSize.Dnd); break; + case 31: imgG31.SetFromStock(sName, IconSize.Dnd); break; + case 32: imgG32.SetFromStock(sName, IconSize.Dnd); break; + case 33: imgG33.SetFromStock(sName, IconSize.Dnd); break; + case 34: imgG34.SetFromStock(sName, IconSize.Dnd); break; + case 35: imgG35.SetFromStock(sName, IconSize.Dnd); break; + case 36: imgG36.SetFromStock(sName, IconSize.Dnd); break; + case 37: imgG37.SetFromStock(sName, IconSize.Dnd); break; + case 38: imgG38.SetFromStock(sName, IconSize.Dnd); break; + case 39: imgG39.SetFromStock(sName, IconSize.Dnd); break; + case 40: imgG40.SetFromStock(sName, IconSize.Dnd); break; + case 41: imgG41.SetFromStock(sName, IconSize.Dnd); break; + case 42: imgG42.SetFromStock(sName, IconSize.Dnd); break; + case 43: imgG43.SetFromStock(sName, IconSize.Dnd); break; + case 44: imgG44.SetFromStock(sName, IconSize.Dnd); break; + case 45: imgG45.SetFromStock(sName, IconSize.Dnd); break; + case 46: imgG46.SetFromStock(sName, IconSize.Dnd); break; + case 47: imgG47.SetFromStock(sName, IconSize.Dnd); break; + case 48: imgG48.SetFromStock(sName, IconSize.Dnd); break; + case 49: imgG49.SetFromStock(sName, IconSize.Dnd); break; + } + } + } + + lblSuperLayer.Text = MobStatsController.GetPlayerSuperLayerName(); + lblCoord1.Text = "X: " + MobStatsController.GetPlayerXCoord(); + lblCoord2.Text = "Y: " + MobStatsController.GetPlayerYCoord(); + + //Prints the "Item layer" in map menu + for (int row = Calculate.CalculateStartY(Size), maxY = Calculate.CalculateMaxY(Size), img = 1; row <= maxY; row++) { + for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, img++) { + string sName = ImageController.GetPlayerStructureImage(row, col).Stock; + + switch (img) { + case 1: imgI1.SetFromStock(sName, IconSize.Dnd); break; + case 2: imgI2.SetFromStock(sName, IconSize.Dnd); break; + case 3: imgI3.SetFromStock(sName, IconSize.Dnd); break; + case 4: imgI4.SetFromStock(sName, IconSize.Dnd); break; + case 5: imgI5.SetFromStock(sName, IconSize.Dnd); break; + case 6: imgI6.SetFromStock(sName, IconSize.Dnd); break; + case 7: imgI7.SetFromStock(sName, IconSize.Dnd); break; + case 8: imgI8.SetFromStock(sName, IconSize.Dnd); break; + case 9: imgI9.SetFromStock(sName, IconSize.Dnd); break; + case 10: imgI10.SetFromStock(sName, IconSize.Dnd); break; + case 11: imgI11.SetFromStock(sName, IconSize.Dnd); break; + case 12: imgI12.SetFromStock(sName, IconSize.Dnd); break; + case 13: imgI13.SetFromStock(sName, IconSize.Dnd); break; + case 14: imgI14.SetFromStock(sName, IconSize.Dnd); break; + case 15: imgI15.SetFromStock(sName, IconSize.Dnd); break; + case 16: imgI16.SetFromStock(sName, IconSize.Dnd); break; + case 17: imgI17.SetFromStock(sName, IconSize.Dnd); break; + case 18: imgI18.SetFromStock(sName, IconSize.Dnd); break; + case 19: imgI19.SetFromStock(sName, IconSize.Dnd); break; + case 20: imgI20.SetFromStock(sName, IconSize.Dnd); break; + case 21: imgI21.SetFromStock(sName, IconSize.Dnd); break; + case 22: imgI22.SetFromStock(sName, IconSize.Dnd); break; + case 23: imgI23.SetFromStock(sName, IconSize.Dnd); break; + case 24: imgI24.SetFromStock(sName, IconSize.Dnd); break; + case 25: imgI25.SetFromStock(sName, IconSize.Dnd); break; + case 26: imgI26.SetFromStock(sName, IconSize.Dnd); break; + case 27: imgI27.SetFromStock(sName, IconSize.Dnd); break; + case 28: imgI28.SetFromStock(sName, IconSize.Dnd); break; + case 29: imgI29.SetFromStock(sName, IconSize.Dnd); break; + case 30: imgI30.SetFromStock(sName, IconSize.Dnd); break; + case 31: imgI31.SetFromStock(sName, IconSize.Dnd); break; + case 32: imgI32.SetFromStock(sName, IconSize.Dnd); break; + case 33: imgI33.SetFromStock(sName, IconSize.Dnd); break; + case 34: imgI34.SetFromStock(sName, IconSize.Dnd); break; + case 35: imgI35.SetFromStock(sName, IconSize.Dnd); break; + case 36: imgI36.SetFromStock(sName, IconSize.Dnd); break; + case 37: imgI37.SetFromStock(sName, IconSize.Dnd); break; + case 38: imgI38.SetFromStock(sName, IconSize.Dnd); break; + case 39: imgI39.SetFromStock(sName, IconSize.Dnd); break; + case 40: imgI40.SetFromStock(sName, IconSize.Dnd); break; + case 41: imgI41.SetFromStock(sName, IconSize.Dnd); break; + case 42: imgI42.SetFromStock(sName, IconSize.Dnd); break; + case 43: imgI43.SetFromStock(sName, IconSize.Dnd); break; + case 44: imgI44.SetFromStock(sName, IconSize.Dnd); break; + case 45: imgI45.SetFromStock(sName, IconSize.Dnd); break; + case 46: imgI46.SetFromStock(sName, IconSize.Dnd); break; + case 47: imgI47.SetFromStock(sName, IconSize.Dnd); break; + case 48: imgI48.SetFromStock(sName, IconSize.Dnd); break; + case 49: imgI49.SetFromStock(sName, IconSize.Dnd); break; + } + } + } + + lblHoleOnTop.Text = MobStatsController.ExistsHoleOnTopOfPlayer() + ""; + } + + public void PrintInventory() { + //Prints the actual inventory (items) + for (int row = 0; row < Size; row++) { + for (int col = 0; col < Size; col++) { + Image img = ImageController.GetPlayerInventoryItemImage(row * Size + col); + + switch (row * Size + col + 1) { + case 1: btnI1.Image = img; break; + case 2: btnI2.Image = img; break; + case 3: btnI3.Image = img; break; + case 4: btnI4.Image = img; break; + case 5: btnI5.Image = img; break; + case 6: btnI6.Image = img; break; + case 7: btnI7.Image = img; break; + case 8: btnI8.Image = img; break; + case 9: btnI9.Image = img; break; + case 10: btnI10.Image = img; break; + case 11: btnI11.Image = img; break; + case 12: btnI12.Image = img; break; + case 13: btnI13.Image = img; break; + case 14: btnI14.Image = img; break; + case 15: btnI15.Image = img; break; + case 16: btnI16.Image = img; break; + case 17: btnI17.Image = img; break; + case 18: btnI18.Image = img; break; + case 19: btnI19.Image = img; break; + case 20: btnI20.Image = img; break; + case 21: btnI21.Image = img; break; + case 22: btnI22.Image = img; break; + case 23: btnI23.Image = img; break; + case 24: btnI24.Image = img; break; + case 25: btnI25.Image = img; break; + case 26: btnI26.Image = img; break; + case 27: btnI27.Image = img; break; + case 28: btnI28.Image = img; break; + case 29: btnI29.Image = img; break; + case 30: btnI30.Image = img; break; + case 31: btnI31.Image = img; break; + case 32: btnI32.Image = img; break; + case 33: btnI33.Image = img; break; + case 34: btnI34.Image = img; break; + case 35: btnI35.Image = img; break; + case 36: btnI36.Image = img; break; + case 37: btnI37.Image = img; break; + case 38: btnI38.Image = img; break; + case 39: btnI39.Image = img; break; + case 40: btnI40.Image = img; break; + case 41: btnI41.Image = img; break; + case 42: btnI42.Image = img; break; + case 43: btnI43.Image = img; break; + case 44: btnI44.Image = img; break; + case 45: btnI45.Image = img; break; + case 46: btnI46.Image = img; break; + case 47: btnI47.Image = img; break; + case 48: btnI48.Image = img; break; + case 49: btnI49.Image = img; break; + } + } + } + + //Prints accessories + for (int row = 0; row < 2; row++) { + for (int col = 0; col < Size; col++) { + Image img = ImageController.GetPlayerAccessoryImage(row * Size + col); + + switch (row * Size + col + 1) { + case 1: btnA1.Image = img; break; + case 2: btnA2.Image = img; break; + case 3: btnA3.Image = img; break; + case 4: btnA4.Image = img; break; + case 5: btnA5.Image = img; break; + case 6: btnA6.Image = img; break; + case 7: btnA7.Image = img; break; + case 8: btnA8.Image = img; break; + case 9: btnA9.Image = img; break; + case 10: btnA10.Image = img; break; + case 11: btnA11.Image = img; break; + case 12: btnA12.Image = img; break; + case 13: btnA13.Image = img; break; + case 14: btnA14.Image = img; break; + } + } + } + + //Prints gear + for (int i = 0; i < Size; i++) { + Image img = ImageController.GetPlayerGearImage(i); + + switch (i + 1) { + case 1: btnG1.Image = img; break; + case 2: btnG2.Image = img; break; + case 3: btnG3.Image = img; break; + case 4: btnG4.Image = img; break; + case 5: btnG5.Image = img; break; + case 6: btnG6.Image = img; break; + case 7: btnG7.Image = img; break; + } + } + } + + // + // BUTTON CLICKED EVENTS + // + + protected void OnBtnMapClicked(object sender, EventArgs e) { + //Hide inv menu, if it is visible (so only one of the two is visible) + if (this.InvMenuIsVisible()) this.OnBtnInvClicked(this, null); + + if (this.MapMenuIsVisible()) { + this.SetMapMenuVisibility(false); + } + else { + this.PrintMap(); + this.SetMapMenuVisibility(true); + } + } + + protected void OnBtnInvClicked(object sender, EventArgs e) { + //Hide map menu, if it is visible (so only one of the two is visible) + if (this.MapMenuIsVisible()) this.OnBtnMapClicked(this, null); + + if (btnI1.Visible) { + this.SetInvMenuVisibility(false); + } + else { + this.PrintInventory(); + this.SetInvMenuVisibility(true); + } + } + + protected void OnBtnPauseClicked(object sender, EventArgs e) { + // Note: pause window blocks player input + WindowController.ShowPauseWindow(); + } + + protected void OnBtnMusicClicked(object sender, EventArgs e) { + WindowController.ShowMusicWindow(); + } + + + protected void OnBtnCraftingClicked(object sender, EventArgs e) { + WindowController.ShowCraftingWindow(); + } + + // Screen buttons + protected void OnBtnP1Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(1); + } + } + + protected void OnBtnP2Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(2); + } + } + + protected void OnBtnP3Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(3); + } + } + + protected void OnBtnP4Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(4); + } + } + + protected void OnBtnP5Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(5); + } + } + + protected void OnBtnP6Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(6); + } + } + + protected void OnBtnP7Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(7); + } + } + + protected void OnBtnP8Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(8); + } + } + + protected void OnBtnP9Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(9); + } + } + + protected void OnBtnP10Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(10); + } + } + + protected void OnBtnP11Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(11); + } + } + + protected void OnBtnP12Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(12); + } + } + + protected void OnBtnP13Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(13); + } + } + + protected void OnBtnP14Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(14); + } + } + + protected void OnBtnP15Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(15); + } + } + + protected void OnBtnP16Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(16); + } + } + + protected void OnBtnP17Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(17); + } + } + + protected void OnBtnP18Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(18); + } + } + + protected void OnBtnP19Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(19); + } + } + + protected void OnBtnP20Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(20); + } + } + + protected void OnBtnP21Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(21); + } + } + + protected void OnBtnP22Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(22); + } + } + + protected void OnBtnP23Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(23); + } + } + + protected void OnBtnP24Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(24); + } + } + + protected void OnBtnP25Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(25); + } + } + + protected void OnBtnP26Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(26); + } + } + + protected void OnBtnP27Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(27); + } + } + + protected void OnBtnP28Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(28); + } + } + + protected void OnBtnP29Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(29); + } + } + + protected void OnBtnP30Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(30); + } + } + + protected void OnBtnP31Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(31); + } + } + + protected void OnBtnP32Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(32); + } + } + + protected void OnBtnP33Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(33); + } + } + + protected void OnBtnP34Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(34); + } + } + + protected void OnBtnP35Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(35); + } + } + + protected void OnBtnP36Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(36); + } + } + + protected void OnBtnP37Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(37); + } + } + + protected void OnBtnP38Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(38); + } + } + + protected void OnBtnP39Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(39); + } + } + + protected void OnBtnP40Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(40); + } + } + + protected void OnBtnP41Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(41); + } + } + + protected void OnBtnP42Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(42); + } + } + + protected void OnBtnP43Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(43); + } + } + + protected void OnBtnP44Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(44); + } + } + + protected void OnBtnP45Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(45); + } + } + + protected void OnBtnP46Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(46); + } + } + + protected void OnBtnP47Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(47); + } + } + + protected void OnBtnP48Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(48); + } + } + + protected void OnBtnP49Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(49); + } + } + + // Hotbar buttons + protected void OnBtnH1Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 0); + this.PrintMainMenu(); + } + } + + protected void OnBtnH2Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 1); + this.PrintMainMenu(); + } + } + + protected void OnBtnH3Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 2); + this.PrintMainMenu(); + } + } + + protected void OnBtnH4Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 3); + this.PrintMainMenu(); + } + } + + protected void OnBtnH5Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 4); + this.PrintMainMenu(); + } + } + + protected void OnBtnH6Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 5); + this.PrintMainMenu(); + } + } + + protected void OnBtnH7Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 6); + this.PrintMainMenu(); + } + } + + protected void OnBtnLogClicked(object sender, EventArgs e) { + WindowController.ShowLogWindow(); + } + + // Inventory (items) buttons + protected void OnBtnI1Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 0); + this.PrintInventory(); + } + } + + protected void OnBtnI2Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 1); + this.PrintInventory(); + } + } + + protected void OnBtnI3Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 2); + this.PrintInventory(); + } + } + + protected void OnBtnI4Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 3); + this.PrintInventory(); + } + } + + protected void OnBtnI5Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 4); + this.PrintInventory(); + } + } + + protected void OnBtnI6Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 5); + this.PrintInventory(); + } + } + + protected void OnBtnI7Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 6); + this.PrintInventory(); + } + } + + protected void OnBtnI8Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 7); + this.PrintInventory(); + } + } + + protected void OnBtnI9Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 8); + this.PrintInventory(); + } + } + + protected void OnBtnI10Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 9); + this.PrintInventory(); + } + } + + protected void OnBtnI11Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 10); + this.PrintInventory(); + } + } + + protected void OnBtnI12Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 11); + this.PrintInventory(); + } + } + + protected void OnBtnI13Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 12); + this.PrintInventory(); + } + } + + protected void OnBtnI14Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 13); + this.PrintInventory(); + } + } + + protected void OnBtnI15Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 14); + this.PrintInventory(); + } + } + + protected void OnBtnI16Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 15); + this.PrintInventory(); + } + } + + protected void OnBtnI17Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 16); + this.PrintInventory(); + } + } + + protected void OnBtnI18Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 17); + this.PrintInventory(); + } + } + + protected void OnBtnI19Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 18); + this.PrintInventory(); + } + } + + protected void OnBtnI20Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 19); + this.PrintInventory(); + } + } + + protected void OnBtnI21Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 20); + this.PrintInventory(); + } + } + + protected void OnBtnI22Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 21); + this.PrintInventory(); + } + } + + protected void OnBtnI23Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 22); + this.PrintInventory(); + } + } + + protected void OnBtnI24Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 23); + this.PrintInventory(); + } + } + + protected void OnBtnI25Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 24); + this.PrintInventory(); + } + } + + protected void OnBtnI26Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 25); + this.PrintInventory(); + } + } + + protected void OnBtnI27Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 26); + this.PrintInventory(); + } + } + + protected void OnBtnI28Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 27); + this.PrintInventory(); + } + } + + protected void OnBtnI29Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 28); + this.PrintInventory(); + } + } + + protected void OnBtnI30Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 29); + this.PrintInventory(); + } + } + + protected void OnBtnI31Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 30); + this.PrintInventory(); + } + } + + protected void OnBtnI32Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 31); + this.PrintInventory(); + } + } + + protected void OnBtnI33Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 32); + this.PrintInventory(); + } + } + + protected void OnBtnI34Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 33); + this.PrintInventory(); + } + } + + protected void OnBtnI35Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 34); + this.PrintInventory(); + } + } + + protected void OnBtnI36Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 35); + this.PrintInventory(); + } + } + + protected void OnBtnI37Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 36); + this.PrintInventory(); + } + } + + protected void OnBtnI38Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 37); + this.PrintInventory(); + } + } + + protected void OnBtnI39Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 38); + this.PrintInventory(); + } + } + + protected void OnBtnI40Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 39); + this.PrintInventory(); + } + } + + protected void OnBtnI41Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 40); + this.PrintInventory(); + } + } + + protected void OnBtnI42Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 41); + this.PrintInventory(); + } + } + + protected void OnBtnI43Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 42); + this.PrintInventory(); + } + } + + protected void OnBtnI44Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 43); + this.PrintInventory(); + } + } + + protected void OnBtnI45Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 44); + this.PrintInventory(); + } + } + + protected void OnBtnI46Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 45); + this.PrintInventory(); + } + } + + protected void OnBtnI47Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 46); + this.PrintInventory(); + } + } + + protected void OnBtnI48Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 47); + this.PrintInventory(); + } + } + + protected void OnBtnI49Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 48); + this.PrintInventory(); + } + } + + // Accessories buttons + protected void OnBtnA1Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 0); + this.PrintInventory(); + } + } + + protected void OnBtnA2Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 1); + this.PrintInventory(); + } + } + + protected void OnBtnA3Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 2); + this.PrintInventory(); + } + } + + protected void OnBtnA4Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 3); + this.PrintInventory(); + } + } + + protected void OnBtnA5Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 4); + this.PrintInventory(); + } + } + + protected void OnBtnA6Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 5); + this.PrintInventory(); + } + } + + protected void OnBtnA7Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 6); + this.PrintInventory(); + } + } + + protected void OnBtnA8Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 7); + this.PrintInventory(); + } + } + + protected void OnBtnA9Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 8); + this.PrintInventory(); + } + } + + protected void OnBtnA10Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 9); + this.PrintInventory(); + } + } + + protected void OnBtnA11Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 10); + this.PrintInventory(); + } + } + + protected void OnBtnA12Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 11); + this.PrintInventory(); + } + } + + protected void OnBtnA13Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 12); + this.PrintInventory(); + } + } + + protected void OnBtnA14Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 13); + this.PrintInventory(); + } + } + + // Gear buttons + protected void OnBtnG1Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 0); + this.PrintInventory(); + } + } + + protected void OnBtnG2Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 1); + this.PrintInventory(); + } + } + + protected void OnBtnG3Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 2); + this.PrintInventory(); + } + } + + protected void OnBtnG4Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 3); + this.PrintInventory(); + } + } + + protected void OnBtnG5Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 4); + this.PrintInventory(); + } + } + + protected void OnBtnG6Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 5); + this.PrintInventory(); + } + } + + protected void OnBtnG7Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 6); + this.PrintInventory(); + } + } + + // + // VISIBILITY + // + + private void SetMapMenuVisibility(bool isVisible) { + lblGroundLayer.Visible = isVisible; + imgG1.Visible = isVisible; + imgG2.Visible = isVisible; + imgG3.Visible = isVisible; + imgG4.Visible = isVisible; + imgG5.Visible = isVisible; + imgG6.Visible = isVisible; + imgG7.Visible = isVisible; + imgG8.Visible = isVisible; + imgG9.Visible = isVisible; + imgG10.Visible = isVisible; + imgG11.Visible = isVisible; + imgG12.Visible = isVisible; + imgG13.Visible = isVisible; + imgG14.Visible = isVisible; + imgG15.Visible = isVisible; + imgG16.Visible = isVisible; + imgG17.Visible = isVisible; + imgG18.Visible = isVisible; + imgG19.Visible = isVisible; + imgG20.Visible = isVisible; + imgG21.Visible = isVisible; + imgG22.Visible = isVisible; + imgG23.Visible = isVisible; + imgG24.Visible = isVisible; + imgG25.Visible = isVisible; + imgG26.Visible = isVisible; + imgG27.Visible = isVisible; + imgG28.Visible = isVisible; + imgG29.Visible = isVisible; + imgG30.Visible = isVisible; + imgG31.Visible = isVisible; + imgG32.Visible = isVisible; + imgG33.Visible = isVisible; + imgG34.Visible = isVisible; + imgG35.Visible = isVisible; + imgG36.Visible = isVisible; + imgG37.Visible = isVisible; + imgG38.Visible = isVisible; + imgG39.Visible = isVisible; + imgG40.Visible = isVisible; + imgG41.Visible = isVisible; + imgG42.Visible = isVisible; + imgG43.Visible = isVisible; + imgG44.Visible = isVisible; + imgG45.Visible = isVisible; + imgG46.Visible = isVisible; + imgG47.Visible = isVisible; + imgG48.Visible = isVisible; + imgG49.Visible = isVisible; + + lblSuperLayer.Visible = isVisible; + lblCoord1.Visible = isVisible; + lblCoord2.Visible = isVisible; + + lblItemLayer.Visible = isVisible; + imgI1.Visible = isVisible; + imgI2.Visible = isVisible; + imgI3.Visible = isVisible; + imgI4.Visible = isVisible; + imgI5.Visible = isVisible; + imgI6.Visible = isVisible; + imgI7.Visible = isVisible; + imgI8.Visible = isVisible; + imgI9.Visible = isVisible; + imgI10.Visible = isVisible; + imgI11.Visible = isVisible; + imgI12.Visible = isVisible; + imgI13.Visible = isVisible; + imgI14.Visible = isVisible; + imgI15.Visible = isVisible; + imgI16.Visible = isVisible; + imgI17.Visible = isVisible; + imgI18.Visible = isVisible; + imgI19.Visible = isVisible; + imgI20.Visible = isVisible; + imgI21.Visible = isVisible; + imgI22.Visible = isVisible; + imgI23.Visible = isVisible; + imgI24.Visible = isVisible; + imgI25.Visible = isVisible; + imgI26.Visible = isVisible; + imgI27.Visible = isVisible; + imgI28.Visible = isVisible; + imgI29.Visible = isVisible; + imgI30.Visible = isVisible; + imgI31.Visible = isVisible; + imgI32.Visible = isVisible; + imgI33.Visible = isVisible; + imgI34.Visible = isVisible; + imgI35.Visible = isVisible; + imgI36.Visible = isVisible; + imgI37.Visible = isVisible; + imgI38.Visible = isVisible; + imgI39.Visible = isVisible; + imgI40.Visible = isVisible; + imgI41.Visible = isVisible; + imgI42.Visible = isVisible; + imgI43.Visible = isVisible; + imgI44.Visible = isVisible; + imgI45.Visible = isVisible; + imgI46.Visible = isVisible; + imgI47.Visible = isVisible; + imgI48.Visible = isVisible; + imgI49.Visible = isVisible; + + lblHoleMsg.Visible = isVisible; + lblHoleOnTop.Visible = isVisible; + + lblBlank6.Visible = isVisible; + } + + private void SetInvMenuVisibility(bool isVisible) { + btnI1.Visible = isVisible; + btnI2.Visible = isVisible; + btnI3.Visible = isVisible; + btnI4.Visible = isVisible; + btnI5.Visible = isVisible; + btnI6.Visible = isVisible; + btnI7.Visible = isVisible; + btnI8.Visible = isVisible; + btnI9.Visible = isVisible; + btnI10.Visible = isVisible; + btnI11.Visible = isVisible; + btnI12.Visible = isVisible; + btnI13.Visible = isVisible; + btnI14.Visible = isVisible; + btnI15.Visible = isVisible; + btnI16.Visible = isVisible; + btnI17.Visible = isVisible; + btnI18.Visible = isVisible; + btnI19.Visible = isVisible; + btnI20.Visible = isVisible; + btnI21.Visible = isVisible; + btnI22.Visible = isVisible; + btnI23.Visible = isVisible; + btnI24.Visible = isVisible; + btnI25.Visible = isVisible; + btnI26.Visible = isVisible; + btnI27.Visible = isVisible; + btnI28.Visible = isVisible; + btnI29.Visible = isVisible; + btnI30.Visible = isVisible; + btnI31.Visible = isVisible; + btnI32.Visible = isVisible; + btnI33.Visible = isVisible; + btnI34.Visible = isVisible; + btnI35.Visible = isVisible; + btnI36.Visible = isVisible; + btnI37.Visible = isVisible; + btnI38.Visible = isVisible; + btnI39.Visible = isVisible; + btnI40.Visible = isVisible; + btnI41.Visible = isVisible; + btnI42.Visible = isVisible; + btnI43.Visible = isVisible; + btnI44.Visible = isVisible; + btnI45.Visible = isVisible; + btnI46.Visible = isVisible; + btnI47.Visible = isVisible; + btnI48.Visible = isVisible; + btnI49.Visible = isVisible; + btnCrafting.Visible = isVisible; + + lblAccessories.Visible = isVisible; + btnA1.Visible = isVisible; + btnA2.Visible = isVisible; + btnA3.Visible = isVisible; + btnA4.Visible = isVisible; + btnA5.Visible = isVisible; + btnA6.Visible = isVisible; + btnA7.Visible = isVisible; + btnA8.Visible = isVisible; + btnA9.Visible = isVisible; + btnA10.Visible = isVisible; + btnA11.Visible = isVisible; + btnA12.Visible = isVisible; + btnA13.Visible = isVisible; + btnA14.Visible = isVisible; + + lblGear.Visible = isVisible; + btnG1.Visible = isVisible; + btnG2.Visible = isVisible; + btnG3.Visible = isVisible; + btnG4.Visible = isVisible; + btnG5.Visible = isVisible; + btnG6.Visible = isVisible; + btnG7.Visible = isVisible; + + imgInfo.Visible = isVisible; + lblInfo.Visible = isVisible; + + lblBlank6.Visible = isVisible; + } + } +} diff --git a/Mundus/Views/Windows/GameWindows/SmallGameWindow.cs b/Mundus/Views/Windows/GameWindows/SmallGameWindow.cs new file mode 100644 index 0000000..bf07401 --- /dev/null +++ b/Mundus/Views/Windows/GameWindows/SmallGameWindow.cs @@ -0,0 +1,959 @@ +using System; +using Gtk; +using Mundus.Service; +using Mundus.Service.Tiles.Mobs.Controllers; +using Mundus.Service.SuperLayers; +using Mundus.Service.Tiles.Items; +using Mundus.Service.Tiles.Mobs; + +namespace Mundus.Views.Windows.GameWindows { + public partial class SmallGameWindow : Gtk.Window, IGameWindow { + /*Value for the height and width of the game screen, map screens and inventory screen + *and the width of stats, hotbar, accessories, gear & items on the ground menus*/ + public int Size { get; private set; } + + public SmallGameWindow() : base( Gtk.WindowType.Toplevel ) { + this.Build(); + } + + public void OnDeleteEvent(object o, Gtk.DeleteEventArgs args) { + //Open exit dialogue if you haven't saved in a while + //if () { //TODO: check if you have saved + // //TODO: pause game cycle + + // ResponseType rt = (ResponseType)DI.DExit.Run(); + // DI.DExit.Hide(); + + // if(rt == ResponseType.Cancel || rt == ResponseType.DeleteEvent) { + // //cancel the exit procedure and keep the window open + // args.RetVal = true; + // return; + // } + // else if (rt == ResponseType.Accept) { + // //TODO: call code for saving the game + // } + //} + + Application.Quit(); + } + + public void SetDefaults() { + this.Size = 5; + this.SetMapMenuVisibility(false); + this.SetInvMenuVisibility(false); + } + + private void SelectItem(string place, int index) { + if (HasSelection()) { + ResetSelection(); + SwitchItems.ReplaceItems(place, index); + } + else { + selPlace = place; + selIndex = index; + SwitchItems.SetOrigin(place, index); + } + + this.PrintMainMenu(); + this.PrintInventory(); + } + + private void React(int button) { + int buttonYPos = (button - 1) / Size; + int buttonXPos = (button - (buttonYPos * Size)) - 1; + + int mapXPos = Calculate.CalculateXFromButton(buttonXPos, Size); + int mapYPos = Calculate.CalculateYFromButton(buttonYPos, Size); + + if (!HasSelection()) { + MobMovement.MovePlayer(mapYPos, mapXPos, Size); + MobMovement.MoveRandomlyAllMobs(); + } + else { + if (Inventory.GetPlayerItem(selPlace, selIndex) != null) { + if (MobFighting.ExistsFightTargetForPlayer(mapYPos, mapXPos)) { + MobFighting.PlayerTryFight(selPlace, selIndex, mapYPos, mapXPos); + } + else { + MobTerraforming.PlayerTerraformAt(mapYPos, mapXPos, selPlace, selIndex); + } + } + ResetSelection(); + } + + this.PrintScreen(); + this.PrintMainMenu(); + + if (this.MapMenuIsVisible()) { + this.PrintMap(); + } + else if (this.InvMenuIsVisible()) { + this.PrintInventory(); + } + } + + private static string selPlace = null; + private static int selIndex = -1; + private static void ResetSelection() { + selPlace = null; + selIndex = -1; + } + private static bool HasSelection() { + return selPlace != null; + } + + private bool MapMenuIsVisible() { + return imgG1.Visible; + } + + + private bool InvMenuIsVisible() { + return btnI1.Visible; + } + + // + // PRINTING + // + + public void PrintSelectedItemInfo(ItemTile itemTile) { + if (itemTile != null) { + imgInfo.SetFromStock(itemTile.stock_id, IconSize.Dnd); + lblInfo.Text = itemTile.ToString(); + } + else { + imgInfo.SetFromImage(null, null); + lblInfo.Text = null; + } + } + + public void PrintScreen() { + for (int layer = 0; layer < 3; layer++) { + for (int row = Calculate.CalculateStartY(Size), maxY = Calculate.CalculateMaxY(Size), btn = 1; row <= maxY; row++) { + for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, btn++) { + Image img = ImageController.GetScreenImage(row, col, layer); + + if (img == null) continue; + + switch (btn) { + case 1: btnP1.Image = img; break; + case 2: btnP2.Image = img; break; + case 3: btnP3.Image = img; break; + case 4: btnP4.Image = img; break; + case 5: btnP5.Image = img; break; + case 6: btnP6.Image = img; break; + case 7: btnP7.Image = img; break; + case 8: btnP8.Image = img; break; + case 9: btnP9.Image = img; break; + case 10: btnP10.Image = img; break; + case 11: btnP11.Image = img; break; + case 12: btnP12.Image = img; break; + case 13: btnP13.Image = img; break; + case 14: btnP14.Image = img; break; + case 15: btnP15.Image = img; break; + case 16: btnP16.Image = img; break; + case 17: btnP17.Image = img; break; + case 18: btnP18.Image = img; break; + case 19: btnP19.Image = img; break; + case 20: btnP20.Image = img; break; + case 21: btnP21.Image = img; break; + case 22: btnP22.Image = img; break; + case 23: btnP23.Image = img; break; + case 24: btnP24.Image = img; break; + case 25: btnP25.Image = img; break; + } + } + } + } + } + + /// + /// Prints the lung capacity, health, hotbar items and event log + /// + public void PrintMainMenu() { + //Print lungs + + //Print health + for (int i = 0; i < Size; i++) { + string iName = MobStatsController.GetPlayerHearth(i); + + switch (i) { + case 0: imgS6.SetFromStock(iName, IconSize.Dnd); break; + case 1: imgS7.SetFromStock(iName, IconSize.Dnd); break; + case 2: imgS8.SetFromStock(iName, IconSize.Dnd); break; + case 3: imgS9.SetFromStock(iName, IconSize.Dnd); break; + case 4: imgS10.SetFromStock(iName, IconSize.Dnd); break; + } + } + + //Prints hotbar + for (int i = 0; i < Size; i++) { + Image img = ImageController.GetPlayerHotbarImage(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 log + for (int i = 0, mIndex = LogController.GetCount() - 1; i < Size; mIndex--, i++) { + string msg = LogController.GetMessagage(mIndex); + + switch(i) { + case 0: lblLog1.Text = msg; break; + case 1: lblLog2.Text = msg; break; + case 2: lblLog3.Text = msg; break; + case 3: lblLog4.Text = msg; break; + } + } + } + + 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++) { + for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, img++) { + string sName = ImageController.GetPlayerGroundImage(row, col).Stock; + + switch (img) { + case 1: imgG1.SetFromStock(sName, IconSize.Dnd); break; + case 2: imgG2.SetFromStock(sName, IconSize.Dnd); break; + case 3: imgG3.SetFromStock(sName, IconSize.Dnd); break; + case 4: imgG4.SetFromStock(sName, IconSize.Dnd); break; + case 5: imgG5.SetFromStock(sName, IconSize.Dnd); break; + case 6: imgG6.SetFromStock(sName, IconSize.Dnd); break; + case 7: imgG7.SetFromStock(sName, IconSize.Dnd); break; + case 8: imgG8.SetFromStock(sName, IconSize.Dnd); break; + case 9: imgG9.SetFromStock(sName, IconSize.Dnd); break; + case 10: imgG10.SetFromStock(sName, IconSize.Dnd); break; + case 11: imgG11.SetFromStock(sName, IconSize.Dnd); break; + case 12: imgG12.SetFromStock(sName, IconSize.Dnd); break; + case 13: imgG13.SetFromStock(sName, IconSize.Dnd); break; + case 14: imgG14.SetFromStock(sName, IconSize.Dnd); break; + case 15: imgG15.SetFromStock(sName, IconSize.Dnd); break; + case 16: imgG16.SetFromStock(sName, IconSize.Dnd); break; + case 17: imgG17.SetFromStock(sName, IconSize.Dnd); break; + case 18: imgG18.SetFromStock(sName, IconSize.Dnd); break; + case 19: imgG19.SetFromStock(sName, IconSize.Dnd); break; + case 20: imgG20.SetFromStock(sName, IconSize.Dnd); break; + case 21: imgG21.SetFromStock(sName, IconSize.Dnd); break; + case 22: imgG22.SetFromStock(sName, IconSize.Dnd); break; + case 23: imgG23.SetFromStock(sName, IconSize.Dnd); break; + case 24: imgG24.SetFromStock(sName, IconSize.Dnd); break; + case 25: imgG25.SetFromStock(sName, IconSize.Dnd); break; + } + } + } + + lblSuperLayer.Text = MobStatsController.GetPlayerSuperLayerName(); + lblCoord1.Text = "X: " + MobStatsController.GetPlayerXCoord(); + lblCoord2.Text = "Y: " + MobStatsController.GetPlayerYCoord(); + + //Prints the "Item layer" in map menu + for (int row = Calculate.CalculateStartY(Size), maxY = Calculate.CalculateMaxY(Size), img = 1; row <= maxY; row++) { + for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, img++) { + string sName = ImageController.GetPlayerStructureImage(row, col).Stock; + + switch (img) { + case 1: imgI1.SetFromStock(sName, IconSize.Dnd); break; + case 2: imgI2.SetFromStock(sName, IconSize.Dnd); break; + case 3: imgI3.SetFromStock(sName, IconSize.Dnd); break; + case 4: imgI4.SetFromStock(sName, IconSize.Dnd); break; + case 5: imgI5.SetFromStock(sName, IconSize.Dnd); break; + case 6: imgI6.SetFromStock(sName, IconSize.Dnd); break; + case 7: imgI7.SetFromStock(sName, IconSize.Dnd); break; + case 8: imgI8.SetFromStock(sName, IconSize.Dnd); break; + case 9: imgI9.SetFromStock(sName, IconSize.Dnd); break; + case 10: imgI10.SetFromStock(sName, IconSize.Dnd); break; + case 11: imgI11.SetFromStock(sName, IconSize.Dnd); break; + case 12: imgI12.SetFromStock(sName, IconSize.Dnd); break; + case 13: imgI13.SetFromStock(sName, IconSize.Dnd); break; + case 14: imgI14.SetFromStock(sName, IconSize.Dnd); break; + case 15: imgI15.SetFromStock(sName, IconSize.Dnd); break; + case 16: imgI16.SetFromStock(sName, IconSize.Dnd); break; + case 17: imgI17.SetFromStock(sName, IconSize.Dnd); break; + case 18: imgI18.SetFromStock(sName, IconSize.Dnd); break; + case 19: imgI19.SetFromStock(sName, IconSize.Dnd); break; + case 20: imgI20.SetFromStock(sName, IconSize.Dnd); break; + case 21: imgI21.SetFromStock(sName, IconSize.Dnd); break; + case 22: imgI22.SetFromStock(sName, IconSize.Dnd); break; + case 23: imgI23.SetFromStock(sName, IconSize.Dnd); break; + case 24: imgI24.SetFromStock(sName, IconSize.Dnd); break; + case 25: imgI25.SetFromStock(sName, IconSize.Dnd); break; + } + } + } + + lblHoleOnTop.Text = MobStatsController.ExistsHoleOnTopOfPlayer() + ""; + } + + public void PrintInventory() { + //Prints the actual inventory (items) + for (int row = 0; row < Size; row++) { + for (int col = 0; col < Size; col++) { + Image img = ImageController.GetPlayerInventoryItemImage(row * Size + col); + + switch (row * Size + col + 1) { + case 1: btnI1.Image = img; break; + case 2: btnI2.Image = img; break; + case 3: btnI3.Image = img; break; + case 4: btnI4.Image = img; break; + case 5: btnI5.Image = img; break; + case 6: btnI6.Image = img; break; + case 7: btnI7.Image = img; break; + case 8: btnI8.Image = img; break; + case 9: btnI9.Image = img; break; + case 10: btnI10.Image = img; break; + case 11: btnI11.Image = img; break; + case 12: btnI12.Image = img; break; + case 13: btnI13.Image = img; break; + case 14: btnI14.Image = img; break; + case 15: btnI15.Image = img; break; + case 16: btnI16.Image = img; break; + case 17: btnI17.Image = img; break; + case 18: btnI18.Image = img; break; + case 19: btnI19.Image = img; break; + case 20: btnI20.Image = img; break; + case 21: btnI21.Image = img; break; + case 22: btnI22.Image = img; break; + case 23: btnI23.Image = img; break; + case 24: btnI24.Image = img; break; + case 25: btnI25.Image = img; break; + } + } + } + + //Prints accessories + for (int row = 0; row < 2; row++) { + for (int col = 0; col < Size; col++) { + Image img = ImageController.GetPlayerAccessoryImage(row * Size + col); + + switch (row * Size + col + 1) { + case 1: btnA1.Image = img; break; + case 2: btnA2.Image = img; break; + case 3: btnA3.Image = img; break; + case 4: btnA4.Image = img; break; + case 5: btnA5.Image = img; break; + case 6: btnA6.Image = img; break; + case 7: btnA7.Image = img; break; + case 8: btnA8.Image = img; break; + case 9: btnA9.Image = img; break; + case 10: btnA10.Image = img; break; + } + } + } + + //Prints gear + for (int i = 0; i < Size; i++) { + Image img = ImageController.GetPlayerGearImage(i); + + switch (i + 1) { + case 1: btnG1.Image = img; break; + case 2: btnG2.Image = img; break; + case 3: btnG3.Image = img; break; + case 4: btnG4.Image = img; break; + case 5: btnG5.Image = img; break; + } + } + } + + // + // BUTTON CLICKED EVENTS + // + + protected void OnBtnIG1Clicked(object sender, EventArgs e) { + //Mundus.Data.Superlayers.Mobs.LMI.Player.Inventory.Hotbar[0] = LandPresets.Boulder(); + MobStatsController.DamagePlayer(1); + //Service.Crafting.CraftingController.FindAvalableItems(); + PrintMainMenu(); + } + + protected void OnBtnIG2Clicked(object sender, EventArgs e) { + //Mundus.Data.Superlayers.Mobs.LMI.Player.Inventory.Hotbar[1] = new Service.Tiles.Items.Tool("blank_hand", Mundus.Data.Tiles.ToolTypes.Pickaxe, 1); + //Mundus.Data.Superlayers.Mobs.LMI.Player.Inventory.Hotbar[0] = new Service.Tiles.Items.Tool("blank_hand", Mundus.Data.Tiles.ToolTypes.Axe, 1); + + MobStatsController.HealPlayer(1); + PrintMainMenu(); + } + + protected void OnBtnPauseClicked(object sender, EventArgs e) { + // Note: pause window blocks player input + WindowController.ShowPauseWindow(); + } + + protected void OnBtnMusicClicked(object sender, EventArgs e) { + WindowController.ShowMusicWindow(); + } + + + protected void OnBtnCraftingClicked(object sender, EventArgs e) { + WindowController.ShowCraftingWindow(); + } + + protected void OnBtnMapClicked(object sender, EventArgs e) { + //Hide inv menu, if it is visible (so only one of the two is visible) + if (this.InvMenuIsVisible()) this.OnBtnInvClicked(this, null); + + if (this.MapMenuIsVisible()) { + this.SetMapMenuVisibility(false); + } + else { + this.PrintMap(); + this.SetMapMenuVisibility(true); + } + } + + protected void OnBtnInvClicked(object sender, EventArgs e) { + //Hide map menu, if it is visible (so only one of the two is visible) + if (this.MapMenuIsVisible()) this.OnBtnMapClicked(this, null); + + if (btnI1.Visible) { + this.SetInvMenuVisibility(false); + } + else { + this.PrintInventory(); + this.SetInvMenuVisibility(true); + } + } + + // Screen buttons + protected void OnBtnP1Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(1); + } + } + protected void OnBtnP2Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(2); + } + } + protected void OnBtnP3Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(3); + } + } + protected void OnBtnP4Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(4); + } + } + protected void OnBtnP5Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(5); + } + } + protected void OnBtnP6Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(6); + } + } + protected void OnBtnP7Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(7); + } + } + protected void OnBtnP8Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(8); + } + } + protected void OnBtnP9Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(9); + } + } + protected void OnBtnP10Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(10); + } + } + protected void OnBtnP11Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(11); + } + } + protected void OnBtnP12Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(12); + } + } + protected void OnBtnP13Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(13); + } + } + protected void OnBtnP14Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(14); + } + } + protected void OnBtnP15Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(15); + } + } + protected void OnBtnP16Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(16); + } + } + protected void OnBtnP17Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(17); + } + } + protected void OnBtnP18Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(18); + } + } + protected void OnBtnP19Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(19); + } + } + protected void OnBtnP20Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(20); + } + } + protected void OnBtnP21Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(21); + } + } + protected void OnBtnP22Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(22); + } + } + protected void OnBtnP23Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(23); + } + } + protected void OnBtnP24Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(24); + } + } + protected void OnBtnP25Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + React(25); + } + } + + //Hotbar buttons + protected void OnBtnH1Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 0); + this.PrintMainMenu(); + } + } + protected void OnBtnH2Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 1); + this.PrintMainMenu(); + } + } + protected void OnBtnH3Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 2); + this.PrintMainMenu(); + } + } + protected void OnBtnH4Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 3); + this.PrintMainMenu(); + } + } + protected void OnBtnH5Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("hotbar", 4); + this.PrintMainMenu(); + } + } + + protected void OnBtnLogClicked(object sender, EventArgs e) { + WindowController.ShowLogWindow(); + } + + // Inventory (items) buttons + protected void OnBtnI1Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 0); + this.PrintInventory(); + } + } + protected void OnBtnI2Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 1); + this.PrintInventory(); + } + } + protected void OnBtnI3Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 2); + this.PrintInventory(); + } + } + protected void OnBtnI4Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 3); + this.PrintInventory(); + } + } + protected void OnBtnI5Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 4); + this.PrintInventory(); + } + } + protected void OnBtnI6Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 5); + this.PrintInventory(); + } + } + protected void OnBtnI7Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 6); + this.PrintInventory(); + } + } + protected void OnBtnI8Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 7); + this.PrintInventory(); + } + } + protected void OnBtnI9Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 8); + this.PrintInventory(); + } + } + protected void OnBtnI10Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 9); + this.PrintInventory(); + } + } + protected void OnBtnI11Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 10); + this.PrintInventory(); + } + } + protected void OnBtnI12Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 11); + this.PrintInventory(); + } + } + protected void OnBtnI13Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 12); + this.PrintInventory(); + } + } + protected void OnBtnI14Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 13); + this.PrintInventory(); + } + } + protected void OnBtnI15Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 14); + this.PrintInventory(); + } + } + protected void OnBtnI16Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 15); + this.PrintInventory(); + } + } + protected void OnBtnI17Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 16); + this.PrintInventory(); + } + } + protected void OnBtnI18Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 17); + this.PrintInventory(); + } + } + protected void OnBtnI19Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 18); + this.PrintInventory(); + } + } + protected void OnBtnI20Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 19); + this.PrintInventory(); + } + } + protected void OnBtnI21Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 20); + this.PrintInventory(); + } + } + protected void OnBtnI22Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 21); + this.PrintInventory(); + } + } + protected void OnBtnI23Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 22); + this.PrintInventory(); + } + } + protected void OnBtnI24Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 23); + this.PrintInventory(); + } + } + protected void OnBtnI25Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("items", 24); + this.PrintInventory(); + } + } + + // Accessories buttons + protected void OnBtnA1Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 0); + this.PrintInventory(); + } + } + protected void OnBtnA2Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 1); + this.PrintInventory(); + } + } + protected void OnBtnA3Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 2); + this.PrintInventory(); + } + } + protected void OnBtnA4Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 3); + this.PrintInventory(); + } + } + protected void OnBtnA5Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 4); + this.PrintInventory(); + } + } + protected void OnBtnA6Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 5); + this.PrintInventory(); + } + } + protected void OnBtnA7Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 6); + this.PrintInventory(); + } + } + protected void OnBtnA8Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 7); + this.PrintInventory(); + } + } + protected void OnBtnA9Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 8); + this.PrintInventory(); + } + } + protected void OnBtnA10Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("accessories", 9); + this.PrintInventory(); + } + } + + // Gear buttons + protected void OnBtnG1Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 0); + this.PrintInventory(); + } + } + + protected void OnBtnG2Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 1); + this.PrintInventory(); + } + } + + protected void OnBtnG3Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 2); + this.PrintInventory(); + } + } + + protected void OnBtnG4Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 3); + this.PrintInventory(); + } + } + + protected void OnBtnG5Clicked(object sender, EventArgs e) { + if (!WindowController.PauseWindowVisible) { + this.SelectItem("gear", 4); + this.PrintInventory(); + } + } + + // + // VISIBILITY + // + + private void SetMapMenuVisibility(bool isVisible) { + lblGroundLayer.Visible = isVisible; + imgG1.Visible = isVisible; + imgG2.Visible = isVisible; + imgG3.Visible = isVisible; + imgG4.Visible = isVisible; + imgG5.Visible = isVisible; + imgG6.Visible = isVisible; + imgG7.Visible = isVisible; + imgG8.Visible = isVisible; + imgG9.Visible = isVisible; + imgG10.Visible = isVisible; + imgG11.Visible = isVisible; + imgG12.Visible = isVisible; + imgG13.Visible = isVisible; + imgG14.Visible = isVisible; + imgG15.Visible = isVisible; + imgG16.Visible = isVisible; + imgG17.Visible = isVisible; + imgG18.Visible = isVisible; + imgG19.Visible = isVisible; + imgG20.Visible = isVisible; + imgG21.Visible = isVisible; + imgG22.Visible = isVisible; + imgG23.Visible = isVisible; + imgG24.Visible = isVisible; + imgG25.Visible = isVisible; + + lblSuperLayer.Visible = isVisible; + lblCoord1.Visible = isVisible; + lblCoord2.Visible = isVisible; + + lblItemLayer.Visible = isVisible; + imgI1.Visible = isVisible; + imgI2.Visible = isVisible; + imgI3.Visible = isVisible; + imgI4.Visible = isVisible; + imgI5.Visible = isVisible; + imgI6.Visible = isVisible; + imgI7.Visible = isVisible; + imgI8.Visible = isVisible; + imgI9.Visible = isVisible; + imgI10.Visible = isVisible; + imgI11.Visible = isVisible; + imgI12.Visible = isVisible; + imgI13.Visible = isVisible; + imgI14.Visible = isVisible; + imgI15.Visible = isVisible; + imgI16.Visible = isVisible; + imgI17.Visible = isVisible; + imgI18.Visible = isVisible; + imgI19.Visible = isVisible; + imgI20.Visible = isVisible; + imgI21.Visible = isVisible; + imgI22.Visible = isVisible; + imgI23.Visible = isVisible; + imgI24.Visible = isVisible; + imgI25.Visible = isVisible; + + lblHoleMsg.Visible = isVisible; + lblHoleOnTop.Visible = isVisible; + + lblBlank5.Visible = isVisible; + } + + private void SetInvMenuVisibility(bool isVisible) { + btnI1.Visible = isVisible; + btnI2.Visible = isVisible; + btnI3.Visible = isVisible; + btnI4.Visible = isVisible; + btnI5.Visible = isVisible; + btnI6.Visible = isVisible; + btnI7.Visible = isVisible; + btnI8.Visible = isVisible; + btnI9.Visible = isVisible; + btnI10.Visible = isVisible; + btnI11.Visible = isVisible; + btnI12.Visible = isVisible; + btnI13.Visible = isVisible; + btnI14.Visible = isVisible; + btnI15.Visible = isVisible; + btnI16.Visible = isVisible; + btnI17.Visible = isVisible; + btnI18.Visible = isVisible; + btnI19.Visible = isVisible; + btnI20.Visible = isVisible; + btnI21.Visible = isVisible; + btnI22.Visible = isVisible; + btnI23.Visible = isVisible; + btnI24.Visible = isVisible; + btnI25.Visible = isVisible; + btnCrafting.Visible = isVisible; + + lblAccessories.Visible = isVisible; + btnA1.Visible = isVisible; + btnA2.Visible = isVisible; + btnA3.Visible = isVisible; + btnA4.Visible = isVisible; + btnA5.Visible = isVisible; + btnA6.Visible = isVisible; + btnA7.Visible = isVisible; + btnA8.Visible = isVisible; + btnA9.Visible = isVisible; + btnA10.Visible = isVisible; + + lblGear.Visible = isVisible; + btnG1.Visible = isVisible; + btnG2.Visible = isVisible; + btnG3.Visible = isVisible; + btnG4.Visible = isVisible; + btnG5.Visible = isVisible; + + btnIG1.Visible = isVisible; + btnIG2.Visible = isVisible; + + imgInfo.Visible = isVisible; + lblInfo.Visible = isVisible; + + lblBlank4.Visible = isVisible; + } + } +} diff --git a/Mundus/Views/Windows/IGameWindow.cs b/Mundus/Views/Windows/IGameWindow.cs deleted file mode 100644 index 95f8636..0000000 --- a/Mundus/Views/Windows/IGameWindow.cs +++ /dev/null @@ -1,19 +0,0 @@ -using Mundus.Service.Tiles.Items; - -namespace Mundus.Views.Windows { - public interface IGameWindow { - int Size { get; } - - //Events that are generated from designer window - void OnDeleteEvent(object o, Gtk.DeleteEventArgs args); - void SetDefaults(); - void PrintScreen(); - void PrintMap(); - void PrintMainMenu(); - void PrintInventory(); - void PrintSelectedItemInfo(ItemTile itemTile); - - //Stuff that are in Gtk.Window class - void Show(); - } -} diff --git a/Mundus/Views/Windows/LargeGameWindow.cs b/Mundus/Views/Windows/LargeGameWindow.cs deleted file mode 100644 index d010a68..0000000 --- a/Mundus/Views/Windows/LargeGameWindow.cs +++ /dev/null @@ -1,2246 +0,0 @@ -using System; -using Gtk; -using Mundus.Service; -using Mundus.Service.Mob.Controllers; -using Mundus.Service.Mobs.Controllers; -using Mundus.Service.SuperLayers; -using Mundus.Service.Tiles.Items; - -namespace Mundus.Views.Windows { - public partial class LargeGameWindow : Gtk.Window, IGameWindow { - public int Size { get; private set; } - - public LargeGameWindow() : base( Gtk.WindowType.Toplevel ) { - this.Build(); - } - - public void OnDeleteEvent(object o, DeleteEventArgs args) { - Application.Quit(); - } - - public void SetDefaults() { - this.Size = 9; - this.SetMapMenuVisibility(false); - this.SetInvMenuVisibility(false); - } - - private void SelectItem(string place, int index) { - if (HasSelection()) { - ResetSelection(); - SwitchItems.ReplaceItems(place, index); - } - else { - selPlace = place; - selIndex = index; - SwitchItems.SetOrigin(place, index); - } - - this.PrintMainMenu(); - this.PrintInventory(); - } - - private void React(int button) { - int buttonYPos = (button - 1) / Size; - int buttonXPos = (button - (buttonYPos * Size)) - 1; - - int mapXPos = Calculate.CalculateXFromButton(buttonXPos, Size); - int mapYPos = Calculate.CalculateYFromButton(buttonYPos, Size); - - if (!HasSelection()) { - MobMovement.MovePlayer(mapYPos, mapXPos, Size); - MobMovement.MoveRandomlyAllMobs(); - } - else { - if (Inventory.GetPlayerItem(selPlace, selIndex) != null) { - if (MobFighting.ExistsFightTargetForPlayer(mapYPos, mapXPos)) { - MobFighting.PlayerTryFight(selPlace, selIndex, mapYPos, mapXPos); - } - else { - MobTerraforming.PlayerTerraformAt(mapYPos, mapXPos, selPlace, selIndex); - } - } - ResetSelection(); - } - - this.PrintScreen(); - this.PrintMainMenu(); - - if (this.MapMenuIsVisible()) { - this.PrintMap(); - } - else if (this.InvMenuIsVisible()) { - this.PrintInventory(); - } - } - - private static string selPlace = null; - private static int selIndex = -1; - private static void ResetSelection() { - selPlace = null; - selIndex = -1; - } - private static bool HasSelection() { - return selPlace != null; - } - - private bool InvMenuIsVisible() { - return btnI1.Visible; - } - - private bool MapMenuIsVisible() { - return imgG1.Visible; - } - - // - // PRINTING - // - - public void PrintSelectedItemInfo(ItemTile itemTile) { - if (itemTile != null) { - imgInfo.SetFromStock(itemTile.stock_id, IconSize.Dnd); - lblInfo.Text = itemTile.ToString(); - } - else { - imgInfo.SetFromImage(null, null); - lblInfo.Text = null; - } - } - - public void PrintScreen() { - for (int layer = 0; layer < 3; layer++) { - for (int row = Calculate.CalculateStartY(Size), maxY = Calculate.CalculateMaxY(Size), btn = 1; row <= maxY; row++) { - for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, btn++) { - Image img = ImageController.GetScreenImage(row, col, layer); - - if (img == null) continue; - - switch (btn) { - case 1: btnP1.Image = img; break; - case 2: btnP2.Image = img; break; - case 3: btnP3.Image = img; break; - case 4: btnP4.Image = img; break; - case 5: btnP5.Image = img; break; - case 6: btnP6.Image = img; break; - case 7: btnP7.Image = img; break; - case 8: btnP8.Image = img; break; - case 9: btnP9.Image = img; break; - case 10: btnP10.Image = img; break; - case 11: btnP11.Image = img; break; - case 12: btnP12.Image = img; break; - case 13: btnP13.Image = img; break; - case 14: btnP14.Image = img; break; - case 15: btnP15.Image = img; break; - case 16: btnP16.Image = img; break; - case 17: btnP17.Image = img; break; - case 18: btnP18.Image = img; break; - case 19: btnP19.Image = img; break; - case 20: btnP20.Image = img; break; - case 21: btnP21.Image = img; break; - case 22: btnP22.Image = img; break; - case 23: btnP23.Image = img; break; - case 24: btnP24.Image = img; break; - case 25: btnP25.Image = img; break; - case 26: btnP26.Image = img; break; - case 27: btnP27.Image = img; break; - case 28: btnP28.Image = img; break; - case 29: btnP29.Image = img; break; - case 30: btnP30.Image = img; break; - case 31: btnP31.Image = img; break; - case 32: btnP32.Image = img; break; - case 33: btnP33.Image = img; break; - case 34: btnP34.Image = img; break; - case 35: btnP35.Image = img; break; - case 36: btnP36.Image = img; break; - case 37: btnP37.Image = img; break; - case 38: btnP38.Image = img; break; - case 39: btnP39.Image = img; break; - case 40: btnP40.Image = img; break; - case 41: btnP41.Image = img; break; - case 42: btnP42.Image = img; break; - case 43: btnP43.Image = img; break; - case 44: btnP44.Image = img; break; - case 45: btnP45.Image = img; break; - case 46: btnP46.Image = img; break; - case 47: btnP47.Image = img; break; - case 48: btnP48.Image = img; break; - case 49: btnP49.Image = img; break; - case 50: btnP50.Image = img; break; - case 51: btnP51.Image = img; break; - case 52: btnP52.Image = img; break; - case 53: btnP53.Image = img; break; - case 54: btnP54.Image = img; break; - case 55: btnP55.Image = img; break; - case 56: btnP56.Image = img; break; - case 57: btnP57.Image = img; break; - case 58: btnP58.Image = img; break; - case 59: btnP59.Image = img; break; - case 60: btnP60.Image = img; break; - case 61: btnP61.Image = img; break; - case 62: btnP62.Image = img; break; - case 63: btnP63.Image = img; break; - case 64: btnP64.Image = img; break; - case 65: btnP65.Image = img; break; - case 66: btnP66.Image = img; break; - case 67: btnP67.Image = img; break; - case 68: btnP68.Image = img; break; - case 69: btnP69.Image = img; break; - case 70: btnP70.Image = img; break; - case 71: btnP71.Image = img; break; - case 72: btnP72.Image = img; break; - case 73: btnP73.Image = img; break; - case 74: btnP74.Image = img; break; - case 75: btnP75.Image = img; break; - case 76: btnP76.Image = img; break; - case 77: btnP77.Image = img; break; - case 78: btnP78.Image = img; break; - case 79: btnP79.Image = img; break; - case 80: btnP80.Image = img; break; - case 81: btnP81.Image = img; break; - } - } - } - } - } - - public void PrintMainMenu() { - //Print lungs - - //Print health - for (int i = 0; i < Size; i++) { - string iName = MobStatsController.GetPlayerHearth(i); - - switch (i) { - case 0: imgS10.SetFromStock(iName, IconSize.Dnd); break; - case 1: imgS11.SetFromStock(iName, IconSize.Dnd); break; - case 2: imgS12.SetFromStock(iName, IconSize.Dnd); break; - case 3: imgS13.SetFromStock(iName, IconSize.Dnd); break; - case 4: imgS14.SetFromStock(iName, IconSize.Dnd); break; - case 5: imgS15.SetFromStock(iName, IconSize.Dnd); break; - case 6: imgS16.SetFromStock(iName, IconSize.Dnd); break; - case 7: imgS17.SetFromStock(iName, IconSize.Dnd); break; - case 8: imgS18.SetFromStock(iName, IconSize.Dnd); break; - } - } - - //Prints hotbar - for (int i = 0; i < Size; i++) { - Image img = ImageController.GetPlayerHotbarImage(i); - - switch (i) { - case 0: btnH1.Image = img; break; - case 1: btnH2.Image = img; break; - case 2: btnH3.Image = img; break; - case 3: btnH4.Image = img; break; - case 4: btnH5.Image = img; break; - case 5: btnH6.Image = img; break; - case 6: btnH7.Image = img; break; - case 7: btnH8.Image = img; break; - case 8: btnH9.Image = img; break; - } - } - - //Prints log - for (int i = 0, mIndex = LogController.GetCount() - 1; i < Size; mIndex--, i++) { - string msg = LogController.GetMessagage(mIndex); - - switch (i) { - case 0: lblLog1.Text = msg; break; - case 1: lblLog2.Text = msg; break; - case 2: lblLog3.Text = msg; break; - case 3: lblLog4.Text = msg; break; - case 4: lblLog5.Text = msg; break; - case 5: lblLog6.Text = msg; break; - case 7: lblLog7.Text = msg; break; - case 8: lblLog8.Text = msg; break; - } - } - } - - 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++) { - for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, img++) { - string sName = ImageController.GetPlayerGroundImage(row, col).Stock; - - switch (img) { - case 1: imgG1.SetFromStock(sName, IconSize.Dnd); break; - case 2: imgG2.SetFromStock(sName, IconSize.Dnd); break; - case 3: imgG3.SetFromStock(sName, IconSize.Dnd); break; - case 4: imgG4.SetFromStock(sName, IconSize.Dnd); break; - case 5: imgG5.SetFromStock(sName, IconSize.Dnd); break; - case 6: imgG6.SetFromStock(sName, IconSize.Dnd); break; - case 7: imgG7.SetFromStock(sName, IconSize.Dnd); break; - case 8: imgG8.SetFromStock(sName, IconSize.Dnd); break; - case 9: imgG9.SetFromStock(sName, IconSize.Dnd); break; - case 10: imgG10.SetFromStock(sName, IconSize.Dnd); break; - case 11: imgG11.SetFromStock(sName, IconSize.Dnd); break; - case 12: imgG12.SetFromStock(sName, IconSize.Dnd); break; - case 13: imgG13.SetFromStock(sName, IconSize.Dnd); break; - case 14: imgG14.SetFromStock(sName, IconSize.Dnd); break; - case 15: imgG15.SetFromStock(sName, IconSize.Dnd); break; - case 16: imgG16.SetFromStock(sName, IconSize.Dnd); break; - case 17: imgG17.SetFromStock(sName, IconSize.Dnd); break; - case 18: imgG18.SetFromStock(sName, IconSize.Dnd); break; - case 19: imgG19.SetFromStock(sName, IconSize.Dnd); break; - case 20: imgG20.SetFromStock(sName, IconSize.Dnd); break; - case 21: imgG21.SetFromStock(sName, IconSize.Dnd); break; - case 22: imgG22.SetFromStock(sName, IconSize.Dnd); break; - case 23: imgG23.SetFromStock(sName, IconSize.Dnd); break; - case 24: imgG24.SetFromStock(sName, IconSize.Dnd); break; - case 25: imgG25.SetFromStock(sName, IconSize.Dnd); break; - case 26: imgG26.SetFromStock(sName, IconSize.Dnd); break; - case 27: imgG27.SetFromStock(sName, IconSize.Dnd); break; - case 28: imgG28.SetFromStock(sName, IconSize.Dnd); break; - case 29: imgG29.SetFromStock(sName, IconSize.Dnd); break; - case 30: imgG30.SetFromStock(sName, IconSize.Dnd); break; - case 31: imgG31.SetFromStock(sName, IconSize.Dnd); break; - case 32: imgG32.SetFromStock(sName, IconSize.Dnd); break; - case 33: imgG33.SetFromStock(sName, IconSize.Dnd); break; - case 34: imgG34.SetFromStock(sName, IconSize.Dnd); break; - case 35: imgG35.SetFromStock(sName, IconSize.Dnd); break; - case 36: imgG36.SetFromStock(sName, IconSize.Dnd); break; - case 37: imgG37.SetFromStock(sName, IconSize.Dnd); break; - case 38: imgG38.SetFromStock(sName, IconSize.Dnd); break; - case 39: imgG39.SetFromStock(sName, IconSize.Dnd); break; - case 40: imgG40.SetFromStock(sName, IconSize.Dnd); break; - case 41: imgG41.SetFromStock(sName, IconSize.Dnd); break; - case 42: imgG42.SetFromStock(sName, IconSize.Dnd); break; - case 43: imgG43.SetFromStock(sName, IconSize.Dnd); break; - case 44: imgG44.SetFromStock(sName, IconSize.Dnd); break; - case 45: imgG45.SetFromStock(sName, IconSize.Dnd); break; - case 46: imgG46.SetFromStock(sName, IconSize.Dnd); break; - case 47: imgG47.SetFromStock(sName, IconSize.Dnd); break; - case 48: imgG48.SetFromStock(sName, IconSize.Dnd); break; - case 49: imgG49.SetFromStock(sName, IconSize.Dnd); break; - case 50: imgG50.SetFromStock(sName, IconSize.Dnd); break; - case 51: imgG51.SetFromStock(sName, IconSize.Dnd); break; - case 52: imgG52.SetFromStock(sName, IconSize.Dnd); break; - case 53: imgG53.SetFromStock(sName, IconSize.Dnd); break; - case 54: imgG54.SetFromStock(sName, IconSize.Dnd); break; - case 55: imgG55.SetFromStock(sName, IconSize.Dnd); break; - case 56: imgG56.SetFromStock(sName, IconSize.Dnd); break; - case 57: imgG57.SetFromStock(sName, IconSize.Dnd); break; - case 58: imgG58.SetFromStock(sName, IconSize.Dnd); break; - case 59: imgG59.SetFromStock(sName, IconSize.Dnd); break; - case 60: imgG60.SetFromStock(sName, IconSize.Dnd); break; - case 61: imgG61.SetFromStock(sName, IconSize.Dnd); break; - case 62: imgG62.SetFromStock(sName, IconSize.Dnd); break; - case 63: imgG63.SetFromStock(sName, IconSize.Dnd); break; - case 64: imgG64.SetFromStock(sName, IconSize.Dnd); break; - case 65: imgG65.SetFromStock(sName, IconSize.Dnd); break; - case 66: imgG66.SetFromStock(sName, IconSize.Dnd); break; - case 67: imgG67.SetFromStock(sName, IconSize.Dnd); break; - case 68: imgG68.SetFromStock(sName, IconSize.Dnd); break; - case 69: imgG69.SetFromStock(sName, IconSize.Dnd); break; - case 70: imgG70.SetFromStock(sName, IconSize.Dnd); break; - case 71: imgG71.SetFromStock(sName, IconSize.Dnd); break; - case 72: imgG72.SetFromStock(sName, IconSize.Dnd); break; - case 73: imgG73.SetFromStock(sName, IconSize.Dnd); break; - case 74: imgG74.SetFromStock(sName, IconSize.Dnd); break; - case 75: imgG75.SetFromStock(sName, IconSize.Dnd); break; - case 76: imgG76.SetFromStock(sName, IconSize.Dnd); break; - case 77: imgG77.SetFromStock(sName, IconSize.Dnd); break; - case 78: imgG78.SetFromStock(sName, IconSize.Dnd); break; - case 79: imgG79.SetFromStock(sName, IconSize.Dnd); break; - case 80: imgG80.SetFromStock(sName, IconSize.Dnd); break; - case 81: imgG81.SetFromStock(sName, IconSize.Dnd); break; - } - } - } - - lblSuperLayer.Text = MobStatsController.GetPlayerSuperLayerName(); - lblCoord1.Text = "X: " + MobStatsController.GetPlayerXCoord(); - lblCoord2.Text = "Y: " + MobStatsController.GetPlayerYCoord(); - - //Prints the "Item layer" in map menu - for (int row = Calculate.CalculateStartY(Size), maxY = Calculate.CalculateMaxY(Size), img = 1; row <= maxY; row++) { - for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, img++) { - string sName = ImageController.GetPlayerStructureImage(row, col).Stock; - - switch (img) { - case 1: imgI1.SetFromStock(sName, IconSize.Dnd); break; - case 2: imgI2.SetFromStock(sName, IconSize.Dnd); break; - case 3: imgI3.SetFromStock(sName, IconSize.Dnd); break; - case 4: imgI4.SetFromStock(sName, IconSize.Dnd); break; - case 5: imgI5.SetFromStock(sName, IconSize.Dnd); break; - case 6: imgI6.SetFromStock(sName, IconSize.Dnd); break; - case 7: imgI7.SetFromStock(sName, IconSize.Dnd); break; - case 8: imgI8.SetFromStock(sName, IconSize.Dnd); break; - case 9: imgI9.SetFromStock(sName, IconSize.Dnd); break; - case 10: imgI10.SetFromStock(sName, IconSize.Dnd); break; - case 11: imgI11.SetFromStock(sName, IconSize.Dnd); break; - case 12: imgI12.SetFromStock(sName, IconSize.Dnd); break; - case 13: imgI13.SetFromStock(sName, IconSize.Dnd); break; - case 14: imgI14.SetFromStock(sName, IconSize.Dnd); break; - case 15: imgI15.SetFromStock(sName, IconSize.Dnd); break; - case 16: imgI16.SetFromStock(sName, IconSize.Dnd); break; - case 17: imgI17.SetFromStock(sName, IconSize.Dnd); break; - case 18: imgI18.SetFromStock(sName, IconSize.Dnd); break; - case 19: imgI19.SetFromStock(sName, IconSize.Dnd); break; - case 20: imgI20.SetFromStock(sName, IconSize.Dnd); break; - case 21: imgI21.SetFromStock(sName, IconSize.Dnd); break; - case 22: imgI22.SetFromStock(sName, IconSize.Dnd); break; - case 23: imgI23.SetFromStock(sName, IconSize.Dnd); break; - case 24: imgI24.SetFromStock(sName, IconSize.Dnd); break; - case 25: imgI25.SetFromStock(sName, IconSize.Dnd); break; - case 26: imgI26.SetFromStock(sName, IconSize.Dnd); break; - case 27: imgI27.SetFromStock(sName, IconSize.Dnd); break; - case 28: imgI28.SetFromStock(sName, IconSize.Dnd); break; - case 29: imgI29.SetFromStock(sName, IconSize.Dnd); break; - case 30: imgI30.SetFromStock(sName, IconSize.Dnd); break; - case 31: imgI31.SetFromStock(sName, IconSize.Dnd); break; - case 32: imgI32.SetFromStock(sName, IconSize.Dnd); break; - case 33: imgI33.SetFromStock(sName, IconSize.Dnd); break; - case 34: imgI34.SetFromStock(sName, IconSize.Dnd); break; - case 35: imgI35.SetFromStock(sName, IconSize.Dnd); break; - case 36: imgI36.SetFromStock(sName, IconSize.Dnd); break; - case 37: imgI37.SetFromStock(sName, IconSize.Dnd); break; - case 38: imgI38.SetFromStock(sName, IconSize.Dnd); break; - case 39: imgI39.SetFromStock(sName, IconSize.Dnd); break; - case 40: imgI40.SetFromStock(sName, IconSize.Dnd); break; - case 41: imgI41.SetFromStock(sName, IconSize.Dnd); break; - case 42: imgI42.SetFromStock(sName, IconSize.Dnd); break; - case 43: imgI43.SetFromStock(sName, IconSize.Dnd); break; - case 44: imgI44.SetFromStock(sName, IconSize.Dnd); break; - case 45: imgI45.SetFromStock(sName, IconSize.Dnd); break; - case 46: imgI46.SetFromStock(sName, IconSize.Dnd); break; - case 47: imgI47.SetFromStock(sName, IconSize.Dnd); break; - case 48: imgI48.SetFromStock(sName, IconSize.Dnd); break; - case 49: imgI49.SetFromStock(sName, IconSize.Dnd); break; - case 50: imgI50.SetFromStock(sName, IconSize.Dnd); break; - case 51: imgI51.SetFromStock(sName, IconSize.Dnd); break; - case 52: imgI52.SetFromStock(sName, IconSize.Dnd); break; - case 53: imgI53.SetFromStock(sName, IconSize.Dnd); break; - case 54: imgI54.SetFromStock(sName, IconSize.Dnd); break; - case 55: imgI55.SetFromStock(sName, IconSize.Dnd); break; - case 56: imgI56.SetFromStock(sName, IconSize.Dnd); break; - case 57: imgI57.SetFromStock(sName, IconSize.Dnd); break; - case 58: imgI58.SetFromStock(sName, IconSize.Dnd); break; - case 59: imgI59.SetFromStock(sName, IconSize.Dnd); break; - case 60: imgI60.SetFromStock(sName, IconSize.Dnd); break; - case 61: imgI61.SetFromStock(sName, IconSize.Dnd); break; - case 62: imgI62.SetFromStock(sName, IconSize.Dnd); break; - case 63: imgI63.SetFromStock(sName, IconSize.Dnd); break; - case 64: imgI64.SetFromStock(sName, IconSize.Dnd); break; - case 65: imgI65.SetFromStock(sName, IconSize.Dnd); break; - case 66: imgI66.SetFromStock(sName, IconSize.Dnd); break; - case 67: imgI67.SetFromStock(sName, IconSize.Dnd); break; - case 68: imgI68.SetFromStock(sName, IconSize.Dnd); break; - case 69: imgI69.SetFromStock(sName, IconSize.Dnd); break; - case 70: imgI70.SetFromStock(sName, IconSize.Dnd); break; - case 71: imgI71.SetFromStock(sName, IconSize.Dnd); break; - case 72: imgI72.SetFromStock(sName, IconSize.Dnd); break; - case 73: imgI73.SetFromStock(sName, IconSize.Dnd); break; - case 74: imgI74.SetFromStock(sName, IconSize.Dnd); break; - case 75: imgI75.SetFromStock(sName, IconSize.Dnd); break; - case 76: imgI76.SetFromStock(sName, IconSize.Dnd); break; - case 77: imgI77.SetFromStock(sName, IconSize.Dnd); break; - case 78: imgI78.SetFromStock(sName, IconSize.Dnd); break; - case 79: imgI79.SetFromStock(sName, IconSize.Dnd); break; - case 80: imgI80.SetFromStock(sName, IconSize.Dnd); break; - case 81: imgI81.SetFromStock(sName, IconSize.Dnd); break; - } - } - } - - lblHoleOnTop.Text = MobStatsController.ExistsHoleOnTopOfPlayer() + ""; - } - - public void PrintInventory() { - //Prints the actual inventory (items) - for (int row = 0; row < Size; row++) { - for (int col = 0; col < Size; col++) { - Image img = ImageController.GetPlayerInventoryItemImage(row * Size + col); - - switch (row * Size + col + 1) { - case 1: btnI1.Image = img; break; - case 2: btnI2.Image = img; break; - case 3: btnI3.Image = img; break; - case 4: btnI4.Image = img; break; - case 5: btnI5.Image = img; break; - case 6: btnI6.Image = img; break; - case 7: btnI7.Image = img; break; - case 8: btnI8.Image = img; break; - case 9: btnI9.Image = img; break; - case 10: btnI10.Image = img; break; - case 11: btnI11.Image = img; break; - case 12: btnI12.Image = img; break; - case 13: btnI13.Image = img; break; - case 14: btnI14.Image = img; break; - case 15: btnI15.Image = img; break; - case 16: btnI16.Image = img; break; - case 17: btnI17.Image = img; break; - case 18: btnI18.Image = img; break; - case 19: btnI19.Image = img; break; - case 20: btnI20.Image = img; break; - case 21: btnI21.Image = img; break; - case 22: btnI22.Image = img; break; - case 23: btnI23.Image = img; break; - case 24: btnI24.Image = img; break; - case 25: btnI25.Image = img; break; - case 26: btnI26.Image = img; break; - case 27: btnI27.Image = img; break; - case 28: btnI28.Image = img; break; - case 29: btnI29.Image = img; break; - case 30: btnI30.Image = img; break; - case 31: btnI31.Image = img; break; - case 32: btnI32.Image = img; break; - case 33: btnI33.Image = img; break; - case 34: btnI34.Image = img; break; - case 35: btnI35.Image = img; break; - case 36: btnI36.Image = img; break; - case 37: btnI37.Image = img; break; - case 38: btnI38.Image = img; break; - case 39: btnI39.Image = img; break; - case 40: btnI40.Image = img; break; - case 41: btnI41.Image = img; break; - case 42: btnI42.Image = img; break; - case 43: btnI43.Image = img; break; - case 44: btnI44.Image = img; break; - case 45: btnI45.Image = img; break; - case 46: btnI46.Image = img; break; - case 47: btnI47.Image = img; break; - case 48: btnI48.Image = img; break; - case 49: btnI49.Image = img; break; - case 50: btnI50.Image = img; break; - case 51: btnI51.Image = img; break; - case 52: btnI52.Image = img; break; - case 53: btnI53.Image = img; break; - case 54: btnI54.Image = img; break; - case 55: btnI55.Image = img; break; - case 56: btnI56.Image = img; break; - case 57: btnI57.Image = img; break; - case 58: btnI58.Image = img; break; - case 59: btnI59.Image = img; break; - case 60: btnI60.Image = img; break; - case 61: btnI61.Image = img; break; - case 62: btnI62.Image = img; break; - case 63: btnI63.Image = img; break; - case 64: btnI64.Image = img; break; - case 65: btnI65.Image = img; break; - case 66: btnI66.Image = img; break; - case 67: btnI67.Image = img; break; - case 68: btnI68.Image = img; break; - case 69: btnI69.Image = img; break; - case 70: btnI70.Image = img; break; - case 71: btnI71.Image = img; break; - case 72: btnI72.Image = img; break; - case 73: btnI73.Image = img; break; - case 74: btnI74.Image = img; break; - case 75: btnI75.Image = img; break; - case 76: btnI76.Image = img; break; - case 77: btnI77.Image = img; break; - case 78: btnI78.Image = img; break; - case 79: btnI79.Image = img; break; - case 80: btnI80.Image = img; break; - case 81: btnI81.Image = img; break; - } - } - } - - //Prints accessories - for (int row = 0; row < 2; row++) { - for (int col = 0; col < Size; col++) { - Image img = ImageController.GetPlayerAccessoryImage(row * Size + col); - - switch (row * Size + col + 1) { - case 1: btnA1.Image = img; break; - case 2: btnA2.Image = img; break; - case 3: btnA3.Image = img; break; - case 4: btnA4.Image = img; break; - case 5: btnA5.Image = img; break; - case 6: btnA6.Image = img; break; - case 7: btnA7.Image = img; break; - case 8: btnA8.Image = img; break; - case 9: btnA9.Image = img; break; - case 10: btnA10.Image = img; break; - case 11: btnA11.Image = img; break; - case 12: btnA12.Image = img; break; - case 13: btnA13.Image = img; break; - case 14: btnA14.Image = img; break; - case 15: btnA15.Image = img; break; - case 16: btnA16.Image = img; break; - case 17: btnA17.Image = img; break; - case 18: btnA18.Image = img; break; - } - } - } - - //Prints gear - for (int i = 0; i < Size; i++) { - Image img = ImageController.GetPlayerGearImage(i); - - switch (i + 1) { - case 1: btnG1.Image = img; break; - case 2: btnG2.Image = img; break; - case 3: btnG3.Image = img; break; - case 4: btnG4.Image = img; break; - case 5: btnG5.Image = img; break; - case 6: btnG6.Image = img; break; - case 7: btnG7.Image = img; break; - case 8: btnG8.Image = img; break; - case 9: btnG9.Image = img; break; - } - } - } - - // - // BUTTON CLICKED EVENTS - // - - protected void OnBtnMapClicked(object sender, EventArgs e) { - //Hide inv menu, if it is visible (so only one of the two is visible) - if (this.InvMenuIsVisible()) this.OnBtnInvClicked(this, null); - - if (this.MapMenuIsVisible()) { - this.SetMapMenuVisibility(false); - } - else { - this.PrintMap(); - this.SetMapMenuVisibility(true); - } - } - - protected void OnBtnInvClicked(object sender, EventArgs e) { - //Hide map menu, if it is visible (so only one of the two is visible) - if (this.MapMenuIsVisible()) this.OnBtnMapClicked(this, null); - - if (btnI1.Visible) { - this.SetInvMenuVisibility(false); - } - else { - this.PrintInventory(); - this.SetInvMenuVisibility(true); - } - } - - protected void OnBtnPauseClicked(object sender, EventArgs e) { - // Note: pause window blocks player input - WindowController.ShowPauseWindow(); - } - - protected void OnBtnMusicClicked(object sender, EventArgs e) { - WindowController.ShowMusicWindow(); - } - - protected void OnBtnCraftingClicked(object sender, EventArgs e) { - WindowController.ShowCraftingWindow(); - } - - // Screen buttons - protected void OnBtnP1Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(1); - } - } - - protected void OnBtnP2Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(2); - } - } - - protected void OnBtnP3Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(3); - } - } - - protected void OnBtnP4Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(4); - } - } - - protected void OnBtnP5Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(5); - } - } - - protected void OnBtnP6Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(6); - } - } - - protected void OnBtnP7Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(7); - } - } - - protected void OnBtnP8Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(8); - } - } - - protected void OnBtnP9Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(9); - } - } - - protected void OnBtnP10Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(10); - } - } - - protected void OnBtnP11Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(11); - } - } - - protected void OnBtnP12Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(12); - } - } - - protected void OnBtnP13Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(13); - } - } - - protected void OnBtnP14Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(14); - } - } - - protected void OnBtnP15Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(15); - } - } - - protected void OnBtnP16Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(16); - } - } - - protected void OnBtnP17Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(17); - } - } - - protected void OnBtnP18Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(18); - } - } - - protected void OnBtnP19Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(19); - } - } - - protected void OnBtnP20Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(20); - } - } - - protected void OnBtnP21Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(21); - } - } - - protected void OnBtnP22Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(22); - } - } - - protected void OnBtnP23Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(23); - } - } - - protected void OnBtnP24Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(24); - } - } - - protected void OnBtnP25Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(25); - } - } - - protected void OnBtnP26Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(26); - } - } - - protected void OnBtnP27Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(27); - } - } - - protected void OnBtnP28Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(28); - } - } - - protected void OnBtnP29Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(29); - } - } - - protected void OnBtnP30Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(30); - } - } - - protected void OnBtnP31Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(31); - } - } - - protected void OnBtnP32Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(32); - } - } - - protected void OnBtnP33Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(33); - } - } - - protected void OnBtnP34Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(34); - } - } - - protected void OnBtnP35Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(35); - } - } - - protected void OnBtnP36Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(36); - } - } - - protected void OnBtnP37Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(37); - } - } - - protected void OnBtnP38Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(38); - } - } - - protected void OnBtnP39Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(39); - } - } - - protected void OnBtnP40Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(40); - } - } - - protected void OnBtnP41Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(41); - } - } - - protected void OnBtnP42Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(42); - } - } - - protected void OnBtnP43Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(43); - } - } - - protected void OnBtnP44Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(44); - } - } - - protected void OnBtnP45Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(45); - } - } - - protected void OnBtnP46Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(46); - } - } - - protected void OnBtnP47Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(47); - } - } - - protected void OnBtnP48Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(48); - } - } - - protected void OnBtnP49Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(49); - } - } - - protected void OnBtnP50Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(50); - } - } - - protected void OnBtnP51Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(51); - } - } - - protected void OnBtnP52Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(52); - } - } - - protected void OnBtnP53Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(53); - } - } - - protected void OnBtnP54Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(54); - } - } - - protected void OnBtnP55Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(55); - } - } - - protected void OnBtnP56Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(56); - } - } - - protected void OnBtnP57Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(57); - } - } - - protected void OnBtnP58Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(58); - } - } - - protected void OnBtnP59Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(59); - } - } - - protected void OnBtnP60Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(60); - } - } - - protected void OnBtnP61Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(61); - } - } - - protected void OnBtnP62Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(62); - } - } - - protected void OnBtnP63Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(63); - } - } - - protected void OnBtnP64Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(64); - } - } - - protected void OnBtnP65Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(65); - } - } - - protected void OnBtnP66Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(66); - } - } - - protected void OnBtnP67Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(67); - } - } - - protected void OnBtnP68Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(68); - } - } - - protected void OnBtnP69Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(69); - } - } - - protected void OnBtnP70Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(70); - } - } - - protected void OnBtnP71Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(71); - } - } - - protected void OnBtnP72Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(72); - } - } - - protected void OnBtnP73Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(73); - } - } - - protected void OnBtnP74Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(74); - } - } - - protected void OnBtnP75Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(75); - } - } - - protected void OnBtnP76Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(76); - } - } - - protected void OnBtnP77Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(77); - } - } - - protected void OnBtnP78Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(78); - } - } - - protected void OnBtnP79Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(79); - } - } - - protected void OnBtnP80Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(80); - } - } - - protected void OnBtnP81Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(81); - } - } - - // Hotbar buttons - protected void OnBtnH1Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 0); - this.PrintMainMenu(); - } - } - - protected void OnBtnH2Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 1); - this.PrintMainMenu(); - } - } - - protected void OnBtnH3Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 2); - this.PrintMainMenu(); - } - } - - protected void OnBtnH4Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 3); - this.PrintMainMenu(); - } - } - - protected void OnBtnH5Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 4); - this.PrintMainMenu(); - } - } - - protected void OnBtnH6Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 5); - this.PrintMainMenu(); - } - } - - protected void OnBtnH7Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 6); - this.PrintMainMenu(); - } - } - - protected void OnBtnH8Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 7); - this.PrintMainMenu(); - } - } - - protected void OnBtnH9Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 8); - this.PrintMainMenu(); - } - } - - protected void OnBtnLogClicked(object sender, EventArgs e) { - WindowController.ShowLogWindow(); - } - - // Inventory (items) buttons - protected void OnBtnI1Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 0); - this.PrintInventory(); - } - } - - protected void OnBtnI2Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 1); - this.PrintInventory(); - } - } - - protected void OnBtnI3Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 2); - this.PrintInventory(); - } - } - - protected void OnBtnI4Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 3); - this.PrintInventory(); - } - } - - protected void OnBtnI5Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 4); - this.PrintInventory(); - } - } - - protected void OnBtnI6Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 5); - this.PrintInventory(); - } - } - - protected void OnBtnI7Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 6); - this.PrintInventory(); - } - } - - protected void OnBtnI8Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 7); - this.PrintInventory(); - } - } - - protected void OnBtnI9Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 8); - this.PrintInventory(); - } - } - - protected void OnBtnI10Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 9); - this.PrintInventory(); - } - } - - protected void OnBtnI11Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 10); - this.PrintInventory(); - } - } - - protected void OnBtnI12Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 11); - this.PrintInventory(); - } - } - - protected void OnBtnI13Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 12); - this.PrintInventory(); - } - } - - protected void OnBtnI14Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 13); - this.PrintInventory(); - } - } - - protected void OnBtnI15Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 14); - this.PrintInventory(); - } - } - - protected void OnBtnI16Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 15); - this.PrintInventory(); - } - } - - protected void OnBtnI17Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 16); - this.PrintInventory(); - } - } - - protected void OnBtnI18Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 17); - this.PrintInventory(); - } - } - - protected void OnBtnI19Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 18); - this.PrintInventory(); - } - } - - protected void OnBtnI20Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 19); - this.PrintInventory(); - } - } - - protected void OnBtnI21Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 20); - this.PrintInventory(); - } - } - - protected void OnBtnI22Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 21); - this.PrintInventory(); - } - } - - protected void OnBtnI23Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 22); - this.PrintInventory(); - } - } - - protected void OnBtnI24Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 23); - this.PrintInventory(); - } - } - - protected void OnBtnI25Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 24); - this.PrintInventory(); - } - } - - protected void OnBtnI26Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 25); - this.PrintInventory(); - } - } - - protected void OnBtnI27Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 26); - this.PrintInventory(); - } - } - - protected void OnBtnI28Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 27); - this.PrintInventory(); - } - } - - protected void OnBtnI29Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 28); - this.PrintInventory(); - } - } - - protected void OnBtnI30Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 29); - this.PrintInventory(); - } - } - - protected void OnBtnI31Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 30); - this.PrintInventory(); - } - } - - protected void OnBtnI32Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 31); - this.PrintInventory(); - } - } - - protected void OnBtnI33Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 32); - this.PrintInventory(); - } - } - - protected void OnBtnI34Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 33); - this.PrintInventory(); - } - } - - protected void OnBtnI35Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 34); - this.PrintInventory(); - } - } - - protected void OnBtnI36Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 35); - this.PrintInventory(); - } - } - - protected void OnBtnI37Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 36); - this.PrintInventory(); - } - } - - protected void OnBtnI38Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 37); - this.PrintInventory(); - } - } - - protected void OnBtnI39Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 38); - this.PrintInventory(); - } - } - - protected void OnBtnI40Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 39); - this.PrintInventory(); - } - } - - protected void OnBtnI41Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 40); - this.PrintInventory(); - } - } - - protected void OnBtnI42Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 41); - this.PrintInventory(); - } - } - - protected void OnBtnI43Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 42); - this.PrintInventory(); - } - } - - protected void OnBtnI44Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 43); - this.PrintInventory(); - } - } - - protected void OnBtnI45Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 44); - this.PrintInventory(); - } - } - - protected void OnBtnI46Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 45); - this.PrintInventory(); - } - } - - protected void OnBtnI47Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 46); - this.PrintInventory(); - } - } - - protected void OnBtnI48Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 47); - this.PrintInventory(); - } - } - - protected void OnBtnI49Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 48); - this.PrintInventory(); - } - } - - protected void OnBtnI50Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 49); - this.PrintInventory(); - } - } - - protected void OnBtnI51Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 50); - this.PrintInventory(); - } - } - - protected void OnBtnI52Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 51); - this.PrintInventory(); - } - } - - protected void OnBtnI53Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 52); - this.PrintInventory(); - } - } - - protected void OnBtnI54Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 53); - this.PrintInventory(); - } - } - - protected void OnBtnI55Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 54); - this.PrintInventory(); - } - } - - protected void OnBtnI56Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 55); - this.PrintInventory(); - } - } - - protected void OnBtnI57Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 56); - this.PrintInventory(); - } - } - - protected void OnBtnI58Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 57); - this.PrintInventory(); - } - } - - protected void OnBtnI59Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 58); - this.PrintInventory(); - } - } - - protected void OnBtnI60Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 59); - this.PrintInventory(); - } - } - - protected void OnBtnI61Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 60); - this.PrintInventory(); - } - } - - protected void OnBtnI62Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 61); - this.PrintInventory(); - } - } - - protected void OnBtnI63Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 62); - this.PrintInventory(); - } - } - - protected void OnBtnI64Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 63); - this.PrintInventory(); - } - } - - protected void OnBtnI65Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 64); - this.PrintInventory(); - } - } - - protected void OnBtnI66Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 65); - this.PrintInventory(); - } - } - - protected void OnBtnI67Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 66); - this.PrintInventory(); - } - } - - protected void OnBtnI68Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 67); - this.PrintInventory(); - } - } - - protected void OnBtnI69Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 68); - this.PrintInventory(); - } - } - - protected void OnBtnI70Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 69); - this.PrintInventory(); - } - } - - protected void OnBtnI71Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 70); - this.PrintInventory(); - } - } - - protected void OnBtnI72Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 71); - this.PrintInventory(); - } - } - - protected void OnBtnI73Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 72); - this.PrintInventory(); - } - } - - protected void OnBtnI74Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 73); - this.PrintInventory(); - } - } - - protected void OnBtnI75Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 74); - this.PrintInventory(); - } - } - - protected void OnBtnI76Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 75); - this.PrintInventory(); - } - } - - protected void OnBtnI77Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 76); - this.PrintInventory(); - } - } - - protected void OnBtnI78Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 77); - this.PrintInventory(); - } - } - - protected void OnBtnI79Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 78); - this.PrintInventory(); - } - } - - protected void OnBtnI80Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 79); - this.PrintInventory(); - } - } - - protected void OnBtnI81Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 80); - this.PrintInventory(); - } - } - - // Accessories buttons - protected void OnBtnA1Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 0); - this.PrintInventory(); - } - } - - protected void OnBtnA2Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 1); - this.PrintInventory(); - } - } - - protected void OnBtnA3Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 2); - this.PrintInventory(); - } - } - - protected void OnBtnA4Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 3); - this.PrintInventory(); - } - } - - protected void OnBtnA5Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 4); - this.PrintInventory(); - } - } - - protected void OnBtnA6Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 5); - this.PrintInventory(); - } - } - - protected void OnBtnA7Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 6); - this.PrintInventory(); - } - } - - protected void OnBtnA8Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 7); - this.PrintInventory(); - } - } - - protected void OnBtnA9Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 8); - this.PrintInventory(); - } - } - - protected void OnBtnA10Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 9); - this.PrintInventory(); - } - } - - protected void OnBtnA11Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 10); - this.PrintInventory(); - } - } - - protected void OnBtnA12Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 11); - this.PrintInventory(); - } - } - - protected void OnBtnA13Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 12); - this.PrintInventory(); - } - } - - protected void OnBtnA14Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 13); - this.PrintInventory(); - } - } - - protected void OnBtnA15Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 14); - this.PrintInventory(); - } - } - - protected void OnBtnA16Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 15); - this.PrintInventory(); - } - } - - protected void OnBtnA17Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 16); - this.PrintInventory(); - } - } - - protected void OnBtnA18Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 17); - this.PrintInventory(); - } - } - - // Gear buttons - protected void OnBtnG1Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 0); - this.PrintInventory(); - } - } - - protected void OnBtnG2Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 1); - this.PrintInventory(); - } - } - - protected void OnBtnG3Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 2); - this.PrintInventory(); - } - } - - protected void OnBtnG4Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 3); - this.PrintInventory(); - } - } - - protected void OnBtnG5Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 4); - this.PrintInventory(); - } - } - - protected void OnBtnG6Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 5); - this.PrintInventory(); - } - } - - protected void OnBtnG7Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 6); - this.PrintInventory(); - } - } - - protected void OnBtnG8Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 7); - this.PrintInventory(); - } - } - - protected void OnBtnG9Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 8); - this.PrintInventory(); - } - } - - // - // VISIBILITY - // - - private void SetMapMenuVisibility(bool isVisible) { - lblGroundLayer.Visible = isVisible; - imgG1.Visible = isVisible; - imgG2.Visible = isVisible; - imgG3.Visible = isVisible; - imgG4.Visible = isVisible; - imgG5.Visible = isVisible; - imgG6.Visible = isVisible; - imgG7.Visible = isVisible; - imgG8.Visible = isVisible; - imgG9.Visible = isVisible; - imgG10.Visible = isVisible; - imgG11.Visible = isVisible; - imgG12.Visible = isVisible; - imgG13.Visible = isVisible; - imgG14.Visible = isVisible; - imgG15.Visible = isVisible; - imgG16.Visible = isVisible; - imgG17.Visible = isVisible; - imgG18.Visible = isVisible; - imgG19.Visible = isVisible; - imgG20.Visible = isVisible; - imgG21.Visible = isVisible; - imgG22.Visible = isVisible; - imgG23.Visible = isVisible; - imgG24.Visible = isVisible; - imgG25.Visible = isVisible; - imgG26.Visible = isVisible; - imgG27.Visible = isVisible; - imgG28.Visible = isVisible; - imgG29.Visible = isVisible; - imgG30.Visible = isVisible; - imgG31.Visible = isVisible; - imgG32.Visible = isVisible; - imgG33.Visible = isVisible; - imgG34.Visible = isVisible; - imgG35.Visible = isVisible; - imgG36.Visible = isVisible; - imgG37.Visible = isVisible; - imgG38.Visible = isVisible; - imgG39.Visible = isVisible; - imgG40.Visible = isVisible; - imgG41.Visible = isVisible; - imgG42.Visible = isVisible; - imgG43.Visible = isVisible; - imgG44.Visible = isVisible; - imgG45.Visible = isVisible; - imgG46.Visible = isVisible; - imgG47.Visible = isVisible; - imgG48.Visible = isVisible; - imgG49.Visible = isVisible; - imgG50.Visible = isVisible; - imgG51.Visible = isVisible; - imgG52.Visible = isVisible; - imgG53.Visible = isVisible; - imgG54.Visible = isVisible; - imgG55.Visible = isVisible; - imgG56.Visible = isVisible; - imgG57.Visible = isVisible; - imgG58.Visible = isVisible; - imgG59.Visible = isVisible; - imgG60.Visible = isVisible; - imgG61.Visible = isVisible; - imgG62.Visible = isVisible; - imgG63.Visible = isVisible; - imgG64.Visible = isVisible; - imgG65.Visible = isVisible; - imgG66.Visible = isVisible; - imgG67.Visible = isVisible; - imgG68.Visible = isVisible; - imgG69.Visible = isVisible; - imgG70.Visible = isVisible; - imgG71.Visible = isVisible; - imgG72.Visible = isVisible; - imgG73.Visible = isVisible; - imgG74.Visible = isVisible; - imgG75.Visible = isVisible; - imgG76.Visible = isVisible; - imgG77.Visible = isVisible; - imgG78.Visible = isVisible; - imgG79.Visible = isVisible; - imgG80.Visible = isVisible; - imgG81.Visible = isVisible; - - lblSuperLayer.Visible = isVisible; - lblCoord1.Visible = isVisible; - lblCoord2.Visible = isVisible; - - lblItemLayer.Visible = isVisible; - imgI1.Visible = isVisible; - imgI2.Visible = isVisible; - imgI3.Visible = isVisible; - imgI4.Visible = isVisible; - imgI5.Visible = isVisible; - imgI6.Visible = isVisible; - imgI7.Visible = isVisible; - imgI8.Visible = isVisible; - imgI9.Visible = isVisible; - imgI10.Visible = isVisible; - imgI11.Visible = isVisible; - imgI12.Visible = isVisible; - imgI13.Visible = isVisible; - imgI14.Visible = isVisible; - imgI15.Visible = isVisible; - imgI16.Visible = isVisible; - imgI17.Visible = isVisible; - imgI18.Visible = isVisible; - imgI19.Visible = isVisible; - imgI20.Visible = isVisible; - imgI21.Visible = isVisible; - imgI22.Visible = isVisible; - imgI23.Visible = isVisible; - imgI24.Visible = isVisible; - imgI25.Visible = isVisible; - imgI26.Visible = isVisible; - imgI27.Visible = isVisible; - imgI28.Visible = isVisible; - imgI29.Visible = isVisible; - imgI30.Visible = isVisible; - imgI31.Visible = isVisible; - imgI32.Visible = isVisible; - imgI33.Visible = isVisible; - imgI34.Visible = isVisible; - imgI35.Visible = isVisible; - imgI36.Visible = isVisible; - imgI37.Visible = isVisible; - imgI38.Visible = isVisible; - imgI39.Visible = isVisible; - imgI40.Visible = isVisible; - imgI41.Visible = isVisible; - imgI42.Visible = isVisible; - imgI43.Visible = isVisible; - imgI44.Visible = isVisible; - imgI45.Visible = isVisible; - imgI46.Visible = isVisible; - imgI47.Visible = isVisible; - imgI48.Visible = isVisible; - imgI49.Visible = isVisible; - imgI50.Visible = isVisible; - imgI51.Visible = isVisible; - imgI52.Visible = isVisible; - imgI53.Visible = isVisible; - imgI54.Visible = isVisible; - imgI55.Visible = isVisible; - imgI56.Visible = isVisible; - imgI57.Visible = isVisible; - imgI58.Visible = isVisible; - imgI59.Visible = isVisible; - imgI60.Visible = isVisible; - imgI61.Visible = isVisible; - imgI62.Visible = isVisible; - imgI63.Visible = isVisible; - imgI64.Visible = isVisible; - imgI65.Visible = isVisible; - imgI66.Visible = isVisible; - imgI67.Visible = isVisible; - imgI68.Visible = isVisible; - imgI69.Visible = isVisible; - imgI70.Visible = isVisible; - imgI71.Visible = isVisible; - imgI72.Visible = isVisible; - imgI73.Visible = isVisible; - imgI74.Visible = isVisible; - imgI75.Visible = isVisible; - imgI76.Visible = isVisible; - imgI77.Visible = isVisible; - imgI78.Visible = isVisible; - imgI79.Visible = isVisible; - imgI80.Visible = isVisible; - imgI81.Visible = isVisible; - - lblHoleMsg.Visible = isVisible; - lblHoleOnTop.Visible = isVisible; - - lblBlank6.Visible = isVisible; - } - - private void SetInvMenuVisibility(bool isVisible) { - btnI1.Visible = isVisible; - btnI2.Visible = isVisible; - btnI3.Visible = isVisible; - btnI4.Visible = isVisible; - btnI5.Visible = isVisible; - btnI6.Visible = isVisible; - btnI7.Visible = isVisible; - btnI8.Visible = isVisible; - btnI9.Visible = isVisible; - btnI10.Visible = isVisible; - btnI11.Visible = isVisible; - btnI12.Visible = isVisible; - btnI13.Visible = isVisible; - btnI14.Visible = isVisible; - btnI15.Visible = isVisible; - btnI16.Visible = isVisible; - btnI17.Visible = isVisible; - btnI18.Visible = isVisible; - btnI19.Visible = isVisible; - btnI20.Visible = isVisible; - btnI21.Visible = isVisible; - btnI22.Visible = isVisible; - btnI23.Visible = isVisible; - btnI24.Visible = isVisible; - btnI25.Visible = isVisible; - btnI26.Visible = isVisible; - btnI27.Visible = isVisible; - btnI28.Visible = isVisible; - btnI29.Visible = isVisible; - btnI30.Visible = isVisible; - btnI31.Visible = isVisible; - btnI32.Visible = isVisible; - btnI33.Visible = isVisible; - btnI34.Visible = isVisible; - btnI35.Visible = isVisible; - btnI36.Visible = isVisible; - btnI37.Visible = isVisible; - btnI38.Visible = isVisible; - btnI39.Visible = isVisible; - btnI40.Visible = isVisible; - btnI41.Visible = isVisible; - btnI42.Visible = isVisible; - btnI43.Visible = isVisible; - btnI44.Visible = isVisible; - btnI45.Visible = isVisible; - btnI46.Visible = isVisible; - btnI47.Visible = isVisible; - btnI48.Visible = isVisible; - btnI49.Visible = isVisible; - btnI50.Visible = isVisible; - btnI51.Visible = isVisible; - btnI52.Visible = isVisible; - btnI53.Visible = isVisible; - btnI54.Visible = isVisible; - btnI55.Visible = isVisible; - btnI56.Visible = isVisible; - btnI57.Visible = isVisible; - btnI58.Visible = isVisible; - btnI59.Visible = isVisible; - btnI60.Visible = isVisible; - btnI61.Visible = isVisible; - btnI62.Visible = isVisible; - btnI63.Visible = isVisible; - btnI64.Visible = isVisible; - btnI65.Visible = isVisible; - btnI66.Visible = isVisible; - btnI67.Visible = isVisible; - btnI68.Visible = isVisible; - btnI69.Visible = isVisible; - btnI70.Visible = isVisible; - btnI71.Visible = isVisible; - btnI72.Visible = isVisible; - btnI73.Visible = isVisible; - btnI74.Visible = isVisible; - btnI75.Visible = isVisible; - btnI76.Visible = isVisible; - btnI77.Visible = isVisible; - btnI78.Visible = isVisible; - btnI79.Visible = isVisible; - btnI80.Visible = isVisible; - btnI81.Visible = isVisible; - btnCrafting.Visible = isVisible; - - lblAccessories.Visible = isVisible; - btnA1.Visible = isVisible; - btnA2.Visible = isVisible; - btnA3.Visible = isVisible; - btnA4.Visible = isVisible; - btnA5.Visible = isVisible; - btnA6.Visible = isVisible; - btnA7.Visible = isVisible; - btnA8.Visible = isVisible; - btnA9.Visible = isVisible; - btnA10.Visible = isVisible; - btnA11.Visible = isVisible; - btnA12.Visible = isVisible; - btnA13.Visible = isVisible; - btnA14.Visible = isVisible; - btnA15.Visible = isVisible; - btnA16.Visible = isVisible; - btnA17.Visible = isVisible; - btnA18.Visible = isVisible; - - lblGear.Visible = isVisible; - btnG1.Visible = isVisible; - btnG2.Visible = isVisible; - btnG3.Visible = isVisible; - btnG4.Visible = isVisible; - btnG5.Visible = isVisible; - btnG6.Visible = isVisible; - btnG7.Visible = isVisible; - btnG8.Visible = isVisible; - btnG9.Visible = isVisible; - - imgInfo.Visible = isVisible; - lblInfo.Visible = isVisible; - - lblBlank6.Visible = isVisible; - } - } -} diff --git a/Mundus/Views/Windows/MediumGameWindow.cs b/Mundus/Views/Windows/MediumGameWindow.cs deleted file mode 100644 index 623eece..0000000 --- a/Mundus/Views/Windows/MediumGameWindow.cs +++ /dev/null @@ -1,1536 +0,0 @@ -using System; -using Gtk; -using Mundus.Service; -using Mundus.Service.Mob.Controllers; -using Mundus.Service.Mobs.Controllers; -using Mundus.Service.SuperLayers; -using Mundus.Service.Tiles.Items; - -namespace Mundus.Views.Windows { - public partial class MediumGameWindow : Gtk.Window, IGameWindow { - public int Size { get; private set; } - - public MediumGameWindow() : base( Gtk.WindowType.Toplevel ) { - this.Build(); - } - - public void OnDeleteEvent(object o, DeleteEventArgs args) { - //Open exit dialogue if you haven't saved in a while - Application.Quit(); - } - - public void SetDefaults() { - this.Size = 7; - this.SetMapMenuVisibility(false); - this.SetInvMenuVisibility(false); - } - - private void SelectItem(string place, int index) { - if (HasSelection()) { - ResetSelection(); - SwitchItems.ReplaceItems(place, index); - } - else { - selPlace = place; - selIndex = index; - SwitchItems.SetOrigin(place, index); - } - - this.PrintMainMenu(); - this.PrintInventory(); - } - - private void React(int button) { - int buttonYPos = (button - 1) / Size; - int buttonXPos = (button - (buttonYPos * Size)) - 1; - - int mapXPos = Calculate.CalculateXFromButton(buttonXPos, Size); - int mapYPos = Calculate.CalculateYFromButton(buttonYPos, Size); - - if (!HasSelection()) { - MobMovement.MovePlayer(mapYPos, mapXPos, Size); - MobMovement.MoveRandomlyAllMobs(); - } - else { - if (Inventory.GetPlayerItem(selPlace, selIndex) != null) { - if (MobFighting.ExistsFightTargetForPlayer(mapYPos, mapXPos)) { - MobFighting.PlayerTryFight(selPlace, selIndex, mapYPos, mapXPos); - } - else { - MobTerraforming.PlayerTerraformAt(mapYPos, mapXPos, selPlace, selIndex); - } - } - ResetSelection(); - } - - this.PrintScreen(); - this.PrintMainMenu(); - - if (this.MapMenuIsVisible()) { - this.PrintMap(); - } - else if (this.InvMenuIsVisible()) { - this.PrintInventory(); - } - } - - private static string selPlace = null; - private static int selIndex = -1; - private static void ResetSelection() { - selPlace = null; - selIndex = -1; - } - private static bool HasSelection() { - return selPlace != null; - } - - private bool InvMenuIsVisible() { - return btnI1.Visible; - } - - - - private bool MapMenuIsVisible() { - return imgG1.Visible; - } - - // - // PRINTING - // - - public void PrintSelectedItemInfo(ItemTile itemTile) { - if (itemTile != null) { - imgInfo.SetFromStock(itemTile.stock_id, IconSize.Dnd); - lblInfo.Text = itemTile.ToString(); - } - else { - imgInfo.SetFromImage(null, null); - lblInfo.Text = null; - } - } - - public void PrintScreen() { - for (int layer = 0; layer < 3; layer++) { - for (int row = Calculate.CalculateStartY(Size), maxY = Calculate.CalculateMaxY(Size), btn = 1; row <= maxY; row++) { - for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, btn++) { - Image img = ImageController.GetScreenImage(row, col, layer); - - if (img == null) continue; - - switch (btn) { - case 1: btnP1.Image = img; break; - case 2: btnP2.Image = img; break; - case 3: btnP3.Image = img; break; - case 4: btnP4.Image = img; break; - case 5: btnP5.Image = img; break; - case 6: btnP6.Image = img; break; - case 7: btnP7.Image = img; break; - case 8: btnP8.Image = img; break; - case 9: btnP9.Image = img; break; - case 10: btnP10.Image = img; break; - case 11: btnP11.Image = img; break; - case 12: btnP12.Image = img; break; - case 13: btnP13.Image = img; break; - case 14: btnP14.Image = img; break; - case 15: btnP15.Image = img; break; - case 16: btnP16.Image = img; break; - case 17: btnP17.Image = img; break; - case 18: btnP18.Image = img; break; - case 19: btnP19.Image = img; break; - case 20: btnP20.Image = img; break; - case 21: btnP21.Image = img; break; - case 22: btnP22.Image = img; break; - case 23: btnP23.Image = img; break; - case 24: btnP24.Image = img; break; - case 25: btnP25.Image = img; break; - case 26: btnP26.Image = img; break; - case 27: btnP27.Image = img; break; - case 28: btnP28.Image = img; break; - case 29: btnP29.Image = img; break; - case 30: btnP30.Image = img; break; - case 31: btnP31.Image = img; break; - case 32: btnP32.Image = img; break; - case 33: btnP33.Image = img; break; - case 34: btnP34.Image = img; break; - case 35: btnP35.Image = img; break; - case 36: btnP36.Image = img; break; - case 37: btnP37.Image = img; break; - case 38: btnP38.Image = img; break; - case 39: btnP39.Image = img; break; - case 40: btnP40.Image = img; break; - case 41: btnP41.Image = img; break; - case 42: btnP42.Image = img; break; - case 43: btnP43.Image = img; break; - case 44: btnP44.Image = img; break; - case 45: btnP45.Image = img; break; - case 46: btnP46.Image = img; break; - case 47: btnP47.Image = img; break; - case 48: btnP48.Image = img; break; - case 49: btnP49.Image = img; break; - } - } - } - } - } - - public void PrintMainMenu() { - //Print lungs - - //Print health - for (int i = 0; i < Size; i++) { - string iName = MobStatsController.GetPlayerHearth(i); - - switch (i) { - case 0: imgS8.SetFromStock(iName, IconSize.Dnd); break; - case 1: imgS9.SetFromStock(iName, IconSize.Dnd); break; - case 2: imgS10.SetFromStock(iName, IconSize.Dnd); break; - case 3: imgS11.SetFromStock(iName, IconSize.Dnd); break; - case 4: imgS12.SetFromStock(iName, IconSize.Dnd); break; - case 5: imgS13.SetFromStock(iName, IconSize.Dnd); break; - case 6: imgS14.SetFromStock(iName, IconSize.Dnd); break; - } - } - - //Prints hotbar - for (int i = 0; i < Size; i++) { - Image img = ImageController.GetPlayerHotbarImage(i); - - switch (i) { - case 0: btnH1.Image = img; break; - case 1: btnH2.Image = img; break; - case 2: btnH3.Image = img; break; - case 3: btnH4.Image = img; break; - case 4: btnH5.Image = img; break; - case 5: btnH6.Image = img; break; - case 6: btnH7.Image = img; break; - } - } - - //Prints log - for (int i = 0, mIndex = LogController.GetCount() - 1; i < Size; mIndex--, i++) { - string msg = LogController.GetMessagage(mIndex); - - switch (i) { - case 0: lblLog1.Text = msg; break; - case 1: lblLog2.Text = msg; break; - case 2: lblLog3.Text = msg; break; - case 3: lblLog4.Text = msg; break; - case 4: lblLog5.Text = msg; break; - case 5: lblLog6.Text = msg; break; - } - } - } - - 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++) { - for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, img++) { - string sName = ImageController.GetPlayerGroundImage(row, col).Stock; - - switch (img) { - case 1: imgG1.SetFromStock(sName, IconSize.Dnd); break; - case 2: imgG2.SetFromStock(sName, IconSize.Dnd); break; - case 3: imgG3.SetFromStock(sName, IconSize.Dnd); break; - case 4: imgG4.SetFromStock(sName, IconSize.Dnd); break; - case 5: imgG5.SetFromStock(sName, IconSize.Dnd); break; - case 6: imgG6.SetFromStock(sName, IconSize.Dnd); break; - case 7: imgG7.SetFromStock(sName, IconSize.Dnd); break; - case 8: imgG8.SetFromStock(sName, IconSize.Dnd); break; - case 9: imgG9.SetFromStock(sName, IconSize.Dnd); break; - case 10: imgG10.SetFromStock(sName, IconSize.Dnd); break; - case 11: imgG11.SetFromStock(sName, IconSize.Dnd); break; - case 12: imgG12.SetFromStock(sName, IconSize.Dnd); break; - case 13: imgG13.SetFromStock(sName, IconSize.Dnd); break; - case 14: imgG14.SetFromStock(sName, IconSize.Dnd); break; - case 15: imgG15.SetFromStock(sName, IconSize.Dnd); break; - case 16: imgG16.SetFromStock(sName, IconSize.Dnd); break; - case 17: imgG17.SetFromStock(sName, IconSize.Dnd); break; - case 18: imgG18.SetFromStock(sName, IconSize.Dnd); break; - case 19: imgG19.SetFromStock(sName, IconSize.Dnd); break; - case 20: imgG20.SetFromStock(sName, IconSize.Dnd); break; - case 21: imgG21.SetFromStock(sName, IconSize.Dnd); break; - case 22: imgG22.SetFromStock(sName, IconSize.Dnd); break; - case 23: imgG23.SetFromStock(sName, IconSize.Dnd); break; - case 24: imgG24.SetFromStock(sName, IconSize.Dnd); break; - case 25: imgG25.SetFromStock(sName, IconSize.Dnd); break; - case 26: imgG26.SetFromStock(sName, IconSize.Dnd); break; - case 27: imgG27.SetFromStock(sName, IconSize.Dnd); break; - case 28: imgG28.SetFromStock(sName, IconSize.Dnd); break; - case 29: imgG29.SetFromStock(sName, IconSize.Dnd); break; - case 30: imgG30.SetFromStock(sName, IconSize.Dnd); break; - case 31: imgG31.SetFromStock(sName, IconSize.Dnd); break; - case 32: imgG32.SetFromStock(sName, IconSize.Dnd); break; - case 33: imgG33.SetFromStock(sName, IconSize.Dnd); break; - case 34: imgG34.SetFromStock(sName, IconSize.Dnd); break; - case 35: imgG35.SetFromStock(sName, IconSize.Dnd); break; - case 36: imgG36.SetFromStock(sName, IconSize.Dnd); break; - case 37: imgG37.SetFromStock(sName, IconSize.Dnd); break; - case 38: imgG38.SetFromStock(sName, IconSize.Dnd); break; - case 39: imgG39.SetFromStock(sName, IconSize.Dnd); break; - case 40: imgG40.SetFromStock(sName, IconSize.Dnd); break; - case 41: imgG41.SetFromStock(sName, IconSize.Dnd); break; - case 42: imgG42.SetFromStock(sName, IconSize.Dnd); break; - case 43: imgG43.SetFromStock(sName, IconSize.Dnd); break; - case 44: imgG44.SetFromStock(sName, IconSize.Dnd); break; - case 45: imgG45.SetFromStock(sName, IconSize.Dnd); break; - case 46: imgG46.SetFromStock(sName, IconSize.Dnd); break; - case 47: imgG47.SetFromStock(sName, IconSize.Dnd); break; - case 48: imgG48.SetFromStock(sName, IconSize.Dnd); break; - case 49: imgG49.SetFromStock(sName, IconSize.Dnd); break; - } - } - } - - lblSuperLayer.Text = MobStatsController.GetPlayerSuperLayerName(); - lblCoord1.Text = "X: " + MobStatsController.GetPlayerXCoord(); - lblCoord2.Text = "Y: " + MobStatsController.GetPlayerYCoord(); - - //Prints the "Item layer" in map menu - for (int row = Calculate.CalculateStartY(Size), maxY = Calculate.CalculateMaxY(Size), img = 1; row <= maxY; row++) { - for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, img++) { - string sName = ImageController.GetPlayerStructureImage(row, col).Stock; - - switch (img) { - case 1: imgI1.SetFromStock(sName, IconSize.Dnd); break; - case 2: imgI2.SetFromStock(sName, IconSize.Dnd); break; - case 3: imgI3.SetFromStock(sName, IconSize.Dnd); break; - case 4: imgI4.SetFromStock(sName, IconSize.Dnd); break; - case 5: imgI5.SetFromStock(sName, IconSize.Dnd); break; - case 6: imgI6.SetFromStock(sName, IconSize.Dnd); break; - case 7: imgI7.SetFromStock(sName, IconSize.Dnd); break; - case 8: imgI8.SetFromStock(sName, IconSize.Dnd); break; - case 9: imgI9.SetFromStock(sName, IconSize.Dnd); break; - case 10: imgI10.SetFromStock(sName, IconSize.Dnd); break; - case 11: imgI11.SetFromStock(sName, IconSize.Dnd); break; - case 12: imgI12.SetFromStock(sName, IconSize.Dnd); break; - case 13: imgI13.SetFromStock(sName, IconSize.Dnd); break; - case 14: imgI14.SetFromStock(sName, IconSize.Dnd); break; - case 15: imgI15.SetFromStock(sName, IconSize.Dnd); break; - case 16: imgI16.SetFromStock(sName, IconSize.Dnd); break; - case 17: imgI17.SetFromStock(sName, IconSize.Dnd); break; - case 18: imgI18.SetFromStock(sName, IconSize.Dnd); break; - case 19: imgI19.SetFromStock(sName, IconSize.Dnd); break; - case 20: imgI20.SetFromStock(sName, IconSize.Dnd); break; - case 21: imgI21.SetFromStock(sName, IconSize.Dnd); break; - case 22: imgI22.SetFromStock(sName, IconSize.Dnd); break; - case 23: imgI23.SetFromStock(sName, IconSize.Dnd); break; - case 24: imgI24.SetFromStock(sName, IconSize.Dnd); break; - case 25: imgI25.SetFromStock(sName, IconSize.Dnd); break; - case 26: imgI26.SetFromStock(sName, IconSize.Dnd); break; - case 27: imgI27.SetFromStock(sName, IconSize.Dnd); break; - case 28: imgI28.SetFromStock(sName, IconSize.Dnd); break; - case 29: imgI29.SetFromStock(sName, IconSize.Dnd); break; - case 30: imgI30.SetFromStock(sName, IconSize.Dnd); break; - case 31: imgI31.SetFromStock(sName, IconSize.Dnd); break; - case 32: imgI32.SetFromStock(sName, IconSize.Dnd); break; - case 33: imgI33.SetFromStock(sName, IconSize.Dnd); break; - case 34: imgI34.SetFromStock(sName, IconSize.Dnd); break; - case 35: imgI35.SetFromStock(sName, IconSize.Dnd); break; - case 36: imgI36.SetFromStock(sName, IconSize.Dnd); break; - case 37: imgI37.SetFromStock(sName, IconSize.Dnd); break; - case 38: imgI38.SetFromStock(sName, IconSize.Dnd); break; - case 39: imgI39.SetFromStock(sName, IconSize.Dnd); break; - case 40: imgI40.SetFromStock(sName, IconSize.Dnd); break; - case 41: imgI41.SetFromStock(sName, IconSize.Dnd); break; - case 42: imgI42.SetFromStock(sName, IconSize.Dnd); break; - case 43: imgI43.SetFromStock(sName, IconSize.Dnd); break; - case 44: imgI44.SetFromStock(sName, IconSize.Dnd); break; - case 45: imgI45.SetFromStock(sName, IconSize.Dnd); break; - case 46: imgI46.SetFromStock(sName, IconSize.Dnd); break; - case 47: imgI47.SetFromStock(sName, IconSize.Dnd); break; - case 48: imgI48.SetFromStock(sName, IconSize.Dnd); break; - case 49: imgI49.SetFromStock(sName, IconSize.Dnd); break; - } - } - } - - lblHoleOnTop.Text = MobStatsController.ExistsHoleOnTopOfPlayer() + ""; - } - - public void PrintInventory() { - //Prints the actual inventory (items) - for (int row = 0; row < Size; row++) { - for (int col = 0; col < Size; col++) { - Image img = ImageController.GetPlayerInventoryItemImage(row * Size + col); - - switch (row * Size + col + 1) { - case 1: btnI1.Image = img; break; - case 2: btnI2.Image = img; break; - case 3: btnI3.Image = img; break; - case 4: btnI4.Image = img; break; - case 5: btnI5.Image = img; break; - case 6: btnI6.Image = img; break; - case 7: btnI7.Image = img; break; - case 8: btnI8.Image = img; break; - case 9: btnI9.Image = img; break; - case 10: btnI10.Image = img; break; - case 11: btnI11.Image = img; break; - case 12: btnI12.Image = img; break; - case 13: btnI13.Image = img; break; - case 14: btnI14.Image = img; break; - case 15: btnI15.Image = img; break; - case 16: btnI16.Image = img; break; - case 17: btnI17.Image = img; break; - case 18: btnI18.Image = img; break; - case 19: btnI19.Image = img; break; - case 20: btnI20.Image = img; break; - case 21: btnI21.Image = img; break; - case 22: btnI22.Image = img; break; - case 23: btnI23.Image = img; break; - case 24: btnI24.Image = img; break; - case 25: btnI25.Image = img; break; - case 26: btnI26.Image = img; break; - case 27: btnI27.Image = img; break; - case 28: btnI28.Image = img; break; - case 29: btnI29.Image = img; break; - case 30: btnI30.Image = img; break; - case 31: btnI31.Image = img; break; - case 32: btnI32.Image = img; break; - case 33: btnI33.Image = img; break; - case 34: btnI34.Image = img; break; - case 35: btnI35.Image = img; break; - case 36: btnI36.Image = img; break; - case 37: btnI37.Image = img; break; - case 38: btnI38.Image = img; break; - case 39: btnI39.Image = img; break; - case 40: btnI40.Image = img; break; - case 41: btnI41.Image = img; break; - case 42: btnI42.Image = img; break; - case 43: btnI43.Image = img; break; - case 44: btnI44.Image = img; break; - case 45: btnI45.Image = img; break; - case 46: btnI46.Image = img; break; - case 47: btnI47.Image = img; break; - case 48: btnI48.Image = img; break; - case 49: btnI49.Image = img; break; - } - } - } - - //Prints accessories - for (int row = 0; row < 2; row++) { - for (int col = 0; col < Size; col++) { - Image img = ImageController.GetPlayerAccessoryImage(row * Size + col); - - switch (row * Size + col + 1) { - case 1: btnA1.Image = img; break; - case 2: btnA2.Image = img; break; - case 3: btnA3.Image = img; break; - case 4: btnA4.Image = img; break; - case 5: btnA5.Image = img; break; - case 6: btnA6.Image = img; break; - case 7: btnA7.Image = img; break; - case 8: btnA8.Image = img; break; - case 9: btnA9.Image = img; break; - case 10: btnA10.Image = img; break; - case 11: btnA11.Image = img; break; - case 12: btnA12.Image = img; break; - case 13: btnA13.Image = img; break; - case 14: btnA14.Image = img; break; - } - } - } - - //Prints gear - for (int i = 0; i < Size; i++) { - Image img = ImageController.GetPlayerGearImage(i); - - switch (i + 1) { - case 1: btnG1.Image = img; break; - case 2: btnG2.Image = img; break; - case 3: btnG3.Image = img; break; - case 4: btnG4.Image = img; break; - case 5: btnG5.Image = img; break; - case 6: btnG6.Image = img; break; - case 7: btnG7.Image = img; break; - } - } - } - - // - // BUTTON CLICKED EVENTS - // - - protected void OnBtnMapClicked(object sender, EventArgs e) { - //Hide inv menu, if it is visible (so only one of the two is visible) - if (this.InvMenuIsVisible()) this.OnBtnInvClicked(this, null); - - if (this.MapMenuIsVisible()) { - this.SetMapMenuVisibility(false); - } - else { - this.PrintMap(); - this.SetMapMenuVisibility(true); - } - } - - protected void OnBtnInvClicked(object sender, EventArgs e) { - //Hide map menu, if it is visible (so only one of the two is visible) - if (this.MapMenuIsVisible()) this.OnBtnMapClicked(this, null); - - if (btnI1.Visible) { - this.SetInvMenuVisibility(false); - } - else { - this.PrintInventory(); - this.SetInvMenuVisibility(true); - } - } - - protected void OnBtnPauseClicked(object sender, EventArgs e) { - // Note: pause window blocks player input - WindowController.ShowPauseWindow(); - } - - protected void OnBtnMusicClicked(object sender, EventArgs e) { - WindowController.ShowMusicWindow(); - } - - - protected void OnBtnCraftingClicked(object sender, EventArgs e) { - WindowController.ShowCraftingWindow(); - } - - // Screen buttons - protected void OnBtnP1Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(1); - } - } - - protected void OnBtnP2Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(2); - } - } - - protected void OnBtnP3Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(3); - } - } - - protected void OnBtnP4Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(4); - } - } - - protected void OnBtnP5Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(5); - } - } - - protected void OnBtnP6Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(6); - } - } - - protected void OnBtnP7Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(7); - } - } - - protected void OnBtnP8Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(8); - } - } - - protected void OnBtnP9Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(9); - } - } - - protected void OnBtnP10Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(10); - } - } - - protected void OnBtnP11Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(11); - } - } - - protected void OnBtnP12Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(12); - } - } - - protected void OnBtnP13Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(13); - } - } - - protected void OnBtnP14Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(14); - } - } - - protected void OnBtnP15Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(15); - } - } - - protected void OnBtnP16Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(16); - } - } - - protected void OnBtnP17Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(17); - } - } - - protected void OnBtnP18Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(18); - } - } - - protected void OnBtnP19Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(19); - } - } - - protected void OnBtnP20Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(20); - } - } - - protected void OnBtnP21Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(21); - } - } - - protected void OnBtnP22Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(22); - } - } - - protected void OnBtnP23Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(23); - } - } - - protected void OnBtnP24Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(24); - } - } - - protected void OnBtnP25Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(25); - } - } - - protected void OnBtnP26Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(26); - } - } - - protected void OnBtnP27Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(27); - } - } - - protected void OnBtnP28Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(28); - } - } - - protected void OnBtnP29Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(29); - } - } - - protected void OnBtnP30Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(30); - } - } - - protected void OnBtnP31Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(31); - } - } - - protected void OnBtnP32Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(32); - } - } - - protected void OnBtnP33Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(33); - } - } - - protected void OnBtnP34Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(34); - } - } - - protected void OnBtnP35Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(35); - } - } - - protected void OnBtnP36Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(36); - } - } - - protected void OnBtnP37Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(37); - } - } - - protected void OnBtnP38Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(38); - } - } - - protected void OnBtnP39Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(39); - } - } - - protected void OnBtnP40Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(40); - } - } - - protected void OnBtnP41Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(41); - } - } - - protected void OnBtnP42Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(42); - } - } - - protected void OnBtnP43Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(43); - } - } - - protected void OnBtnP44Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(44); - } - } - - protected void OnBtnP45Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(45); - } - } - - protected void OnBtnP46Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(46); - } - } - - protected void OnBtnP47Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(47); - } - } - - protected void OnBtnP48Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(48); - } - } - - protected void OnBtnP49Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(49); - } - } - - // Hotbar buttons - protected void OnBtnH1Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 0); - this.PrintMainMenu(); - } - } - - protected void OnBtnH2Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 1); - this.PrintMainMenu(); - } - } - - protected void OnBtnH3Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 2); - this.PrintMainMenu(); - } - } - - protected void OnBtnH4Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 3); - this.PrintMainMenu(); - } - } - - protected void OnBtnH5Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 4); - this.PrintMainMenu(); - } - } - - protected void OnBtnH6Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 5); - this.PrintMainMenu(); - } - } - - protected void OnBtnH7Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 6); - this.PrintMainMenu(); - } - } - - protected void OnBtnLogClicked(object sender, EventArgs e) { - WindowController.ShowLogWindow(); - } - - // Inventory (items) buttons - protected void OnBtnI1Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 0); - this.PrintInventory(); - } - } - - protected void OnBtnI2Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 1); - this.PrintInventory(); - } - } - - protected void OnBtnI3Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 2); - this.PrintInventory(); - } - } - - protected void OnBtnI4Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 3); - this.PrintInventory(); - } - } - - protected void OnBtnI5Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 4); - this.PrintInventory(); - } - } - - protected void OnBtnI6Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 5); - this.PrintInventory(); - } - } - - protected void OnBtnI7Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 6); - this.PrintInventory(); - } - } - - protected void OnBtnI8Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 7); - this.PrintInventory(); - } - } - - protected void OnBtnI9Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 8); - this.PrintInventory(); - } - } - - protected void OnBtnI10Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 9); - this.PrintInventory(); - } - } - - protected void OnBtnI11Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 10); - this.PrintInventory(); - } - } - - protected void OnBtnI12Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 11); - this.PrintInventory(); - } - } - - protected void OnBtnI13Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 12); - this.PrintInventory(); - } - } - - protected void OnBtnI14Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 13); - this.PrintInventory(); - } - } - - protected void OnBtnI15Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 14); - this.PrintInventory(); - } - } - - protected void OnBtnI16Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 15); - this.PrintInventory(); - } - } - - protected void OnBtnI17Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 16); - this.PrintInventory(); - } - } - - protected void OnBtnI18Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 17); - this.PrintInventory(); - } - } - - protected void OnBtnI19Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 18); - this.PrintInventory(); - } - } - - protected void OnBtnI20Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 19); - this.PrintInventory(); - } - } - - protected void OnBtnI21Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 20); - this.PrintInventory(); - } - } - - protected void OnBtnI22Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 21); - this.PrintInventory(); - } - } - - protected void OnBtnI23Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 22); - this.PrintInventory(); - } - } - - protected void OnBtnI24Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 23); - this.PrintInventory(); - } - } - - protected void OnBtnI25Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 24); - this.PrintInventory(); - } - } - - protected void OnBtnI26Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 25); - this.PrintInventory(); - } - } - - protected void OnBtnI27Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 26); - this.PrintInventory(); - } - } - - protected void OnBtnI28Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 27); - this.PrintInventory(); - } - } - - protected void OnBtnI29Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 28); - this.PrintInventory(); - } - } - - protected void OnBtnI30Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 29); - this.PrintInventory(); - } - } - - protected void OnBtnI31Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 30); - this.PrintInventory(); - } - } - - protected void OnBtnI32Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 31); - this.PrintInventory(); - } - } - - protected void OnBtnI33Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 32); - this.PrintInventory(); - } - } - - protected void OnBtnI34Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 33); - this.PrintInventory(); - } - } - - protected void OnBtnI35Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 34); - this.PrintInventory(); - } - } - - protected void OnBtnI36Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 35); - this.PrintInventory(); - } - } - - protected void OnBtnI37Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 36); - this.PrintInventory(); - } - } - - protected void OnBtnI38Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 37); - this.PrintInventory(); - } - } - - protected void OnBtnI39Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 38); - this.PrintInventory(); - } - } - - protected void OnBtnI40Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 39); - this.PrintInventory(); - } - } - - protected void OnBtnI41Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 40); - this.PrintInventory(); - } - } - - protected void OnBtnI42Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 41); - this.PrintInventory(); - } - } - - protected void OnBtnI43Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 42); - this.PrintInventory(); - } - } - - protected void OnBtnI44Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 43); - this.PrintInventory(); - } - } - - protected void OnBtnI45Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 44); - this.PrintInventory(); - } - } - - protected void OnBtnI46Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 45); - this.PrintInventory(); - } - } - - protected void OnBtnI47Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 46); - this.PrintInventory(); - } - } - - protected void OnBtnI48Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 47); - this.PrintInventory(); - } - } - - protected void OnBtnI49Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 48); - this.PrintInventory(); - } - } - - // Accessories buttons - protected void OnBtnA1Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 0); - this.PrintInventory(); - } - } - - protected void OnBtnA2Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 1); - this.PrintInventory(); - } - } - - protected void OnBtnA3Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 2); - this.PrintInventory(); - } - } - - protected void OnBtnA4Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 3); - this.PrintInventory(); - } - } - - protected void OnBtnA5Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 4); - this.PrintInventory(); - } - } - - protected void OnBtnA6Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 5); - this.PrintInventory(); - } - } - - protected void OnBtnA7Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 6); - this.PrintInventory(); - } - } - - protected void OnBtnA8Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 7); - this.PrintInventory(); - } - } - - protected void OnBtnA9Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 8); - this.PrintInventory(); - } - } - - protected void OnBtnA10Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 9); - this.PrintInventory(); - } - } - - protected void OnBtnA11Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 10); - this.PrintInventory(); - } - } - - protected void OnBtnA12Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 11); - this.PrintInventory(); - } - } - - protected void OnBtnA13Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 12); - this.PrintInventory(); - } - } - - protected void OnBtnA14Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 13); - this.PrintInventory(); - } - } - - // Gear buttons - protected void OnBtnG1Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 0); - this.PrintInventory(); - } - } - - protected void OnBtnG2Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 1); - this.PrintInventory(); - } - } - - protected void OnBtnG3Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 2); - this.PrintInventory(); - } - } - - protected void OnBtnG4Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 3); - this.PrintInventory(); - } - } - - protected void OnBtnG5Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 4); - this.PrintInventory(); - } - } - - protected void OnBtnG6Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 5); - this.PrintInventory(); - } - } - - protected void OnBtnG7Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 6); - this.PrintInventory(); - } - } - - // - // VISIBILITY - // - - private void SetMapMenuVisibility(bool isVisible) { - lblGroundLayer.Visible = isVisible; - imgG1.Visible = isVisible; - imgG2.Visible = isVisible; - imgG3.Visible = isVisible; - imgG4.Visible = isVisible; - imgG5.Visible = isVisible; - imgG6.Visible = isVisible; - imgG7.Visible = isVisible; - imgG8.Visible = isVisible; - imgG9.Visible = isVisible; - imgG10.Visible = isVisible; - imgG11.Visible = isVisible; - imgG12.Visible = isVisible; - imgG13.Visible = isVisible; - imgG14.Visible = isVisible; - imgG15.Visible = isVisible; - imgG16.Visible = isVisible; - imgG17.Visible = isVisible; - imgG18.Visible = isVisible; - imgG19.Visible = isVisible; - imgG20.Visible = isVisible; - imgG21.Visible = isVisible; - imgG22.Visible = isVisible; - imgG23.Visible = isVisible; - imgG24.Visible = isVisible; - imgG25.Visible = isVisible; - imgG26.Visible = isVisible; - imgG27.Visible = isVisible; - imgG28.Visible = isVisible; - imgG29.Visible = isVisible; - imgG30.Visible = isVisible; - imgG31.Visible = isVisible; - imgG32.Visible = isVisible; - imgG33.Visible = isVisible; - imgG34.Visible = isVisible; - imgG35.Visible = isVisible; - imgG36.Visible = isVisible; - imgG37.Visible = isVisible; - imgG38.Visible = isVisible; - imgG39.Visible = isVisible; - imgG40.Visible = isVisible; - imgG41.Visible = isVisible; - imgG42.Visible = isVisible; - imgG43.Visible = isVisible; - imgG44.Visible = isVisible; - imgG45.Visible = isVisible; - imgG46.Visible = isVisible; - imgG47.Visible = isVisible; - imgG48.Visible = isVisible; - imgG49.Visible = isVisible; - - lblSuperLayer.Visible = isVisible; - lblCoord1.Visible = isVisible; - lblCoord2.Visible = isVisible; - - lblItemLayer.Visible = isVisible; - imgI1.Visible = isVisible; - imgI2.Visible = isVisible; - imgI3.Visible = isVisible; - imgI4.Visible = isVisible; - imgI5.Visible = isVisible; - imgI6.Visible = isVisible; - imgI7.Visible = isVisible; - imgI8.Visible = isVisible; - imgI9.Visible = isVisible; - imgI10.Visible = isVisible; - imgI11.Visible = isVisible; - imgI12.Visible = isVisible; - imgI13.Visible = isVisible; - imgI14.Visible = isVisible; - imgI15.Visible = isVisible; - imgI16.Visible = isVisible; - imgI17.Visible = isVisible; - imgI18.Visible = isVisible; - imgI19.Visible = isVisible; - imgI20.Visible = isVisible; - imgI21.Visible = isVisible; - imgI22.Visible = isVisible; - imgI23.Visible = isVisible; - imgI24.Visible = isVisible; - imgI25.Visible = isVisible; - imgI26.Visible = isVisible; - imgI27.Visible = isVisible; - imgI28.Visible = isVisible; - imgI29.Visible = isVisible; - imgI30.Visible = isVisible; - imgI31.Visible = isVisible; - imgI32.Visible = isVisible; - imgI33.Visible = isVisible; - imgI34.Visible = isVisible; - imgI35.Visible = isVisible; - imgI36.Visible = isVisible; - imgI37.Visible = isVisible; - imgI38.Visible = isVisible; - imgI39.Visible = isVisible; - imgI40.Visible = isVisible; - imgI41.Visible = isVisible; - imgI42.Visible = isVisible; - imgI43.Visible = isVisible; - imgI44.Visible = isVisible; - imgI45.Visible = isVisible; - imgI46.Visible = isVisible; - imgI47.Visible = isVisible; - imgI48.Visible = isVisible; - imgI49.Visible = isVisible; - - lblHoleMsg.Visible = isVisible; - lblHoleOnTop.Visible = isVisible; - - lblBlank6.Visible = isVisible; - } - - private void SetInvMenuVisibility(bool isVisible) { - btnI1.Visible = isVisible; - btnI2.Visible = isVisible; - btnI3.Visible = isVisible; - btnI4.Visible = isVisible; - btnI5.Visible = isVisible; - btnI6.Visible = isVisible; - btnI7.Visible = isVisible; - btnI8.Visible = isVisible; - btnI9.Visible = isVisible; - btnI10.Visible = isVisible; - btnI11.Visible = isVisible; - btnI12.Visible = isVisible; - btnI13.Visible = isVisible; - btnI14.Visible = isVisible; - btnI15.Visible = isVisible; - btnI16.Visible = isVisible; - btnI17.Visible = isVisible; - btnI18.Visible = isVisible; - btnI19.Visible = isVisible; - btnI20.Visible = isVisible; - btnI21.Visible = isVisible; - btnI22.Visible = isVisible; - btnI23.Visible = isVisible; - btnI24.Visible = isVisible; - btnI25.Visible = isVisible; - btnI26.Visible = isVisible; - btnI27.Visible = isVisible; - btnI28.Visible = isVisible; - btnI29.Visible = isVisible; - btnI30.Visible = isVisible; - btnI31.Visible = isVisible; - btnI32.Visible = isVisible; - btnI33.Visible = isVisible; - btnI34.Visible = isVisible; - btnI35.Visible = isVisible; - btnI36.Visible = isVisible; - btnI37.Visible = isVisible; - btnI38.Visible = isVisible; - btnI39.Visible = isVisible; - btnI40.Visible = isVisible; - btnI41.Visible = isVisible; - btnI42.Visible = isVisible; - btnI43.Visible = isVisible; - btnI44.Visible = isVisible; - btnI45.Visible = isVisible; - btnI46.Visible = isVisible; - btnI47.Visible = isVisible; - btnI48.Visible = isVisible; - btnI49.Visible = isVisible; - btnCrafting.Visible = isVisible; - - lblAccessories.Visible = isVisible; - btnA1.Visible = isVisible; - btnA2.Visible = isVisible; - btnA3.Visible = isVisible; - btnA4.Visible = isVisible; - btnA5.Visible = isVisible; - btnA6.Visible = isVisible; - btnA7.Visible = isVisible; - btnA8.Visible = isVisible; - btnA9.Visible = isVisible; - btnA10.Visible = isVisible; - btnA11.Visible = isVisible; - btnA12.Visible = isVisible; - btnA13.Visible = isVisible; - btnA14.Visible = isVisible; - - lblGear.Visible = isVisible; - btnG1.Visible = isVisible; - btnG2.Visible = isVisible; - btnG3.Visible = isVisible; - btnG4.Visible = isVisible; - btnG5.Visible = isVisible; - btnG6.Visible = isVisible; - btnG7.Visible = isVisible; - - imgInfo.Visible = isVisible; - lblInfo.Visible = isVisible; - - lblBlank6.Visible = isVisible; - } - } -} diff --git a/Mundus/Views/Windows/PauseWindow.cs b/Mundus/Views/Windows/PauseWindow.cs index b67e27c..7df7717 100644 --- a/Mundus/Views/Windows/PauseWindow.cs +++ b/Mundus/Views/Windows/PauseWindow.cs @@ -1,6 +1,7 @@ using System; using Gtk; using Mundus.Service; +using Mundus.Views.Windows.GameWindows; namespace Mundus.Views.Windows { public partial class PauseWindow : Gtk.Window { diff --git a/Mundus/Views/Windows/SmallGameWindow.cs b/Mundus/Views/Windows/SmallGameWindow.cs deleted file mode 100644 index d57ea30..0000000 --- a/Mundus/Views/Windows/SmallGameWindow.cs +++ /dev/null @@ -1,960 +0,0 @@ -using System; -using Gtk; -using Mundus.Service; -using Mundus.Service.Mob.Controllers; -using Mundus.Service.Mobs; -using Mundus.Service.Mobs.Controllers; -using Mundus.Service.SuperLayers; -using Mundus.Service.Tiles.Items; - -namespace Mundus.Views.Windows { - public partial class SmallGameWindow : Gtk.Window, IGameWindow { - /*Value for the height and width of the game screen, map screens and inventory screen - *and the width of stats, hotbar, accessories, gear & items on the ground menus*/ - public int Size { get; private set; } - - public SmallGameWindow() : base( Gtk.WindowType.Toplevel ) { - this.Build(); - } - - public void OnDeleteEvent(object o, Gtk.DeleteEventArgs args) { - //Open exit dialogue if you haven't saved in a while - //if () { //TODO: check if you have saved - // //TODO: pause game cycle - - // ResponseType rt = (ResponseType)DI.DExit.Run(); - // DI.DExit.Hide(); - - // if(rt == ResponseType.Cancel || rt == ResponseType.DeleteEvent) { - // //cancel the exit procedure and keep the window open - // args.RetVal = true; - // return; - // } - // else if (rt == ResponseType.Accept) { - // //TODO: call code for saving the game - // } - //} - - Application.Quit(); - } - - public void SetDefaults() { - this.Size = 5; - this.SetMapMenuVisibility(false); - this.SetInvMenuVisibility(false); - } - - private void SelectItem(string place, int index) { - if (HasSelection()) { - ResetSelection(); - SwitchItems.ReplaceItems(place, index); - } - else { - selPlace = place; - selIndex = index; - SwitchItems.SetOrigin(place, index); - } - - this.PrintMainMenu(); - this.PrintInventory(); - } - - private void React(int button) { - int buttonYPos = (button - 1) / Size; - int buttonXPos = (button - (buttonYPos * Size)) - 1; - - int mapXPos = Calculate.CalculateXFromButton(buttonXPos, Size); - int mapYPos = Calculate.CalculateYFromButton(buttonYPos, Size); - - if (!HasSelection()) { - MobMovement.MovePlayer(mapYPos, mapXPos, Size); - MobMovement.MoveRandomlyAllMobs(); - } - else { - if (Inventory.GetPlayerItem(selPlace, selIndex) != null) { - if (MobFighting.ExistsFightTargetForPlayer(mapYPos, mapXPos)) { - MobFighting.PlayerTryFight(selPlace, selIndex, mapYPos, mapXPos); - } - else { - MobTerraforming.PlayerTerraformAt(mapYPos, mapXPos, selPlace, selIndex); - } - } - ResetSelection(); - } - - this.PrintScreen(); - this.PrintMainMenu(); - - if (this.MapMenuIsVisible()) { - this.PrintMap(); - } - else if (this.InvMenuIsVisible()) { - this.PrintInventory(); - } - } - - private static string selPlace = null; - private static int selIndex = -1; - private static void ResetSelection() { - selPlace = null; - selIndex = -1; - } - private static bool HasSelection() { - return selPlace != null; - } - - private bool MapMenuIsVisible() { - return imgG1.Visible; - } - - - private bool InvMenuIsVisible() { - return btnI1.Visible; - } - - // - // PRINTING - // - - public void PrintSelectedItemInfo(ItemTile itemTile) { - if (itemTile != null) { - imgInfo.SetFromStock(itemTile.stock_id, IconSize.Dnd); - lblInfo.Text = itemTile.ToString(); - } - else { - imgInfo.SetFromImage(null, null); - lblInfo.Text = null; - } - } - - public void PrintScreen() { - for (int layer = 0; layer < 3; layer++) { - for (int row = Calculate.CalculateStartY(Size), maxY = Calculate.CalculateMaxY(Size), btn = 1; row <= maxY; row++) { - for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, btn++) { - Image img = ImageController.GetScreenImage(row, col, layer); - - if (img == null) continue; - - switch (btn) { - case 1: btnP1.Image = img; break; - case 2: btnP2.Image = img; break; - case 3: btnP3.Image = img; break; - case 4: btnP4.Image = img; break; - case 5: btnP5.Image = img; break; - case 6: btnP6.Image = img; break; - case 7: btnP7.Image = img; break; - case 8: btnP8.Image = img; break; - case 9: btnP9.Image = img; break; - case 10: btnP10.Image = img; break; - case 11: btnP11.Image = img; break; - case 12: btnP12.Image = img; break; - case 13: btnP13.Image = img; break; - case 14: btnP14.Image = img; break; - case 15: btnP15.Image = img; break; - case 16: btnP16.Image = img; break; - case 17: btnP17.Image = img; break; - case 18: btnP18.Image = img; break; - case 19: btnP19.Image = img; break; - case 20: btnP20.Image = img; break; - case 21: btnP21.Image = img; break; - case 22: btnP22.Image = img; break; - case 23: btnP23.Image = img; break; - case 24: btnP24.Image = img; break; - case 25: btnP25.Image = img; break; - } - } - } - } - } - - /// - /// Prints the lung capacity, health, hotbar items and event log - /// - public void PrintMainMenu() { - //Print lungs - - //Print health - for (int i = 0; i < Size; i++) { - string iName = MobStatsController.GetPlayerHearth(i); - - switch (i) { - case 0: imgS6.SetFromStock(iName, IconSize.Dnd); break; - case 1: imgS7.SetFromStock(iName, IconSize.Dnd); break; - case 2: imgS8.SetFromStock(iName, IconSize.Dnd); break; - case 3: imgS9.SetFromStock(iName, IconSize.Dnd); break; - case 4: imgS10.SetFromStock(iName, IconSize.Dnd); break; - } - } - - //Prints hotbar - for (int i = 0; i < Size; i++) { - Image img = ImageController.GetPlayerHotbarImage(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 log - for (int i = 0, mIndex = LogController.GetCount() - 1; i < Size; mIndex--, i++) { - string msg = LogController.GetMessagage(mIndex); - - switch(i) { - case 0: lblLog1.Text = msg; break; - case 1: lblLog2.Text = msg; break; - case 2: lblLog3.Text = msg; break; - case 3: lblLog4.Text = msg; break; - } - } - } - - 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++) { - for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, img++) { - string sName = ImageController.GetPlayerGroundImage(row, col).Stock; - - switch (img) { - case 1: imgG1.SetFromStock(sName, IconSize.Dnd); break; - case 2: imgG2.SetFromStock(sName, IconSize.Dnd); break; - case 3: imgG3.SetFromStock(sName, IconSize.Dnd); break; - case 4: imgG4.SetFromStock(sName, IconSize.Dnd); break; - case 5: imgG5.SetFromStock(sName, IconSize.Dnd); break; - case 6: imgG6.SetFromStock(sName, IconSize.Dnd); break; - case 7: imgG7.SetFromStock(sName, IconSize.Dnd); break; - case 8: imgG8.SetFromStock(sName, IconSize.Dnd); break; - case 9: imgG9.SetFromStock(sName, IconSize.Dnd); break; - case 10: imgG10.SetFromStock(sName, IconSize.Dnd); break; - case 11: imgG11.SetFromStock(sName, IconSize.Dnd); break; - case 12: imgG12.SetFromStock(sName, IconSize.Dnd); break; - case 13: imgG13.SetFromStock(sName, IconSize.Dnd); break; - case 14: imgG14.SetFromStock(sName, IconSize.Dnd); break; - case 15: imgG15.SetFromStock(sName, IconSize.Dnd); break; - case 16: imgG16.SetFromStock(sName, IconSize.Dnd); break; - case 17: imgG17.SetFromStock(sName, IconSize.Dnd); break; - case 18: imgG18.SetFromStock(sName, IconSize.Dnd); break; - case 19: imgG19.SetFromStock(sName, IconSize.Dnd); break; - case 20: imgG20.SetFromStock(sName, IconSize.Dnd); break; - case 21: imgG21.SetFromStock(sName, IconSize.Dnd); break; - case 22: imgG22.SetFromStock(sName, IconSize.Dnd); break; - case 23: imgG23.SetFromStock(sName, IconSize.Dnd); break; - case 24: imgG24.SetFromStock(sName, IconSize.Dnd); break; - case 25: imgG25.SetFromStock(sName, IconSize.Dnd); break; - } - } - } - - lblSuperLayer.Text = MobStatsController.GetPlayerSuperLayerName(); - lblCoord1.Text = "X: " + MobStatsController.GetPlayerXCoord(); - lblCoord2.Text = "Y: " + MobStatsController.GetPlayerYCoord(); - - //Prints the "Item layer" in map menu - for (int row = Calculate.CalculateStartY(Size), maxY = Calculate.CalculateMaxY(Size), img = 1; row <= maxY; row++) { - for (int col = Calculate.CalculateStartX(Size), maxX = Calculate.CalculateMaxX(Size); col <= maxX; col++, img++) { - string sName = ImageController.GetPlayerStructureImage(row, col).Stock; - - switch (img) { - case 1: imgI1.SetFromStock(sName, IconSize.Dnd); break; - case 2: imgI2.SetFromStock(sName, IconSize.Dnd); break; - case 3: imgI3.SetFromStock(sName, IconSize.Dnd); break; - case 4: imgI4.SetFromStock(sName, IconSize.Dnd); break; - case 5: imgI5.SetFromStock(sName, IconSize.Dnd); break; - case 6: imgI6.SetFromStock(sName, IconSize.Dnd); break; - case 7: imgI7.SetFromStock(sName, IconSize.Dnd); break; - case 8: imgI8.SetFromStock(sName, IconSize.Dnd); break; - case 9: imgI9.SetFromStock(sName, IconSize.Dnd); break; - case 10: imgI10.SetFromStock(sName, IconSize.Dnd); break; - case 11: imgI11.SetFromStock(sName, IconSize.Dnd); break; - case 12: imgI12.SetFromStock(sName, IconSize.Dnd); break; - case 13: imgI13.SetFromStock(sName, IconSize.Dnd); break; - case 14: imgI14.SetFromStock(sName, IconSize.Dnd); break; - case 15: imgI15.SetFromStock(sName, IconSize.Dnd); break; - case 16: imgI16.SetFromStock(sName, IconSize.Dnd); break; - case 17: imgI17.SetFromStock(sName, IconSize.Dnd); break; - case 18: imgI18.SetFromStock(sName, IconSize.Dnd); break; - case 19: imgI19.SetFromStock(sName, IconSize.Dnd); break; - case 20: imgI20.SetFromStock(sName, IconSize.Dnd); break; - case 21: imgI21.SetFromStock(sName, IconSize.Dnd); break; - case 22: imgI22.SetFromStock(sName, IconSize.Dnd); break; - case 23: imgI23.SetFromStock(sName, IconSize.Dnd); break; - case 24: imgI24.SetFromStock(sName, IconSize.Dnd); break; - case 25: imgI25.SetFromStock(sName, IconSize.Dnd); break; - } - } - } - - lblHoleOnTop.Text = MobStatsController.ExistsHoleOnTopOfPlayer() + ""; - } - - public void PrintInventory() { - //Prints the actual inventory (items) - for (int row = 0; row < Size; row++) { - for (int col = 0; col < Size; col++) { - Image img = ImageController.GetPlayerInventoryItemImage(row * Size + col); - - switch (row * Size + col + 1) { - case 1: btnI1.Image = img; break; - case 2: btnI2.Image = img; break; - case 3: btnI3.Image = img; break; - case 4: btnI4.Image = img; break; - case 5: btnI5.Image = img; break; - case 6: btnI6.Image = img; break; - case 7: btnI7.Image = img; break; - case 8: btnI8.Image = img; break; - case 9: btnI9.Image = img; break; - case 10: btnI10.Image = img; break; - case 11: btnI11.Image = img; break; - case 12: btnI12.Image = img; break; - case 13: btnI13.Image = img; break; - case 14: btnI14.Image = img; break; - case 15: btnI15.Image = img; break; - case 16: btnI16.Image = img; break; - case 17: btnI17.Image = img; break; - case 18: btnI18.Image = img; break; - case 19: btnI19.Image = img; break; - case 20: btnI20.Image = img; break; - case 21: btnI21.Image = img; break; - case 22: btnI22.Image = img; break; - case 23: btnI23.Image = img; break; - case 24: btnI24.Image = img; break; - case 25: btnI25.Image = img; break; - } - } - } - - //Prints accessories - for (int row = 0; row < 2; row++) { - for (int col = 0; col < Size; col++) { - Image img = ImageController.GetPlayerAccessoryImage(row * Size + col); - - switch (row * Size + col + 1) { - case 1: btnA1.Image = img; break; - case 2: btnA2.Image = img; break; - case 3: btnA3.Image = img; break; - case 4: btnA4.Image = img; break; - case 5: btnA5.Image = img; break; - case 6: btnA6.Image = img; break; - case 7: btnA7.Image = img; break; - case 8: btnA8.Image = img; break; - case 9: btnA9.Image = img; break; - case 10: btnA10.Image = img; break; - } - } - } - - //Prints gear - for (int i = 0; i < Size; i++) { - Image img = ImageController.GetPlayerGearImage(i); - - switch (i + 1) { - case 1: btnG1.Image = img; break; - case 2: btnG2.Image = img; break; - case 3: btnG3.Image = img; break; - case 4: btnG4.Image = img; break; - case 5: btnG5.Image = img; break; - } - } - } - - // - // BUTTON CLICKED EVENTS - // - - protected void OnBtnIG1Clicked(object sender, EventArgs e) { - //Mundus.Data.Superlayers.Mobs.LMI.Player.Inventory.Hotbar[0] = LandPresets.Boulder(); - MobStatsController.DamagePlayer(1); - //Service.Crafting.CraftingController.FindAvalableItems(); - PrintMainMenu(); - } - - protected void OnBtnIG2Clicked(object sender, EventArgs e) { - //Mundus.Data.Superlayers.Mobs.LMI.Player.Inventory.Hotbar[1] = new Service.Tiles.Items.Tool("blank_hand", Mundus.Data.Tiles.ToolTypes.Pickaxe, 1); - //Mundus.Data.Superlayers.Mobs.LMI.Player.Inventory.Hotbar[0] = new Service.Tiles.Items.Tool("blank_hand", Mundus.Data.Tiles.ToolTypes.Axe, 1); - - MobStatsController.HealPlayer(1); - PrintMainMenu(); - } - - protected void OnBtnPauseClicked(object sender, EventArgs e) { - // Note: pause window blocks player input - WindowController.ShowPauseWindow(); - } - - protected void OnBtnMusicClicked(object sender, EventArgs e) { - WindowController.ShowMusicWindow(); - } - - - protected void OnBtnCraftingClicked(object sender, EventArgs e) { - WindowController.ShowCraftingWindow(); - } - - protected void OnBtnMapClicked(object sender, EventArgs e) { - //Hide inv menu, if it is visible (so only one of the two is visible) - if (this.InvMenuIsVisible()) this.OnBtnInvClicked(this, null); - - if (this.MapMenuIsVisible()) { - this.SetMapMenuVisibility(false); - } - else { - this.PrintMap(); - this.SetMapMenuVisibility(true); - } - } - - protected void OnBtnInvClicked(object sender, EventArgs e) { - //Hide map menu, if it is visible (so only one of the two is visible) - if (this.MapMenuIsVisible()) this.OnBtnMapClicked(this, null); - - if (btnI1.Visible) { - this.SetInvMenuVisibility(false); - } - else { - this.PrintInventory(); - this.SetInvMenuVisibility(true); - } - } - - // Screen buttons - protected void OnBtnP1Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(1); - } - } - protected void OnBtnP2Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(2); - } - } - protected void OnBtnP3Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(3); - } - } - protected void OnBtnP4Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(4); - } - } - protected void OnBtnP5Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(5); - } - } - protected void OnBtnP6Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(6); - } - } - protected void OnBtnP7Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(7); - } - } - protected void OnBtnP8Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(8); - } - } - protected void OnBtnP9Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(9); - } - } - protected void OnBtnP10Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(10); - } - } - protected void OnBtnP11Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(11); - } - } - protected void OnBtnP12Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(12); - } - } - protected void OnBtnP13Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(13); - } - } - protected void OnBtnP14Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(14); - } - } - protected void OnBtnP15Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(15); - } - } - protected void OnBtnP16Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(16); - } - } - protected void OnBtnP17Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(17); - } - } - protected void OnBtnP18Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(18); - } - } - protected void OnBtnP19Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(19); - } - } - protected void OnBtnP20Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(20); - } - } - protected void OnBtnP21Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(21); - } - } - protected void OnBtnP22Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(22); - } - } - protected void OnBtnP23Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(23); - } - } - protected void OnBtnP24Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(24); - } - } - protected void OnBtnP25Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - React(25); - } - } - - //Hotbar buttons - protected void OnBtnH1Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 0); - this.PrintMainMenu(); - } - } - protected void OnBtnH2Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 1); - this.PrintMainMenu(); - } - } - protected void OnBtnH3Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 2); - this.PrintMainMenu(); - } - } - protected void OnBtnH4Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 3); - this.PrintMainMenu(); - } - } - protected void OnBtnH5Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("hotbar", 4); - this.PrintMainMenu(); - } - } - - protected void OnBtnLogClicked(object sender, EventArgs e) { - WindowController.ShowLogWindow(); - } - - // Inventory (items) buttons - protected void OnBtnI1Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 0); - this.PrintInventory(); - } - } - protected void OnBtnI2Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 1); - this.PrintInventory(); - } - } - protected void OnBtnI3Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 2); - this.PrintInventory(); - } - } - protected void OnBtnI4Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 3); - this.PrintInventory(); - } - } - protected void OnBtnI5Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 4); - this.PrintInventory(); - } - } - protected void OnBtnI6Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 5); - this.PrintInventory(); - } - } - protected void OnBtnI7Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 6); - this.PrintInventory(); - } - } - protected void OnBtnI8Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 7); - this.PrintInventory(); - } - } - protected void OnBtnI9Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 8); - this.PrintInventory(); - } - } - protected void OnBtnI10Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 9); - this.PrintInventory(); - } - } - protected void OnBtnI11Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 10); - this.PrintInventory(); - } - } - protected void OnBtnI12Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 11); - this.PrintInventory(); - } - } - protected void OnBtnI13Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 12); - this.PrintInventory(); - } - } - protected void OnBtnI14Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 13); - this.PrintInventory(); - } - } - protected void OnBtnI15Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 14); - this.PrintInventory(); - } - } - protected void OnBtnI16Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 15); - this.PrintInventory(); - } - } - protected void OnBtnI17Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 16); - this.PrintInventory(); - } - } - protected void OnBtnI18Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 17); - this.PrintInventory(); - } - } - protected void OnBtnI19Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 18); - this.PrintInventory(); - } - } - protected void OnBtnI20Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 19); - this.PrintInventory(); - } - } - protected void OnBtnI21Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 20); - this.PrintInventory(); - } - } - protected void OnBtnI22Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 21); - this.PrintInventory(); - } - } - protected void OnBtnI23Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 22); - this.PrintInventory(); - } - } - protected void OnBtnI24Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 23); - this.PrintInventory(); - } - } - protected void OnBtnI25Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("items", 24); - this.PrintInventory(); - } - } - - // Accessories buttons - protected void OnBtnA1Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 0); - this.PrintInventory(); - } - } - protected void OnBtnA2Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 1); - this.PrintInventory(); - } - } - protected void OnBtnA3Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 2); - this.PrintInventory(); - } - } - protected void OnBtnA4Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 3); - this.PrintInventory(); - } - } - protected void OnBtnA5Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 4); - this.PrintInventory(); - } - } - protected void OnBtnA6Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 5); - this.PrintInventory(); - } - } - protected void OnBtnA7Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 6); - this.PrintInventory(); - } - } - protected void OnBtnA8Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 7); - this.PrintInventory(); - } - } - protected void OnBtnA9Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 8); - this.PrintInventory(); - } - } - protected void OnBtnA10Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("accessories", 9); - this.PrintInventory(); - } - } - - // Gear buttons - protected void OnBtnG1Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 0); - this.PrintInventory(); - } - } - - protected void OnBtnG2Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 1); - this.PrintInventory(); - } - } - - protected void OnBtnG3Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 2); - this.PrintInventory(); - } - } - - protected void OnBtnG4Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 3); - this.PrintInventory(); - } - } - - protected void OnBtnG5Clicked(object sender, EventArgs e) { - if (!WindowController.PauseWindowVisible) { - this.SelectItem("gear", 4); - this.PrintInventory(); - } - } - - // - // VISIBILITY - // - - private void SetMapMenuVisibility(bool isVisible) { - lblGroundLayer.Visible = isVisible; - imgG1.Visible = isVisible; - imgG2.Visible = isVisible; - imgG3.Visible = isVisible; - imgG4.Visible = isVisible; - imgG5.Visible = isVisible; - imgG6.Visible = isVisible; - imgG7.Visible = isVisible; - imgG8.Visible = isVisible; - imgG9.Visible = isVisible; - imgG10.Visible = isVisible; - imgG11.Visible = isVisible; - imgG12.Visible = isVisible; - imgG13.Visible = isVisible; - imgG14.Visible = isVisible; - imgG15.Visible = isVisible; - imgG16.Visible = isVisible; - imgG17.Visible = isVisible; - imgG18.Visible = isVisible; - imgG19.Visible = isVisible; - imgG20.Visible = isVisible; - imgG21.Visible = isVisible; - imgG22.Visible = isVisible; - imgG23.Visible = isVisible; - imgG24.Visible = isVisible; - imgG25.Visible = isVisible; - - lblSuperLayer.Visible = isVisible; - lblCoord1.Visible = isVisible; - lblCoord2.Visible = isVisible; - - lblItemLayer.Visible = isVisible; - imgI1.Visible = isVisible; - imgI2.Visible = isVisible; - imgI3.Visible = isVisible; - imgI4.Visible = isVisible; - imgI5.Visible = isVisible; - imgI6.Visible = isVisible; - imgI7.Visible = isVisible; - imgI8.Visible = isVisible; - imgI9.Visible = isVisible; - imgI10.Visible = isVisible; - imgI11.Visible = isVisible; - imgI12.Visible = isVisible; - imgI13.Visible = isVisible; - imgI14.Visible = isVisible; - imgI15.Visible = isVisible; - imgI16.Visible = isVisible; - imgI17.Visible = isVisible; - imgI18.Visible = isVisible; - imgI19.Visible = isVisible; - imgI20.Visible = isVisible; - imgI21.Visible = isVisible; - imgI22.Visible = isVisible; - imgI23.Visible = isVisible; - imgI24.Visible = isVisible; - imgI25.Visible = isVisible; - - lblHoleMsg.Visible = isVisible; - lblHoleOnTop.Visible = isVisible; - - lblBlank5.Visible = isVisible; - } - - private void SetInvMenuVisibility(bool isVisible) { - btnI1.Visible = isVisible; - btnI2.Visible = isVisible; - btnI3.Visible = isVisible; - btnI4.Visible = isVisible; - btnI5.Visible = isVisible; - btnI6.Visible = isVisible; - btnI7.Visible = isVisible; - btnI8.Visible = isVisible; - btnI9.Visible = isVisible; - btnI10.Visible = isVisible; - btnI11.Visible = isVisible; - btnI12.Visible = isVisible; - btnI13.Visible = isVisible; - btnI14.Visible = isVisible; - btnI15.Visible = isVisible; - btnI16.Visible = isVisible; - btnI17.Visible = isVisible; - btnI18.Visible = isVisible; - btnI19.Visible = isVisible; - btnI20.Visible = isVisible; - btnI21.Visible = isVisible; - btnI22.Visible = isVisible; - btnI23.Visible = isVisible; - btnI24.Visible = isVisible; - btnI25.Visible = isVisible; - btnCrafting.Visible = isVisible; - - lblAccessories.Visible = isVisible; - btnA1.Visible = isVisible; - btnA2.Visible = isVisible; - btnA3.Visible = isVisible; - btnA4.Visible = isVisible; - btnA5.Visible = isVisible; - btnA6.Visible = isVisible; - btnA7.Visible = isVisible; - btnA8.Visible = isVisible; - btnA9.Visible = isVisible; - btnA10.Visible = isVisible; - - lblGear.Visible = isVisible; - btnG1.Visible = isVisible; - btnG2.Visible = isVisible; - btnG3.Visible = isVisible; - btnG4.Visible = isVisible; - btnG5.Visible = isVisible; - - btnIG1.Visible = isVisible; - btnIG2.Visible = isVisible; - - imgInfo.Visible = isVisible; - lblInfo.Visible = isVisible; - - lblBlank4.Visible = isVisible; - } - } -} diff --git a/Mundus/gtk-gui/Mundus.Views.Windows.LargeGameWindow.cs b/Mundus/gtk-gui/Mundus.Views.Windows.LargeGameWindow.cs index 3a31e9d..18c246f 100644 --- a/Mundus/gtk-gui/Mundus.Views.Windows.LargeGameWindow.cs +++ b/Mundus/gtk-gui/Mundus.Views.Windows.LargeGameWindow.cs @@ -1,6 +1,6 @@ // This file has been generated by the GUI designer. Do not modify. -namespace Mundus.Views.Windows +namespace Mundus.Views.Windows.GameWindows { public partial class LargeGameWindow { diff --git a/Mundus/gtk-gui/Mundus.Views.Windows.MediumGameWindow.cs b/Mundus/gtk-gui/Mundus.Views.Windows.MediumGameWindow.cs index 7dac688..f802514 100644 --- a/Mundus/gtk-gui/Mundus.Views.Windows.MediumGameWindow.cs +++ b/Mundus/gtk-gui/Mundus.Views.Windows.MediumGameWindow.cs @@ -1,6 +1,6 @@ // This file has been generated by the GUI designer. Do not modify. -namespace Mundus.Views.Windows +namespace Mundus.Views.Windows.GameWindows { public partial class MediumGameWindow { diff --git a/Mundus/gtk-gui/Mundus.Views.Windows.SmallGameWindow.cs b/Mundus/gtk-gui/Mundus.Views.Windows.SmallGameWindow.cs index 5cb01f0..7cc5178 100644 --- a/Mundus/gtk-gui/Mundus.Views.Windows.SmallGameWindow.cs +++ b/Mundus/gtk-gui/Mundus.Views.Windows.SmallGameWindow.cs @@ -1,6 +1,6 @@ // This file has been generated by the GUI designer. Do not modify. -namespace Mundus.Views.Windows +namespace Mundus.Views.Windows.GameWindows { public partial class SmallGameWindow { -- cgit v1.2.3