fix(ConnectionLine):修复AB两点重复连接,有多条连接线,触发重启的BUG

This commit is contained in:
2025-10-28 09:17:35 +08:00
parent 6ed134968e
commit 5e2b53a530
2 changed files with 11 additions and 1 deletions

View File

@@ -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<ConnectionLine>();
if (connectionLine != null)

View File

@@ -157,7 +157,7 @@ namespace Script.Gameplay.Player
return;
}
// 创建连接线
ConnectionLine connectionLine = ConnectionLineManager.Instance.GenerateConnectionLine(outTarget, inputTarget);
ConnectionLineManager.Instance.GenerateConnectionLine(outTarget, inputTarget);
// 重置信号目标
outTarget = null;