forked from Misaki/GhostEngine
Major ECS API overhaul: added ComponentSet, refactored ComponentRegistry, and updated all entity/component creation methods. Introduced robust custom serialization infrastructure and per-component source generators for registration and (de)serialization. Updated editor, engine, and test code to use new APIs. Improved code quality, naming, and performance throughout. Removed obsolete code and updated dependencies.
35 lines
1.0 KiB
C#
35 lines
1.0 KiB
C#
using Ghost.Data.Services;
|
|
|
|
namespace Ghost.Editor.Core.AssetHandle;
|
|
|
|
public static partial class AssetDatabase
|
|
{
|
|
private static FileSystemWatcher? s_watcher;
|
|
|
|
private static readonly Dictionary<Guid, string> s_assetPathLookup = new();
|
|
|
|
public static DirectoryInfo? AssetsDirectory
|
|
{
|
|
get;
|
|
private set;
|
|
}
|
|
|
|
internal static void Initialize()
|
|
{
|
|
if (ProjectService.CurrentProject.Metadata == null)
|
|
{
|
|
throw new InvalidOperationException("Project metadata is not initialized. Ensure that the project is loaded before accessing the AssetDatabase.");
|
|
}
|
|
|
|
AssetsDirectory = new DirectoryInfo(Path.Combine(Path.GetDirectoryName(ProjectService.CurrentProject.Path)!, ProjectService.ASSETS_FOLDER));
|
|
s_watcher = new FileSystemWatcher
|
|
{
|
|
Path = AssetsDirectory.FullName,
|
|
IncludeSubdirectories = true,
|
|
EnableRaisingEvents = true
|
|
};
|
|
|
|
InitializeAssetHandle();
|
|
InitializeMetaData();
|
|
}
|
|
} |