Files
trail-into-darkness/Assets/Code/Platform/UnityEditorPlatform.cs
2026-03-19 18:12:07 +01:00

34 lines
1.2 KiB
C#

using Nox.Input;
using System.Collections;
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 IEnumerator Initialize(object applicationData) {
var handle = Addressables.LoadAssetAsync<UnityEditorPlatformSettings>(assetReference);
yield return new WaitUntil(() => handle.IsDone);
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() { }
}
}