Changed the project structure to reflect a shift from `Ghost.App` to `Ghost.Editor`, updating namespaces and class names throughout. Changed the application class in `App.xaml` and `App.xaml.cs` from `GhostApplication` to `EditorApplication`. Changed several service interfaces to reside under `Ghost.Editor.Services.Contracts`, including `IInspectorService`, `INotificationService`, and `IProgressService`. Added `InspectorView` and `InspectorViewModel` classes to manage inspector functionality. Added `NavigationTabView` and `NavigationTabPage` classes to facilitate navigation within the editor. Enhanced `WorldNode` and `EntityNode` classes to support scene graph functionality, including serialization and entity management. Updated the project file `Ghost.Editor.csproj` to reflect the new structure and removed old references. Modified the solution file `GhostEngine.sln` to remove references to `Ghost.App` and include `Ghost.Editor`. Updated unit tests to align with the new namespaces and project structure.
62 lines
1.5 KiB
C#
62 lines
1.5 KiB
C#
using Ghost.Data.Models;
|
|
using Ghost.Data.Services;
|
|
using Ghost.Editor.Core.AssetHandle;
|
|
using Ghost.Editor.View.Windows;
|
|
using Ghost.Engine;
|
|
|
|
namespace Ghost.Editor.Core.AppState;
|
|
|
|
internal class EditorState : IAppState
|
|
{
|
|
private EngineEditorWindow? _window;
|
|
private EngineCore? _engineCore;
|
|
|
|
public Task OnExitingAsync()
|
|
{
|
|
if (EditorApplication.Window == _window)
|
|
{
|
|
EditorApplication.Window = null;
|
|
}
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
public async Task OnEnteringAsync(object? parameter)
|
|
{
|
|
if (parameter is not ProjectMetadataInfo metadataInfo)
|
|
{
|
|
throw new ArgumentException("Parameter must be of type ProjectMetadata.", nameof(parameter));
|
|
}
|
|
|
|
ProjectService.CurrentProject = metadataInfo;
|
|
|
|
_engineCore = EditorApplication.GetService<EngineCore>();
|
|
await _engineCore.StartAsync(new Engine.Models.LaunchArgument());
|
|
|
|
_window = EditorApplication.GetService<EngineEditorWindow>();
|
|
_window.Activate();
|
|
|
|
EditorApplication.Window = _window;
|
|
}
|
|
|
|
public async Task OnExitedAsync()
|
|
{
|
|
if (_engineCore != null)
|
|
{
|
|
await _engineCore.ShutDownAsync();
|
|
}
|
|
|
|
if (EditorApplication.Window == _window)
|
|
{
|
|
EditorApplication.Window = null;
|
|
}
|
|
|
|
_window?.Close();
|
|
_window = null;
|
|
}
|
|
|
|
public Task OnEnteredAsync(object? parameter)
|
|
{
|
|
AssetDatabase.Initialize();
|
|
return Task.CompletedTask;
|
|
}
|
|
} |