diff --git a/Assets/Scripts/FixSystem/HeatMap/HeatMapController.cs b/Assets/Scripts/FixSystem/HeatMap/HeatMapController.cs
index f5e3cb2b0..09044dcfc 100644
--- a/Assets/Scripts/FixSystem/HeatMap/HeatMapController.cs
+++ b/Assets/Scripts/FixSystem/HeatMap/HeatMapController.cs
@@ -143,6 +143,39 @@ public class HeatMapController : MonoBehaviour
SetDataToMaterial();
}
+ ///
+ /// 热点尺寸:优先 SpriteRenderer,其次 UI Image,最后用 RectTransform 尺寸。
+ ///
+ private static bool TryGetHotspotSize(Transform t, out Vector2 size)
+ {
+ size = default;
+ if (t == null) return false;
+
+ var sr = t.GetComponent();
+ if (sr != null && sr.sprite != null)
+ {
+ var b = sr.sprite.bounds.size;
+ size = new Vector2(b.x, b.y);
+ return true;
+ }
+
+ var image = t.GetComponent();
+ if (image != null && image.sprite != null)
+ {
+ var b = image.sprite.bounds.size;
+ size = new Vector2(b.x, b.y);
+ return true;
+ }
+
+ if (t is RectTransform rt)
+ {
+ size = new Vector2(rt.rect.width, rt.rect.height);
+ return size.x > 0f || size.y > 0f;
+ }
+
+ return false;
+ }
+
public void SetDataToMaterial()
{
if (tempture == 0)
@@ -169,9 +202,18 @@ public class HeatMapController : MonoBehaviour
// }
+ if (Pos == null || heatMaterial == null)
+ return;
+
for (int i = 0; i < 7; i++)
{
- //RectTransform transform=Pos[i].GetComponent();
+ if (Pos[i] == null)
+ {
+ points[i] = Vector4.zero;
+ properties[i] = Vector4.zero;
+ continue;
+ }
+
Transform currentTransform = Pos[i].GetComponent();
if (i == 0)
@@ -188,12 +230,10 @@ public class HeatMapController : MonoBehaviour
0); // (x, y, z, temperature)
}
- Sprite currentSprite = currentTransform.GetComponent().sprite;
- properties[i] =
- new Vector4(currentSprite.bounds.size.x, currentSprite.bounds.size.y, 0.0f,
- 0.0f); // (boxsize x, boxsize y, unused, unused)
- //properties[i] = new Vector4(transform.rect.width*1, transform.rect.height*1, 0.0f, 0.0f); // (boxsize x, boxsize y, unused, unused)
- //properties[i] = new Vector4(transform.rect.width*1, transform.rect.height*1, 0.0f, 0.0f); // (boxsize x, boxsize y, unused, unused)
+ if (!TryGetHotspotSize(currentTransform, out var boxSize))
+ boxSize = Vector2.one;
+
+ properties[i] = new Vector4(boxSize.x, boxSize.y, 0.0f, 0.0f);
}
// 将数据传递给 Shader
diff --git a/Assets/Scripts/FixSystemNew/BodyModule/BodyModuleSystem.cs b/Assets/Scripts/FixSystemNew/BodyModule/BodyModuleSystem.cs
index 718965989..067cfd228 100644
--- a/Assets/Scripts/FixSystemNew/BodyModule/BodyModuleSystem.cs
+++ b/Assets/Scripts/FixSystemNew/BodyModule/BodyModuleSystem.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
@@ -180,7 +180,7 @@ namespace AibisDream.FixSystem
{
HeatValue = targetHeatValue;
- heatMapController.SetTemptureDirect(HeatValue);
+ heatMapController?.SetTemptureDirect(HeatValue);
}
public void ShowHeatMap()
diff --git a/Assets/Scripts/FixSystemNew/BodyModule/Modules/BodyModule.cs b/Assets/Scripts/FixSystemNew/BodyModule/Modules/BodyModule.cs
index 995536080..99f81bad1 100644
--- a/Assets/Scripts/FixSystemNew/BodyModule/Modules/BodyModule.cs
+++ b/Assets/Scripts/FixSystemNew/BodyModule/Modules/BodyModule.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using AibisDream.Framework;
using Newtonsoft.Json;
using UnityEngine;
@@ -24,6 +24,11 @@ namespace AibisDream.FixSystem
private Material _alarmMaterial;
private Material _originalMaterial; // 原材质
+ ///
+ /// Yarn 可能在 Start 里异步加载材质完成前就调用 ModuleHightLight,需记下来待加载后再套材质。
+ ///
+ private bool _wantsHighlight;
+
[SerializeField]
private SpriteRenderer targetSpriteRenderer; // 目标的 SpriteRenderer
@@ -93,6 +98,8 @@ namespace AibisDream.FixSystem
_alarmMaterial = alarmHandle.Result;
else
Debug.LogError("[BodyModule] Failed to load AlarmMaterial");
+
+ ApplyHighlightVisual();
}
#region 插槽功能
@@ -157,11 +164,16 @@ namespace AibisDream.FixSystem
public void Highlight(bool enable)
{
- if (targetSpriteRenderer != null && _highlightMaterial != null &&
- targetSpriteRenderer.material != _alarmMaterial)
- {
- targetSpriteRenderer.material = enable ? _highlightMaterial : _originalMaterial;
- }
+ _wantsHighlight = enable;
+ ApplyHighlightVisual();
+ }
+
+ private void ApplyHighlightVisual()
+ {
+ if (targetSpriteRenderer == null || _highlightMaterial == null) return;
+ if (_alarmMaterial != null && targetSpriteRenderer.material == _alarmMaterial) return;
+
+ targetSpriteRenderer.material = _wantsHighlight ? _highlightMaterial : _originalMaterial;
}
public void Alarm(bool enable)
diff --git a/Assets/Scripts/SceneManagement/DreamDoorSystem.cs b/Assets/Scripts/SceneManagement/DreamDoorSystem.cs
index d3ef6ad55..4214ff583 100644
--- a/Assets/Scripts/SceneManagement/DreamDoorSystem.cs
+++ b/Assets/Scripts/SceneManagement/DreamDoorSystem.cs
@@ -40,7 +40,9 @@ namespace AibisDream
[SerializeField] private float postMorphBootDelay = 0.12f;
[SerializeField] private float referenceSnapMorphProgress = 0.08f;
[SerializeField] private Vector2 referenceSnapPadding = new(0.18f, 0.18f);
+ [Tooltip("终端变形时 sceneBlackOverlay 淡入目标透明度(背景压暗)")]
[SerializeField] private float blackoutAlpha = 0.92f;
+ [Tooltip("黑场淡入时长(与终端 morph 并行)")]
[SerializeField] private float blackoutFadeInDuration = 0.08f;
[SerializeField] private float blackoutFadeOutDuration = 0.12f;
@@ -217,7 +219,13 @@ namespace AibisDream
flashOverlay.SetAlpha(0f);
if (sceneBlackOverlay != null)
+ {
+ sceneBlackOverlay.gameObject.SetActive(true);
sceneBlackOverlay.SetAlpha(0f);
+ }
+
+ if (backgroundCutDelay > 0f)
+ yield return new WaitForSeconds(backgroundCutDelay);
if (preMorphHoldDuration > 0f)
yield return new WaitForSeconds(preMorphHoldDuration);
@@ -225,11 +233,16 @@ namespace AibisDream
if (terminalUI != null)
{
float morph = 0f;
- yield return DOTween.To(() => morph, v =>
+ var morphTween = DOTween.To(() => morph, v =>
{
morph = v;
terminalUI.MorphProgress = v;
- }, 1f, 0.82f).SetEase(morphEase).WaitForCompletion();
+ }, 1f, 0.82f).SetEase(morphEase);
+
+ if (sceneBlackOverlay != null)
+ sceneBlackOverlay.DOFade(blackoutAlpha, Mathf.Max(0.01f, blackoutFadeInDuration));
+
+ yield return morphTween.WaitForCompletion();
}
ResetDoorShellScale();
diff --git a/Assets/Scripts/UI/Components/DreamTerminalUI.cs b/Assets/Scripts/UI/Components/DreamTerminalUI.cs
index dca4411a4..f80b2e7fb 100644
--- a/Assets/Scripts/UI/Components/DreamTerminalUI.cs
+++ b/Assets/Scripts/UI/Components/DreamTerminalUI.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
+using AibisDream;
using DG.Tweening;
using Shapes;
using TMPro;
@@ -761,8 +762,7 @@ namespace AibisDream.UI
}
else if (c == '\n' || c == '\r')
{
- if (_inputBuffer.Length > 0)
- EnterConfirmPhase();
+ EnterConfirmPhase();
return;
}
else if (!char.IsControl(c) && _inputBuffer.Length < maxInputLength)
@@ -784,7 +784,7 @@ namespace AibisDream.UI
private void HandleConfirmInput()
{
- if (Input.GetKeyDown(KeyCode.Y))
+ if (Input.GetKeyDown(KeyCode.Y) || Input.GetKeyDown(KeyCode.Return) || Input.GetKeyDown(KeyCode.KeypadEnter))
{
CommitPendingInputToHistory(includeConfirmPrompt: true);
_phase = TerminalPhase.EndAnimation;
@@ -812,6 +812,7 @@ namespace AibisDream.UI
yield return PlayCrashEnding();
_phase = TerminalPhase.Done;
+ DreamDoorSystem.Instance?.HideAll();
yield return new WaitForSeconds(1f);
DialogController.Instance.StartDialogNode(onCompleteNode);
}