Update icon assets
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
using Ghost.Core;
|
||||
using Ghost.Data.Models;
|
||||
using Ghost.Data.Services;
|
||||
using Ghost.Editor.Core.AssetHandle;
|
||||
using Ghost.Editor.View.Windows;
|
||||
using Ghost.Engine;
|
||||
using Ghost.Engine.Services;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
|
||||
namespace Ghost.Editor.Core.AppState;
|
||||
|
||||
@@ -13,63 +12,49 @@ internal class EditorState : IAppState
|
||||
private EngineEditorWindow? _window;
|
||||
private EngineCore? _engineCore;
|
||||
|
||||
public Task OnExitingAsync()
|
||||
public ValueTask<Result> OnExitingAsync()
|
||||
{
|
||||
if (App.Window == _window)
|
||||
{
|
||||
App.Window = null;
|
||||
}
|
||||
|
||||
_engineCore?.ShutDown();
|
||||
CompositionTarget.Rendering -= OnRendering;
|
||||
_engineCore?.Dispose();
|
||||
|
||||
return Task.CompletedTask;
|
||||
return ValueTask.FromResult(Result.Success());
|
||||
}
|
||||
|
||||
public Task OnEnteringAsync(object? parameter)
|
||||
public ValueTask<Result> OnEnteringAsync(object? parameter)
|
||||
{
|
||||
if (parameter is not ProjectMetadataInfo metadataInfo)
|
||||
{
|
||||
throw new ArgumentException("Parameter must be of type ProjectMetadata.", nameof(parameter));
|
||||
return ValueTask.FromResult(Result.Failure("Invalid parameter for entering EditorState."));
|
||||
}
|
||||
|
||||
ProjectService.CurrentProject = metadataInfo;
|
||||
|
||||
_engineCore = App.GetService<EngineCore>();
|
||||
_engineCore.Init(new Engine.Models.LaunchArgument());
|
||||
CompositionTarget.Rendering += OnRendering;
|
||||
_engineCore.Init();
|
||||
|
||||
_window = App.GetService<EngineEditorWindow>();
|
||||
_window.Activate();
|
||||
|
||||
App.Window = _window;
|
||||
|
||||
return Task.CompletedTask;
|
||||
return ValueTask.FromResult(Result.Success());
|
||||
}
|
||||
|
||||
public Task OnExitedAsync()
|
||||
public ValueTask<Result> OnExitedAsync()
|
||||
{
|
||||
_window?.Close();
|
||||
_window = null;
|
||||
|
||||
return Task.CompletedTask;
|
||||
return ValueTask.FromResult(Result.Success());
|
||||
}
|
||||
|
||||
public Task OnEnteredAsync(object? parameter)
|
||||
public async ValueTask<Result> OnEnteredAsync(object? parameter)
|
||||
{
|
||||
AssetDatabase.Initialize();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void OnRendering(object? sender, object e)
|
||||
{
|
||||
if (GraphicsPipeline.WaitForGPUReady(0))
|
||||
{
|
||||
_window?.DispatcherQueue.TryEnqueue(Microsoft.UI.Dispatching.DispatcherQueuePriority.High, () =>
|
||||
{
|
||||
PlayerLoopService.Update();
|
||||
GraphicsPipeline.SignalCPUReady();
|
||||
});
|
||||
}
|
||||
await AssetDatabase.Initialize();
|
||||
return Result.Success();
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,4 @@
|
||||
using Ghost.Core;
|
||||
using Ghost.Editor.View.Windows;
|
||||
|
||||
namespace Ghost.Editor.Core.AppState;
|
||||
@@ -6,36 +7,36 @@ internal class LandingState : IAppState
|
||||
{
|
||||
private LandingWindow? _window;
|
||||
|
||||
public Task OnExitingAsync()
|
||||
public ValueTask<Result> OnExitingAsync()
|
||||
{
|
||||
if (App.Window == _window)
|
||||
{
|
||||
App.Window = null;
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
return ValueTask.FromResult(Result.Success());
|
||||
}
|
||||
|
||||
public Task OnEnteringAsync(object? parameter)
|
||||
public ValueTask<Result> OnEnteringAsync(object? parameter)
|
||||
{
|
||||
_window = App.GetService<LandingWindow>();
|
||||
_window.Activate();
|
||||
|
||||
App.Window = _window;
|
||||
|
||||
return Task.CompletedTask;
|
||||
return ValueTask.FromResult(Result.Success());
|
||||
}
|
||||
|
||||
public Task OnExitedAsync()
|
||||
public ValueTask<Result> OnExitedAsync()
|
||||
{
|
||||
_window?.Close();
|
||||
_window = null;
|
||||
|
||||
return Task.CompletedTask;
|
||||
return ValueTask.FromResult(Result.Success());
|
||||
}
|
||||
|
||||
public Task OnEnteredAsync(object? parameter)
|
||||
public ValueTask<Result> OnEnteredAsync(object? parameter)
|
||||
{
|
||||
return Task.CompletedTask;
|
||||
return ValueTask.FromResult(Result.Success());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user