diff --git a/Assets/Prefabs/FixSystemPrefabs/维修面板.prefab b/Assets/Prefabs/FixSystemPrefabs/维修面板.prefab index b8a9cb45b..f9665829b 100644 --- a/Assets/Prefabs/FixSystemPrefabs/维修面板.prefab +++ b/Assets/Prefabs/FixSystemPrefabs/维修面板.prefab @@ -283,19 +283,16 @@ MonoBehaviour: cableMaterial: {fileID: 0} sortingLayerName: Tools sortingOrder: 47 - shadowColor: {r: 0.05, g: 0.05, b: 0.07, a: 0.2} - shadowWidth: 0.295 - shadowDrop: 0.12 - darkColor: {r: 0.012, g: 0.055, b: 0.095, a: 1} - darkWidth: 0.33 - bodyColor: {r: 0.025, g: 0.135, b: 0.195, a: 1} + darkColor: {r: 0.032, g: 0.085, b: 0.155, a: 1} + darkWidth: 0.32 + bodyColor: {r: 0, g: 0.2, b: 0.373, a: 1} bodyWidth: 0.26 - midColor: {r: 0.08, g: 0.25, b: 0.29, a: 1} - midWidth: 0.115 - midLift: 0.036 - highlightColor: {r: 0.16, g: 0.31, b: 0.32, a: 1} - highlightWidth: 0.045 - highlightLift: 0.065 + midColor: {r: 0.038, g: 0.238, b: 0.345, a: 1} + midWidth: 0.082 + midLift: 0.015 + highlightColor: {r: 0.056, g: 0.248, b: 0.298, a: 1} + highlightWidth: 0.02 + highlightLift: 0.015 tipTaperFraction: 0.08 tipTaperScale: 0.72 overlapMargin: 0.1 diff --git a/Assets/Scripts/FixSystemNew/BodyModule/BodyModuleSystem.cs b/Assets/Scripts/FixSystemNew/BodyModule/BodyModuleSystem.cs index ee0a0c6cb..4239c4aba 100644 --- a/Assets/Scripts/FixSystemNew/BodyModule/BodyModuleSystem.cs +++ b/Assets/Scripts/FixSystemNew/BodyModule/BodyModuleSystem.cs @@ -285,7 +285,8 @@ namespace AibisDream.FixSystem { heatMapController.ShowHeatMap(); DisableSystem(); - FixPanelSystem.GetRepairPanel().ResetPlug(); + // 散热期间收起插头,避免插线状态与热力图交互冲突 + FixPanelSystem.GetRepairPanel().PullUpCable(); } public void HideHeatMap() diff --git a/Assets/Scripts/FixSystemNew/BodyModule/CableReel.cs b/Assets/Scripts/FixSystemNew/BodyModule/CableReel.cs index b333243fc..8e771ee6e 100644 --- a/Assets/Scripts/FixSystemNew/BodyModule/CableReel.cs +++ b/Assets/Scripts/FixSystemNew/BodyModule/CableReel.cs @@ -7,6 +7,8 @@ namespace AibisDream.FixSystem [Header("转盘设置")] [SerializeField] private float torqueStrength = 200f; // 扭矩强度 [SerializeField] private float angularDamping = 5f; // 角速度阻尼 + [SerializeField] private float maxHalfAngle = 60f; // 单侧最大转角(总范围约 2× 此值 ≈ 120°) + [SerializeField] private float returnSpeed = 4f; // 闲置回正速度 private CablePanel cablePanel; private float angularVelocity; // 角速度 @@ -61,42 +63,48 @@ namespace AibisDream.FixSystem } /// 拖拽/插接中朝拉力方向施加扭矩;闲置时缓动回正。 - public void UpdateRotation(bool active) + public void UpdateRotation(bool active, float tautness = 1f) { if (cablePanel == null || cablePanel.PlugRef == null) return; if (!active) { angularVelocity = 0f; - currentAngle = Mathf.LerpAngle(currentAngle, 0f, 4f * Time.deltaTime); - transform.rotation = Quaternion.Euler(0, 0, currentAngle); - UpdateOutletPosition(); + currentAngle = Mathf.LerpAngle(currentAngle, 0f, returnSpeed * Time.deltaTime); + ApplyRotation(); + return; + } + + // 线缆还有余量时不驱动转盘,避免"还没拉紧就先转" + if (tautness <= 0f) + { + angularVelocity *= Mathf.Exp(-angularDamping * Time.deltaTime); + ApplyRotation(); return; } Vector2 center = transform.position; - - // 使用当前出线口位置 Vector2 outlet = outletPos; - - // 力向量(线缆拉力方向) Vector2 force = (Vector2)cablePanel.PlugRef.transform.position - outlet; - - // 杆臂向量(力作用点相对于圆心的位置) Vector2 r = outlet - center; - - // 计算 2D 扭矩:r × F - float torque = (r.x * force.y - r.y * force.x); - - // 应用扭矩 + 阻尼 + + float torque = (r.x * force.y - r.y * force.x) * tautness; + angularVelocity += torque * torqueStrength * Time.deltaTime; - angularVelocity *= Mathf.Exp(-angularDamping * Time.deltaTime); // 简易阻尼 - - // 应用旋转 + angularVelocity *= Mathf.Exp(-angularDamping * Time.deltaTime); + currentAngle += angularVelocity * Time.deltaTime; + currentAngle = Mathf.Clamp(currentAngle, -maxHalfAngle, maxHalfAngle); + + if (currentAngle <= -maxHalfAngle && angularVelocity < 0f) angularVelocity = 0f; + if (currentAngle >= maxHalfAngle && angularVelocity > 0f) angularVelocity = 0f; + + ApplyRotation(); + } + + private void ApplyRotation() + { transform.rotation = Quaternion.Euler(0, 0, currentAngle); - - // 更新出线口位置 UpdateOutletPosition(); } } diff --git a/Assets/Scripts/FixSystemNew/Cable/PhysicCable.cs b/Assets/Scripts/FixSystemNew/Cable/PhysicCable.cs index 4ca8d977a..eed2730c7 100644 --- a/Assets/Scripts/FixSystemNew/Cable/PhysicCable.cs +++ b/Assets/Scripts/FixSystemNew/Cable/PhysicCable.cs @@ -68,19 +68,17 @@ public class PhysicCable : MonoBehaviour [SerializeField] private string sortingLayerName = "Tools"; [SerializeField] private int sortingOrder = 47; // 7/7 PixelCableLine step 色阶: Edge → Band Dark → Band Light - [SerializeField] private Color shadowColor = new(0f, 0.08f, 0.16f, 0.22f); - [SerializeField] private float shadowWidth = 0.295f; - [SerializeField] private float shadowDrop = 0.12f; // 原型:向下平移 7px - [SerializeField] private Color darkColor = new(0.012f, 0.055f, 0.095f, 1f); // Edge Outline - [SerializeField] private float darkWidth = 0.33f; // 原型:w+4 - [SerializeField] private Color bodyColor = new(0.025f, 0.135f, 0.195f, 1f); // Band Dark - [SerializeField] private float bodyWidth = 0.26f; // 原型:w=15px ≈ 0.26wu - [SerializeField] private Color midColor = new(0.08f, 0.25f, 0.29f, 1f); // Band Light - [SerializeField] private float midWidth = 0.115f; // 中亮切面,保持硬边色阶 - [SerializeField] private float midLift = 0.036f; // 原型:上移 0.14w - [SerializeField] private Color highlightColor = new(0.16f, 0.31f, 0.32f, 1f); // Narrow Top Light - [SerializeField] private float highlightWidth = 0.045f; - [SerializeField] private float highlightLift = 0.065f; + // 体色 #00335f;暗部微偏红、亮部微偏黄(贴近 PS 暖调体积),高光约 75% 强度 + [SerializeField] private Color darkColor = new(0.032f, 0.085f, 0.155f, 1f); // 暗面偏暖红 + [SerializeField] private float darkWidth = 0.32f; + [SerializeField] private Color bodyColor = new(0f, 0.2f, 0.373f, 1f); // #00335f + [SerializeField] private float bodyWidth = 0.26f; + [SerializeField] private Color midColor = new(0.038f, 0.238f, 0.345f, 1f); // 中间调微偏黄 + [SerializeField] private float midWidth = 0.082f; + [SerializeField] private float midLift = 0.015f; + [SerializeField] private Color highlightColor = new(0.056f, 0.248f, 0.298f, 1f); // ≈75% 叠在 mid 上的暖高光 + [SerializeField] private float highlightWidth = 0.02f; + [SerializeField] private float highlightLift = 0.015f; [Header("端部收窄(默认关闭:整根线宽与插头/孔匹配)")] [SerializeField, Range(0f, 0.3f)] private float tipTaperFraction = 0f; // 末端收窄段占全长比例,0 关闭 @@ -98,6 +96,18 @@ public class PhysicCable : MonoBehaviour public float CurrentLength => _length; + /// 0=完全松弛,1=绷直。线盘只在真正拉紧后才应转动。 + public float GetTautness(float slackMargin = 0.35f) + { + if (State != CableState.Dragging && State != CableState.Plugged) return 0f; + if (_pts == null || startTransform == null) return 0f; + + float straightDist = Vector3.Distance(startTransform.position, FlattenZ(EndPosition)); + float slack = _length - straightDist; + if (slack >= slackMargin) return 0f; + return 1f - Mathf.Clamp01(slack / slackMargin); + } + private struct Particle { public Vector3 pos; @@ -776,7 +786,6 @@ public class PhysicCable : MonoBehaviour // 提交顺序即画序(后画的盖前画的);硬边四档色阶保留平滑轮廓,只强化高清像素感 return new[] { - new CableMeshRenderer.Band(shadowColor, shadowWidth, -shadowDrop, skipInTail: true), new CableMeshRenderer.Band(darkColor, darkWidth, 0f), new CableMeshRenderer.Band(bodyColor, bodyWidth, 0f), new CableMeshRenderer.Band(midColor, midWidth, midLift), diff --git a/Assets/Scripts/FixSystemNew/Screen System/FixPanel/CablePanel.cs b/Assets/Scripts/FixSystemNew/Screen System/FixPanel/CablePanel.cs index 67c850539..cd598e842 100644 --- a/Assets/Scripts/FixSystemNew/Screen System/FixPanel/CablePanel.cs +++ b/Assets/Scripts/FixSystemNew/Screen System/FixPanel/CablePanel.cs @@ -186,7 +186,19 @@ namespace AibisDream.FixSystem && FixSystemCenter.Director.CurrentMode == FixSceneMode.BodyModule; } - // 线盘本体不再随拉力转动(同 html:盘体静止);待美术提供独立转动图层后再挂回 + private void Update() + { + // 拖拽/插接时转盘朝拉力方向转动,闲置时缓动回正 + if (CableReelRef != null && physicCableRef != null + && physicCableRef.State != PhysicCable.CableState.Hidden) + { + bool active = physicCableRef.State == PhysicCable.CableState.Dragging + || physicCableRef.State == PhysicCable.CableState.Plugged; + float tautness = active ? physicCableRef.GetTautness() : 0f; + CableReelRef.UpdateRotation(active, tautness); + } + } + private void LateUpdate() { if (suppressPlugFollow || physicCableRef == null) return;