Merge branch 'develop' into feature/帧动画系统

This commit is contained in:
2026-07-16 20:56:53 +08:00
694 changed files with 51868 additions and 11092 deletions
+76 -19
View File
@@ -99,14 +99,14 @@ namespace AibisDream.UI
[Header("启动日志")]
[SerializeField] private List<BootLogEntry> bootSequence = new()
{
new BootLogEntry { text = "root@sys:~$ ./boot --test", style = LogStyle.Dim, delayAfter = 0.2f },
new BootLogEntry { text = "[ OK ] Test passed.", style = LogStyle.Normal, delayAfter = 0.2f },
new BootLogEntry { text = "root@sys:~$ render --target ocean && aplay sea.wav", style = LogStyle.Dim, delayAfter = 0.2f },
new BootLogEntry { text = "[ OK ] Ocean rendered. Audio stream started.", style = LogStyle.Normal, delayAfter = 0.2f },
new BootLogEntry { text = "root@sys:~$ render --stop", style = LogStyle.Dim, delayAfter = 0.2f },
new BootLogEntry { text = "[ OK ] Render pipeline closed.", style = LogStyle.Normal, delayAfter = 0.2f },
new BootLogEntry { text = "root@sys:~$ showcode", style = LogStyle.Alert, delayAfter = 0.2f },
new BootLogEntry { text = "root@sys:~$ print_string(\"海是存在的吗?\")", style = LogStyle.Highlight, delayAfter = 0.2f },
new BootLogEntry { text = "root@sys:~$ dream.render --stop --session 0742", style = LogStyle.Dim, delayAfter = 0.15f },
new BootLogEntry { text = "[ OK ] Dream renderer stopped.", style = LogStyle.Normal, delayAfter = 0.25f },
new BootLogEntry { text = "[ RAW ] Untitled_Greybox_0 exposed.", style = LogStyle.Normal, delayAfter = 0.35f },
new BootLogEntry { text = "root@sys:~$ trace --tail /log/dream_0742.rec", style = LogStyle.Dim, delayAfter = 0.15f },
new BootLogEntry { text = "[0005] audio.play(\"sea_ambient\", source=door.rear)", style = LogStyle.Dim, delayAfter = 0.1f },
new BootLogEntry { text = "[0006] memory.project(\"glass_sea\")", style = LogStyle.Dim, delayAfter = 0.1f },
new BootLogEntry { text = "[ WARN ] memory source unresolved; overflow detected.", style = LogStyle.Alert, delayAfter = 0.4f },
new BootLogEntry { text = "root@sys:~$ print_string(\"海是存在的吗?\")", style = LogStyle.Highlight, delayAfter = 0.5f },
};
#endregion
@@ -133,9 +133,9 @@ namespace AibisDream.UI
private bool _cursorVisible = true;
private Coroutine _crashSpamCoroutine;
private double _editorLastRepaintTime;
#if UNITY_EDITOR
private GUIStyle _editorPreviewLabelStyle;
#endif
private IMECompositionMode _previousImeMode = IMECompositionMode.Auto;
private bool _imeOverridden;
private bool _compositionWasActive;
// 全局 alpha(用于 DreamDoorSystem 淡入淡出)
public float Alpha { get; set; } = 0f;
@@ -180,6 +180,7 @@ namespace AibisDream.UI
#endif
base.OnDisable();
_phase = TerminalPhase.Idle;
RestoreImeMode();
StopAllCoroutines();
}
@@ -229,12 +230,14 @@ namespace AibisDream.UI
public void ForceEnd()
{
StopAllCoroutines();
RestoreImeMode();
_phase = TerminalPhase.Done;
}
public void ResetVisualState()
{
StopAllCoroutines();
RestoreImeMode();
_phase = TerminalPhase.Idle;
_lines.Clear();
_lineColors.Clear();
@@ -570,11 +573,11 @@ namespace AibisDream.UI
});
}
if (_phase == TerminalPhase.WaitingInput && _inputBuffer.Length > 0)
if (_phase == TerminalPhase.WaitingInput)
{
rows.Add(new RenderRow
{
text = ">> Press Enter to submit",
text = ">> TYPE ANSWER | ENTER = CONFIRM",
color = colAmberDim,
showCursor = false
});
@@ -584,7 +587,7 @@ namespace AibisDream.UI
{
rows.Add(new RenderRow
{
text = ">> Submit? (Y/N)",
text = ">> Submit? [Y/Enter = YES | N = EDIT]",
color = colWhiteGlow,
showCursor = false
});
@@ -608,12 +611,15 @@ namespace AibisDream.UI
AddLine(GetInputDisplayText(), colWhiteGlow);
if (includeConfirmPrompt)
AddLine(">> Submit? (Y/N)", colWhiteGlow);
AddLine(">> Submit? [Y/Enter = YES | N = EDIT]", colWhiteGlow);
}
private string GetInputDisplayText()
{
return promptString + _inputBuffer;
string composition = Application.isPlaying && _phase == TerminalPhase.WaitingInput
? Input.compositionString
: string.Empty;
return promptString + _inputBuffer + composition;
}
private void DrawContinuousLine(Vector3 start, Vector3 end, Color color, float thickness, float noiseSeed)
@@ -775,28 +781,75 @@ namespace AibisDream.UI
{
_phase = TerminalPhase.WaitingInput;
_inputBuffer = "";
_compositionWasActive = false;
OverrideImeMode(IMECompositionMode.On);
StartCursorBlink();
}
private void HandleTypingInput()
{
string compositionBeforeInput = Input.compositionString;
bool compositionHandledEnter = _compositionWasActive || !string.IsNullOrEmpty(compositionBeforeInput);
bool enterSeen = false;
bool backspaceSeen = false;
foreach (char c in Input.inputString)
{
if (c == '\b')
{
backspaceSeen = true;
if (_inputBuffer.Length > 0)
_inputBuffer = _inputBuffer[..^1];
}
else if (c == '\n' || c == '\r')
{
EnterConfirmPhase();
return;
enterSeen = true;
}
else if (!char.IsControl(c) && _inputBuffer.Length < maxInputLength)
{
_inputBuffer += c;
}
}
if (!backspaceSeen && Input.GetKeyDown(KeyCode.Backspace) && string.IsNullOrEmpty(Input.compositionString))
{
if (_inputBuffer.Length > 0)
_inputBuffer = _inputBuffer[..^1];
}
// inputString 在部分输入法/键盘布局下收不到回车,用 GetKeyDown 兜底
if (!enterSeen && (Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter)))
enterSeen = true;
string compositionAfterInput = Input.compositionString;
compositionHandledEnter |= !string.IsNullOrEmpty(compositionAfterInput);
_compositionWasActive = !string.IsNullOrEmpty(compositionAfterInput);
if (enterSeen && !compositionHandledEnter && _inputBuffer.Length > 0)
EnterConfirmPhase();
}
/// <summary>
/// 保存玩家原输入法状态,并按终端当前阶段切换 IME。
/// </summary>
private void OverrideImeMode(IMECompositionMode mode)
{
if (!_imeOverridden)
{
_previousImeMode = Input.imeCompositionMode;
_imeOverridden = true;
}
Input.imeCompositionMode = mode;
Input.compositionCursorPos = new Vector2(Screen.width * 0.5f, Screen.height * 0.62f);
}
private void RestoreImeMode()
{
if (!_imeOverridden) return;
Input.imeCompositionMode = _previousImeMode;
_imeOverridden = false;
_compositionWasActive = false;
}
#endregion
@@ -806,6 +859,8 @@ namespace AibisDream.UI
private void EnterConfirmPhase()
{
_phase = TerminalPhase.Confirming;
OverrideImeMode(IMECompositionMode.Off);
_compositionWasActive = false;
StopCursorBlink();
}
@@ -820,6 +875,7 @@ namespace AibisDream.UI
else if (Input.GetKeyDown(KeyCode.N))
{
_phase = TerminalPhase.WaitingInput;
OverrideImeMode(IMECompositionMode.On);
StartCursorBlink();
}
}
@@ -830,7 +886,8 @@ namespace AibisDream.UI
private IEnumerator HandleSubmission(string input)
{
string val = input.Trim().ToLower();
RestoreImeMode();
string val = input.Trim().ToLowerInvariant();
bool isFalse = val is "false" or "0" or "no" or "不存在";
if (isFalse)