From 5e2b53a53033706880f14119cbe3fdc0ed212eec Mon Sep 17 00:00:00 2001 From: GanX <2423855310@qq.com> Date: Tue, 28 Oct 2025 09:17:35 +0800 Subject: [PATCH] =?UTF-8?q?fix(ConnectionLine):=E4=BF=AE=E5=A4=8DAB?= =?UTF-8?q?=E4=B8=A4=E7=82=B9=E9=87=8D=E5=A4=8D=E8=BF=9E=E6=8E=A5=EF=BC=8C?= =?UTF-8?q?=E6=9C=89=E5=A4=9A=E6=9D=A1=E8=BF=9E=E6=8E=A5=E7=BA=BF=EF=BC=8C?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E9=87=8D=E5=90=AF=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Script/Gameplay/Connect/ConnectionLineManager.cs | 10 ++++++++++ .../Script/Gameplay/Player/PlayerConnectController.cs | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Assets/Script/Gameplay/Connect/ConnectionLineManager.cs b/Assets/Script/Gameplay/Connect/ConnectionLineManager.cs index cf49f7d..464ecd7 100644 --- a/Assets/Script/Gameplay/Connect/ConnectionLineManager.cs +++ b/Assets/Script/Gameplay/Connect/ConnectionLineManager.cs @@ -26,6 +26,16 @@ namespace Script.Gameplay.Connect public ConnectionLine GenerateConnectionLine(IConnectable a, IConnectable b) { + // 先检测 a b 点是否已经存在连接线 + foreach (var aline in a.ConnectionLines) + { + if (aline.PointA.GetGameObject() == b.GetGameObject() || aline.PointB.GetGameObject() == b.GetGameObject()) + { + Debug.Log("ab点间已经存在连接线"); + return null; + } + } + GameObject lineObject = Instantiate(linePrefab, this.transform); ConnectionLine connectionLine = lineObject.GetComponent(); if (connectionLine != null) diff --git a/Assets/Script/Gameplay/Player/PlayerConnectController.cs b/Assets/Script/Gameplay/Player/PlayerConnectController.cs index ddc1602..33e5e67 100644 --- a/Assets/Script/Gameplay/Player/PlayerConnectController.cs +++ b/Assets/Script/Gameplay/Player/PlayerConnectController.cs @@ -157,7 +157,7 @@ namespace Script.Gameplay.Player return; } // 创建连接线 - ConnectionLine connectionLine = ConnectionLineManager.Instance.GenerateConnectionLine(outTarget, inputTarget); + ConnectionLineManager.Instance.GenerateConnectionLine(outTarget, inputTarget); // 重置信号目标 outTarget = null;