Files
trail-into-darkness-demo/Assets/Code/Platform/UnityEditorPlatform.cs

34 lines
1.2 KiB
C#

using Nox.Input;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.AddressableAssets;
namespace Nox.Platform {
public class UnityEditorPlatform : IPlatform {
private readonly AssetReference assetReference;
private UnityEditorPlatformSettings editorPlatformSettings;
public UnityEditorPlatform(AssetReference assetReference) {
this.assetReference = assetReference;
}
public PlatformSettings PlatformSettings => editorPlatformSettings;
public async Task Initialize(object applicationData) {
var handle = Addressables.LoadAssetAsync<UnityEditorPlatformSettings>(assetReference);
await handle.Task;
editorPlatformSettings = handle.Result;
Debug.Log($"Device Platform {editorPlatformSettings.devicePlatform} initialized");
InitializeInput();
}
public IInput InitializeInput() {
var inputHandler = new EditorInput(editorPlatformSettings);
inputHandler.Initialize();
return inputHandler;
}
public void Tick() { }
public void Dispose() { }
public void OnApplicationQuit() { }
}
}