Sample input settings through current typed access
This commit is contained in:
parent
6708581363
commit
2f09855ddb
2 changed files with 13 additions and 37 deletions
|
|
@ -4,7 +4,6 @@ using System.Linq;
|
|||
using GameCult.Aetheria.EveRuntime;
|
||||
using GameCult.Aetheria.State.Verse;
|
||||
using GameCult.Eve.Surface;
|
||||
using GameCult.Mesh;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
using UnityEngine.InputSystem.Utilities;
|
||||
|
|
@ -14,8 +13,6 @@ public class InputDisplayLayout : MonoBehaviour
|
|||
{
|
||||
private UIDocument _surfaceDocument;
|
||||
private AetheriaInput _ownedInput;
|
||||
private string _clientStatePath = "";
|
||||
private CultMeshReactiveDocument<AetheriaRuntimePlayerSettingsDocument> _playerSettings;
|
||||
private InputAction _captureAction;
|
||||
private InputActionAsset _input;
|
||||
private string _captureActionName = "";
|
||||
|
|
@ -95,8 +92,6 @@ public class InputDisplayLayout : MonoBehaviour
|
|||
_ownedInput?.Dispose();
|
||||
_ownedInput = null;
|
||||
|
||||
ClearClientCaches();
|
||||
|
||||
if (_surfaceDocument != null)
|
||||
{
|
||||
AetheriaEveUnitySurfaceHost.DestroyDocument(_surfaceDocument);
|
||||
|
|
@ -366,39 +361,23 @@ public class InputDisplayLayout : MonoBehaviour
|
|||
$"Input settings require a readable local Aetheria Verse state file: {stateBoot.FailureMessage}");
|
||||
}
|
||||
|
||||
if (!string.Equals(_clientStatePath, stateBoot.StateFilePath, StringComparison.Ordinal))
|
||||
{
|
||||
_clientStatePath = stateBoot.StateFilePath;
|
||||
ClearClientCaches();
|
||||
}
|
||||
|
||||
return stateBoot;
|
||||
}
|
||||
|
||||
private void ClearClientCaches()
|
||||
{
|
||||
_playerSettings?.Dispose();
|
||||
_playerSettings = null;
|
||||
}
|
||||
|
||||
private AetheriaRuntimePlayerSettingsDocument ResolvePlayerSettings()
|
||||
{
|
||||
if (_playerSettings != null)
|
||||
return _playerSettings.Current;
|
||||
|
||||
try
|
||||
{
|
||||
_playerSettings = AetheriaUnityRuntimeClientProvider
|
||||
.ReactivePlayerSettingsDocument(
|
||||
RequireLocalStateBoot(),
|
||||
"unity-input-screen");
|
||||
return AetheriaUnityRuntimeClientProvider
|
||||
.RuntimeState(RequireLocalStateBoot(), "unity-input-screen")
|
||||
.CurrentPlayerSettings();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"Failed to bind Aetheria player settings for input screen: {ex.Message}");
|
||||
Debug.LogWarning($"Failed to read Aetheria player settings for input screen: {ex.Message}");
|
||||
}
|
||||
|
||||
return _playerSettings?.Current;
|
||||
return null;
|
||||
}
|
||||
|
||||
private void ClearCapture()
|
||||
|
|
|
|||
Loading…
Reference in a new issue