From 4a66ba766ee294fb4fc743c6a6f7f83894d69301 Mon Sep 17 00:00:00 2001 From: bottlefish <781230111@qq.com> Date: Thu, 9 Jul 2026 12:54:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(cable):=20=E5=9B=BA=E5=AE=9A=E6=8F=92?= =?UTF-8?q?=E5=A4=B4=E4=B8=8E=E7=BA=BF=E7=BC=86=E6=8E=92=E5=BA=8F=E5=B9=B6?= =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=8B=96=E6=8B=BD=E5=88=87=E5=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- Assets/Scripts/FixSystemNew/Cable/Plug.cs | 24 +++++++++++++++---- .../Screen System/FixPanel/CablePanel.cs | 21 +++------------- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/Assets/Scripts/FixSystemNew/Cable/Plug.cs b/Assets/Scripts/FixSystemNew/Cable/Plug.cs index aa3f0c9b5..b10c21c11 100644 --- a/Assets/Scripts/FixSystemNew/Cable/Plug.cs +++ b/Assets/Scripts/FixSystemNew/Cable/Plug.cs @@ -12,8 +12,13 @@ namespace AibisDream.FixSystem { private static readonly int ShineFade = Shader.PropertyToID("_ShineFade"); - private const string SortingLayerDragging = "Tools"; - private const int SortingOrderDragging = 48; + // 插头常态排序:与线缆(Tools/47)同层且在其上,拖拽不再切层—— + // 原型里插头永远画在线之上、画序不随交互变化;整套线缆系统被外部元素 + // 遮挡时也必须整体一起被盖,不能插头浮出而线身沉底。 + // Tools 整层高于 FixTop(屏幕 UI Canvas 在 FixTop/100),Tools/48 是插头 + // 历史沿用且验证过不被面板遮挡的位置;剪线演出(Tools/50+)仍可盖住整套线缆 + private const string NormalSortingLayer = "Tools"; + private const int NormalSortingOrder = 48; #region 插头当前信息 @@ -46,6 +51,9 @@ namespace AibisDream.FixSystem InitComponentRef(); EventRegister(); _startPos = transform.position + startPosOffset; + + // 预制体里序列化的还是旧的 Tools 层,启动时归一化;收起态由 CablePanel 之后覆盖 + ApplyNormalSorting(); } private void InitComponentRef() @@ -88,6 +96,7 @@ namespace AibisDream.FixSystem public void PullUpSocket() { _sprite.enabled = true; + ApplyNormalSorting(); OnPullUpSocket?.Invoke(); } @@ -96,6 +105,14 @@ namespace AibisDream.FixSystem public void PullUpSocketSilent() { _sprite.enabled = true; + ApplyNormalSorting(); + } + + /// 恢复插头常态排序(收起态会被 CablePanel 压到线盘下方,放下时调回)。 + public void ApplyNormalSorting() + { + _sprite.sortingLayerName = NormalSortingLayer; + _sprite.sortingOrder = NormalSortingOrder; } /// 读档:无动画回到初始位。 @@ -135,8 +152,7 @@ namespace AibisDream.FixSystem if (eventData is PointerEventData { button: PointerEventData.InputButton.Right }) return; - _sprite.sortingLayerName = SortingLayerDragging; - _sprite.sortingOrder = SortingOrderDragging; + ApplyNormalSorting(); OnPlugPointerDown?.Invoke(); diff --git a/Assets/Scripts/FixSystemNew/Screen System/FixPanel/CablePanel.cs b/Assets/Scripts/FixSystemNew/Screen System/FixPanel/CablePanel.cs index c5b5c6f98..ec2d2fb30 100644 --- a/Assets/Scripts/FixSystemNew/Screen System/FixPanel/CablePanel.cs +++ b/Assets/Scripts/FixSystemNew/Screen System/FixPanel/CablePanel.cs @@ -7,9 +7,7 @@ namespace AibisDream.FixSystem { public class CablePanel : MonoBehaviour, IOperatorPanel { - private const string SortingLayerDragging = "Tools"; private const int SortingOrderRetracted = 41; - private const int CableSortingOrderDragging = 47; #region 组件索引 @@ -187,18 +185,7 @@ namespace AibisDream.FixSystem && FixSystemCenter.Director.CurrentMode == FixSceneMode.BodyModule; } - private void Update() - { - // 拖拽/插接时转盘朝拉力方向转动,闲置时缓动回正 - if (CableReelRef != null && physicCableRef != null - && physicCableRef.State != PhysicCable.CableState.Hidden) - { - bool taut = physicCableRef.State == PhysicCable.CableState.Dragging - || physicCableRef.State == PhysicCable.CableState.Plugged; - CableReelRef.UpdateRotation(taut); - } - } - + // 线盘本体不再随拉力转动(同 html:盘体静止);待美术提供独立转动图层后再挂回 private void LateUpdate() { if (suppressPlugFollow || physicCableRef == null) return; @@ -231,7 +218,6 @@ namespace AibisDream.FixSystem var isSameSocket = curSocket == socket; curSocket = socket; physicCableRef.PlugInto(socket.GetSocketPos()); - physicCableRef.RestoreDefaultSorting(); AudioManager.Instance.PlaySfx("event:/FollowInput/plugin"); if (!isSameSocket @@ -261,9 +247,9 @@ namespace AibisDream.FixSystem { if (IsPlugInSocket()) PlugRef.PullUpSocket(); - // 末端钉到拖拽目标,按需送线;指针位置随 OnDrag 持续更新 + // 末端钉到拖拽目标,按需送线;指针位置随 OnDrag 持续更新。 + // 排序不随拖拽切换:线缆与插头常驻 FixTop 高位(原型画序固定不变) physicCableRef.BeginDrag(PlugRef.transform.position); - physicCableRef.SetSorting(SortingLayerDragging, CableSortingOrderDragging); // 打开插孔 BodyModuleSystem.OpenModuleSlots(); @@ -279,7 +265,6 @@ namespace AibisDream.FixSystem public void ReleasePlug() { physicCableRef.EndDrag(); - physicCableRef.RestoreDefaultSorting(); } // ------------------------------ 系统状态 ------------------------------