清理项目目录,引入 InputModule 做多平台输入适配

This commit is contained in:
SepComet
2026-06-16 17:09:19 +08:00
committed by basil
parent d28ccaa7f9
commit 29c4468d54
227 changed files with 16702 additions and 2059 deletions
@@ -0,0 +1,10 @@
using UnityEngine;
namespace SepCore.UI
{
public class JoystickContext : UIContext
{
public Vector2 Direction { get; set; }
public float Magnitude { get; set; }
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 52c3c2991dab492439d786507182ec4c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,48 @@
using Cysharp.Threading.Tasks;
using SepCore.Definition;
using SepCore.InputModule;
using UnityGameFramework.Runtime;
namespace SepCore.UI
{
public class JoystickController : UIControllerBase<JoystickContext, JoystickForm>
{
protected override UIFormType UIFormType => UIFormType.JoystickForm;
protected override void RefreshUI(JoystickForm form, JoystickContext context)
{
form.RefreshUI(context);
}
protected override void SubscribeCustomEvents()
{
GameEntry.InputModule.CommandTriggered += OnCommandTriggered;
}
protected override void UnsubscribeCustomEvents()
{
GameEntry.InputModule.CommandTriggered -= OnCommandTriggered;
}
public override async UniTask OpenUIAsync(object userData = null, float timeout = 30f)
{
JoystickContext context = new JoystickContext();
await OpenFormAsync(context, timeout);
}
public override void BindUseCase(IUIUseCase useCase)
{
Log.Info("JoystickController doesn't need UseCase");
}
private void OnCommandTriggered(InputCommand cmd)
{
if (cmd.ActionId != InputActionId.Move) return;
if (Context == null || Form == null) return;
Context.Direction = cmd.Vector2Value;
Context.Magnitude = cmd.Vector2Value.magnitude;
Form.RefreshUI(Context);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ea7ab1500ac7fa540b3ed92295f7687c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,25 @@
using UnityEngine;
namespace SepCore.UI
{
public class JoystickForm : UGuiForm
{
public void RefreshUI(JoystickContext context)
{
}
#region FSM
protected override void OnInit(object userData)
{
base.OnInit(userData);
}
protected override void OnClose(bool isShutdown, object userData)
{
base.OnClose(isShutdown, userData);
}
#endregion
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 62121b0e23245f14fb22e8ca418c8ddf
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: