forked from Misaki/GhostEngine
Modify AssetService
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Ghost.Editor.Core;
|
||||
using Ghost.Editor.Core.Contracts;
|
||||
using Ghost.Editor.Core.Utilities;
|
||||
using Ghost.Editor.Models;
|
||||
using Ghost.Engine;
|
||||
@@ -61,7 +62,9 @@ internal static class ActivationHandler
|
||||
((EngineCore)App.GetService<IEngineContext>()).Init();
|
||||
});
|
||||
|
||||
// TODO: Initialize other subsystems here.
|
||||
await ((Core.AssetHandle.AssetService)App.GetService<IAssetService>()).Init();
|
||||
|
||||
// TODO: Init other subsystems here.
|
||||
// await Task.Delay(10000); // Wait 10 seconds to simulate work.
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
using Ghost.Core;
|
||||
using Ghost.Editor.Core;
|
||||
using Ghost.Editor.Core.AssetHandle;
|
||||
using Ghost.Editor.Core.Contracts;
|
||||
using Ghost.Editor.Core.Services;
|
||||
using Ghost.Editor.View.Pages.EngineEditor;
|
||||
|
||||
@@ -11,6 +11,7 @@ namespace Ghost.Editor.ViewModels.Controls;
|
||||
internal partial class ProjectBrowserViewModel : ObservableObject
|
||||
{
|
||||
private readonly IInspectorService _inspectorService;
|
||||
private readonly IAssetService _assetService;
|
||||
|
||||
private readonly Dictionary<string, ExplorerItem> _pathToDirectoryItemMap = new();
|
||||
private ExplorerItem? _selectedItem;
|
||||
@@ -40,9 +41,10 @@ internal partial class ProjectBrowserViewModel : ObservableObject
|
||||
get; set;
|
||||
} = string.Empty;
|
||||
|
||||
public ProjectBrowserViewModel(IInspectorService inspectorService)
|
||||
public ProjectBrowserViewModel(IInspectorService inspectorService, IAssetService assetService)
|
||||
{
|
||||
_inspectorService = inspectorService;
|
||||
_assetService = assetService;
|
||||
|
||||
var assetsRootItem = new ExplorerItem(EditorApplication.ASSETS_FOLDER_NAME, Path.Combine(EditorApplication.CurrentProjectPath, EditorApplication.ASSETS_FOLDER_NAME), true);
|
||||
LoadSubFolderRecursive(assetsRootItem);
|
||||
@@ -108,7 +110,7 @@ internal partial class ProjectBrowserViewModel : ObservableObject
|
||||
}
|
||||
else
|
||||
{
|
||||
AssetService.OpenAsset(SelectedItem.FullName);
|
||||
_assetService.OpenAsset(SelectedItem.FullName);
|
||||
return (null, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Ghost.Editor.Core;
|
||||
using Ghost.Editor.Core.AssetHandle;
|
||||
using Ghost.Editor.Core.Contracts;
|
||||
using Ghost.Editor.Models;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
@@ -8,6 +9,8 @@ namespace Ghost.Editor.ViewModels.Pages.EngineEditor;
|
||||
|
||||
internal partial class ProjectViewModel : ObservableObject
|
||||
{
|
||||
private readonly IAssetService _assetService;
|
||||
|
||||
public ObservableCollection<ExplorerItem> SubDirectories
|
||||
{
|
||||
get;
|
||||
@@ -34,8 +37,10 @@ internal partial class ProjectViewModel : ObservableObject
|
||||
set;
|
||||
}
|
||||
|
||||
public ProjectViewModel()
|
||||
public ProjectViewModel(IAssetService assetService)
|
||||
{
|
||||
_assetService = assetService;
|
||||
|
||||
var assetsRootItem = new ExplorerItem("Assets", Path.Combine(EditorApplication.CurrentProjectPath, EditorApplication.ASSETS_FOLDER_NAME), true);
|
||||
LoadSubFolderRecursive(ref assetsRootItem);
|
||||
|
||||
@@ -124,7 +129,7 @@ internal partial class ProjectViewModel : ObservableObject
|
||||
}
|
||||
else
|
||||
{
|
||||
AssetService.OpenAsset(SelectedAsset.FullName);
|
||||
_assetService.OpenAsset(SelectedAsset.FullName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user