First commit on my server, yey!

This commit is contained in:
Sebastian Bularca
2026-03-19 18:12:07 +01:00
parent 5139ec2cec
commit fedd1961a0
602 changed files with 101587 additions and 6 deletions

View File

@@ -0,0 +1,35 @@
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() { }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 12257b10c3e51434690692262f91c5e2

View File

@@ -0,0 +1,7 @@
using UnityEngine;
namespace Nox.Platform {
[CreateAssetMenu(fileName = "DesktopPlatformSettings", menuName = "Nox/Database/Platform/DesktopPlatformSettings")]
public class DesktopPlatformSettings : PlatformSettings {
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 0cc0353d3bc1c4e459d99f4a43fd0d99

View File

@@ -0,0 +1,25 @@
using Nox.Input;
using System.Collections;
namespace Nox.Platform {
/// <summary>
/// Add here your platforms as needed
/// </summary>
public enum DevicePlatform {
Desktop,
UnityEditor
}
/// <summary>
/// Factory interface for platform selection and initialization
/// </summary>
public interface IPlatform {
PlatformSettings PlatformSettings { get; }
IEnumerator Initialize(object applicationData);
IInput InitializeInput();
void Tick();
void Dispose();
void OnApplicationQuit();
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: bc04131d1b2a34bd598c49aac51798ce

View File

@@ -0,0 +1,11 @@
using Nox.Game;
using Nox.Input;
using UnityEngine;
namespace Nox.Platform {
public abstract class PlatformSettings : ScriptableObject {
public DevicePlatform devicePlatform;
public InputSettings inputSettings;
public GameObject cameraPrefab;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 43a7da5fc809941d08a8085b930a43f7

View File

@@ -0,0 +1,33 @@
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() { }
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 1018321491bd24e558f83b130106ee31

View File

@@ -0,0 +1,8 @@
using UnityEngine;
namespace Nox.Platform {
[CreateAssetMenu(fileName = "UnityEditorPlatformSettings", menuName = "Nox/Database/Platform/UnityEditorPlatformSettings")]
public class UnityEditorPlatformSettings: PlatformSettings{
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 991c17f0fe58d4538bcae7b792ccf6bc