Added research display to the game
This commit is contained in:
@@ -19,6 +19,7 @@ public partial class GameData
|
||||
public static float tileWidth = 6;
|
||||
public static float tileHeight = 4;
|
||||
public static SortedDictionary<string, ItemData> availableItems = ResourceLoader.LoadItems();
|
||||
public static Dictionary<string, ResearchData> availableResearch = ResourceLoader.LoadResearch();
|
||||
|
||||
//--- PLAYER ADJUSTABLE VALUES ---
|
||||
//Color used in primary objects (e.g. Robots)
|
||||
|
||||
@@ -101,4 +101,21 @@ public partial class ResourceLoader
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Dictionary<string, ResearchData> LoadResearch()
|
||||
{
|
||||
|
||||
FileAccess file = FileAccess.Open("res://Assets/Research.json", FileAccess.ModeFlags.Read);
|
||||
string json = file.GetAsText();
|
||||
|
||||
Dictionary<string, ResearchData> result = new();
|
||||
|
||||
List<ResearchData> researches = JsonSerializer.Deserialize<List<ResearchData>>(json);
|
||||
foreach (ResearchData research in researches)
|
||||
{
|
||||
result.Add(research.Id, research);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user