Improved recipes and added resources to it. Changed how ingredients and items work.
This commit is contained in:
@@ -2,6 +2,7 @@ using Godot;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
public partial class ResourceLoader
|
||||
{
|
||||
|
||||
@@ -19,7 +20,7 @@ public partial class ResourceLoader
|
||||
{
|
||||
return GD.Load<PackedScene>($"res://Prefabs/Robot/RobotDisplay.tscn");
|
||||
}
|
||||
|
||||
|
||||
public static Dictionary<string, MeshInstance3D> LoadTiles()
|
||||
{
|
||||
Dictionary<string, MeshInstance3D> tileMeshes = new Dictionary<string, MeshInstance3D>();
|
||||
@@ -49,37 +50,45 @@ public partial class ResourceLoader
|
||||
public static Dictionary<ProgramNode, PackedScene> LoadDSLNodes()
|
||||
{
|
||||
Dictionary<ProgramNode, PackedScene> nodes = new()
|
||||
{
|
||||
{ new MoveNode(), GD.Load<PackedScene>($"res://Prefabs/DSL/MoveNode.tscn") },
|
||||
{
|
||||
{ new MoveNode(), GD.Load<PackedScene>($"res://Prefabs/DSL/MoveNode.tscn") },
|
||||
{ new HarvestNode(), GD.Load<PackedScene>($"res://Prefabs/DSL/HarvestNode.tscn") },
|
||||
{ new CraftNode(), GD.Load<PackedScene>($"res://Prefabs/DSL/CraftNode.tscn") },
|
||||
{ new ExploreNode(), GD.Load<PackedScene>($"res://Prefabs/DSL/ExploreNode.tscn") }
|
||||
};
|
||||
};
|
||||
return nodes;
|
||||
}
|
||||
|
||||
public static Dictionary<string, Texture2D> LoadResourceSymbols()
|
||||
{
|
||||
Dictionary<string, Texture2D> symbols = new()
|
||||
{
|
||||
{ "Iron ore", GD.Load<Texture2D>($"res://Assets/Images/Resources/IronSymbol.png") },
|
||||
{ "Tin ore", GD.Load<Texture2D>($"res://Assets/Images/Resources/TinSymbol.png") },
|
||||
{ "Copper ore", GD.Load<Texture2D>($"res://Assets/Images/Resources/CopperSymbol.png") },
|
||||
{ "Mushroom", GD.Load<Texture2D>($"res://Assets/Images/Resources/MushroomSymbol.png") },
|
||||
{ "Spiderweb", GD.Load<Texture2D>($"res://Assets/Images/Resources/SpiderSilkSymbol.png") },
|
||||
{ "Coal", GD.Load<Texture2D>($"res://Assets/Images/Resources/CoalSymbol.png") },
|
||||
{ "Water", GD.Load<Texture2D>($"res://Assets/Images/Resources/WaterSymbol.png") },
|
||||
{ "Stone", GD.Load<Texture2D>($"res://Assets/Images/Resources/StoneSymbol.png") },
|
||||
};
|
||||
{
|
||||
{ "iron_ore", GD.Load<Texture2D>($"res://Assets/Images/Resources/IronSymbol.png") },
|
||||
{ "tin_ore", GD.Load<Texture2D>($"res://Assets/Images/Resources/TinSymbol.png") },
|
||||
{ "copper_ore", GD.Load<Texture2D>($"res://Assets/Images/Resources/CopperSymbol.png") },
|
||||
{ "mushroom", GD.Load<Texture2D>($"res://Assets/Images/Resources/MushroomSymbol.png") },
|
||||
{ "spider_silk", GD.Load<Texture2D>($"res://Assets/Images/Resources/SpiderSilkSymbol.png") },
|
||||
{ "coal", GD.Load<Texture2D>($"res://Assets/Images/Resources/CoalSymbol.png") },
|
||||
{ "water", GD.Load<Texture2D>($"res://Assets/Images/Resources/WaterSymbol.png") },
|
||||
{ "stone", GD.Load<Texture2D>($"res://Assets/Images/Resources/StoneSymbol.png") },
|
||||
};
|
||||
return symbols;
|
||||
}
|
||||
|
||||
public static Dictionary<Ingredient, Texture2D> LoadIngredients()
|
||||
public static Dictionary<string, ItemData> LoadItems()
|
||||
{
|
||||
Dictionary<Ingredient, Texture2D> ingredients = new()
|
||||
{
|
||||
|
||||
};
|
||||
return ingredients;
|
||||
|
||||
FileAccess file = FileAccess.Open("res://Assets/Recipes.json", FileAccess.ModeFlags.Read);
|
||||
string json = file.GetAsText();
|
||||
|
||||
Dictionary<string, ItemData> result = new();
|
||||
|
||||
List<ItemData> items = JsonSerializer.Deserialize<List<ItemData>>(json);
|
||||
foreach (ItemData item in items)
|
||||
{
|
||||
result.Add(item.Id, item);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user