fix(cable): 固定插头与线缆排序并移除拖拽切层
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
/// <summary>恢复插头常态排序(收起态会被 CablePanel 压到线盘下方,放下时调回)。</summary>
|
||||
public void ApplyNormalSorting()
|
||||
{
|
||||
_sprite.sortingLayerName = NormalSortingLayer;
|
||||
_sprite.sortingOrder = NormalSortingOrder;
|
||||
}
|
||||
|
||||
/// <summary>读档:无动画回到初始位。</summary>
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
// ------------------------------ 系统状态 ------------------------------
|
||||
|
||||
Reference in New Issue
Block a user