清理项目目录,引入 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
@@ -27,7 +27,7 @@ namespace SepCore.UI
protected override void RefreshUI(DisplayItemInfoForm form, DisplayItemInfoContext context)
{
form.RefreshUI(context);
form.RefreshUI(context).Forget();
}
protected override void CloseLoadedFormDirect(DisplayItemInfoForm form)
@@ -91,7 +91,7 @@ namespace SepCore.UI
return;
}
RefreshUI(context);
RefreshUI(context).Forget();
}
protected override void OnClose(bool isShutdown, object userData)
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e1f796998c8814d45993d47e84e802ec
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -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:
@@ -61,7 +61,7 @@ namespace SepCore.UI
EnsureItemCount(targetCount);
for (int i = 0; i < targetCount; i++)
{
_activeItems[i].OnInit(context.ItemContexts[i], i);
_activeItems[i].OnInit(context.ItemContexts[i], i).Forget();
}
LayoutItems();
@@ -98,7 +98,7 @@ namespace SepCore.UI
int index = _activeItems.Count;
_activeItems.Add(item);
item.OnInit(itemContext, index);
item.OnInit(itemContext, index).Forget();
item.SetIndex(index);
int columnCount = _fixedColumnCount > 0 ? _fixedColumnCount : CalculateColumnCount(GetRootWidth());