清理项目目录,引入 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,79 @@
using System.Collections.Generic;
namespace SepCore.InputModule
{
public sealed class InputContextStack
{
private readonly List<InputContextId> _contexts = new List<InputContextId>();
public int Count => _contexts.Count;
public InputContextId Current => Count > 0 ? _contexts[Count - 1] : InputContextId.None;
public IReadOnlyList<InputContextId> Items => _contexts;
public bool Push(InputContextId context)
{
if (!IsStackable(context) || Current == context)
{
return false;
}
if (_contexts.Contains(context))
{
_contexts.Remove(context);
}
_contexts.Add(context);
return true;
}
public bool Pop(out InputContextId context)
{
if (Count == 0)
{
context = InputContextId.None;
return false;
}
int index = Count - 1;
context = _contexts[index];
_contexts.RemoveAt(index);
return true;
}
public bool Set(InputContextId context)
{
if (!IsStackable(context))
{
return Clear();
}
if (Count == 1 && Current == context)
{
return false;
}
_contexts.Clear();
_contexts.Add(context);
return true;
}
public bool Clear()
{
if (Count == 0)
{
return false;
}
_contexts.Clear();
return true;
}
private static bool IsStackable(InputContextId context)
{
return context != InputContextId.None && context != InputContextId.Global;
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 3164a25880fece946b5acf0d3d6bf006
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: