提交优化连线功能

This commit is contained in:
lujiajian 2025-11-27 16:57:15 +08:00
parent b67ea980a3
commit 52a65d42ab
19 changed files with 7986 additions and 2121 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9bf3d06a6cbb5274ea7d510fc3976db4
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,86 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4876145980168852962
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4405293386849165131}
- component: {fileID: 9003817468447510240}
- component: {fileID: 1943132296857660741}
m_Layer: 0
m_Name: chatou_black
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4405293386849165131
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4876145980168852962}
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 10.413016, y: 0.03366661, z: -3.0453572}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &9003817468447510240
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4876145980168852962}
m_Mesh: {fileID: -5068107600471147975, guid: db6a5a541221af949b28431ba95977c1, type: 3}
--- !u!23 &1943132296857660741
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4876145980168852962}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 7ab0b1d68e7598f4ea678dbe0f41f115, type: 2}
- {fileID: 2100000, guid: ef389274d66a92c4e92a2ec2f2452885, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 64b716a1d2be8cc48a6a22d6e44d5681
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,100 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &9215586912333653583
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7256217081674647743}
- component: {fileID: 788431060368910837}
- component: {fileID: 7854985420201316895}
- component: {fileID: 7115559409462537049}
m_Layer: 0
m_Name: chatou_green
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7256217081674647743
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9215586912333653583}
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 8.555387, y: 1.4372082, z: -2.877256}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &788431060368910837
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9215586912333653583}
m_Mesh: {fileID: -5739990180367190424, guid: db6a5a541221af949b28431ba95977c1, type: 3}
--- !u!23 &7854985420201316895
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9215586912333653583}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 7ab0b1d68e7598f4ea678dbe0f41f115, type: 2}
- {fileID: 2100000, guid: 60de1ea540cb9d0488799f6838e98c54, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!65 &7115559409462537049
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9215586912333653583}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 0.5912819, y: 1.0420685, z: 2.5101469}
m_Center: {x: 0, y: 0.0000038146973, z: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: d078ca4e433c6f045bccc0dd9acb4fd8
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,86 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4896413350699486543
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2338269300094910341}
- component: {fileID: 1694125729474289721}
- component: {fileID: 6947822706064961827}
m_Layer: 0
m_Name: chatou_red
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2338269300094910341
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4896413350699486543}
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 12.310012, y: -1.451746, z: -3.289691}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &1694125729474289721
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4896413350699486543}
m_Mesh: {fileID: 626106108065951344, guid: db6a5a541221af949b28431ba95977c1, type: 3}
--- !u!23 &6947822706064961827
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4896413350699486543}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 7ab0b1d68e7598f4ea678dbe0f41f115, type: 2}
- {fileID: 2100000, guid: 5d584feac28e6794b9baef26ba2e2840, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 7cf157f3f6e1d5b42bd77332071758c5
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,86 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &4550299753966931929
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 371850445114960997}
- component: {fileID: 5226633491984867799}
- component: {fileID: 7108057574260589766}
m_Layer: 0
m_Name: chatou_yellow
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &371850445114960997
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4550299753966931929}
m_LocalRotation: {x: 0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0.6076169, y: -0.20281029, z: -1.743763}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &5226633491984867799
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4550299753966931929}
m_Mesh: {fileID: 2685499888173787047, guid: db6a5a541221af949b28431ba95977c1, type: 3}
--- !u!23 &7108057574260589766
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4550299753966931929}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 7ab0b1d68e7598f4ea678dbe0f41f115, type: 2}
- {fileID: 2100000, guid: 0c0f05601b68b0d47aa19ab02889caec, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 1e66ff67ba91b7a48ae5e10e030256b4
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -49,7 +49,7 @@ public class LineConnect : MonoBehaviour
public InterfaceType interfaceType = InterfaceType.None;
private void OnMouseDown()
{
LineManager.instance.ClickPoint(transform);
//LineManager.instance.ClickPoint(transform);
}
private void Update()

View File

@ -1,9 +1,10 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using UnityEngine;
using UnityEngine.UIElements;
// 可序列化的连线数据
[System.Serializable]
@ -136,6 +137,17 @@ public class WireDataPersistence : MonoBehaviour
{
ShowDebugInfo();
}
// 新增:堆叠系统验证快捷键
if (Input.GetKeyDown(KeyCode.F12))
{
Debug.Log("验证堆叠系统");
ValidateStackingSystem();
}
if (Input.GetKeyDown(KeyCode.F10))
{
TestStackingLimit("chudian218");
}
}
/// <summary>
@ -360,7 +372,6 @@ public class WireDataPersistence : MonoBehaviour
Debug.LogError($"WireDataPersistence: 保存数据失败: {e.Message}\n{e.StackTrace}");
}
}
/// <summary>
/// 从文件加载连线数据
/// </summary>
@ -440,13 +451,15 @@ public class WireDataPersistence : MonoBehaviour
// 更新连线计数
lastWireCount = GetCurrentWireCount();
// 新增:验证堆叠系统
ValidateStackingSystem();
}
catch (System.Exception e)
{
Debug.LogError($"WireDataPersistence: 加载数据失败: {e.Message}\n{e.StackTrace}");
}
}
/// <summary>
/// 手动清除连线(备用方法)
/// </summary>
@ -506,6 +519,17 @@ public class WireDataPersistence : MonoBehaviour
GameObject startInterface = FindInterfaceByName(wireData.startInterfaceName);
GameObject endInterface = FindInterfaceByName(wireData.endInterfaceName);
// 如果接口不存在记录警告但继续重建使用null接口
if (startInterface == null && !string.IsNullOrEmpty(wireData.startInterfaceName))
{
Debug.LogWarning($"无法找到起点接口: {wireData.startInterfaceName},将创建无接口连接");
}
if (endInterface == null && !string.IsNullOrEmpty(wireData.endInterfaceName))
{
Debug.LogWarning($"无法找到终点接口: {wireData.endInterfaceName},将创建无接口连接");
}
if (debugMode)
{
Debug.Log($"起点接口: {wireData.startInterfaceName} -> {startInterface != null}");
@ -529,7 +553,6 @@ public class WireDataPersistence : MonoBehaviour
return false;
}
}
/// <summary>
/// 重建圆柱体连线 - 使用保存的圆柱体数据
/// </summary>
@ -542,26 +565,39 @@ public class WireDataPersistence : MonoBehaviour
// 创建连线对象
GameObject wireObject = new GameObject(wireData.wireName);
// 添加 CylinderWireData 组件并设置数据
// 首先创建连接点,因为 CylinderWireData 可能需要引用它们
List<GameObject> connectionPoints = CreateConnectionPointsForWire(wireObject, wireData, startInterface, endInterface);
// 添加 CylinderWireData 组件
CylinderWireData cylinderData = wireObject.AddComponent<CylinderWireData>();
// 使用反射设置 CylinderWireData 的所有字段
SetCylinderWireDataFields(cylinderData, wireData, startInterface, endInterface);
// 使用保存的连接点对象(如果有的话)
GameObject startConnectionPoint = connectionPoints.Find(p => p.name.Contains("Start"));
GameObject endConnectionPoint = connectionPoints.Find(p => p.name.Contains("End"));
// 创建圆柱体视觉表现 - 使用保存的圆柱体数据
CreateCylinderVisual(wireObject, wireData);
// 创建连接点
CreateConnectionPointsForWire(wireObject, wireData, startInterface, endInterface);
// 使用反射设置 CylinderWireData 的所有字段
SetCylinderWireDataFields(cylinderData, wireData, startInterface, endInterface);
// 特别设置连接点引用(如果 CylinderWireData 需要它们)
SetConnectionPointReferences(cylinderData, startConnectionPoint, endConnectionPoint);
// 添加到连线系统
AddWireToSystem(wireObject, wireData, startInterface, endInterface);
// 注册连接点到堆叠系统
RegisterConnectionPointsToStackSystem(wireObject, startInterface, endInterface);
if (debugMode)
{
Debug.Log($"WireDataPersistence: 成功重建圆柱体连线: {wireData.wireName}");
Debug.Log($"圆柱体缩放: {wireData.cylinderScale}, 位置: {wireData.cylinderPosition}");
Debug.Log($"连线颜色: {wireData.hasCustomColor}");
// 验证 CylinderWireData 字段是否设置正确
ValidateCylinderWireData(cylinderData);
}
return true;
}
@ -573,7 +609,281 @@ public class WireDataPersistence : MonoBehaviour
}
/// <summary>
/// 使用反射设置 CylinderWireData 的所有字段
/// 设置连接点引用
/// </summary>
private void SetConnectionPointReferences(CylinderWireData cylinderData, GameObject startPoint, GameObject endPoint)
{
try
{
FieldInfo[] fields = typeof(CylinderWireData).GetFields(BindingFlags.Public | BindingFlags.Instance);
foreach (FieldInfo field in fields)
{
try
{
if (field.FieldType == typeof(GameObject))
{
if (field.Name.ToLower().Contains("start") && field.Name.ToLower().Contains("point"))
{
field.SetValue(cylinderData, startPoint);
if (debugMode) Debug.Log($"设置起点连接点引用: {startPoint?.name ?? "null"}");
}
else if (field.Name.ToLower().Contains("end") && field.Name.ToLower().Contains("point"))
{
field.SetValue(cylinderData, endPoint);
if (debugMode) Debug.Log($"设置终点连接点引用: {endPoint?.name ?? "null"}");
}
}
}
catch (System.Exception e)
{
Debug.LogWarning($"设置连接点引用 {field.Name} 失败: {e.Message}");
}
}
}
catch (System.Exception e)
{
Debug.LogError($"设置连接点引用失败: {e.Message}");
}
}
/// <summary>
/// 验证 CylinderWireData 字段设置
/// </summary>
private void ValidateCylinderWireData(CylinderWireData cylinderData)
{
try
{
FieldInfo[] fields = typeof(CylinderWireData).GetFields(BindingFlags.Public | BindingFlags.Instance);
Debug.Log("=== CylinderWireData 字段验证 ===");
foreach (FieldInfo field in fields)
{
object value = field.GetValue(cylinderData);
Debug.Log($"{field.Name}: {value ?? "null"} (类型: {field.FieldType})");
}
Debug.Log("=== 验证结束 ===");
}
catch (System.Exception e)
{
Debug.LogError($"验证 CylinderWireData 失败: {e.Message}");
}
}
/// <summary>
/// 注册连接点到堆叠系统 - 增强版
/// </summary>
private void RegisterConnectionPointsToStackSystem(GameObject wireObject, GameObject startInterface, GameObject endInterface)
{
try
{
if (wireSystem == null)
{
if (debugMode) Debug.LogWarning("WireSystem 为 null无法注册连接点到堆叠系统");
return;
}
// 获取 WireDrawingSystem 中的 interfaceStacks 字典
var interfaceStacksField = typeof(WireDrawingSystem).GetField("interfaceStacks",
BindingFlags.NonPublic | BindingFlags.Instance);
if (interfaceStacksField == null)
{
if (debugMode) Debug.LogWarning("无法找到 interfaceStacks 字段");
return;
}
var interfaceStacks = (Dictionary<string, List<GameObject>>)interfaceStacksField.GetValue(wireSystem);
// 获取 allConnectionPoints 列表
var allConnectionPointsField = typeof(WireDrawingSystem).GetField("allConnectionPoints",
BindingFlags.NonPublic | BindingFlags.Instance);
List<GameObject> allConnectionPoints = null;
if (allConnectionPointsField != null)
{
allConnectionPoints = (List<GameObject>)allConnectionPointsField.GetValue(wireSystem);
}
// 查找连线对象下的连接点并注册
int registeredCount = 0;
foreach (Transform child in wireObject.transform)
{
if (child.name.StartsWith("ConnectionPoint_Start"))
{
// 只有当起点接口存在时才注册到堆叠系统
if (startInterface != null)
{
RegisterConnectionPointWithInterface(interfaceStacks, child.gameObject, startInterface);
// 同时添加到 allConnectionPoints 列表
if (allConnectionPoints != null && !allConnectionPoints.Contains(child.gameObject))
{
allConnectionPoints.Add(child.gameObject);
}
registeredCount++;
}
else if (debugMode)
{
Debug.Log($"起点接口为 null跳过堆叠注册: {child.name}");
}
}
else if (child.name.StartsWith("ConnectionPoint_End"))
{
// 只有当终点接口存在时才注册到堆叠系统
if (endInterface != null)
{
RegisterConnectionPointWithInterface(interfaceStacks, child.gameObject, endInterface);
// 同时添加到 allConnectionPoints 列表
if (allConnectionPoints != null && !allConnectionPoints.Contains(child.gameObject))
{
allConnectionPoints.Add(child.gameObject);
}
registeredCount++;
}
else if (debugMode)
{
Debug.Log($"终点接口为 null跳过堆叠注册: {child.name}");
}
}
}
if (debugMode)
{
int startCount = startInterface != null ? GetStackCountForInterface(interfaceStacks, startInterface) : 0;
int endCount = endInterface != null ? GetStackCountForInterface(interfaceStacks, endInterface) : 0;
Debug.Log($"连接点堆叠注册完成 - 注册了 {registeredCount} 个连接点");
Debug.Log($"起点接口: {startInterface?.name ?? "null"} ({startCount}个), 终点接口: {endInterface?.name ?? "null"} ({endCount}个)");
Debug.Log($"allConnectionPoints 列表总数: {allConnectionPoints?.Count ?? 0}");
// 打印所有接口的堆叠状态
Debug.Log("=== 所有接口堆叠状态 ===");
foreach (var kvp in interfaceStacks)
{
Debug.Log($"接口: {kvp.Key}, 连接点数量: {kvp.Value.Count}");
}
Debug.Log("=== 堆叠状态结束 ===");
}
}
catch (System.Exception e)
{
Debug.LogError($"注册连接点到堆叠系统失败: {e.Message}");
}
}
/// <summary>
/// 验证堆叠限制是否正常工作
/// </summary>
public void ValidateStackingSystem()
{
if (wireSystem == null)
{
Debug.LogError("WireSystem 为 null无法验证堆叠系统");
return;
}
try
{
// 获取 WireDrawingSystem 中的 interfaceStacks 字典
var interfaceStacksField = typeof(WireDrawingSystem).GetField("interfaceStacks",
BindingFlags.NonPublic | BindingFlags.Instance);
if (interfaceStacksField == null)
{
Debug.LogError("无法找到 interfaceStacks 字段");
return;
}
var interfaceStacks = (Dictionary<string, List<GameObject>>)interfaceStacksField.GetValue(wireSystem);
// 获取最大堆叠数量
var maxStackCountField = typeof(WireDrawingSystem).GetField("maxStackCount",
BindingFlags.Public | BindingFlags.Instance);
int maxStackCount = maxStackCountField != null ? (int)maxStackCountField.GetValue(wireSystem) : 5;
Debug.Log("=== 堆叠系统验证 ===");
Debug.Log($"最大堆叠数量: {maxStackCount}");
Debug.Log($"接口数量: {interfaceStacks.Count}");
// 检查每个接口的堆叠状态
foreach (var kvp in interfaceStacks)
{
string interfaceObj = kvp.Key;
List<GameObject> connectionPoints = kvp.Value;
// 清理已销毁的连接点
connectionPoints.RemoveAll(item => item == null);
Debug.Log($"接口: {interfaceObj}, 连接点数量: {connectionPoints.Count}, 是否达到限制: {connectionPoints.Count >= maxStackCount}");
// 验证每个连接点是否都有正确的引用
foreach (GameObject point in connectionPoints)
{
if (point != null)
{
ConnectionPointInterfaceReference refComponent = point.GetComponent<ConnectionPointInterfaceReference>();
if (refComponent == null || refComponent.targetInterface == null)
{
Debug.LogWarning($"连接点 {point.name} 缺少有效的接口引用");
}
}
}
}
Debug.Log("=== 验证结束 ===");
}
catch (System.Exception e)
{
Debug.LogError($"验证堆叠系统失败: {e.Message}");
}
}
/// <summary>
/// 注册单个连接点到接口堆叠系统
/// </summary>
private void RegisterConnectionPointWithInterface(Dictionary<string, List<GameObject>> interfaceStacks,
GameObject connectionPoint, GameObject targetInterface)
{
if (targetInterface == null) return;
// 确保接口在字典中存在
if (!interfaceStacks.ContainsKey(targetInterface.name))
{
interfaceStacks[targetInterface.name] = new List<GameObject>();
if (debugMode) Debug.Log($"为接口 {targetInterface.name} 创建新堆叠列表");
}
// 添加连接点到堆叠列表
if (!interfaceStacks[targetInterface.name].Contains(connectionPoint))
{
interfaceStacks[targetInterface.name].Add(connectionPoint);
if (debugMode) Debug.Log($"连接点 {connectionPoint.name} 已注册到接口 {targetInterface.name},当前总数: {interfaceStacks[targetInterface.name].Count}");
}
// 确保连接点有 ConnectionPointInterfaceReference 组件
ConnectionPointInterfaceReference refComponent = connectionPoint.GetComponent<ConnectionPointInterfaceReference>();
if (refComponent == null)
{
refComponent = connectionPoint.AddComponent<ConnectionPointInterfaceReference>();
}
refComponent.targetInterface = targetInterface;
}
/// <summary>
/// 获取接口上的连接点数量
/// </summary>
private int GetStackCountForInterface(Dictionary<string, List<GameObject>> interfaceStacks, GameObject targetInterface)
{
if (targetInterface == null || !interfaceStacks.ContainsKey(targetInterface.name))
{
return 0;
}
// 清理已销毁的模型引用
interfaceStacks[targetInterface.name].RemoveAll(item => item == null);
return interfaceStacks[targetInterface.name].Count;
}
/// <summary>
/// 使用反射设置 CylinderWireData 的所有字段 - 修复版
/// </summary>
private void SetCylinderWireDataFields(CylinderWireData cylinderData, SerializableWireConnectionData wireData,
GameObject startInterface, GameObject endInterface)
@ -583,8 +893,9 @@ public class WireDataPersistence : MonoBehaviour
// 获取 CylinderWireData 类型的所有字段
FieldInfo[] fields = typeof(CylinderWireData).GetFields(BindingFlags.Public | BindingFlags.Instance);
if (debugMode) Debug.Log($"CylinderWireData 有 {fields.Length} 个字段");
if (debugMode) Debug.Log($"CylinderWireData 有 {fields.Length} 个公共字段");
// 首先设置基本的连接点信息
foreach (FieldInfo field in fields)
{
try
@ -593,25 +904,38 @@ public class WireDataPersistence : MonoBehaviour
switch (field.Name)
{
case "startPoint":
// 使用保存的起点位置
field.SetValue(cylinderData, wireData.startPoint);
if (debugMode) Debug.Log($"设置 startPoint: {wireData.startPoint}");
break;
case "endPoint":
// 使用保存的终点位置
field.SetValue(cylinderData, wireData.endPoint);
if (debugMode) Debug.Log($"设置 endPoint: {wireData.endPoint}");
break;
case "snapStartObject":
case "startInterface":
// 设置起点接口
field.SetValue(cylinderData, startInterface);
if (debugMode) Debug.Log($"设置 snapStartObject: {startInterface?.name ?? "null"}");
if (debugMode) Debug.Log($"设置 snapStartObject/startInterface: {startInterface?.name ?? "null"}");
break;
case "snapEndObject":
case "endInterface":
// 设置终点接口
field.SetValue(cylinderData, endInterface);
if (debugMode) Debug.Log($"设置 snapEndObject: {endInterface?.name ?? "null"}");
if (debugMode) Debug.Log($"设置 snapEndObject/endInterface: {endInterface?.name ?? "null"}");
break;
case "creationTime":
// 使用保存的创建时间
field.SetValue(cylinderData, wireData.creationTime);
if (debugMode) Debug.Log($"设置 creationTime: {wireData.creationTime}");
break;
case "wireDiameter":
// 使用保存的圆柱体半径计算直径,或使用默认值
float diameter = wireData.cylinderRadius > 0 ? wireData.cylinderRadius * 2f : 0.02f;
field.SetValue(cylinderData, diameter);
if (debugMode) Debug.Log($"设置 wireDiameter: {diameter} (从半径 {wireData.cylinderRadius} 计算)");
break;
default:
// 尝试设置其他字段
if (debugMode) Debug.Log($"跳过字段: {field.Name} (类型: {field.FieldType})");
@ -623,6 +947,9 @@ public class WireDataPersistence : MonoBehaviour
Debug.LogWarning($"设置字段 {field.Name} 失败: {e.Message}");
}
}
// 额外设置一些可能需要的属性
SetAdditionalCylinderWireProperties(cylinderData, wireData);
}
catch (System.Exception e)
{
@ -630,6 +957,48 @@ public class WireDataPersistence : MonoBehaviour
}
}
/// <summary>
/// 设置额外的圆柱体连线属性
/// </summary>
private void SetAdditionalCylinderWireProperties(CylinderWireData cylinderData, SerializableWireConnectionData wireData)
{
try
{
// 使用反射设置可能存在的其他属性
PropertyInfo[] properties = typeof(CylinderWireData).GetProperties(BindingFlags.Public | BindingFlags.Instance);
foreach (PropertyInfo property in properties)
{
try
{
if (property.CanWrite)
{
switch (property.Name)
{
case "WireColor":
// 如果有自定义颜色,设置连线颜色
if (wireData.hasCustomColor)
{
Color wireColor = new Color(wireData.wireColorR, wireData.wireColorG, wireData.wireColorB, wireData.wireColorA);
property.SetValue(cylinderData, wireColor);
if (debugMode) Debug.Log($"设置 WireColor: {wireColor}");
}
break;
// 可以根据需要添加更多属性设置
}
}
}
catch (System.Exception e)
{
Debug.LogWarning($"设置属性 {property.Name} 失败: {e.Message}");
}
}
}
catch (System.Exception e)
{
Debug.LogError($"设置额外圆柱体连线属性失败: {e.Message}");
}
}
/// <summary>
/// 创建圆柱体视觉表现 - 使用保存的圆柱体数据和颜色
/// </summary>
@ -765,11 +1134,13 @@ public class WireDataPersistence : MonoBehaviour
}
/// <summary>
/// 为连线创建连接点 - 恢复连接点样式
/// 为连线创建连接点 - 恢复连接点样式,返回创建的连接点列表
/// </summary>
private void CreateConnectionPointsForWire(GameObject wireObject, SerializableWireConnectionData wireData,
private List<GameObject> CreateConnectionPointsForWire(GameObject wireObject, SerializableWireConnectionData wireData,
GameObject startInterface, GameObject endInterface)
{
List<GameObject> connectionPoints = new List<GameObject>();
try
{
// 通过反射获取连接点预制体
@ -796,6 +1167,7 @@ public class WireDataPersistence : MonoBehaviour
if (startConnectionPoint != null)
{
startConnectionPoint.transform.SetParent(wireObject.transform);
connectionPoints.Add(startConnectionPoint);
}
}
@ -814,6 +1186,7 @@ public class WireDataPersistence : MonoBehaviour
if (endConnectionPoint != null)
{
endConnectionPoint.transform.SetParent(wireObject.transform);
connectionPoints.Add(endConnectionPoint);
}
}
}
@ -822,6 +1195,8 @@ public class WireDataPersistence : MonoBehaviour
{
Debug.LogWarning($"创建连接点失败: {e.Message}");
}
return connectionPoints;
}
/// <summary>
@ -936,7 +1311,7 @@ public class WireDataPersistence : MonoBehaviour
return null;
}
// 方法1: 首先尝试从 CylinderWireData 组件获取
// 方法1首先尝试从 CylinderWireData 组件获取
CylinderWireData cylinderData = wireObject.GetComponent<CylinderWireData>();
if (cylinderData != null)
{
@ -962,12 +1337,12 @@ public class WireDataPersistence : MonoBehaviour
case "endPoint":
connectionData.endPoint = (Vector3)field.GetValue(cylinderData);
break;
case "snapStartObject":
case "startInterface":
GameObject startInterface = (GameObject)field.GetValue(cylinderData);
connectionData.startInterfaceName = startInterface ? startInterface.name : "";
connectionData.hasStartInterface = startInterface != null;
break;
case "snapEndObject":
case "endInterface":
GameObject endInterface = (GameObject)field.GetValue(cylinderData);
connectionData.endInterfaceName = endInterface ? endInterface.name : "";
connectionData.hasEndInterface = endInterface != null;
@ -1049,12 +1424,13 @@ public class WireDataPersistence : MonoBehaviour
{
Debug.Log($"从 CylinderWireData 组件获取连线数据: {connectionData.wireName}");
Debug.Log($"起点: {connectionData.startPoint}, 终点: {connectionData.endPoint}");
Debug.Log($"起点接口: {connectionData.startInterfaceName}, 终点接口: {connectionData.endInterfaceName}");
Debug.Log($"连线颜色: {connectionData.hasCustomColor}");
}
return connectionData;
}
// 方法2: 尝试从 WireData 组件获取(兼容旧版本)
// 方法2尝试从 WireData 组件获取(兼容旧版本)
WireData wireDataComponent = wireObject.GetComponent<WireData>();
if (wireDataComponent != null)
{
@ -1135,23 +1511,54 @@ public class WireDataPersistence : MonoBehaviour
}
/// <summary>
/// 根据名称查找接口物体
/// 根据名称查找接口对象 - 增强查找能力
/// </summary>
private GameObject FindInterfaceByName(string interfaceName)
{
if (string.IsNullOrEmpty(interfaceName))
return null;
// 在场景中查找物体
GameObject obj = GameObject.Find(interfaceName);
if (obj == null && debugMode)
{
Debug.LogWarning($"WireDataPersistence: 找不到接口物体: {interfaceName}");
if (debugMode) Debug.LogWarning("接口名称为空");
return null;
}
// 方法1直接通过名称查找
GameObject obj = GameObject.Find(interfaceName);
if (obj != null)
{
if (debugMode) Debug.Log($"通过名称找到接口: {interfaceName}");
return obj;
}
// 方法2在场景中查找包含该名称的对象
GameObject[] allObjects = GameObject.FindObjectsOfType<GameObject>();
foreach (GameObject gameObj in allObjects)
{
if (gameObj.name.Contains(interfaceName))
{
if (debugMode) Debug.Log($"通过包含名称找到接口: {interfaceName} -> {gameObj.name}");
return gameObj;
}
}
// 方法3通过标签查找如果有特定标签
try
{
GameObject[] taggedObjs = GameObject.FindGameObjectsWithTag("Interface");
foreach (GameObject taggedObj in taggedObjs)
{
if (taggedObj.name == interfaceName)
{
if (debugMode) Debug.Log($"通过标签找到接口: {interfaceName}");
return taggedObj;
}
}
}
catch { }
if (debugMode) Debug.LogWarning($"WireDataPersistence: 找不到接口物体: {interfaceName}");
return null;
}
/// <summary>
/// 手动保存
/// </summary>
@ -1275,7 +1682,67 @@ public class WireDataPersistence : MonoBehaviour
return $"获取统计信息失败: {e.Message}";
}
}
/// <summary>
/// 测试特定接口的堆叠限制
/// </summary>
public void TestStackingLimit(string interfaceName)
{
if (wireSystem == null)
{
Debug.LogError("WireSystem 为 null无法测试堆叠限制");
return;
}
try
{
// 获取 WireDrawingSystem 中的 interfaceStacks 字典
var interfaceStacksField = typeof(WireDrawingSystem).GetField("interfaceStacks",
BindingFlags.NonPublic | BindingFlags.Instance);
if (interfaceStacksField == null)
{
Debug.LogError("无法找到 interfaceStacks 字段");
return;
}
var interfaceStacks = (Dictionary<GameObject, List<GameObject>>)interfaceStacksField.GetValue(wireSystem);
// 查找接口
GameObject targetInterface = null;
foreach (var kvp in interfaceStacks)
{
if (kvp.Key.name == interfaceName)
{
targetInterface = kvp.Key;
break;
}
}
if (targetInterface == null)
{
Debug.LogWarning($"找不到接口: {interfaceName}");
return;
}
// 获取堆叠检查方法
var isStackLimitReachedMethod = typeof(WireDrawingSystem).GetMethod("IsStackLimitReached",
BindingFlags.NonPublic | BindingFlags.Instance);
if (isStackLimitReachedMethod == null)
{
Debug.LogError("无法找到 IsStackLimitReached 方法");
return;
}
bool isLimitReached = (bool)isStackLimitReachedMethod.Invoke(wireSystem, new object[] { targetInterface });
Debug.Log($"堆叠限制测试 - 接口: {interfaceName}, 是否达到限制: {isLimitReached}");
}
catch (System.Exception e)
{
Debug.LogError($"测试堆叠限制失败: {e.Message}");
}
}
/// <summary>
/// 强制立即保存
/// </summary>

View File

@ -1,6 +1,7 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
// 连线连接数据结构
[System.Serializable]
public class WireConnectionData
@ -60,6 +61,9 @@ public class WireDrawingSystem : MonoBehaviour
// 修复问题:记录鼠标点击的实际位置
private Vector3 actualMousePosition;
public List<GameObject> model = new List<GameObject>();
public List<Material> Colors = new List<Material>();
/// <summary>
/// 接线头样式
/// </summary>
@ -93,7 +97,7 @@ public class WireDrawingSystem : MonoBehaviour
public Color selfConnectionWarningColor = Color.magenta; // 自连接警告颜色
// 存储每个接口上的模型堆叠信息
private Dictionary<GameObject, List<GameObject>> interfaceStacks = new Dictionary<GameObject, List<GameObject>>();
private Dictionary<string, List<GameObject>> interfaceStacks = new Dictionary<string, List<GameObject>>();
// 用于临时存储当前操作的目标接口
private GameObject currentStartInterface;
@ -154,6 +158,8 @@ public class WireDrawingSystem : MonoBehaviour
ClearAllHighlights();
}
}
Debug.Log("字典内总数:" + interfaceStacks.Count);
}
/// <summary>
@ -271,7 +277,7 @@ public class WireDrawingSystem : MonoBehaviour
/// <summary>
/// 检查接口是否达到堆叠数量限制
/// 检查接口是否达到堆叠数量限制 - 增强版
/// </summary>
bool IsStackLimitReached(GameObject targetInterface)
{
@ -279,9 +285,15 @@ public class WireDrawingSystem : MonoBehaviour
return false;
int currentCount = GetStackCountForInterface(targetInterface);
return currentCount >= maxStackCount;
bool isLimitReached = currentCount >= maxStackCount;
if (isLimitReached)
{
Debug.Log($"堆叠限制检查: 接口 {targetInterface.name} 已达到限制 ({currentCount}/{maxStackCount})");
}
return isLimitReached;
}
/// <summary>
/// 检查是否尝试自连接
/// </summary>
@ -383,14 +395,17 @@ public class WireDrawingSystem : MonoBehaviour
{
if (targetInterface == null) return;
if (!interfaceStacks.ContainsKey(targetInterface))
if (!interfaceStacks.ContainsKey(targetInterface.name))
{
interfaceStacks[targetInterface] = new List<GameObject>();
interfaceStacks[targetInterface.name] = new List<GameObject>();
Debug.Log($"为接口 {targetInterface.name} 创建新堆叠列表");
}
if (interfaceStacks[targetInterface.name].Count < 2)
{
interfaceStacks[targetInterface.name].Add(connectionPoint);
}
interfaceStacks[targetInterface].Add(connectionPoint);
Debug.Log($"连接点 {connectionPoint.name} 已注册到接口 {targetInterface.name},当前总数: {interfaceStacks[targetInterface].Count}");
Debug.Log($"连接点 {connectionPoint.name} 已注册到接口 {targetInterface.name},当前总数: {interfaceStacks[targetInterface.name].Count}");
// 添加接口引用组件
ConnectionPointInterfaceReference refComponent = connectionPoint.GetComponent<ConnectionPointInterfaceReference>();
@ -410,14 +425,14 @@ public class WireDrawingSystem : MonoBehaviour
if (refComponent != null && refComponent.targetInterface != null)
{
GameObject targetInterface = refComponent.targetInterface;
if (interfaceStacks.ContainsKey(targetInterface))
if (interfaceStacks.ContainsKey(targetInterface.name))
{
interfaceStacks[targetInterface].Remove(connectionPoint);
interfaceStacks[targetInterface.name].Remove(connectionPoint);
// 如果接口没有更多连接点,移除接口条目
if (interfaceStacks[targetInterface].Count == 0)
if (interfaceStacks[targetInterface.name].Count == 0)
{
interfaceStacks.Remove(targetInterface);
interfaceStacks.Remove(targetInterface.name);
}
// Debug.Log($"连接点 {connectionPoint.name} 已从接口 {targetInterface.name} 移除,剩余数量: {interfaceStacks.ContainsKey(targetInterface) ? interfaceStacks[targetInterface].Count : 0}");
@ -446,20 +461,34 @@ public class WireDrawingSystem : MonoBehaviour
}
/// <summary>
/// 获取接口上的模型堆叠数量
/// 获取接口上的模型堆叠数量 - 增强版
/// </summary>
int GetStackCountForInterface(GameObject targetInterface)
{
if (targetInterface == null || !interfaceStacks.ContainsKey(targetInterface))
if (targetInterface == null || !interfaceStacks.ContainsKey(targetInterface.name))
{
return 0;
}
// 清理已销毁的模型引用
interfaceStacks[targetInterface].RemoveAll(item => item == null);
return interfaceStacks[targetInterface].Count;
interfaceStacks[targetInterface.name].RemoveAll(item => item == null);
int count = interfaceStacks[targetInterface.name].Count;
// 调试日志
if (count > 0)
{
Debug.Log($"接口 {targetInterface.name} 当前堆叠数量: {count}");
foreach (var point in interfaceStacks[targetInterface.name])
{
if (point != null)
{
Debug.Log($" - {point.name}");
}
}
}
return count;
}
/// <summary>
/// 删除未完成的连接点(用于取消操作时)
/// </summary>
@ -1001,6 +1030,14 @@ public class WireDrawingSystem : MonoBehaviour
return;
}
// 新增:检查堆叠限制
if (enableStacking && IsStackLimitReached(snapTarget))
{
Debug.LogWarning($"目标接口 {snapTarget.name} 已达到堆叠限制 ({GetStackCountForInterface(snapTarget)}/{maxStackCount}),无法连接");
ShowStackLimitWarning(snapTarget);
return;
}
// 应用点击高亮效果
HandleClickHighlight(snapTarget);
@ -1012,10 +1049,26 @@ public class WireDrawingSystem : MonoBehaviour
{
currentStartInterface = snapTarget;
startInterfaceObject = snapTarget; // 记录起点接口
// 新增:检查起点接口的堆叠限制
if (enableStacking && IsStackLimitReached(snapTarget))
{
Debug.LogWarning($"起点接口 {snapTarget.name} 已达到堆叠限制 ({GetStackCountForInterface(snapTarget)}/{maxStackCount}),无法创建新连线");
ShowStackLimitWarning(snapTarget);
return;
}
}
else if (currentState == DrawingState.SelectingEnd)
{
currentEndInterface = snapTarget;
// 新增:检查终点接口的堆叠限制
if (enableStacking && IsStackLimitReached(snapTarget))
{
Debug.LogWarning($"终点接口 {snapTarget.name} 已达到堆叠限制 ({GetStackCountForInterface(snapTarget)}/{maxStackCount}),无法连接");
ShowStackLimitWarning(snapTarget);
return;
}
}
switch (currentState)
@ -1051,6 +1104,14 @@ public class WireDrawingSystem : MonoBehaviour
return;
}
// 新增:检查堆叠限制
if (enableStacking && IsStackLimitReached(hitObject))
{
Debug.LogWarning($"目标接口 {hitObject.name} 已达到堆叠限制 ({GetStackCountForInterface(hitObject)}/{maxStackCount}),无法连接");
ShowStackLimitWarning(hitObject);
return;
}
// 应用点击高亮效果
HandleClickHighlight(hitObject);
@ -1066,10 +1127,26 @@ public class WireDrawingSystem : MonoBehaviour
{
currentStartInterface = hitObject;
startInterfaceObject = hitObject; // 记录起点接口
// 新增:检查起点接口的堆叠限制
if (enableStacking && IsStackLimitReached(hitObject))
{
Debug.LogWarning($"起点接口 {hitObject.name} 已达到堆叠限制 ({GetStackCountForInterface(hitObject)}/{maxStackCount}),无法创建新连线");
ShowStackLimitWarning(hitObject);
return;
}
}
else if (currentState == DrawingState.SelectingEnd)
{
currentEndInterface = hitObject;
// 新增:检查终点接口的堆叠限制
if (enableStacking && IsStackLimitReached(hitObject))
{
Debug.LogWarning($"终点接口 {hitObject.name} 已达到堆叠限制 ({GetStackCountForInterface(hitObject)}/{maxStackCount}),无法连接");
ShowStackLimitWarning(hitObject);
return;
}
}
}
@ -1127,6 +1204,16 @@ public class WireDrawingSystem : MonoBehaviour
// 修改 StartNewWire 方法,传递目标接口
void StartNewWire(Vector3 point)
{
// 新增:最终确认起点接口的堆叠限制
if (startInterfaceObject != null && enableStacking && IsStackLimitReached(startInterfaceObject))
{
Debug.LogWarning($"起点接口 {startInterfaceObject.name} 已达到堆叠限制 ({GetStackCountForInterface(startInterfaceObject)}/{maxStackCount}),无法创建新连线");
ShowStackLimitWarning(startInterfaceObject);
currentState = DrawingState.Idle;
startInterfaceObject = null;
return;
}
startPoint = point;
currentState = DrawingState.SelectingEnd;
@ -1147,6 +1234,7 @@ public class WireDrawingSystem : MonoBehaviour
Debug.Log($"选择起点: {point}, 接口: {startInterfaceObject?.name ?? ""}");
}
// 修改 CompleteWire 方法,传递目标接口
void CompleteWire(Vector3 point)
{
@ -1162,10 +1250,10 @@ public class WireDrawingSystem : MonoBehaviour
return;
}
// 检查终点堆叠限制
// 新增:最终确认终点接口的堆叠限制
if (endInterfaceObject != null && enableStacking && IsStackLimitReached(endInterfaceObject))
{
Debug.LogWarning($"终点接口 {endInterfaceObject.name} 已达到堆叠限制,无法连接");
Debug.LogWarning($"终点接口 {endInterfaceObject.name} 已达到堆叠限制 ({GetStackCountForInterface(endInterfaceObject)}/{maxStackCount}),无法连接");
ShowStackLimitWarning(endInterfaceObject);
CancelDrawing();
return;
@ -1197,7 +1285,6 @@ public class WireDrawingSystem : MonoBehaviour
startInterfaceObject = null;
endInterfaceObject = null;
}
void CreateWirePreview()
{
currentWireObject = new GameObject("WirePreview");
@ -1680,10 +1767,10 @@ public class WireDrawingSystem : MonoBehaviour
Debug.Log("取消连线操作");
}
/// <summary>
/// 更新吸附点预览模型
/// </summary>
void UpdateSnapPreview()
/// <summary>
/// 更新吸附点预览模型
/// </summary>
void UpdateSnapPreview()
{
if (snapPreviewPrefab == null) return;
@ -1938,9 +2025,9 @@ void UpdateSnapPreview()
{
List<Vector3> positions = new List<Vector3>();
if (interfaceStacks.ContainsKey(targetInterface))
if (interfaceStacks.ContainsKey(targetInterface.name))
{
foreach (GameObject connectionPoint in interfaceStacks[targetInterface])
foreach (GameObject connectionPoint in interfaceStacks[targetInterface.name])
{
if (connectionPoint != null)
{
@ -1986,10 +2073,10 @@ void UpdateSnapPreview()
/// </summary>
public void ClearConnectionPointsOnInterface(GameObject targetInterface)
{
if (interfaceStacks.ContainsKey(targetInterface))
if (interfaceStacks.ContainsKey(targetInterface.name))
{
// 创建副本,避免在遍历时修改集合
List<GameObject> pointsToRemove = new List<GameObject>(interfaceStacks[targetInterface]);
List<GameObject> pointsToRemove = new List<GameObject>(interfaceStacks[targetInterface.name]);
foreach (GameObject connectionPoint in pointsToRemove)
{
if (connectionPoint != null)
@ -1998,7 +2085,7 @@ void UpdateSnapPreview()
}
}
interfaceStacks.Remove(targetInterface);
interfaceStacks.Remove(targetInterface.name);
}
}
@ -2047,4 +2134,34 @@ void UpdateSnapPreview()
{
highlightDuration = Mathf.Max(0.1f, duration);
}
public void SetColor_Model(string color)
{
switch (color)
{
case "红":
connectionPointPrefab = model[0];
snapPreviewPrefab = model[0];
cylinderWireMaterial = Colors[0];
break;
case "绿":
connectionPointPrefab = model[1];
snapPreviewPrefab = model[1];
cylinderWireMaterial = Colors[1];
break;
case "黑":
connectionPointPrefab = model[2];
snapPreviewPrefab = model[2];
cylinderWireMaterial = Colors[2];
break;
case "黄":
connectionPointPrefab = model[3];
snapPreviewPrefab = model[3];
cylinderWireMaterial = Colors[3];
break;
}
}
}

View File

@ -1,16 +1,16 @@
{
"wires": [
{
"startInterfaceName": "",
"endInterfaceName": "",
"startInterfaceName": "chudian233",
"endInterfaceName": "chudian227",
"startConnectionPointPosition": {
"x": -1.3185701370239258,
"y": -0.26755011081695559,
"x": -1.250161051750183,
"y": -0.28797510266304018,
"z": 0.08528154343366623
},
"endConnectionPointPosition": {
"x": -1.2912330627441407,
"y": -0.26317930221557619,
"x": -1.3185701370239258,
"y": -0.2905614376068115,
"z": 0.08528154343366623
},
"startPoint": {
@ -23,31 +23,31 @@
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127134949",
"wireName": "Wire_20251127163809",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.013842142187058926,
"y": 0.03422898054122925,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.3049015998840333,
"y": -0.26536470651626589,
"x": -1.2843656539916993,
"y": -0.28926825523376467,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": -0.6488911509513855,
"w": 0.760881245136261
"z": 0.7203401327133179,
"w": 0.6936209797859192
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": false,
"hasEndInterface": false,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.5943396091461182,
"wireColorG": 0.18467971682548524,
"wireColorB": 0.12615692615509034,
"wireColorG": 0.18467968702316285,
"wireColorB": 0.12615689635276795,
"wireColorA": 1.0,
"hasCustomColor": true,
"connectionPointScale": 0.004999999888241291,
@ -59,132 +59,16 @@
"endPointColorB": 0.7830188274383545
},
{
"startInterfaceName": "",
"endInterfaceName": "",
"startConnectionPointPosition": {
"x": -1.2912330627441407,
"y": -0.26317930221557619,
"z": 0.09028154611587525
},
"endConnectionPointPosition": {
"x": -1.270147442817688,
"y": -0.3188800513744354,
"z": 0.08528154343366623
},
"startPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"endPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127134950",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.029779089614748956,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.2806901931762696,
"y": -0.291029691696167,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": 0.9836748838424683,
"w": -0.17995478212833405
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": false,
"hasEndInterface": false,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.5943396091461182,
"wireColorG": 0.18467971682548524,
"wireColorB": 0.12615692615509034,
"wireColorA": 1.0,
"hasCustomColor": true,
"connectionPointScale": 0.004999999888241291,
"startPointColorR": 0.7830188274383545,
"startPointColorG": 0.7830188274383545,
"startPointColorB": 0.7830188274383545,
"endPointColorR": 0.7830188274383545,
"endPointColorG": 0.7830188274383545,
"endPointColorB": 0.7830188274383545
},
{
"startInterfaceName": "",
"endInterfaceName": "",
"startConnectionPointPosition": {
"x": -1.270147442817688,
"y": -0.3188800513744354,
"z": 0.09028154611587525
},
"endConnectionPointPosition": {
"x": -1.3185701370239258,
"y": -0.3104493021965027,
"z": 0.08528154343366623
},
"startPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"endPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127134951",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.024575570598244668,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.294358730316162,
"y": -0.31466466188430788,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": 0.6436120867729187,
"w": 0.7653518915176392
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": false,
"hasEndInterface": false,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.5943396091461182,
"wireColorG": 0.18467971682548524,
"wireColorB": 0.12615692615509034,
"wireColorA": 1.0,
"hasCustomColor": true,
"connectionPointScale": 0.004999999888241291,
"startPointColorR": 0.7830188274383545,
"startPointColorG": 0.7830188274383545,
"startPointColorB": 0.7830188274383545,
"endPointColorR": 0.7830188274383545,
"endPointColorG": 0.7830188274383545,
"endPointColorB": 0.7830188274383545
},
{
"startInterfaceName": "",
"endInterfaceName": "",
"startInterfaceName": "chudian227",
"endInterfaceName": "chudian228",
"startConnectionPointPosition": {
"x": -1.3185701370239258,
"y": -0.3104493021965027,
"y": -0.2905614376068115,
"z": 0.09028154611587525
},
"endConnectionPointPosition": {
"x": -1.3627458810806275,
"y": -0.3050294816493988,
"y": -0.2951911687850952,
"z": 0.08528154343366623
},
"startPoint": {
@ -197,31 +81,31 @@
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127134952",
"wireName": "Wire_20251127163810",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.02225348725914955,
"y": 0.022208843380212785,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.3406579494476319,
"y": -0.30773937702178957,
"y": -0.29287630319595339,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": 0.662655770778656,
"w": 0.7489241361618042
"z": 0.7430449724197388,
"w": 0.6692414879798889
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": false,
"hasEndInterface": false,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.5943396091461182,
"wireColorG": 0.18467971682548524,
"wireColorB": 0.12615692615509034,
"wireColorG": 0.18467968702316285,
"wireColorB": 0.12615689635276795,
"wireColorA": 1.0,
"hasCustomColor": true,
"connectionPointScale": 0.004999999888241291,
@ -233,13 +117,129 @@
"endPointColorB": 0.7830188274383545
},
{
"startInterfaceName": "",
"endInterfaceName": "",
"startInterfaceName": "chudian228",
"endInterfaceName": "chudian232",
"startConnectionPointPosition": {
"x": -1.3303356170654297,
"y": -0.26755011081695559,
"x": -1.3627458810806275,
"y": -0.2951911687850952,
"z": 0.09028154611587525
},
"endConnectionPointPosition": {
"x": -1.378318190574646,
"y": -0.2723008692264557,
"z": 0.08528154343366623
},
"startPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"endPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127163811",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.01384253054857254,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.3705320358276368,
"y": -0.28374600410461428,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": 0.2942698299884796,
"w": 0.9557223916053772
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.5943396091461182,
"wireColorG": 0.18467968702316285,
"wireColorB": 0.12615689635276795,
"wireColorA": 1.0,
"hasCustomColor": true,
"connectionPointScale": 0.004999999888241291,
"startPointColorR": 0.7830188274383545,
"startPointColorG": 0.7830188274383545,
"startPointColorB": 0.7830188274383545,
"endPointColorR": 0.7830188274383545,
"endPointColorG": 0.7830188274383545,
"endPointColorB": 0.7830188274383545
},
{
"startInterfaceName": "chudian232",
"endInterfaceName": "chudian208",
"startConnectionPointPosition": {
"x": -1.378318190574646,
"y": -0.2723008692264557,
"z": 0.09028154611587525
},
"endConnectionPointPosition": {
"x": -1.406347632408142,
"y": -0.26232433319091799,
"z": 0.08528154343366623
},
"startPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"endPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127163812",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.014875994995236397,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.392332911491394,
"y": -0.26731258630752566,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": 0.5764879584312439,
"w": 0.8171056509017944
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.5943396091461182,
"wireColorG": 0.18467968702316285,
"wireColorB": 0.12615689635276795,
"wireColorA": 1.0,
"hasCustomColor": true,
"connectionPointScale": 0.004999999888241291,
"startPointColorR": 0.7830188274383545,
"startPointColorG": 0.7830188274383545,
"startPointColorB": 0.7830188274383545,
"endPointColorR": 0.7830188274383545,
"endPointColorG": 0.7830188274383545,
"endPointColorB": 0.7830188274383545
},
{
"startInterfaceName": "chudian208",
"endInterfaceName": "chudian222",
"startConnectionPointPosition": {
"x": -1.406347632408142,
"y": -0.26232433319091799,
"z": 0.09028154611587525
},
"endConnectionPointPosition": {
"x": -1.382118821144104,
"y": -0.2516351342201233,
@ -255,31 +255,379 @@
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127135401",
"wireName": "Wire_20251127163813",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.027086835354566575,
"y": 0.013240980915725232,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.356227159500122,
"y": -0.25959262251853945,
"x": -1.394233226776123,
"y": -0.25697973370552065,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": 0.594231903553009,
"w": 0.8042938113212586
"z": -0.5460582971572876,
"w": 0.8377472162246704
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": false,
"hasEndInterface": false,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.5943396091461182,
"wireColorG": 0.18467974662780763,
"wireColorB": 0.12615695595741273,
"wireColorG": 0.18467968702316285,
"wireColorB": 0.12615689635276795,
"wireColorA": 1.0,
"hasCustomColor": true,
"connectionPointScale": 0.004999999888241291,
"startPointColorR": 0.7830188274383545,
"startPointColorG": 0.7830188274383545,
"startPointColorB": 0.7830188274383545,
"endPointColorR": 0.7830188274383545,
"endPointColorG": 0.7830188274383545,
"endPointColorB": 0.7830188274383545
},
{
"startInterfaceName": "chudian222",
"endInterfaceName": "chudian244",
"startConnectionPointPosition": {
"x": -1.382118821144104,
"y": -0.2516351342201233,
"z": 0.09028154611587525
},
"endConnectionPointPosition": {
"x": -1.3187440633773804,
"y": -0.24335770308971406,
"z": 0.08528154343366623
},
"startPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"endPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127163814",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.031956516206264499,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.3504314422607422,
"y": -0.24749642610549928,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": -0.6597307324409485,
"w": 0.7515020966529846
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.5943396091461182,
"wireColorG": 0.18467968702316285,
"wireColorB": 0.12615689635276795,
"wireColorA": 1.0,
"hasCustomColor": true,
"connectionPointScale": 0.004999999888241291,
"startPointColorR": 0.7830188274383545,
"startPointColorG": 0.7830188274383545,
"startPointColorB": 0.7830188274383545,
"endPointColorR": 0.7830188274383545,
"endPointColorG": 0.7830188274383545,
"endPointColorB": 0.7830188274383545
},
{
"startInterfaceName": "chudian244",
"endInterfaceName": "chudian218",
"startConnectionPointPosition": {
"x": -1.3187440633773804,
"y": -0.24335770308971406,
"z": 0.09028154611587525
},
"endConnectionPointPosition": {
"x": -1.3303356170654297,
"y": -0.26755011081695559,
"z": 0.08528154343366623
},
"startPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"endPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127165051",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.0134130222722888,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.3245398998260499,
"y": -0.2554539144039154,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": 0.975147545337677,
"w": 0.22155660390853883
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.5943396091461182,
"wireColorG": 0.18467971682548524,
"wireColorB": 0.12615692615509034,
"wireColorA": 1.0,
"hasCustomColor": true,
"connectionPointScale": 0.004999999888241291,
"startPointColorR": 0.7830188274383545,
"startPointColorG": 0.7830188274383545,
"startPointColorB": 0.7830188274383545,
"endPointColorR": 0.7830188274383545,
"endPointColorG": 0.7830188274383545,
"endPointColorB": 0.7830188274383545
},
{
"startInterfaceName": "chudian218",
"endInterfaceName": "chudian240",
"startConnectionPointPosition": {
"x": -1.3303356170654297,
"y": -0.26755011081695559,
"z": 0.09028154611587525
},
"endConnectionPointPosition": {
"x": -1.2700444459915162,
"y": -0.24335770308971406,
"z": 0.08528154343366623
},
"startPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"endPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127165105",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.03248190879821777,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.3001899719238282,
"y": -0.2554539144039154,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": -0.5601793527603149,
"w": 0.8283713459968567
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.5943396091461182,
"wireColorG": 0.18467971682548524,
"wireColorB": 0.12615692615509034,
"wireColorA": 1.0,
"hasCustomColor": true,
"connectionPointScale": 0.004999999888241291,
"startPointColorR": 0.7830188274383545,
"startPointColorG": 0.7830188274383545,
"startPointColorB": 0.7830188274383545,
"endPointColorR": 0.7830188274383545,
"endPointColorG": 0.7830188274383545,
"endPointColorB": 0.7830188274383545
},
{
"startInterfaceName": "chudian240",
"endInterfaceName": "chudian231",
"startConnectionPointPosition": {
"x": -1.2700444459915162,
"y": -0.24335770308971406,
"z": 0.09028154611587525
},
"endConnectionPointPosition": {
"x": -1.2912330627441407,
"y": -0.26317930221557619,
"z": 0.08528154343366623
},
"startPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"endPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127165220",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.014507354237139225,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.2806386947631837,
"y": -0.2532685101032257,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": 0.9173758625984192,
"w": 0.39802202582359316
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.6112549304962158,
"wireColorG": 0.4606019854545593,
"wireColorB": 0.07094951719045639,
"wireColorA": 1.0,
"hasCustomColor": true,
"connectionPointScale": 0.004999999888241291,
"startPointColorR": 0.7830188274383545,
"startPointColorG": 0.7830188274383545,
"startPointColorB": 0.7830188274383545,
"endPointColorR": 0.7830188274383545,
"endPointColorG": 0.7830188274383545,
"endPointColorB": 0.7830188274383545
},
{
"startInterfaceName": "chudian231",
"endInterfaceName": "chudian234",
"startConnectionPointPosition": {
"x": -1.2912330627441407,
"y": -0.26317930221557619,
"z": 0.09028154611587525
},
"endConnectionPointPosition": {
"x": -1.2700444459915162,
"y": -0.26317930221557619,
"z": 0.08528154343366623
},
"startPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"endPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127165450",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.010594308376312256,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.2806386947631837,
"y": -0.26317930221557619,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": -0.7071068286895752,
"w": 0.7071068286895752
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.5943396091461182,
"wireColorG": 0.18467977643013,
"wireColorB": 0.1261569857597351,
"wireColorA": 1.0,
"hasCustomColor": true,
"connectionPointScale": 0.004999999888241291,
"startPointColorR": 0.7830188274383545,
"startPointColorG": 0.7830188274383545,
"startPointColorB": 0.7830188274383545,
"endPointColorR": 0.7830188274383545,
"endPointColorG": 0.7830188274383545,
"endPointColorB": 0.7830188274383545
},
{
"startInterfaceName": "chudian234",
"endInterfaceName": "chudian236",
"startConnectionPointPosition": {
"x": -1.2700444459915162,
"y": -0.26317930221557619,
"z": 0.09028154611587525
},
"endConnectionPointPosition": {
"x": -1.2913323640823365,
"y": -0.3188800513744354,
"z": 0.08528154343366623
},
"startPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"endPoint": {
"x": 0.0,
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127165501",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.029815049842000009,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.2806884050369263,
"y": -0.291029691696167,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": 0.9833881855010986,
"w": 0.18151508271694184
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.03410438448190689,
"wireColorG": 0.03504699096083641,
"wireColorB": 0.029494885355234147,
"wireColorA": 1.0,
"hasCustomColor": true,
"connectionPointScale": 0.004999999888241291,
@ -291,6 +639,6 @@
"endPointColorB": 0.7830188274383545
}
],
"wireCount": 5,
"wireCount": 11,
"sceneName": "xianchang"
}

File diff suppressed because one or more lines are too long