This commit is contained in:
2274240467@qq.com 2025-11-28 13:25:55 +08:00
commit 62363b2beb
19 changed files with 8125 additions and 2026 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()

File diff suppressed because it is too large Load Diff

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");
@ -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,37 @@ void UpdateSnapPreview()
{
highlightDuration = Mathf.Max(0.1f, duration);
}
public void SetColor_Model(string color)
{
if (currentState != DrawingState.Idle)
{
return;
}
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": "chudian231",
"endInterfaceName": "chudian227",
"startConnectionPointPosition": {
"x": -1.3185701370239258,
"y": -0.26755011081695559,
"x": -1.2912330627441407,
"y": -0.26317930221557619,
"z": 0.08528154343366623
},
"endConnectionPointPosition": {
"x": -1.2912330627441407,
"y": -0.26317930221557619,
"x": -1.3185701370239258,
"y": -0.2905614376068115,
"z": 0.08528154343366623
},
"startPoint": {
@ -23,7 +23,65 @@
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127134949",
"wireName": "Wire_20251127170856",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.019346168264746667,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.3049015998840333,
"y": -0.27687036991119387,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": 0.9240370392799377,
"w": 0.38230299949645998
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.5943396091461182,
"wireColorG": 0.18467965722084046,
"wireColorB": 0.12615686655044557,
"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": "chudian220",
"startConnectionPointPosition": {
"x": -1.2912330627441407,
"y": -0.26317930221557619,
"z": 0.09028154611587525
},
"endConnectionPointPosition": {
"x": -1.3185701370239258,
"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_20251127170859",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.013842142187058926,
@ -37,17 +95,23 @@
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": -0.6488911509513855,
"w": 0.760881245136261
"z": 0.760881245136261,
"w": 0.6488911509513855
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": false,
"hasEndInterface": false,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
<<<<<<< HEAD
"wireColorR": 0.5943396091461182,
"wireColorG": 0.18467941880226136,
"wireColorB": 0.12615662813186646,
=======
"wireColorR": 0.6112549304962158,
"wireColorG": 0.4606019854545593,
"wireColorB": 0.07094945758581162,
>>>>>>> 71a99fcbab81574d126fb3d30b37eb20af98fb70
"wireColorA": 1.0,
"hasCustomColor": true,
"connectionPointScale": 0.004999999888241291,
@ -59,6 +123,7 @@
"endPointColorB": 0.7830188274383545
},
{
<<<<<<< HEAD
"startInterfaceName": "",
"endInterfaceName": "",
"startConnectionPointPosition": {
@ -177,14 +242,18 @@
{
"startInterfaceName": "",
"endInterfaceName": "",
=======
"startInterfaceName": "chudian220",
"endInterfaceName": "chudian228",
>>>>>>> 71a99fcbab81574d126fb3d30b37eb20af98fb70
"startConnectionPointPosition": {
"x": -1.3185701370239258,
"y": -0.3104493021965027,
"y": -0.26755011081695559,
"z": 0.09028154611587525
},
"endConnectionPointPosition": {
"x": -1.3627458810806275,
"y": -0.3050294816493988,
"y": -0.2951911687850952,
"z": 0.08528154343366623
},
"startPoint": {
@ -197,31 +266,37 @@
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127134952",
"wireName": "Wire_20251127170903",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.02225348725914955,
"y": 0.02605534717440605,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.3406579494476319,
"y": -0.30773937702178957,
"y": -0.2813706398010254,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": 0.662655770778656,
"w": 0.7489241361618042
"z": 0.8747655749320984,
"w": 0.48454639315605166
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": false,
"hasEndInterface": false,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
<<<<<<< HEAD
"wireColorR": 0.5943396091461182,
"wireColorG": 0.18467941880226136,
"wireColorB": 0.12615662813186646,
=======
"wireColorR": 0.03410438448190689,
"wireColorG": 0.03504699096083641,
"wireColorB": 0.029494885355234147,
>>>>>>> 71a99fcbab81574d126fb3d30b37eb20af98fb70
"wireColorA": 1.0,
"hasCustomColor": true,
"connectionPointScale": 0.004999999888241291,
@ -233,16 +308,16 @@
"endPointColorB": 0.7830188274383545
},
{
"startInterfaceName": "",
"endInterfaceName": "",
"startInterfaceName": "chudian228",
"endInterfaceName": "chudian232",
"startConnectionPointPosition": {
"x": -1.3303356170654297,
"y": -0.26755011081695559,
"z": 0.08528154343366623
"x": -1.3627458810806275,
"y": -0.2951911687850952,
"z": 0.09028154611587525
},
"endConnectionPointPosition": {
"x": -1.382118821144104,
"y": -0.2516351342201233,
"x": -1.378318190574646,
"y": -0.2723008692264557,
"z": 0.08528154343366623
},
"startPoint": {
@ -255,26 +330,258 @@
"y": 0.0,
"z": 0.0
},
"wireName": "Wire_20251127135401",
"wireName": "Wire_20251127170906",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.027086835354566575,
"y": 0.01384253054857254,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.356227159500122,
"y": -0.25959262251853945,
"x": -1.3705320358276368,
"y": -0.28374600410461428,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": 0.594231903553009,
"w": 0.8042938113212586
"z": 0.2942698299884796,
"w": 0.9557223916053772
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": false,
"hasEndInterface": false,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.05406717211008072,
"wireColorG": 0.4245281517505646,
"wireColorB": 0.15887632966041566,
"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": "chudian244",
"startConnectionPointPosition": {
"x": -1.2700444459915162,
"y": -0.24335770308971406,
"z": 0.08528154343366623
},
"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_20251127172103",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.02434980869293213,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.2943942546844483,
"y": -0.24335770308971406,
"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.6112549304962158,
"wireColorG": 0.4606019854545593,
"wireColorB": 0.070949487388134,
"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": "chudian213",
"endInterfaceName": "chudian235",
"startConnectionPointPosition": {
"x": -1.2700444459915162,
"y": -0.25326845049858096,
"z": 0.08528154343366623
},
"endConnectionPointPosition": {
"x": -1.3187440633773804,
"y": -0.25326845049858096,
"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_20251127172109",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.02434980869293213,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.2943942546844483,
"y": -0.25326845049858096,
"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.03410438448190689,
"wireColorG": 0.03504699096083641,
"wireColorB": 0.029494885355234147,
"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": "chudian217",
"startConnectionPointPosition": {
"x": -1.3303356170654297,
"y": -0.26755011081695559,
"z": 0.08528154343366623
},
"endConnectionPointPosition": {
"x": -1.382118821144104,
"y": -0.26208674907684328,
"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_20251127172213",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.026035305112600328,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.356227159500122,
"y": -0.2648184299468994,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": 0.6689834594726563,
"w": 0.7432772517204285
},
"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,
"startPointColorR": 0.7830188274383545,
"startPointColorG": 0.7830188274383545,
"startPointColorB": 0.7830188274383545,
"endPointColorR": 0.7830188274383545,
"endPointColorG": 0.7830188274383545,
"endPointColorB": 0.7830188274383545
},
{
"startInterfaceName": "chudian222",
"endInterfaceName": "chudian208",
"startConnectionPointPosition": {
"x": -1.382118821144104,
"y": -0.2516351342201233,
"z": 0.08528154343366623
},
"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_20251127172216",
"cylinderScale": {
"x": 0.0020000000949949028,
"y": 0.013240980915725232,
"z": 0.0020000000949949028
},
"cylinderPosition": {
"x": -1.394233226776123,
"y": -0.25697973370552065,
"z": 0.08528154343366623
},
"cylinderRotation": {
"x": 0.0,
"y": 0.0,
"z": 0.8377472162246704,
"w": 0.5460582375526428
},
"cylinderRadius": 0.0020000000949949028,
"hasStartInterface": true,
"hasEndInterface": true,
"debugInfo": "从 CylinderWireData 组件获取",
"wireType": "CylinderWireData",
"wireColorR": 0.5943396091461182,
@ -697,6 +1004,11 @@
"endPointColorB": 0.7830188274383545
}
],
<<<<<<< HEAD
"wireCount": 12,
"sceneName": "xianchang-TSQ"
=======
"wireCount": 8,
"sceneName": "xianchang"
>>>>>>> 71a99fcbab81574d126fb3d30b37eb20af98fb70
}

View File

@ -2,14 +2,15 @@
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2180264
Material:
serializedVersion: 6
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: LiberationSans SDF Material
m_Shader: {fileID: 4800000, guid: fe393ace9b354375a9cb14cdbbc28be4, type: 3}
m_ShaderKeywords:
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 1
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
@ -67,6 +68,7 @@ Material:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _Ambient: 0.5
- _Bevel: 0.5
@ -107,9 +109,9 @@ Material:
- _Parallax: 0.02
- _PerspectiveFilter: 0.875
- _Reflectivity: 10
- _ScaleRatioA: 0.90909094
- _ScaleRatioA: 0.9
- _ScaleRatioB: 0.73125
- _ScaleRatioC: 0.7386364
- _ScaleRatioC: 0.73125
- _ScaleX: 1
- _ScaleY: 1
- _ShaderFlags: 0
@ -148,6 +150,7 @@ Material:
- _ReflectOutlineColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecularColor: {r: 1, g: 1, b: 1, a: 1}
- _UnderlayColor: {r: 0, g: 0, b: 0, a: 0.5}
m_BuildTextureStacks: []
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
@ -165,15 +168,16 @@ MonoBehaviour:
materialHashCode: 462855346
m_Version: 1.1.0
m_SourceFontFileGUID: e3265ab4bf004d28a9537516768c1c75
m_SourceFontFile_EditorRef: {fileID: 12800000, guid: e3265ab4bf004d28a9537516768c1c75,
type: 3}
m_SourceFontFile_EditorRef: {fileID: 12800000, guid: e3265ab4bf004d28a9537516768c1c75, type: 3}
m_SourceFontFile: {fileID: 12800000, guid: e3265ab4bf004d28a9537516768c1c75, type: 3}
m_AtlasPopulationMode: 1
m_FaceInfo:
m_FaceIndex: 0
m_FamilyName: Liberation Sans
m_StyleName: Regular
m_PointSize: 86
m_Scale: 1
m_UnitsPerEM: 0
m_LineHeight: 98.8916
m_AscentLine: 77.853516
m_CapLine: 59
@ -313,15 +317,20 @@ Texture2D:
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
serializedVersion: 2
m_IsAlphaChannelOptional: 0
serializedVersion: 3
m_Width: 0
m_Height: 0
m_CompleteImageSize: 0
m_MipsStripped: 0
m_TextureFormat: 1
m_MipCount: 1
m_IsReadable: 1
m_IsPreProcessed: 0
m_IgnoreMasterTextureLimit: 0
m_StreamingMipmaps: 0
m_StreamingMipmapsPriority: 0
m_VTOnly: 0
m_AlphaIsTransparency: 0
m_ImageCount: 1
m_TextureDimension: 2
@ -335,9 +344,14 @@ Texture2D:
m_WrapW: 0
m_LightmapFormat: 0
m_ColorSpace: 0
m_PlatformBlob:
image data: 0
_typelessdata:
m_StreamData:
serializedVersion: 2
offset: 0
size: 0
path:
m_OriginalWidth: 0
m_OriginalHeight: 0
m_OriginalAssetGuid: 00000000000000000000000000000000