diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2020-05-23 18:43:26 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2020-05-23 18:43:26 +0300 |
| commit | f0b74ed2874e44e821e03dfcd554346bc4a3df62 (patch) | |
| tree | 4b7646c92d0e010adaa69d35ecd7a465267347dd | |
| parent | 667b2fc46c1116c58b106c7307ec8f96d13a3441 (diff) | |
| download | Mundus-f0b74ed2874e44e821e03dfcd554346bc4a3df62.tar Mundus-f0b74ed2874e44e821e03dfcd554346bc4a3df62.tar.gz Mundus-f0b74ed2874e44e821e03dfcd554346bc4a3df62.zip | |
Finished with refactoring. This version is now officially finished.
55 files changed, 257 insertions, 254 deletions
diff --git a/Mundus/Service/Tiles/Crafting/CraftingRecipe.cs b/Mundus/Data/Crafting/CraftingRecipe.cs index 1bdb625..d9a3e0b 100644 --- a/Mundus/Service/Tiles/Crafting/CraftingRecipe.cs +++ b/Mundus/Data/Crafting/CraftingRecipe.cs @@ -1,9 +1,7 @@ -namespace Mundus.Service.Tiles.Crafting +namespace Mundus.Data.Crafting { using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; - using System.Linq; - using Mundus.Service.Tiles.Items; [Table("CraftingRecipes", Schema = "Mundus")] public class CraftingRecipe @@ -48,7 +46,7 @@ public int ID { get; set; } /// <summary> - /// Item that will be added to the inventory after crafting + /// Gets the item that will be added to the inventory after crafting /// </summary> /// <value>The result item.</value> public string ResultItem { get; private set; } @@ -103,54 +101,14 @@ /// </summary> public string ReqItem5 { get; private set; } - /// <summary>
- /// Checks if the given array of items has enough of every requried item
- /// </summary>
- /// <returns><c>true</c>If has enough<c>false</c>otherwise</returns>
- public bool HasEnoughItems(ItemTile[] items) - {
- bool hasEnough = false;
-
- if (items.Any(item => item != null)) - { - var allItemStocks = items.Where(x => x != null).Select(x => x.stock_id).ToArray(); - - hasEnough = allItemStocks.Contains(ReqItem1) && - allItemStocks.Count(i => i == ReqItem1) >= Count1; - - if (ReqItem2 != null && hasEnough) - { - hasEnough = allItemStocks.Contains(ReqItem2) && - allItemStocks.Count(i => i == ReqItem2) >= Count2; - } - if (ReqItem3 != null && hasEnough) - { - hasEnough = allItemStocks.Contains(ReqItem3) && - allItemStocks.Count(i => i == ReqItem3) >= Count3; - } - if (ReqItem4 != null && hasEnough) - { - hasEnough = allItemStocks.Contains(ReqItem4) && - allItemStocks.Count(i => i == ReqItem4) >= Count4; - } - if (ReqItem5 != null && hasEnough) - { - hasEnough = allItemStocks.Contains(ReqItem5) && - allItemStocks.Count(i => i == ReqItem5) >= Count5; - } - }
-
- return hasEnough; - }
-
public string[] GetAllRequiredItems() { - return new string[] { ReqItem1, ReqItem2, ReqItem3, ReqItem4, ReqItem5}; + return new string[] { this.ReqItem1, this.ReqItem2, this.ReqItem3, this.ReqItem4, this.ReqItem5 }; }
public int[] GetAllCounts() { - return new int[] { Count1, Count2, Count3, Count4, Count5}; + return new int[] { this.Count1, this.Count2, this.Count3, this.Count4, this.Count5 }; } } } diff --git a/Mundus/Data/Crafting/CraftingTableContext.cs b/Mundus/Data/Crafting/CraftingTableContext.cs index 820c018..47b302c 100644 --- a/Mundus/Data/Crafting/CraftingTableContext.cs +++ b/Mundus/Data/Crafting/CraftingTableContext.cs @@ -1,10 +1,6 @@ namespace Mundus.Data.Crafting { - using System.Linq; using Microsoft.EntityFrameworkCore; - using Mundus.Data.Tiles.Mobs; - using Mundus.Data.Tiles.Presets; - using Mundus.Service.Tiles.Crafting; /// <summary> /// Context for getting the crafting recipes @@ -12,26 +8,17 @@ public class CraftingTableContext : DbContext { /// <summary> - /// Initializes a new instance of the <see cref="T:Mundus.Data.Crafting.CraftingTableContext"/> class and adds all the recipes to the table - /// </summary>
- public CraftingTableContext() : base()
- { - this.AddRecipes();
- } - - /// <summary> /// Gets DBSet of the CraftingRecipes table /// </summary> /// <value>The crafting recipes.</value> public DbSet<CraftingRecipe> CraftingRecipes { get; private set; } /// <summary> - /// Returns an array with all the recipes that can be crafted with the items the player has + /// Truncates the table CraftingRecipes (doesn't save the changes) /// </summary> - public CraftingRecipe[] GetAvalableRecipes() + public void TruncateTable() { - var recipes = this.CraftingRecipes.ToArray(); - return recipes.Where(cr => cr.HasEnoughItems(MI.Player.Inventory.Items)).ToArray(); + this.Database.ExecuteSqlRaw("TRUNCATE TABLE CraftingRecipes"); } /// <summary> @@ -41,35 +28,5 @@ { optionsBuilder.UseMySQL(DataBaseContexts.ConnectionStringMySQL); } - - /// <summary> - /// Truncates CraftingRecipes table and adds the crafting recipes (and saves changes) - /// </summary> - private void AddRecipes() - { - this.TruncateTable(); - - this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenShovel().stock_id, 5, MaterialPresets.GetALandStick().stock_id)); - this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenPickaxe().stock_id, 4, MaterialPresets.GetALandStick().stock_id)); - this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenAxe().stock_id, 3, MaterialPresets.GetALandStick().stock_id)); - this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenLongsword().stock_id, 4, MaterialPresets.GetALandStick().stock_id)); - - this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockShovel().stock_id, 4, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id)); - this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockPickaxe().stock_id, 4, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id)); - this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockAxe().stock_id, 3, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id)); - this.CraftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockLongsword().stock_id, 5, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id)); - - this.CraftingRecipes.Add(new CraftingRecipe(StructurePresets.GetAWoodenLadder().inventory_stock_id, 6, MaterialPresets.GetALandStick().stock_id)); - - this.SaveChanges(); - } - - /// <summary> - /// Truncates the table CraftingRecipes (doesn't save the changes) - /// </summary> - private void TruncateTable() - { - this.Database.ExecuteSqlRaw("TRUNCATE TABLE CraftingRecipes"); - } } } diff --git a/Mundus/Data/GameEventLogs/GameEventLogContext.cs b/Mundus/Data/GameEventLogs/GameEventLogContext.cs index 81a7177..7f4cfc9 100644 --- a/Mundus/Data/GameEventLogs/GameEventLogContext.cs +++ b/Mundus/Data/GameEventLogs/GameEventLogContext.cs @@ -11,7 +11,7 @@ /// <summary> /// Initializes a new instance of the <see cref="T:Mundus.Data.GameEventLogs.GameEventLogContext"/> class and truncates the table /// </summary> - public GameEventLogContext() : base() + public GameEventLogContext() { this.ResetTable(); } diff --git a/Mundus/Data/SuperLayers/DBTables/PlacedTile.cs b/Mundus/Data/SuperLayers/DBTables/PlacedTile.cs index 53c7dd2..6e5e0ff 100644 --- a/Mundus/Data/SuperLayers/DBTables/PlacedTile.cs +++ b/Mundus/Data/SuperLayers/DBTables/PlacedTile.cs @@ -5,7 +5,7 @@ /// </summary> public abstract class PlacedTile { - public PlacedTile(string stock_id, int yPos, int xPos) + protected PlacedTile(string stock_id, int yPos, int xPos) { this.YPos = yPos; this.XPos = xPos; diff --git a/Mundus/Data/SuperLayers/ISuperLayerContext.cs b/Mundus/Data/SuperLayers/ISuperLayerContext.cs index 78a2d83..3deb036 100644 --- a/Mundus/Data/SuperLayers/ISuperLayerContext.cs +++ b/Mundus/Data/SuperLayers/ISuperLayerContext.cs @@ -1,6 +1,4 @@ -using System; - -namespace Mundus.Data.SuperLayers +namespace Mundus.Data.SuperLayers { /// <summary> /// Add, remove and change values in the different superlayers (database tables) diff --git a/Mundus/Data/SuperLayers/LandContext.cs b/Mundus/Data/SuperLayers/LandContext.cs index 9301438..9010956 100644 --- a/Mundus/Data/SuperLayers/LandContext.cs +++ b/Mundus/Data/SuperLayers/LandContext.cs @@ -12,7 +12,7 @@ /// <summary> /// Initializes a new instance of the LandContext class and truncates all related tables /// </summary> - public LandContext() : base() + public LandContext() { this.Database.ExecuteSqlRaw("TRUNCATE TABLE LMobLayer"); this.Database.ExecuteSqlRaw("TRUNCATE TABLE LStructureLayer"); @@ -158,6 +158,11 @@ this.LGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null; } + public override string ToString() + { + return "Land"; + } + /// <summary> /// Used to set the connection string /// </summary> @@ -165,9 +170,5 @@ { optionsBuilder.UseMySQL(DataBaseContexts.ConnectionStringMySQL); } - - public override string ToString() { - return "Land"; - } } } diff --git a/Mundus/Data/SuperLayers/SkyContext.cs b/Mundus/Data/SuperLayers/SkyContext.cs index 25dc216..91c60a2 100644 --- a/Mundus/Data/SuperLayers/SkyContext.cs +++ b/Mundus/Data/SuperLayers/SkyContext.cs @@ -12,7 +12,7 @@ /// <summary> /// Initializes a new instance of the SkyContext class and truncates all related tables /// </summary> - public SkyContext() : base() + public SkyContext() { this.Database.ExecuteSqlRaw("TRUNCATE TABLE SMobLayer"); this.Database.ExecuteSqlRaw("TRUNCATE TABLE SStructureLayer"); @@ -158,16 +158,17 @@ this.SGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null; } + public override string ToString() + { + return "Sky"; + } + /// <summary> /// Used to set the connection string /// </summary> - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseMySQL(DataBaseContexts.ConnectionStringMySQL); } - - public override string ToString() { - return "Sky"; - } } } diff --git a/Mundus/Data/SuperLayers/UndergroundContext.cs b/Mundus/Data/SuperLayers/UndergroundContext.cs index 641f480..1dcd0a4 100644 --- a/Mundus/Data/SuperLayers/UndergroundContext.cs +++ b/Mundus/Data/SuperLayers/UndergroundContext.cs @@ -12,7 +12,7 @@ /// <summary> /// Initializes a new instance of the UndergroundContext class and truncates all related tables /// </summary> - public UndergroundContext() : base() + public UndergroundContext() { this.Database.ExecuteSqlRaw("TRUNCATE TABLE UMobLayer"); this.Database.ExecuteSqlRaw("TRUNCATE TABLE UStructureLayer"); @@ -157,16 +157,17 @@ this.UGroundLayer.First(x => x.YPos == yPos && x.XPos == xPos).stock_id = null; } + public override string ToString() + { + return "Underground"; + } + /// <summary> /// Used to set the connection string /// </summary> - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseMySQL(DataBaseContexts.ConnectionStringMySQL); } - - public override string ToString() { - return "Underground"; - } } } diff --git a/Mundus/Mundus.csproj b/Mundus/Mundus.csproj index 82c0596..08f5a2a 100644 --- a/Mundus/Mundus.csproj +++ b/Mundus/Mundus.csproj @@ -1,5 +1,6 @@ <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="..\packages\NuGet.Build.Packaging.0.2.0\build\NuGet.Build.Packaging.props" Condition="Exists('..\packages\NuGet.Build.Packaging.0.2.0\build\NuGet.Build.Packaging.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
@@ -8,6 +9,17 @@ <RootNamespace>Mundus</RootNamespace>
<AssemblyName>Mundus</AssemblyName>
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
+ <PackageId>Requirements</PackageId>
+ <PackageVersion>Requirements</PackageVersion>
+ <Authors>Kamen Mladenov</Authors>
+ <NeutralLanguage>en</NeutralLanguage>
+ <PackageLicenseUrl>https://github.com/Syndamia/Mundus/blob/requirements/LICENSE</PackageLicenseUrl>
+ <Owners>Kamen Mladenov</Owners>
+ <PackageProjectUrl>https://github.com/Syndamia/Mundus/tree/requirements</PackageProjectUrl>
+ <PackageReleaseNotes>This is Requirements version of the project.</PackageReleaseNotes>
+ <Title>Mundus</Title>
+ <ReleaseVersion>Requirements</ReleaseVersion>
+ <SynchReleaseVersion>false</SynchReleaseVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
@@ -265,8 +277,6 @@ <Compile Include="gtk-gui\Mundus.Views.Dialogs.ExitDialog.cs" />
<Compile Include="Service\Tiles\ITile.cs" />
<Compile Include="Service\SuperLayers\ImageController.cs" />
- <Compile Include="Data\Windows\WI.cs" />
- <Compile Include="Data\Dialogues\DI.cs" />
<Compile Include="Service\GameGenerator.cs" />
<Compile Include="Service\SuperLayers\Generators\LandSuperLayerGenerator.cs" />
<Compile Include="Service\SuperLayers\Generators\UndergroundSuperLayerGenerator.cs" />
@@ -282,8 +292,6 @@ <Compile Include="Service\Tiles\Mobs\LandMobs\Player.cs" />
<Compile Include="Service\Tiles\Mobs\MobTile.cs" />
<Compile Include="Service\Tiles\Mobs\Inventory.cs" />
- <Compile Include="Service\Tiles\Crafting\CraftingController.cs" />
- <Compile Include="Service\Tiles\Crafting\CraftingRecipe.cs" />
<Compile Include="Views\Windows\GameWindows\IGameWindow.cs" />
<Compile Include="Data\Crafting\CraftingTableContext.cs" />
<Compile Include="Data\DataBaseContexts.cs" />
@@ -326,12 +334,18 @@ <Compile Include="Service\Tiles\Items\Types\Material.cs" />
<Compile Include="Service\Tiles\Items\Types\Structure.cs" />
<Compile Include="Service\Tiles\Items\Types\Tool.cs" />
- <Compile Include="Data\Tiles\Presets\GroundPresets.cs" />
- <Compile Include="Data\Tiles\Presets\MaterialPresets.cs" />
- <Compile Include="Data\Tiles\Presets\StructurePresets.cs" />
- <Compile Include="Data\Tiles\Presets\ToolPresets.cs" />
- <Compile Include="Data\Tiles\Mobs\LandMobsPresets.cs" />
- <Compile Include="Data\Tiles\Mobs\MI.cs" />
+ <Compile Include="Data\Crafting\CraftingRecipe.cs">
+ <ExcludeFromStyleCop>false</ExcludeFromStyleCop>
+ </Compile>
+ <Compile Include="Service\Dialogs\DI.cs" />
+ <Compile Include="Service\Tiles\Mobs\LandMobs\LandMobsPresets.cs" />
+ <Compile Include="Service\Tiles\Mobs\MI.cs" />
+ <Compile Include="Service\Tiles\Items\Presets\GroundPresets.cs" />
+ <Compile Include="Service\Tiles\Items\Presets\MaterialPresets.cs" />
+ <Compile Include="Service\Tiles\Items\Presets\StructurePresets.cs" />
+ <Compile Include="Service\Tiles\Items\Presets\ToolPresets.cs" />
+ <Compile Include="Service\Windows\WI.cs" />
+ <Compile Include="Service\Tiles\RecipeController.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Service\" />
@@ -342,8 +356,6 @@ <Folder Include="Service\SuperLayers\" />
<Folder Include="Service\Tiles\" />
<Folder Include="Icons\Land\Ground\" />
- <Folder Include="Data\Windows\" />
- <Folder Include="Data\Dialogues\" />
<Folder Include="Data\SuperLayers\" />
<Folder Include="Service\Tiles\Items\" />
<Folder Include="Data\Crafting\" />
@@ -351,7 +363,6 @@ <Folder Include="Service\SuperLayers\Generators\" />
<Folder Include="Icons\Sky\Ground\" />
<Folder Include="Service\Tiles\Mobs\" />
- <Folder Include="Service\Tiles\Crafting\" />
<Folder Include="Views\Windows\GameWindows\" />
<Folder Include="Icons\UI\Hearth\" />
<Folder Include="Data\SuperLayers\DBTables\" />
@@ -360,10 +371,9 @@ <Folder Include="Views\Windows\GameWindows\Medium\" />
<Folder Include="Views\Windows\GameWindows\Large\" />
<Folder Include="Service\Windows\" />
- <Folder Include="Data\Tiles\" />
<Folder Include="Service\Tiles\Items\Types\" />
- <Folder Include="Data\Tiles\Presets\" />
- <Folder Include="Data\Tiles\Mobs\" />
+ <Folder Include="Service\Dialogs\" />
+ <Folder Include="Service\Tiles\Items\Presets\" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
@@ -371,4 +381,5 @@ </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Microsoft.Data.SqlClient.SNI.1.1.1\build\net46\Microsoft.Data.SqlClient.SNI.targets" Condition="Exists('..\packages\Microsoft.Data.SqlClient.SNI.1.1.1\build\net46\Microsoft.Data.SqlClient.SNI.targets')" />
+ <Import Project="..\packages\NuGet.Build.Packaging.0.2.0\build\NuGet.Build.Packaging.targets" Condition="Exists('..\packages\NuGet.Build.Packaging.0.2.0\build\NuGet.Build.Packaging.targets')" />
</Project>
diff --git a/Mundus/Program.cs b/Mundus/Program.cs index a4cc679..7f102ce 100644 --- a/Mundus/Program.cs +++ b/Mundus/Program.cs @@ -2,14 +2,16 @@ { using Gtk; using Mundus.Data; - using Mundus.Data.Dialogues; - using Mundus.Data.Windows; + using Mundus.Service.Dialogs; + using Mundus.Service.Tiles; + using Mundus.Service.Windows; public static class MainClass { public static void Main(string[] args) { DataBaseContexts.CreateInstances(); + RecipeController.AddAllRecipes(); Application.Init(); // All windows and dialogues that are used by user (instances) are saved and created in WindowInstances.cs diff --git a/Mundus/Data/Dialogues/DI.cs b/Mundus/Service/Dialogs/DI.cs index 94f9ae7..5b74a65 100644 --- a/Mundus/Data/Dialogues/DI.cs +++ b/Mundus/Service/Dialogs/DI.cs @@ -1,4 +1,4 @@ -namespace Mundus.Data.Dialogues +namespace Mundus.Service.Dialogs { using Mundus.Views.Dialogs; diff --git a/Mundus/Service/GameEventLogController.cs b/Mundus/Service/GameEventLogController.cs index 4d11146..7094ca0 100644 --- a/Mundus/Service/GameEventLogController.cs +++ b/Mundus/Service/GameEventLogController.cs @@ -11,7 +11,7 @@ public static string GetMessagage(int index) { - return (0 <= index && index < GetCount()) ? DataBaseContexts.GELContext.GetMessage(index + 1) : null; + return (index >= 0 && index < GetCount()) ? DataBaseContexts.GELContext.GetMessage(index + 1) : null; } public static int GetCount() diff --git a/Mundus/Service/GameGenerator.cs b/Mundus/Service/GameGenerator.cs index e5e30b7..b5da1fe 100644 --- a/Mundus/Service/GameGenerator.cs +++ b/Mundus/Service/GameGenerator.cs @@ -2,9 +2,9 @@ { using System; using Mundus.Data; - using Mundus.Data.Tiles.Mobs; - using Mundus.Data.Windows; using Mundus.Service.SuperLayers.Generators; + using Mundus.Service.Tiles.Mobs; + using Mundus.Service.Windows; public static class GameGenerator { @@ -51,7 +51,7 @@ /// <summary> /// Sets the game difficulty (that affects map generation). /// </summary> - /// <param name="value">Must be "peaceful", "easy", "normal", "hard" or "insane"</param> + /// <param name="difficulty">Must be "peaceful", "easy", "normal", "hard" or "insane"</param> public static void SetDifficulty(Values.Difficulty difficulty) { Values.CurrDifficulty = difficulty; diff --git a/Mundus/Service/SuperLayers/Generators/LandSuperLayerGenerator.cs b/Mundus/Service/SuperLayers/Generators/LandSuperLayerGenerator.cs index b99cc20..0037e22 100644 --- a/Mundus/Service/SuperLayers/Generators/LandSuperLayerGenerator.cs +++ b/Mundus/Service/SuperLayers/Generators/LandSuperLayerGenerator.cs @@ -3,8 +3,9 @@ using System; using Mundus.Data; using Mundus.Data.SuperLayers; - using Mundus.Data.Tiles.Mobs; - using Mundus.Data.Tiles.Presets; + using Mundus.Service.Tiles.Items.Presets; + using Mundus.Service.Tiles.Mobs; + using Mundus.Service.Tiles.Mobs.LandMobs; using static Mundus.Data.Values; /// <summary> diff --git a/Mundus/Service/SuperLayers/Generators/SkySuperLayerGenerator.cs b/Mundus/Service/SuperLayers/Generators/SkySuperLayerGenerator.cs index 790dbfa..c16db26 100644 --- a/Mundus/Service/SuperLayers/Generators/SkySuperLayerGenerator.cs +++ b/Mundus/Service/SuperLayers/Generators/SkySuperLayerGenerator.cs @@ -3,7 +3,7 @@ using System; using Mundus.Data; using Mundus.Data.SuperLayers; - using Mundus.Data.Tiles.Presets; + using Mundus.Service.Tiles.Items.Presets; using static Mundus.Data.Values; /// <summary> diff --git a/Mundus/Service/SuperLayers/Generators/UndergroundSuperLayerGenerator.cs b/Mundus/Service/SuperLayers/Generators/UndergroundSuperLayerGenerator.cs index f4eca86..807533f 100644 --- a/Mundus/Service/SuperLayers/Generators/UndergroundSuperLayerGenerator.cs +++ b/Mundus/Service/SuperLayers/Generators/UndergroundSuperLayerGenerator.cs @@ -3,7 +3,7 @@ using System; using Mundus.Data; using Mundus.Data.SuperLayers; - using Mundus.Data.Tiles.Presets; + using Mundus.Service.Tiles.Items.Presets; using static Mundus.Data.Values; /// <summary> diff --git a/Mundus/Service/SuperLayers/ImageController.cs b/Mundus/Service/SuperLayers/ImageController.cs index 19b4793..8e57340 100644 --- a/Mundus/Service/SuperLayers/ImageController.cs +++ b/Mundus/Service/SuperLayers/ImageController.cs @@ -3,8 +3,8 @@ using Gtk; using Mundus.Data; using Mundus.Data.SuperLayers; - using Mundus.Data.Tiles.Mobs; using Mundus.Service.Tiles.Items.Types; + using Mundus.Service.Tiles.Mobs; using static Mundus.Service.Tiles.Mobs.Inventory; public static class ImageController diff --git a/Mundus/Service/Tiles/Crafting/CraftingController.cs b/Mundus/Service/Tiles/Crafting/CraftingController.cs deleted file mode 100644 index ffd31db..0000000 --- a/Mundus/Service/Tiles/Crafting/CraftingController.cs +++ /dev/null @@ -1,64 +0,0 @@ -namespace Mundus.Service.Tiles.Crafting -{ - using System.Linq; - using Mundus.Data; - using Mundus.Data.Tiles.Mobs; - using Mundus.Data.Tiles.Presets; - using Mundus.Service.Tiles.Items; - using Mundus.Service.Tiles.Mobs; - - public static class CraftingController - { - /// <summary> - /// Removes items and adds the result item to the inventory - /// </summary> - public static void CraftItem(CraftingRecipe itemRecipe, MobTile mob) - { - // Removes all items that are used to craft the result item - var reqItems = itemRecipe.GetAllRequiredItems(); - var reqCounts = itemRecipe.GetAllCounts(); - - var allInventoryItems = mob.Inventory.Items.Where(i => i != null).ToArray(); - - for (int item = 0; item < reqItems.Length; item++) - { - for (int i = 0, removed = 0; i < allInventoryItems.Length && removed < reqCounts[item]; i++) - { - if (allInventoryItems[i].stock_id == reqItems[item]) - { - mob.Inventory.DeleteFromItems(i); - removed++; - } - } - } - - ItemTile result = ToolPresets.GetFromStock(itemRecipe.ResultItem); - - if (result == null) - { - result = StructurePresets.GetFromStock(itemRecipe.ResultItem); - } - - MI.Player.Inventory.AppendToItems(result); - - Data.Windows.WI.SelWin.PrintInventory(); - } - - /// <summary> - /// Does CraftItem method for the player - /// </summary> - /// <param name="itemRecipe">CraftingRecipie of the item that will be crafted</param> - public static void CraftItemPlayer(CraftingRecipe itemRecipe) - { - CraftItem(itemRecipe, MI.Player); - } - - /// <summary> - /// Returns all recipes that can be executed with the current items in the player inventory (Inventory.Items) - /// </summary> - public static CraftingRecipe[] GetAvalableRecipes() - { - return DataBaseContexts.CTContext.GetAvalableRecipes(); - } - } -}
\ No newline at end of file diff --git a/Mundus/Service/Tiles/Items/ItemController.cs b/Mundus/Service/Tiles/Items/ItemController.cs index 17debc9..5600170 100644 --- a/Mundus/Service/Tiles/Items/ItemController.cs +++ b/Mundus/Service/Tiles/Items/ItemController.cs @@ -1,8 +1,8 @@ namespace Mundus.Service.Tiles.Items { - using Mundus.Data.Tiles.Mobs; - using Mundus.Data.Windows; using Mundus.Service.Tiles.Items.Types; + using Mundus.Service.Tiles.Mobs; + using Mundus.Service.Windows; using static Mundus.Service.Tiles.Mobs.Inventory; /// <summary> diff --git a/Mundus/Service/Tiles/Items/ItemTile.cs b/Mundus/Service/Tiles/Items/ItemTile.cs index 83c5590..225e360 100644 --- a/Mundus/Service/Tiles/Items/ItemTile.cs +++ b/Mundus/Service/Tiles/Items/ItemTile.cs @@ -4,7 +4,7 @@ { public string stock_id { get; private set; } - public ItemTile(ItemTile item) : this(item.stock_id) + protected ItemTile(ItemTile item) : this(item.stock_id) { } diff --git a/Mundus/Data/Tiles/Presets/GroundPresets.cs b/Mundus/Service/Tiles/Items/Presets/GroundPresets.cs index ac9f422..705f746 100644 --- a/Mundus/Data/Tiles/Presets/GroundPresets.cs +++ b/Mundus/Service/Tiles/Items/Presets/GroundPresets.cs @@ -1,4 +1,4 @@ -namespace Mundus.Data.Tiles.Presets +namespace Mundus.Service.Tiles.Items.Presets { using Mundus.Service.Tiles.Items.Types; diff --git a/Mundus/Data/Tiles/Presets/MaterialPresets.cs b/Mundus/Service/Tiles/Items/Presets/MaterialPresets.cs index 7298e8f..b546394 100644 --- a/Mundus/Data/Tiles/Presets/MaterialPresets.cs +++ b/Mundus/Service/Tiles/Items/Presets/MaterialPresets.cs @@ -1,4 +1,4 @@ -namespace Mundus.Data.Tiles.Presets +namespace Mundus.Service.Tiles.Items.Presets { using Mundus.Service.Tiles.Items.Types; diff --git a/Mundus/Data/Tiles/Presets/StructurePresets.cs b/Mundus/Service/Tiles/Items/Presets/StructurePresets.cs index 28bad22..c019c7c 100644 --- a/Mundus/Data/Tiles/Presets/StructurePresets.cs +++ b/Mundus/Service/Tiles/Items/Presets/StructurePresets.cs @@ -1,4 +1,4 @@ -namespace Mundus.Data.Tiles.Presets +namespace Mundus.Service.Tiles.Items.Presets { using Mundus.Service.Tiles.Items.Types; using static Mundus.Data.Values; diff --git a/Mundus/Data/Tiles/Presets/ToolPresets.cs b/Mundus/Service/Tiles/Items/Presets/ToolPresets.cs index 9c62201..a168c3c 100644 --- a/Mundus/Data/Tiles/Presets/ToolPresets.cs +++ b/Mundus/Service/Tiles/Items/Presets/ToolPresets.cs @@ -1,4 +1,4 @@ -namespace Mundus.Data.Tiles.Presets +namespace Mundus.Service.Tiles.Items.Presets { using Mundus.Service.Tiles.Items.Types; using static Mundus.Data.Values; diff --git a/Mundus/Service/Tiles/Mobs/Controllers/MobFighting.cs b/Mundus/Service/Tiles/Mobs/Controllers/MobFighting.cs index a903218..1ae1496 100644 --- a/Mundus/Service/Tiles/Mobs/Controllers/MobFighting.cs +++ b/Mundus/Service/Tiles/Mobs/Controllers/MobFighting.cs @@ -3,9 +3,10 @@ using System; using System.Linq; using Mundus.Data; - using Mundus.Data.Tiles.Mobs; + using Mundus.Service.Tiles.Mobs; using Mundus.Service.Tiles.Items.Types; using static Mundus.Data.Values; + using Mundus.Service.Tiles.Mobs.LandMobs; public static class MobFighting { diff --git a/Mundus/Service/Tiles/Mobs/Controllers/MobMovement.cs b/Mundus/Service/Tiles/Mobs/Controllers/MobMovement.cs index c5ed2ac..b6ac419 100644 --- a/Mundus/Service/Tiles/Mobs/Controllers/MobMovement.cs +++ b/Mundus/Service/Tiles/Mobs/Controllers/MobMovement.cs @@ -2,8 +2,8 @@ {
using System; using Mundus.Data; - using Mundus.Data.Tiles.Mobs; - using Mundus.Data.Tiles.Presets; + using Mundus.Service.Tiles.Mobs; + using Mundus.Service.Tiles.Items.Presets; using Mundus.Service.SuperLayers; using Mundus.Service.Tiles.Mobs.LandMobs;
using static Mundus.Data.Values;
diff --git a/Mundus/Service/Tiles/Mobs/Controllers/MobStatsController.cs b/Mundus/Service/Tiles/Mobs/Controllers/MobStatsController.cs index d431ba8..679881f 100644 --- a/Mundus/Service/Tiles/Mobs/Controllers/MobStatsController.cs +++ b/Mundus/Service/Tiles/Mobs/Controllers/MobStatsController.cs @@ -1,7 +1,7 @@ namespace Mundus.Service.Tiles.Mobs.Controllers { - using Mundus.Data.Tiles.Mobs; - using Mundus.Data.Tiles.Presets; + using Mundus.Service.Tiles.Mobs; + using Mundus.Service.Tiles.Items.Presets; using Mundus.Service.SuperLayers; public static class MobStatsController diff --git a/Mundus/Service/Tiles/Mobs/Controllers/MobTerraforming.cs b/Mundus/Service/Tiles/Mobs/Controllers/MobTerraforming.cs index fa70f34..2eea1e9 100644 --- a/Mundus/Service/Tiles/Mobs/Controllers/MobTerraforming.cs +++ b/Mundus/Service/Tiles/Mobs/Controllers/MobTerraforming.cs @@ -3,8 +3,8 @@ using System.Linq; using Mundus.Data; using Mundus.Data.SuperLayers; - using Mundus.Data.Tiles.Mobs; - using Mundus.Data.Tiles.Presets; + using Mundus.Service.Tiles.Mobs; + using Mundus.Service.Tiles.Items.Presets; using Mundus.Service.SuperLayers; using Mundus.Service.Tiles.Items.Types; using static Mundus.Data.Values; diff --git a/Mundus/Service/Tiles/Mobs/Inventory.cs b/Mundus/Service/Tiles/Mobs/Inventory.cs index 47b7b91..8fe6617 100644 --- a/Mundus/Service/Tiles/Mobs/Inventory.cs +++ b/Mundus/Service/Tiles/Mobs/Inventory.cs @@ -2,7 +2,7 @@ { using System; using System.Linq; - using Mundus.Data.Tiles.Mobs; + using Mundus.Service.Tiles.Mobs; using Mundus.Service.Tiles.Items; using Mundus.Service.Tiles.Items.Types; diff --git a/Mundus/Data/Tiles/Mobs/LandMobsPresets.cs b/Mundus/Service/Tiles/Mobs/LandMobs/LandMobsPresets.cs index 7f9edfd..c3986ae 100644 --- a/Mundus/Data/Tiles/Mobs/LandMobsPresets.cs +++ b/Mundus/Service/Tiles/Mobs/LandMobs/LandMobsPresets.cs @@ -1,7 +1,7 @@ -namespace Mundus.Data.Tiles.Mobs +namespace Mundus.Service.Tiles.Mobs.LandMobs { using Mundus.Data; - using Mundus.Data.Tiles.Presets; + using Mundus.Service.Tiles.Items.Presets; using Mundus.Service.Tiles.Mobs; public static class LandMobsPresets diff --git a/Mundus/Service/Tiles/Mobs/LandMobs/Player.cs b/Mundus/Service/Tiles/Mobs/LandMobs/Player.cs index 11d6805..ebc3d7c 100644 --- a/Mundus/Service/Tiles/Mobs/LandMobs/Player.cs +++ b/Mundus/Service/Tiles/Mobs/LandMobs/Player.cs @@ -2,7 +2,7 @@ { using System; using Mundus.Data.SuperLayers; - using Mundus.Data.Windows; + using Mundus.Service.Windows; using Mundus.Service.Tiles.Items.Types; public class Player : MobTile diff --git a/Mundus/Data/Tiles/Mobs/MI.cs b/Mundus/Service/Tiles/Mobs/MI.cs index 8bfa50a..ddf0df1 100644 --- a/Mundus/Data/Tiles/Mobs/MI.cs +++ b/Mundus/Service/Tiles/Mobs/MI.cs @@ -1,6 +1,7 @@ -namespace Mundus.Data.Tiles.Mobs +namespace Mundus.Service.Tiles.Mobs { - using Mundus.Data.Tiles.Presets; + using Mundus.Data; + using Mundus.Service.Tiles.Items.Presets; using Mundus.Service.Tiles.Mobs.LandMobs; /// <summary> diff --git a/Mundus/Service/Tiles/Mobs/MobTile.cs b/Mundus/Service/Tiles/Mobs/MobTile.cs index c527437..31cbd61 100644 --- a/Mundus/Service/Tiles/Mobs/MobTile.cs +++ b/Mundus/Service/Tiles/Mobs/MobTile.cs @@ -1,8 +1,8 @@ namespace Mundus.Service.Tiles.Mobs { using Mundus.Data.SuperLayers; - using Mundus.Data.Windows; using Mundus.Service.Tiles.Items.Types; + using Mundus.Service.Windows; public class MobTile : ITile { diff --git a/Mundus/Service/Tiles/RecipeController.cs b/Mundus/Service/Tiles/RecipeController.cs new file mode 100644 index 0000000..142903a --- /dev/null +++ b/Mundus/Service/Tiles/RecipeController.cs @@ -0,0 +1,124 @@ +namespace Mundus.Service.Tiles +{ + using System.Linq; + using Mundus.Data; + using Mundus.Data.Crafting; + using Mundus.Service.Tiles.Items; + using Mundus.Service.Tiles.Items.Presets; + using Mundus.Service.Tiles.Mobs; + using Mundus.Service.Windows; + + public static class RecipeController + { + /// <summary> + /// Removes items and adds the result item to the inventory + /// </summary> + public static void CraftItem(CraftingRecipe itemRecipe, MobTile mob) + { + // Removes all items that are used to craft the result item + var reqItems = itemRecipe.GetAllRequiredItems(); + var reqCounts = itemRecipe.GetAllCounts(); + + var allInventoryItems = mob.Inventory.Items.Where(i => i != null).ToArray(); + + for (int item = 0; item < reqItems.Length; item++) + { + for (int i = 0, removed = 0; i < allInventoryItems.Length && removed < reqCounts[item]; i++) + { + if (allInventoryItems[i].stock_id == reqItems[item]) + { + mob.Inventory.DeleteFromItems(i); + removed++; + } + } + } + + ItemTile result = ToolPresets.GetFromStock(itemRecipe.ResultItem); + + if (result == null) + { + result = StructurePresets.GetFromStock(itemRecipe.ResultItem); + } + + MI.Player.Inventory.AppendToItems(result); + + WI.SelWin.PrintInventory(); + } + + /// <summary> + /// Does CraftItem method for the player + /// </summary> + /// <param name="itemRecipe">CraftingRecipie of the item that will be crafted</param> + public static void CraftItemPlayer(CraftingRecipe itemRecipe) + { + CraftItem(itemRecipe, MI.Player); + } + + /// <summary> + /// Checks if the given array of items has enough of every requried item + /// </summary> + /// <returns><c>true</c>If has enough<c>false</c>otherwise</returns> + public static bool HasEnoughItems(CraftingRecipe recipe, ItemTile[] items) { + bool hasEnough = false; + + if (items.Any(item => item != null)) { + var allItemStocks = items.Where(x => x != null).Select(x => x.stock_id).ToArray(); + + hasEnough = allItemStocks.Contains(recipe.ReqItem1) && + allItemStocks.Count(i => i == recipe.ReqItem1) >= recipe.Count1; + + if (recipe.ReqItem2 != null && hasEnough) { + hasEnough = allItemStocks.Contains(recipe.ReqItem2) && + allItemStocks.Count(i => i == recipe.ReqItem2) >= recipe.Count2; + } + if (recipe.ReqItem3 != null && hasEnough) { + hasEnough = allItemStocks.Contains(recipe.ReqItem3) && + allItemStocks.Count(i => i == recipe.ReqItem3) >= recipe.Count3; + } + if (recipe.ReqItem4 != null && hasEnough) { + hasEnough = allItemStocks.Contains(recipe.ReqItem4) && + allItemStocks.Count(i => i == recipe.ReqItem4) >= recipe.Count4; + } + if (recipe.ReqItem5 != null && hasEnough) { + hasEnough = allItemStocks.Contains(recipe.ReqItem5) && + allItemStocks.Count(i => i == recipe.ReqItem5) >= recipe.Count5; + } + } + + return hasEnough; + } + + /// <summary> + /// Returns an array with all the recipes that can be crafted with the items the player has + /// </summary> + public static CraftingRecipe[] GetAvalableRecipes() + { + var recipes = DataBaseContexts.CTContext.CraftingRecipes.ToArray(); + return recipes.Where(cr => HasEnoughItems(cr, MI.Player.Inventory.Items)).ToArray(); + } + + + + /// <summary> + /// Truncates CraftingRecipes table and adds the crafting recipes (and saves changes) + /// </summary> + public static void AddAllRecipes() { + DataBaseContexts.CTContext.TruncateTable(); + var craftingRecipes = DataBaseContexts.CTContext.CraftingRecipes; + + craftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenShovel().stock_id, 5, MaterialPresets.GetALandStick().stock_id)); + craftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenPickaxe().stock_id, 4, MaterialPresets.GetALandStick().stock_id)); + craftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenAxe().stock_id, 3, MaterialPresets.GetALandStick().stock_id)); + craftingRecipes.Add(new CraftingRecipe(ToolPresets.GetAWoodenLongsword().stock_id, 4, MaterialPresets.GetALandStick().stock_id)); + + craftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockShovel().stock_id, 4, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id)); + craftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockPickaxe().stock_id, 4, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id)); + craftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockAxe().stock_id, 3, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id)); + craftingRecipes.Add(new CraftingRecipe(ToolPresets.GetARockLongsword().stock_id, 5, MaterialPresets.GetALandRock().stock_id, 2, MaterialPresets.GetALandStick().stock_id)); + + craftingRecipes.Add(new CraftingRecipe(StructurePresets.GetAWoodenLadder().inventory_stock_id, 6, MaterialPresets.GetALandStick().stock_id)); + + DataBaseContexts.CTContext.SaveChanges(); + } + } +}
\ No newline at end of file diff --git a/Mundus/Service/Windows/Calculate.cs b/Mundus/Service/Windows/Calculate.cs index 8bc1823..7bf92c3 100644 --- a/Mundus/Service/Windows/Calculate.cs +++ b/Mundus/Service/Windows/Calculate.cs @@ -2,7 +2,7 @@ {
using System; using Mundus.Data; - using Mundus.Data.Tiles.Mobs; + using Mundus.Service.Tiles.Mobs; /// <summary>
/// Used to calculate values, related to the buttons on the game windows
diff --git a/Mundus/Data/Windows/WI.cs b/Mundus/Service/Windows/WI.cs index 14e5f6e..da3065f 100644 --- a/Mundus/Data/Windows/WI.cs +++ b/Mundus/Service/Windows/WI.cs @@ -1,4 +1,4 @@ -namespace Mundus.Data.Windows +namespace Mundus.Service.Windows { using Mundus.Views.Windows; using Mundus.Views.Windows.GameWindows.Large; diff --git a/Mundus/Service/Windows/WindowController.cs b/Mundus/Service/Windows/WindowController.cs index 1c4a4aa..8b089bf 100644 --- a/Mundus/Service/Windows/WindowController.cs +++ b/Mundus/Service/Windows/WindowController.cs @@ -1,7 +1,6 @@ namespace Mundus.Service.Windows { using Gtk; - using Mundus.Data.Windows; using Mundus.Service.Tiles.Items; using Mundus.Service.Tiles.Mobs; using Mundus.Service.Tiles.Mobs.Controllers; diff --git a/Mundus/Views/Windows/CraftingWindow.cs b/Mundus/Views/Windows/CraftingWindow.cs index f05603d..0339327 100644 --- a/Mundus/Views/Windows/CraftingWindow.cs +++ b/Mundus/Views/Windows/CraftingWindow.cs @@ -2,7 +2,8 @@ { using System; using Gtk; - using Mundus.Service.Tiles.Crafting; + using Mundus.Data.Crafting; + using Mundus.Service.Tiles; public partial class CraftingWindow : Gtk.Window { @@ -28,7 +29,7 @@ { this.Reset(); - this.recipes = CraftingController.GetAvalableRecipes(); + this.recipes = RecipeController.GetAvalableRecipes(); this.recipeIndex = 0; this.PrintRecipe(); @@ -71,7 +72,7 @@ /// </summary> protected void OnBtnCraftClicked(object sender, EventArgs e) { - CraftingController.CraftItemPlayer(this.recipes[this.recipeIndex]); + RecipeController.CraftItemPlayer(this.recipes[this.recipeIndex]); this.Hide(); } @@ -87,7 +88,7 @@ this.btnCraft.Sensitive = true; this.imgItem.SetFromStock(recipe.ResultItem, IconSize.Dnd); - this.lblInfo.Text = recipe.ResultItem.ToString(); + this.lblInfo.Text = recipe.ResultItem; this.lblC1.Text = recipe.Count1 + string.Empty; this.imgI1.SetFromStock(recipe.ReqItem1, IconSize.Dnd); diff --git a/Mundus/Views/Windows/GameWindows/Large/LargeLogic.cs b/Mundus/Views/Windows/GameWindows/Large/LargeLogic.cs index aa456e5..bb095f7 100644 --- a/Mundus/Views/Windows/GameWindows/Large/LargeLogic.cs +++ b/Mundus/Views/Windows/GameWindows/Large/LargeLogic.cs @@ -1,7 +1,7 @@ namespace Mundus.Views.Windows.GameWindows.Large { using Gtk; - using Mundus.Data.Dialogues; + using Mundus.Service.Dialogs; using Mundus.Service.Tiles.Items; using static Mundus.Service.Tiles.Mobs.Inventory; diff --git a/Mundus/Views/Windows/GameWindows/Medium/MediumLogic.cs b/Mundus/Views/Windows/GameWindows/Medium/MediumLogic.cs index 96bdcf3..86920d6 100644 --- a/Mundus/Views/Windows/GameWindows/Medium/MediumLogic.cs +++ b/Mundus/Views/Windows/GameWindows/Medium/MediumLogic.cs @@ -1,7 +1,7 @@ namespace Mundus.Views.Windows.GameWindows.Medium { using Gtk; - using Mundus.Data.Dialogues; + using Mundus.Service.Dialogs; using Mundus.Service.Tiles.Items; using static Mundus.Service.Tiles.Mobs.Inventory; diff --git a/Mundus/Views/Windows/GameWindows/Small/SmallLogic.cs b/Mundus/Views/Windows/GameWindows/Small/SmallLogic.cs index 3948360..e4a3aa4 100644 --- a/Mundus/Views/Windows/GameWindows/Small/SmallLogic.cs +++ b/Mundus/Views/Windows/GameWindows/Small/SmallLogic.cs @@ -1,7 +1,7 @@ namespace Mundus.Views.Windows.GameWindows.Small { using Gtk; - using Mundus.Data.Dialogues; + using Mundus.Service.Dialogs; using Mundus.Service.Tiles.Items; using static Mundus.Service.Tiles.Mobs.Inventory; diff --git a/Mundus/Views/Windows/LogWindow.cs b/Mundus/Views/Windows/LogWindow.cs index e6df1c5..a53d17a 100644 --- a/Mundus/Views/Windows/LogWindow.cs +++ b/Mundus/Views/Windows/LogWindow.cs @@ -8,7 +8,7 @@ /// <summary> /// Used for crolling up and down the log messages /// </summary> - private int scroll = 0; + private int scroll; public LogWindow() : base(Gtk.WindowType.Toplevel) { diff --git a/Mundus/Views/Windows/MainWindow.cs b/Mundus/Views/Windows/MainWindow.cs index ca3b529..80b8094 100644 --- a/Mundus/Views/Windows/MainWindow.cs +++ b/Mundus/Views/Windows/MainWindow.cs @@ -9,7 +9,7 @@ public MainWindow() : base(Gtk.WindowType.Toplevel) { this.Build(); - this.lblBuild.Text = Mundus.Data.Windows.WI.BuildName; + this.lblBuild.Text = WI.BuildName; } protected void OnBtnTutorialClicked(object sender, EventArgs e) diff --git a/Mundus/Views/Windows/PauseWindow.cs b/Mundus/Views/Windows/PauseWindow.cs index 4dde656..75f4386 100644 --- a/Mundus/Views/Windows/PauseWindow.cs +++ b/Mundus/Views/Windows/PauseWindow.cs @@ -9,7 +9,7 @@ public PauseWindow() : base(Gtk.WindowType.Toplevel) { this.Build(); - this.lblBuild.Text = Mundus.Data.Windows.WI.BuildName; + this.lblBuild.Text = WI.BuildName; } /// <summary> diff --git a/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs b/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs index 3f8e3b9..da5314b 100644 --- a/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs +++ b/Mundus/gtk-gui/Mundus.Views.Windows.MainWindow.cs @@ -37,7 +37,7 @@ namespace Mundus.Views.Windows this.lblTitle.WidthRequest = 300; this.lblTitle.HeightRequest = 100; this.lblTitle.Name = "lblTitle"; - this.lblTitle.LabelProp = "Mundus (replace with picture)"; + this.lblTitle.LabelProp = "Mundus"; this.lblTitle.Justify = ((global::Gtk.Justification)(3)); this.vboxUI.Add(this.lblTitle); global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.vboxUI[this.lblTitle])); diff --git a/Mundus/gtk-gui/Mundus.Views.Windows.MusicWindow.cs b/Mundus/gtk-gui/Mundus.Views.Windows.MusicWindow.cs index 2bbbaba..a689d78 100644 --- a/Mundus/gtk-gui/Mundus.Views.Windows.MusicWindow.cs +++ b/Mundus/gtk-gui/Mundus.Views.Windows.MusicWindow.cs @@ -70,6 +70,7 @@ namespace Mundus.Views.Windows this.btnNext = new global::Gtk.Button(); this.btnNext.WidthRequest = 70; this.btnNext.HeightRequest = 50; + this.btnNext.Sensitive = false; this.btnNext.CanFocus = true; this.btnNext.Name = "btnNext"; this.btnNext.UseUnderline = true; @@ -102,6 +103,7 @@ namespace Mundus.Views.Windows this.btnPrevious = new global::Gtk.Button(); this.btnPrevious.WidthRequest = 70; this.btnPrevious.HeightRequest = 50; + this.btnPrevious.Sensitive = false; this.btnPrevious.CanFocus = true; this.btnPrevious.Name = "btnPrevious"; this.btnPrevious.UseUnderline = true; @@ -118,6 +120,7 @@ namespace Mundus.Views.Windows this.btnRandom = new global::Gtk.Button(); this.btnRandom.WidthRequest = 70; this.btnRandom.HeightRequest = 50; + this.btnRandom.Sensitive = false; this.btnRandom.CanFocus = true; this.btnRandom.Name = "btnRandom"; this.btnRandom.UseUnderline = true; diff --git a/Mundus/gtk-gui/Mundus.Views.Windows.NewGameWindow.cs b/Mundus/gtk-gui/Mundus.Views.Windows.NewGameWindow.cs index 0bbc355..2ea610e 100644 --- a/Mundus/gtk-gui/Mundus.Views.Windows.NewGameWindow.cs +++ b/Mundus/gtk-gui/Mundus.Views.Windows.NewGameWindow.cs @@ -247,6 +247,7 @@ namespace Mundus.Views.Windows this.rbCreative.Sensitive = false; this.rbCreative.CanFocus = true; this.rbCreative.Name = "rbCreative"; + this.rbCreative.Active = true; this.rbCreative.DrawIndicator = true; this.rbCreative.UseUnderline = true; this.rbCreative.Group = new global::GLib.SList(global::System.IntPtr.Zero); @@ -263,6 +264,7 @@ namespace Mundus.Views.Windows this.rbEasy.WidthRequest = 90; this.rbEasy.CanFocus = true; this.rbEasy.Name = "rbEasy"; + this.rbEasy.Active = true; this.rbEasy.DrawIndicator = true; this.rbEasy.UseUnderline = true; this.rbEasy.Group = new global::GLib.SList(global::System.IntPtr.Zero); @@ -311,6 +313,7 @@ namespace Mundus.Views.Windows this.rbLarge.WidthRequest = 90; this.rbLarge.CanFocus = true; this.rbLarge.Name = "rbLarge"; + this.rbLarge.Active = true; this.rbLarge.DrawIndicator = true; this.rbLarge.UseUnderline = true; this.rbLarge.Group = new global::GLib.SList(global::System.IntPtr.Zero); @@ -342,6 +345,7 @@ namespace Mundus.Views.Windows this.rbMLarge = new global::Gtk.RadioButton("Large"); this.rbMLarge.CanFocus = true; this.rbMLarge.Name = "rbMLarge"; + this.rbMLarge.Active = true; this.rbMLarge.DrawIndicator = true; this.rbMLarge.UseUnderline = true; this.rbMLarge.Group = new global::GLib.SList(global::System.IntPtr.Zero); diff --git a/Mundus/gtk-gui/Mundus.Views.Windows.SettingsWindow.cs b/Mundus/gtk-gui/Mundus.Views.Windows.SettingsWindow.cs index 94e0260..0c77586 100644 --- a/Mundus/gtk-gui/Mundus.Views.Windows.SettingsWindow.cs +++ b/Mundus/gtk-gui/Mundus.Views.Windows.SettingsWindow.cs @@ -87,7 +87,7 @@ namespace Mundus.Views.Windows // Container child tbUI.Gtk.Table+TableChild this.lblTitle = new global::Gtk.Label(); this.lblTitle.Name = "lblTitle"; - this.lblTitle.LabelProp = "Settings (replace with picture)"; + this.lblTitle.LabelProp = "Settings"; this.tbUI.Add(this.lblTitle); global::Gtk.Table.TableChild w6 = ((global::Gtk.Table.TableChild)(this.tbUI[this.lblTitle])); w6.LeftAttach = ((uint)(2)); diff --git a/Mundus/gtk-gui/gui.stetic b/Mundus/gtk-gui/gui.stetic index 9232005..3bba2ff 100644 --- a/Mundus/gtk-gui/gui.stetic +++ b/Mundus/gtk-gui/gui.stetic @@ -23895,7 +23895,7 @@ <child> <widget class="Gtk.Label" id="lblTitle"> <property name="MemberName" /> - <property name="LabelProp">Settings (replace with picture)</property> + <property name="LabelProp">Settings</property> </widget> <packing> <property name="LeftAttach">2</property> @@ -24872,6 +24872,7 @@ <property name="MemberName" /> <property name="WidthRequest">70</property> <property name="HeightRequest">50</property> + <property name="Sensitive">False</property> <property name="CanFocus">True</property> <property name="Type">TextOnly</property> <property name="Label">Next</property> @@ -24926,6 +24927,7 @@ <property name="MemberName" /> <property name="WidthRequest">70</property> <property name="HeightRequest">50</property> + <property name="Sensitive">False</property> <property name="CanFocus">True</property> <property name="Type">TextOnly</property> <property name="Label">Prev</property> @@ -24952,6 +24954,7 @@ <property name="MemberName" /> <property name="WidthRequest">70</property> <property name="HeightRequest">50</property> + <property name="Sensitive">False</property> <property name="CanFocus">True</property> <property name="Type">TextOnly</property> <property name="Label">Rnd</property> @@ -25143,7 +25146,7 @@ <property name="MemberName" /> <property name="WidthRequest">300</property> <property name="HeightRequest">100</property> - <property name="LabelProp">Mundus (replace with picture)</property> + <property name="LabelProp">Mundus</property> <property name="Justify">Fill</property> </widget> <packing> diff --git a/Mundus/packages.config b/Mundus/packages.config index 871b669..f82577d 100644 --- a/Mundus/packages.config +++ b/Mundus/packages.config @@ -24,6 +24,7 @@ <package id="Microsoft.Extensions.Primitives" version="3.1.4" targetFramework="net47" /> <package id="MySql.Data" version="8.0.20" targetFramework="net47" /> <package id="MySql.Data.EntityFrameworkCore" version="8.0.20" targetFramework="net47" /> + <package id="NuGet.Build.Packaging" version="0.2.0" targetFramework="net47" developmentDependency="true" /> <package id="SSH.NET" version="2016.1.0" targetFramework="net47" /> <package id="System.Buffers" version="4.5.1" targetFramework="net47" /> <package id="System.Collections.Immutable" version="1.7.1" targetFramework="net47" /> diff --git a/MundusTests/ApplicationSetup.cs b/MundusTests/ApplicationSetup.cs index bd39d97..429097d 100644 --- a/MundusTests/ApplicationSetup.cs +++ b/MundusTests/ApplicationSetup.cs @@ -1,7 +1,7 @@ -using Mundus.Data;
-using Mundus.Data.Windows;
+using Gtk; +using Mundus.Data;
+using Mundus.Service.Windows; using NUnit.Framework; -using Gtk; [SetUpFixture] public static class ApplicationSetup { diff --git a/MundusTests/DataTests/Mobs/MITests.cs b/MundusTests/DataTests/Mobs/MITests.cs index 85595d7..bf8b12d 100644 --- a/MundusTests/DataTests/Mobs/MITests.cs +++ b/MundusTests/DataTests/Mobs/MITests.cs @@ -1,6 +1,6 @@ namespace MundusTests.DataTests.Mobs { - using Mundus.Data.Tiles.Mobs; + using Mundus.Service.Tiles.Mobs; using NUnit.Framework; [TestFixture] diff --git a/MundusTests/ServiceTests/SuperLayers/ImageControllerTests.cs b/MundusTests/ServiceTests/SuperLayers/ImageControllerTests.cs index 248adbe..9e1e1c6 100644 --- a/MundusTests/ServiceTests/SuperLayers/ImageControllerTests.cs +++ b/MundusTests/ServiceTests/SuperLayers/ImageControllerTests.cs @@ -2,8 +2,8 @@ { using Gtk; using Mundus.Data; - using Mundus.Data.Tiles.Mobs; using Mundus.Service.SuperLayers; + using Mundus.Service.Tiles.Mobs; using NUnit.Framework; using static Mundus.Service.SuperLayers.ImageController; using static Mundus.Service.Tiles.Mobs.Inventory; diff --git a/MundusTests/ServiceTests/Tiles/Crafting/CraftingControllerTests.cs b/MundusTests/ServiceTests/Tiles/Crafting/CraftingControllerTests.cs index 5961c72..a7be0ee 100644 --- a/MundusTests/ServiceTests/Tiles/Crafting/CraftingControllerTests.cs +++ b/MundusTests/ServiceTests/Tiles/Crafting/CraftingControllerTests.cs @@ -2,9 +2,9 @@ { using System.Linq; using Mundus.Data; - using Mundus.Data.Tiles.Mobs; - using Mundus.Data.Tiles.Presets; - using Mundus.Service.Tiles.Crafting; + using Mundus.Service.Tiles; + using Mundus.Service.Tiles.Items.Presets; + using Mundus.Service.Tiles.Mobs; using NUnit.Framework; [TestFixture] @@ -20,7 +20,7 @@ MI.Player.Inventory.AppendToItems(MaterialPresets.GetALandStick()); } - CraftingController.CraftItemPlayer(recipe); + RecipeController.CraftItemPlayer(recipe); Assert.Contains(recipe.ResultItem, MI.Player.Inventory.Items.Where(x => x != null).Select(x => x.stock_id).ToArray(), "Result item isn't added to player's inventory"); Assert.AreEqual(1, MI.Player.Inventory.Items.Where(x => x != null).Count(), "Not all required items are removed from player's inventory"); diff --git a/MundusTests/ServiceTests/Tiles/Mobs/MobTileTests.cs b/MundusTests/ServiceTests/Tiles/Mobs/MobTileTests.cs index a4329dc..d2b7575 100644 --- a/MundusTests/ServiceTests/Tiles/Mobs/MobTileTests.cs +++ b/MundusTests/ServiceTests/Tiles/Mobs/MobTileTests.cs @@ -1,9 +1,9 @@ namespace MundusTests.ServiceTests.Tiles.Mobs { using Mundus.Data; - using Mundus.Data.Windows; using Mundus.Service.Tiles.Items.Types; using Mundus.Service.Tiles.Mobs; + using Mundus.Service.Windows; using NUnit.Framework; [TestFixture] |
