From 0d40b8db147eb3c36b27c4cb46303f3ecb89c1e9 Mon Sep 17 00:00:00 2001 From: bottlefish <781230111@qq.com> Date: Sat, 25 Jul 2026 19:47:57 +0800 Subject: [PATCH] =?UTF-8?q?feat(open):=20=E6=94=AF=E6=8C=81=E6=8C=89?= =?UTF-8?q?=E8=AE=B0=E5=BF=86=E6=A8=A1=E5=9D=97=E5=88=87=E6=8D=A2=E7=94=B5?= =?UTF-8?q?=E5=87=BB=E9=97=AA=E7=83=81=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- Assets/Prefabs/ECT System.prefab | 19 ++++++-- Assets/Scenes/OpenFixScene.unity | 30 ++++++------ .../FixSystemNew/Open/OpenYarnCommand.cs | 9 ++++ .../Scripts/FixSystemNew/Open/ShockSystem.cs | 48 ++++++++++++++++++- Assets/Yarn/FP/FP_Prologue/Stage2-5_切割.yarn | 2 + Assets/Yarn/FP/FP_Prologue/Stage6_螺旋.yarn | 2 + 6 files changed, 89 insertions(+), 21 deletions(-) diff --git a/Assets/Prefabs/ECT System.prefab b/Assets/Prefabs/ECT System.prefab index 5e3fbe9ef..46220c684 100644 --- a/Assets/Prefabs/ECT System.prefab +++ b/Assets/Prefabs/ECT System.prefab @@ -257,9 +257,18 @@ MonoBehaviour: flashBackgroundSpriteRenderer: {fileID: 0} flashSpriteRenderer: {fileID: 0} flashHeadSprites: - - {fileID: 21300000, guid: ec352317d5419ee46bcd238c319ac018, type: 3} - - {fileID: 21300000, guid: 79aa88d0c51f4034d8366baa2ca3ee18, type: 3} - - {fileID: 21300000, guid: abf3d660f8e0cb14395c6a334574331e, type: 3} + - {fileID: 21300000, guid: b3b0f72c692a44eaadec079c1115ff50, type: 3} + - {fileID: 21300000, guid: f14d9b9712fc439299e1f9e5bfb83047, type: 3} + - {fileID: 21300000, guid: d5503b789eaa4a9aa3694f130149fcf3, type: 3} + flashHeadSpritesWithMemory: + - {fileID: 21300000, guid: b3b0f72c692a44eaadec079c1115ff50, type: 3} + - {fileID: 21300000, guid: f14d9b9712fc439299e1f9e5bfb83047, type: 3} + - {fileID: 21300000, guid: d5503b789eaa4a9aa3694f130149fcf3, type: 3} + flashHeadSpritesWithoutMemory: + - {fileID: 21300000, guid: e81833b6be9047b9b2ecfd34f1624f1c, type: 3} + - {fileID: 21300000, guid: 9a5ceb3b6cf14fa798142a62be294400, type: 3} + - {fileID: 21300000, guid: a4510a1a86a54952a1a3c1831c667638, type: 3} + useMemoryModuleFlashSprites: 1 spriteFlashSystem: {fileID: 0} sparkEffect1: {fileID: 126183770047723201} sparkEffect2: {fileID: 7839986575077344566} @@ -277,8 +286,8 @@ MonoBehaviour: maxSliderValue: 1 progressDecreaseDuration: 1 shockEffectNode: ShockEffect - flashDuration: 0.08 - flashInterval: 0.08 + flashDuration: 0.1 + flashInterval: 0.1 flashCount: 3 strength: 0.25 vibrate: 60 diff --git a/Assets/Scenes/OpenFixScene.unity b/Assets/Scenes/OpenFixScene.unity index 949e33abd..f987d5a13 100644 --- a/Assets/Scenes/OpenFixScene.unity +++ b/Assets/Scenes/OpenFixScene.unity @@ -20298,9 +20298,9 @@ SpriteRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 1016946085 - m_SortingLayer: 11 - m_SortingOrder: 7 + m_SortingLayerID: 467777933 + m_SortingLayer: 12 + m_SortingOrder: 200 m_Sprite: {fileID: 21300000, guid: fab06e0be9375cc4d823efa71629885c, type: 3} m_Color: {r: 0, g: 0, b: 0, a: 0.6666667} m_FlipX: 0 @@ -25138,9 +25138,9 @@ SpriteRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 1016946085 - m_SortingLayer: 11 - m_SortingOrder: 8 + m_SortingLayerID: 467777933 + m_SortingLayer: 12 + m_SortingOrder: 202 m_Sprite: {fileID: 21300000, guid: b01da57c8313bd040b2c8493173aa01b, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 @@ -25161,7 +25161,7 @@ Transform: m_GameObject: {fileID: 1954721088} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalPosition: {x: 3.6, y: 0, z: 0} m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: [] @@ -26316,9 +26316,9 @@ Transform: m_GameObject: {fileID: 2126788500} serializedVersion: 2 m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 + m_LocalPosition: {x: 3.6, y: 0, z: 0} + m_LocalScale: {x: 5.24, y: 5.24, z: 1} + m_ConstrainProportionsScale: 1 m_Children: [] m_Father: {fileID: 866752977} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -26360,15 +26360,15 @@ SpriteRenderer: m_AutoUVMaxDistance: 0.5 m_AutoUVMaxAngle: 89 m_LightmapParameters: {fileID: 0} - m_SortingLayerID: 1016946085 - m_SortingLayer: 11 - m_SortingOrder: 9 - m_Sprite: {fileID: 21300000, guid: ec352317d5419ee46bcd238c319ac018, type: 3} + m_SortingLayerID: 467777933 + m_SortingLayer: 12 + m_SortingOrder: 201 + m_Sprite: {fileID: 21300000, guid: b3b0f72c692a44eaadec079c1115ff50, type: 3} m_Color: {r: 1, g: 1, b: 1, a: 1} m_FlipX: 0 m_FlipY: 0 m_DrawMode: 0 - m_Size: {x: 17.3, y: 21.6039} + m_Size: {x: 3.84, y: 2.16} m_AdaptiveModeThreshold: 0.5 m_SpriteTileMode: 0 m_WasSpriteAssigned: 1 diff --git a/Assets/Scripts/FixSystemNew/Open/OpenYarnCommand.cs b/Assets/Scripts/FixSystemNew/Open/OpenYarnCommand.cs index 2415b2017..713fb4c04 100644 --- a/Assets/Scripts/FixSystemNew/Open/OpenYarnCommand.cs +++ b/Assets/Scripts/FixSystemNew/Open/OpenYarnCommand.cs @@ -39,6 +39,15 @@ namespace AibisDream.FixSystem yield return spriteFlashSystem.TriggerEnding(imagePath, duration); } + /// + /// 切换电击闪烁图:true=带记忆模块,false=不带(切割记忆后)。 + /// + [YarnCommand("set_shock_flash_memory")] + public static void SetShockFlashMemory(bool hasMemoryModule) + { + ShockSystem.SetUseMemoryModuleFlashSprites(hasMemoryModule); + } + [YarnCommand("start_shock")] public static IEnumerator StartShock() { diff --git a/Assets/Scripts/FixSystemNew/Open/ShockSystem.cs b/Assets/Scripts/FixSystemNew/Open/ShockSystem.cs index eadbf4033..afbb88bff 100644 --- a/Assets/Scripts/FixSystemNew/Open/ShockSystem.cs +++ b/Assets/Scripts/FixSystemNew/Open/ShockSystem.cs @@ -26,7 +26,10 @@ public class ShockSystem : MonoBehaviour, IInteraction [SerializeField] private SpriteRenderer flashHeadSpriteRenderer; // 头部闪烁精灵渲染器 [SerializeField] private SpriteRenderer flashBackgroundSpriteRenderer; // 背景闪烁精灵渲染器 [SerializeField] private SpriteRenderer flashSpriteRenderer; - [SerializeField] private List flashHeadSprites; // 头部闪烁精灵列表 + [SerializeField] private List flashHeadSprites; // 当前生效的头部闪烁精灵列表(运行时由两套资源切换) + [SerializeField] private List flashHeadSpritesWithMemory; // 切割记忆模块前:带记忆模块 + [SerializeField] private List flashHeadSpritesWithoutMemory; // 切割记忆模块后:不带记忆模块 + [SerializeField] private bool useMemoryModuleFlashSprites = true; // 是否使用带记忆模块的电击图 [SerializeField] private SpriteFlashSystem spriteFlashSystem; // Sprite闪烁系统 [SerializeField] private GameObject sparkEffect1; // 火花特效1 [SerializeField] private GameObject sparkEffect2; // 火花特效2 @@ -202,6 +205,45 @@ public class ShockSystem : MonoBehaviour, IInteraction // 确保火花效果初始状态为关闭 if (sparkEffect1 != null) sparkEffect1.SetActive(false); if (sparkEffect2 != null) sparkEffect2.SetActive(false); + + ApplyFlashHeadSpriteSet(useMemoryModuleFlashSprites); + } + + /// + /// 切换电击闪烁用的头部图集:切割记忆模块前用带模块图,切后用不带模块图。 + /// + public void SetUseMemoryModuleFlashSprites(bool useMemoryModule) + { + ApplyFlashHeadSpriteSet(useMemoryModule); + } + + private void ApplyFlashHeadSpriteSet(bool useMemoryModule) + { + useMemoryModuleFlashSprites = useMemoryModule; + var source = useMemoryModule ? flashHeadSpritesWithMemory : flashHeadSpritesWithoutMemory; + if (source != null && source.Count > 0) + { + flashHeadSprites = source; + } +#if UNITY_EDITOR + else + { + Debug.LogWarning( + $"[ShockSystem] {(useMemoryModule ? "带记忆" : "不带记忆")}电击闪烁图列表为空,仍使用当前 flashHeadSprites。", + this); + } +#endif + } + + /// + /// 按 Yarn $gameStage 同步图集:1–2 带记忆模块,≥3(已切除)不带。兼容读档。 + /// + private void SyncFlashSpritesFromYarnState() + { + var storage = YarnVariableStorage.Instance; + if (storage == null) return; + if (!storage.TryGetValue("$gameStage", out float stage)) return; + ApplyFlashHeadSpriteSet(stage < 3f); } private void Update() @@ -426,6 +468,8 @@ public class ShockSystem : MonoBehaviour, IInteraction public IEnumerator StartShock() { + SyncFlashSpritesFromYarnState(); + // 移动左右电击装置到各自的目标位置 var moveLeft = leftShockDevice.DOLocalMove(leftShockDeviceTargetPos, moveDuration); var moveRight = rightShockDevice.DOLocalMove(rightShockDeviceTargetPos, moveDuration); @@ -549,6 +593,8 @@ public class ShockSystem : MonoBehaviour, IInteraction public IEnumerator PlayFlashEffect() { + SyncFlashSpritesFromYarnState(); + if (flashSequence != null) { flashSequence.Kill(); diff --git a/Assets/Yarn/FP/FP_Prologue/Stage2-5_切割.yarn b/Assets/Yarn/FP/FP_Prologue/Stage2-5_切割.yarn index bae198672..e797d4e9d 100644 --- a/Assets/Yarn/FP/FP_Prologue/Stage2-5_切割.yarn +++ b/Assets/Yarn/FP/FP_Prologue/Stage2-5_切割.yarn @@ -112,6 +112,8 @@ gts??: 我要醒来… #line:0657c1b me: 出现异常状况。现在重新通电。 #line:0bb059f <> <> +// 记忆模块已切除:改用不带记忆模块的电击闪烁图 +<> <> === diff --git a/Assets/Yarn/FP/FP_Prologue/Stage6_螺旋.yarn b/Assets/Yarn/FP/FP_Prologue/Stage6_螺旋.yarn index f5c134b68..e76a9d52b 100644 --- a/Assets/Yarn/FP/FP_Prologue/Stage6_螺旋.yarn +++ b/Assets/Yarn/FP/FP_Prologue/Stage6_螺旋.yarn @@ -20,6 +20,8 @@ position: 906,-585 <> <> <> + // Stage6 记忆模块已切除 + <> <> <> <>