private bool ReadMetadata() { if (!Directory.Exists(Path)) { return(false); } var metaFiles = Directory.GetFiles(Path, "*." + MetaData.Extension); if (metaFiles.Length > 0) { Metadata = FileUtils.LoadJsonFromAbsolutePath <MetaData>(metaFiles[0]); } else { Console.Error.WriteLine("Can't load file {0}, no metadata found", Path); return(false); } var screenshots = Directory.GetFiles(Path, "*.png"); if (screenshots.Length > 0) { Screenshot = AssetManager.LoadUnbuiltTextureFromAbsolutePath(screenshots[0]); } return(true); }
public bool ReadFile(string filePath) { var metaFilePath = filePath + global::System.IO.Path.DirectorySeparatorChar + "meta.txt"; MetaData = FileUtils.LoadJsonFromAbsolutePath <OverworldMetaData>(metaFilePath); MetaData.Overworld.ColonyCells.InitializeCellMap(); foreach (var resource in MetaData.Resources) { if (!Library.DoesResourceTypeExist(resource.Name)) { Library.AddResourceType(resource); } } var worldFilePath = filePath + global::System.IO.Path.DirectorySeparatorChar + "world.png"; var worldTexture = AssetManager.LoadUnbuiltTextureFromAbsolutePath(worldFilePath); if (worldTexture != null) { var worldData = LoadFromTexture(worldTexture); MetaData.Overworld.Map = new OverworldMap(worldData); } else { Console.Out.WriteLine("Failed to load overworld texture."); return(false); } return(true); }
public bool ReadFile(string filePath) { var worldFilePath = filePath + System.IO.Path.DirectorySeparatorChar + "world.png"; var metaFilePath = filePath + System.IO.Path.DirectorySeparatorChar + "meta.txt"; Data = FileUtils.LoadJsonFromAbsolutePath <OverworldData>(metaFilePath); var worldTexture = AssetManager.LoadUnbuiltTextureFromAbsolutePath(worldFilePath); if (worldTexture != null) { Data.LoadFromTexture(worldTexture); } else { Console.Out.WriteLine("Failed to load overworld texture."); return(false); } return(true); }