ProjectSettingsLoader
- Namespace: Turian.Engine.Core
- Source File: ProjectSettingsLoader.cs
Finds a project's settings assets and reads them into Loaded. Nothing lists them: in a project's sources every data asset whose class is a ProjectSettingsAsset is one, and a built game reads the ids its build wrote to IndexFileName, because packed assets have no meta files to look through.
Fields
IndexFileName (string) = "projectSettings.json": The file a build writes beside the game, listing the settings asset ids — it is also how a built game recognizes the folder it runs from.
PreferredFolderName (string) = "Settings": The folder under Assets whose copy of a kind wins when a project holds more than one.
Public Methods
FindSources
public static IReadOnlyList<ProjectSettingsSource> FindSources(string assetsDirectory)
Every settings asset under a project's Assets folder, one entry per file, with the one each kind uses first: the copy under Assets/Settings, then the first by path.
Parameters:
assetsDirectory(string): The project'sAssetsfolder.
Returns: IReadOnlyList<ProjectSettingsSource>
- The settings assets found.
LoadFromSources
public static void LoadFromSources(IAppSettings settings)
Reads the settings each kind uses from the project's sources. No import is needed.
Parameters:
settings(IAppSettings): The project whose settings are loaded.
Load
public static void Load(IAppSettings settings, IAssetLoader? loader)
Reads the settings a built game lists in IndexFileName through its asset loader. A folder without the index but with an Assets folder is read from its sources instead.
Parameters:
settings(IAppSettings): The project whose settings are loaded.loader(IAssetLoader?): Resolves the asset metadata by id.
WriteIndex
public static void WriteIndex(string assetsDirectory, string indexPath)
Writes the index a built game reads its settings through: the asset each kind uses.
Parameters:
assetsDirectory(string): The project'sAssetsfolder.indexPath(string): Where to writeIndexFileName.
DataAssetSources
public static IEnumerable<string> DataAssetSources(string assetsDirectory)
The data-asset source files under a folder that have a meta file beside them.
Parameters:
assetsDirectory(string): The project'sAssetsfolder.
Returns: IEnumerable<string>
- Absolute source paths.