forked from Shardstone/trail-into-darkness
36 lines
1.2 KiB
C#
36 lines
1.2 KiB
C#
using Nox.Input;
|
|
using System.Collections;
|
|
using UnityEngine;
|
|
using UnityEngine.AddressableAssets;
|
|
|
|
namespace Nox.Platform {
|
|
public class DesktopPlatform : IPlatform {
|
|
private readonly AssetReference assetReference;
|
|
|
|
private DesktopPlatformSettings desktopPlatformSettings;
|
|
|
|
public DesktopPlatform(AssetReference assetReference) {
|
|
this.assetReference = assetReference;
|
|
}
|
|
|
|
public PlatformSettings PlatformSettings => desktopPlatformSettings;
|
|
public IEnumerator Initialize(object applicationData) {
|
|
var handle = Addressables.LoadAssetAsync<DesktopPlatformSettings>(assetReference);
|
|
yield return new WaitUntil(() => handle.IsDone);
|
|
desktopPlatformSettings = handle.Result;
|
|
Debug.Log($"Device Platform {desktopPlatformSettings.devicePlatform} initialized");
|
|
InitializeInput();
|
|
}
|
|
|
|
public IInput InitializeInput() {
|
|
var inputHandler = new DesktopInput(desktopPlatformSettings);
|
|
inputHandler.Initialize();
|
|
return inputHandler;
|
|
}
|
|
public void Tick() { }
|
|
public void Dispose() { }
|
|
|
|
public void OnApplicationQuit() { }
|
|
}
|
|
}
|