fix(bodymodule): 切割入场同步全部模块CutText

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-21 17:42:58 +08:00
co-authored by Cursor
parent 7a8f7dbbd7
commit 597e97c5d7
4 changed files with 33 additions and 7 deletions
@@ -343,6 +343,21 @@ namespace AibisDream.FixSystem
_moduleState = moduleState;
}
/// <summary>
/// 进入切割特写时,按各模块当前 ModuleCondition 同步所有模块的 CutText 亮灭,
/// 保证特写里每个模块文字都与舱外一致——而不只是被切割的目标模块。
/// </summary>
public void SyncAllCutTextsFromCondition()
{
if (BodyModules == null) return;
foreach (var module in BodyModules)
{
if (module != null)
module.ApplyCutTextFromCondition();
}
}
/// <summary>
/// 从模块中清除
/// </summary>
@@ -49,6 +49,11 @@ namespace AibisDream.FixSystem
public bool IsConfigured => modulePicRenderer != null && moduleTextRenderer != null;
/// <summary>
/// 文字当前的亮/灭状态(含 Damaged 闪烁中的瞬时相位),供切割视图入场时对齐。
/// </summary>
public bool IsTextCurrentlyVisible => moduleTextRenderer != null && moduleTextRenderer.enabled;
private void Awake()
{
Initialize();
@@ -245,6 +245,10 @@ namespace AibisDream.FixSystem
/// </summary>
public void ApplyCutTextFromCondition()
{
// 没有独立 CutText 的模块(如无特写文字的模块)直接跳过,避免起无效闪烁协程。
if (_cutTextRenderer == null)
return;
StopCutTextFlicker(restoreVisible: false);
switch (condition)
@@ -253,7 +257,9 @@ namespace AibisDream.FixSystem
SetCutTextVisible(true);
break;
case ModuleCondition.Damaged:
SetCutTextVisible(true);
// 与舱外文字当前的瞬时亮灭相位对齐,而非固定为常亮,避免入场瞬间闪烁不同步
bool currentlyVisible = conditionVisual == null || conditionVisual.IsTextCurrentlyVisible;
SetCutTextVisible(currentlyVisible);
StartCutTextFlicker();
break;
case ModuleCondition.PoweredOff:
@@ -32,9 +32,9 @@ namespace AibisDream.FixSystem
bodyModule.GetCutSpriteRenderer().color = new Color(1f, 1f, 1f, 1f);
bodyModule.GetCutSpriteRenderer().GetComponentInChildren<SpriteRenderer>().color =
new Color(1f, 1f, 1f, 1f);
// 相机切入前先对齐 CutText,避免过渡期间亮灭与舱外不一致
bodyModule.ApplyCutTextFromCondition();
}
// 相机切入前对齐所有模块的 CutText(不只是目标模块),避免特写里其它模块文字亮灭与舱外不一致
bodyModuleSystem.SyncAllCutTextsFromCondition();
yield return CameraKit.Instance.SwitchCamera(CameraEnum.CutEmo);
yield return UIManager.Instance.GetPanel<ScreenTransitionPanel>().FadeInAsync(0.1f);
@@ -79,9 +79,9 @@ namespace AibisDream.FixSystem
bodyModule.GetCutSpriteRenderer().color = new Color(1f, 1f, 1f, 1f);
bodyModule.GetCutSpriteRenderer().GetComponentInChildren<SpriteRenderer>().color =
new Color(1f, 1f, 1f, 1f);
// 相机切入前先对齐 CutText,避免过渡期间亮灭与舱外不一致
bodyModule.ApplyCutTextFromCondition();
}
// 相机切入前对齐所有模块的 CutText(不只是目标模块),避免特写里其它模块文字亮灭与舱外不一致
bodyModuleSystem.SyncAllCutTextsFromCondition();
yield return CameraKit.Instance.SwitchCamera(CameraEnum.CutMemory);
yield return UIManager.Instance.GetPanel<ScreenTransitionPanel>().FadeInAsync(0.1f);
@@ -125,9 +125,9 @@ namespace AibisDream.FixSystem
bodyModule.GetCutSpriteRenderer().color = new Color(1f, 1f, 1f, 1f);
bodyModule.GetCutSpriteRenderer().GetComponentInChildren<SpriteRenderer>().color =
new Color(1f, 1f, 1f, 1f);
// 相机切入前先对齐 CutText,避免过渡期间亮灭与舱外不一致
bodyModule.ApplyCutTextFromCondition();
}
// 相机切入前对齐所有模块的 CutText(不只是目标模块),避免特写里其它模块文字亮灭与舱外不一致
bodyModuleSystem.SyncAllCutTextsFromCondition();
yield return CameraKit.Instance.SwitchCamera(CameraEnum.CutLogic);
yield return UIManager.Instance.GetPanel<ScreenTransitionPanel>().FadeInAsync(0.1f);