引入 UISerializationRoot 和 Item

- 完成 MenuForm 和 SelectRoleForm 的迁移
This commit is contained in:
2026-09-13 22:18:29 +08:00
parent e2fdb660ab
commit 091a29db63
101 changed files with 5281 additions and 5753 deletions
@@ -34,7 +34,7 @@ namespace SepCore.UI
private static string BuildPromptContext(InputActionId actionId)
{
if (GameEntry.InputModule == null || !GameEntry.InputModule.TryGetPrompt(actionId, out InputPrompt prompt))
if (!GameEntry.InputModule.TryGetPrompt(actionId, out InputPrompt prompt))
{
return null;
}
@@ -46,7 +46,7 @@ namespace SepCore.UI
{
if (userData != null)
{
Log.Warning("HudController.OpenUIAsync() userData type is invalid.");
Log.Error("HudController.OpenUIAsync() userData type is invalid.");
return;
}
@@ -60,11 +60,6 @@ namespace SepCore.UI
private void OnDeviceKindChanged(InputDeviceKind deviceKind)
{
if (Context == null || Form == null)
{
return;
}
Context.MovePrompt = BuildPromptContext(InputActionId.Move);
Form.RefreshMovePrompt(Context.MovePrompt);
}
@@ -51,21 +51,14 @@ namespace SepCore.UI
public void RefreshUI(HudContext hudContext)
{
RefreshMovePrompt(hudContext?.MovePrompt);
RefreshMovePrompt(hudContext.MovePrompt);
}
public void RefreshMovePrompt(string prompt)
{
bool visible = !string.IsNullOrEmpty(prompt);
if (_movePromptRoot != null)
{
_movePromptRoot.SetActive(visible);
}
if (_movePromptText != null)
{
_movePromptText.text = prompt;
}
_movePromptRoot.SetActive(visible);
_movePromptText.text = prompt;
}
#region FSM
@@ -182,8 +175,6 @@ namespace SepCore.UI
private void RefreshPerformanceStats()
{
if (_cpuTimeCostText == null) return;
bool hasCpuFrame = TryGetLastValue(_cpuTimeRecorder, out long cpuFrameNanoseconds);
if (!hasCpuFrame)