From 8a6aa9b7ce3e45d33c2391023b7f9789815cf144 Mon Sep 17 00:00:00 2001 From: lujiajian <204551278@qq.com> Date: Fri, 28 Nov 2025 16:00:32 +0800 Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E5=88=86=E8=BF=9E=E7=BA=BF=E5=8F=8D?= =?UTF-8?q?=E9=A6=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scenes/xianchang.unity | 537 +++++++++++++++++- .../Line/ConnectionPointInterfaceReference.cs | 7 +- Assets/Scripts/Line/LineConnect.cs | 20 +- Assets/Scripts/Line/LineManager.cs | 134 ++++- Assets/Scripts/Line/WireDrawingSystem.cs | 13 +- 5 files changed, 692 insertions(+), 19 deletions(-) diff --git a/Assets/Scenes/xianchang.unity b/Assets/Scenes/xianchang.unity index 0a2c3db..4018e18 100644 --- a/Assets/Scenes/xianchang.unity +++ b/Assets/Scenes/xianchang.unity @@ -703,6 +703,8 @@ MonoBehaviour: m_EditorClassIdentifier: point1: {fileID: 0} point2: {fileID: 0} + Tips: {fileID: 1843818177} + TipTexts: {fileID: 328649576} --- !u!114 &140014612 MonoBehaviour: m_ObjectHideFlags: 0 @@ -975,6 +977,19 @@ BoxCollider: serializedVersion: 2 m_Size: {x: 1.0980034, y: 1.0442657, z: 0.31353617} m_Center: {x: -0.000003874302, y: -0.0000032782555, z: 0.13375765} +--- !u!114 &170747685 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 170747680} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6282401d280c18d488e073bf54edbc11, type: 3} + m_Name: + m_EditorClassIdentifier: + interfaceType: 15 --- !u!1 &189223157 stripped GameObject: m_CorrespondingSourceObject: {fileID: 6501468878996255, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} @@ -993,6 +1008,19 @@ BoxCollider: serializedVersion: 2 m_Size: {x: 1.0980034, y: 1.0442657, z: 0.31353664} m_Center: {x: 0.000004529953, y: -0.00001090765, z: 0.13375789} +--- !u!114 &189223162 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 189223157} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6282401d280c18d488e073bf54edbc11, type: 3} + m_Name: + m_EditorClassIdentifier: + interfaceType: 16 --- !u!1 &195981657 GameObject: m_ObjectHideFlags: 0 @@ -1359,7 +1387,7 @@ GameObject: m_Component: - component: {fileID: 244553710} m_Layer: 0 - m_Name: banzi07 (1) + m_Name: banzi07 m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -1494,6 +1522,141 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 309747185} m_Mesh: {fileID: 7746523985622863035, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} +--- !u!1 &328649574 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 328649575} + - component: {fileID: 328649577} + - component: {fileID: 328649576} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &328649575 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328649574} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 527703068} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &328649576 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328649574} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: "\u8D26\u53F7\u6216\u5BC6\u7801\u9519\u8BEF" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 3cee325aec3da104caa0494ae88f026d, type: 2} + m_sharedMaterial: {fileID: 1716905042458031195, guid: 3cee325aec3da104caa0494ae88f026d, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4294967295 + m_fontColor: {r: 1, g: 1, b: 1, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 66 + m_fontSizeBase: 66 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &328649577 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 328649574} + m_CullTransparentMesh: 1 --- !u!1001 &379506783 PrefabInstance: m_ObjectHideFlags: 0 @@ -2200,6 +2363,83 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 517604011} m_Mesh: {fileID: 8418363027437880420, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} +--- !u!1 &527703067 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 527703068} + - component: {fileID: 527703070} + - component: {fileID: 527703069} + m_Layer: 5 + m_Name: Image + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &527703068 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 527703067} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 328649575} + m_Father: {fileID: 1843818178} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0.5} + m_AnchorMax: {x: 0.5, y: 0.5} + m_AnchoredPosition: {x: 0.000022917986, y: 89.91107} + m_SizeDelta: {x: 1920, y: 179.8221} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &527703069 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 527703067} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0.5803922} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 21300000, guid: fa34004fdd35d984ba1cb8d1cefdec76, type: 3} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &527703070 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 527703067} + m_CullTransparentMesh: 1 --- !u!1 &561287910 GameObject: m_ObjectHideFlags: 0 @@ -2661,6 +2901,19 @@ BoxCollider: serializedVersion: 2 m_Size: {x: 1.0980034, y: 1.0442657, z: 0.31353664} m_Center: {x: -0.000019073486, y: 0.000004172325, z: 0.13375789} +--- !u!114 &754513124 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 754513119} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6282401d280c18d488e073bf54edbc11, type: 3} + m_Name: + m_EditorClassIdentifier: + interfaceType: 8 --- !u!1 &769986614 GameObject: m_ObjectHideFlags: 0 @@ -3017,6 +3270,37 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 845795817} m_Mesh: {fileID: 5872381628547774870, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} +--- !u!1 &849744623 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 3559288283342111418, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} + m_PrefabInstance: {fileID: 1045066281} + m_PrefabAsset: {fileID: 0} +--- !u!65 &849744627 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 849744623} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 0.7616043, y: 0.7243347, z: 0.19907904} + m_Center: {x: 0.000015258789, y: -0.0000019073486, z: -0.00000667572} +--- !u!114 &849744628 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 849744623} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6282401d280c18d488e073bf54edbc11, type: 3} + m_Name: + m_EditorClassIdentifier: + interfaceType: 42 --- !u!1 &853107033 stripped GameObject: m_CorrespondingSourceObject: {fileID: -5266785677919700964, guid: b11e3115ad4164947957f5e35d5527cf, type: 3} @@ -3803,10 +4087,18 @@ PrefabInstance: propertyPath: m_Name value: "\u81EA\u63A7\u539F\u7406 (1)" objectReference: {fileID: 0} + - target: {fileID: 3559288283342111418, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} + propertyPath: m_Layer + value: 6 + objectReference: {fileID: 0} - target: {fileID: 6073914910648615971, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} propertyPath: m_Layer value: 6 objectReference: {fileID: 0} + - target: {fileID: 7974939196781025842, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} + propertyPath: m_Layer + value: 6 + objectReference: {fileID: 0} m_RemovedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} --- !u!4 &1045066282 stripped @@ -3814,6 +4106,68 @@ Transform: m_CorrespondingSourceObject: {fileID: -8679921383154817045, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} m_PrefabInstance: {fileID: 1045066281} m_PrefabAsset: {fileID: 0} +--- !u!1 &1045066283 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 7974939196781025842, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} + m_PrefabInstance: {fileID: 1045066281} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1045066284 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1045066283} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6282401d280c18d488e073bf54edbc11, type: 3} + m_Name: + m_EditorClassIdentifier: + interfaceType: 41 +--- !u!65 &1045066285 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1045066283} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1.6609268, y: 9.14378, z: 2.3236628} + m_Center: {x: -0.000015318394, y: -0.0000019073486, z: -0.3833654} +--- !u!1 &1075926901 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: -3176553419678292264, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} + m_PrefabInstance: {fileID: 1045066281} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1075926905 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1075926901} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6282401d280c18d488e073bf54edbc11, type: 3} + m_Name: + m_EditorClassIdentifier: + interfaceType: 43 +--- !u!65 &1075926906 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1075926901} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 0.76161194, y: 0.7243271, z: 0.19907904} + m_Center: {x: -0.000015258789, y: 0.0000038146973, z: -0.00000667572} --- !u!1 &1172298543 GameObject: m_ObjectHideFlags: 0 @@ -4251,6 +4605,19 @@ BoxCollider: serializedVersion: 2 m_Size: {x: 1.0980034, y: 1.0442657, z: 0.31353664} m_Center: {x: -0.000019073486, y: -0.00001090765, z: 0.13375789} +--- !u!114 &1287486851 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1287486846} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6282401d280c18d488e073bf54edbc11, type: 3} + m_Name: + m_EditorClassIdentifier: + interfaceType: 14 --- !u!1 &1292734983 stripped GameObject: m_CorrespondingSourceObject: {fileID: 6073914910648615971, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} @@ -4269,6 +4636,19 @@ BoxCollider: serializedVersion: 2 m_Size: {x: 1.0980034, y: 1.0442657, z: 0.31353664} m_Center: {x: 0.000004529953, y: 0.000004172325, z: 0.13375789} +--- !u!114 &1292734988 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1292734983} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6282401d280c18d488e073bf54edbc11, type: 3} + m_Name: + m_EditorClassIdentifier: + interfaceType: 16 --- !u!65 &1303211144 BoxCollider: m_ObjectHideFlags: 0 @@ -4737,6 +5117,37 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1359383647} m_CullTransparentMesh: 1 +--- !u!1 &1396714429 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 8304324904651862010, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} + m_PrefabInstance: {fileID: 1045066281} + m_PrefabAsset: {fileID: 0} +--- !u!65 &1396714433 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1396714429} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 1.0980015, y: 1.0442657, z: 0.31353664} + m_Center: {x: 0.00000423193, y: 0.000002503395, z: 0.13375789} +--- !u!114 &1396714434 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1396714429} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6282401d280c18d488e073bf54edbc11, type: 3} + m_Name: + m_EditorClassIdentifier: + interfaceType: 25 --- !u!1 &1416330993 GameObject: m_ObjectHideFlags: 0 @@ -5057,7 +5468,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6282401d280c18d488e073bf54edbc11, type: 3} m_Name: m_EditorClassIdentifier: - interfaceType: 21 + interfaceType: 25 --- !u!65 &1515177978 BoxCollider: m_ObjectHideFlags: 0 @@ -5121,6 +5532,37 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1515177975} m_Mesh: {fileID: 8419009533998702215, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} +--- !u!1 &1615636842 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: -7848099655778327179, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} + m_PrefabInstance: {fileID: 1045066281} + m_PrefabAsset: {fileID: 0} +--- !u!114 &1615636846 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1615636842} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6282401d280c18d488e073bf54edbc11, type: 3} + m_Name: + m_EditorClassIdentifier: + interfaceType: 45 +--- !u!65 &1615636847 +BoxCollider: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1615636842} + m_Material: {fileID: 0} + m_IsTrigger: 0 + m_Enabled: 1 + serializedVersion: 2 + m_Size: {x: 0.7616043, y: 0.7243271, z: 0.19907904} + m_Center: {x: 0, y: 0.0000038146973, z: -0.00000667572} --- !u!1 &1678785025 GameObject: m_ObjectHideFlags: 0 @@ -5862,6 +6304,83 @@ MeshFilter: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1818029205} m_Mesh: {fileID: -8847060368604407671, guid: e908463f3f6b7e54cb2ffaa2e941c53e, type: 3} +--- !u!1 &1843818177 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1843818178} + - component: {fileID: 1843818180} + - component: {fileID: 1843818179} + m_Layer: 5 + m_Name: "\u9519\u8BEF\u63D0\u793A" + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &1843818178 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1843818177} + m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 527703068} + m_Father: {fileID: 1914064699} + m_RootOrder: 1 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &1843818179 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1843818177} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.4528302, g: 0.44215024, b: 0.44215024, a: 0.15686275} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_Sprite: {fileID: 0} + m_Type: 0 + m_PreserveAspect: 0 + m_FillCenter: 1 + m_FillMethod: 4 + m_FillAmount: 1 + m_FillClockwise: 1 + m_FillOrigin: 0 + m_UseSpriteMesh: 0 + m_PixelsPerUnitMultiplier: 1 +--- !u!222 &1843818180 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1843818177} + m_CullTransparentMesh: 1 --- !u!1 &1914064695 GameObject: m_ObjectHideFlags: 0 @@ -5956,6 +6475,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1359383648} + - {fileID: 1843818178} m_Father: {fileID: 0} m_RootOrder: 13 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -6825,6 +7345,19 @@ BoxCollider: serializedVersion: 2 m_Size: {x: 1.0980034, y: 1.0442657, z: 0.31353617} m_Center: {x: -0.000003874302, y: 0.000004172325, z: 0.13375765} +--- !u!114 &2096931760 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 2096931755} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 6282401d280c18d488e073bf54edbc11, type: 3} + m_Name: + m_EditorClassIdentifier: + interfaceType: 13 --- !u!1 &2098517107 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Line/ConnectionPointInterfaceReference.cs b/Assets/Scripts/Line/ConnectionPointInterfaceReference.cs index 2797de7..443d738 100644 --- a/Assets/Scripts/Line/ConnectionPointInterfaceReference.cs +++ b/Assets/Scripts/Line/ConnectionPointInterfaceReference.cs @@ -19,8 +19,11 @@ public class ConnectionPointInterfaceReference : MonoBehaviour if (GetComponent() != null) { meshRenderer = GetComponent(); - GameObject Cylinder = transform.parent.Find("WireCylinder").gameObject; - meshRenderer.materials[1].color = Cylinder.GetComponent().material.color; + if (transform.parent != null) + { + GameObject Cylinder = transform.parent.Find("WireCylinder").gameObject; + meshRenderer.materials[1].color = Cylinder.GetComponent().material.color; + } //meshRenderer.materials[1] } } diff --git a/Assets/Scripts/Line/LineConnect.cs b/Assets/Scripts/Line/LineConnect.cs index f1e37cf..b4bf846 100644 --- a/Assets/Scripts/Line/LineConnect.cs +++ b/Assets/Scripts/Line/LineConnect.cs @@ -13,12 +13,15 @@ public enum InterfaceType IN3, IN3_200K, IN4, - _12V,//+12V + 正12V,//+12V GND, GND1, GND2, GND3, - __12V,//-12V + 负12V,//-12V + 正5V, + 负5V, + 零V, UI, UI_100K, UI_01uF, @@ -27,6 +30,7 @@ public enum InterfaceType O1_01uF, O1_1uF, O1_10uF, + OUT, OUT1, OUT2, O1, @@ -43,17 +47,17 @@ public enum InterfaceType _200K_end, _250K_star, _250K_end, + 转换板, + III, + AD1, + AD2 } public class LineConnect : MonoBehaviour { public InterfaceType interfaceType = InterfaceType.None; private void OnMouseDown() { - //LineManager.instance.ClickPoint(transform); - } - - private void Update() - { - + Debug.Log(transform.name); + LineManager.instance.ClickPoint(transform); } } diff --git a/Assets/Scripts/Line/LineManager.cs b/Assets/Scripts/Line/LineManager.cs index c83d49e..09dd613 100644 --- a/Assets/Scripts/Line/LineManager.cs +++ b/Assets/Scripts/Line/LineManager.cs @@ -1,5 +1,7 @@ +using System; using System.Collections; using System.Collections.Generic; +using TMPro; using UnityEngine; public class LineManager : MonoBehaviour @@ -7,17 +9,27 @@ public class LineManager : MonoBehaviour public static LineManager instance; public Transform point1; public Transform point2; + public GameObject Tips; + public TextMeshProUGUI TipTexts; private void Awake() { instance = this; } void Start() { - + //// 测试连接 + //TestConnection(InterfaceType.IN1, InterfaceType.OUT1); // 应该正确 + //TestConnection(InterfaceType.IN1, InterfaceType.GND); // 应该错误 + //TestConnection(InterfaceType.正12V, InterfaceType.GND); // 应该正确 + //TestConnection(InterfaceType._1uF_star, InterfaceType._1uF_end); // 应该正确 } void Update() { - + if (Input.GetMouseButtonDown(2)) + { + point1 = null; + point2 = null; + } } /// /// 鼠标点击的物体 @@ -35,16 +47,130 @@ public class LineManager : MonoBehaviour } if (point1 != null && point2 != null) { - Checkconnection(point1, point2); + StartCoroutine(Checkconnection(point1, point2)); } } - public void Checkconnection(Transform transform, Transform transform2) + IEnumerator Checkconnection(Transform transform, Transform transform2) { + LineConnect line = transform.GetComponent(); + LineConnect line2 = transform2.GetComponent(); + if (line != null && line2 != null) + { + if (!JudgmentLine(line, line2)) + { + Tips.SetActive(true); + yield return new WaitForSeconds(2); + Tips.SetActive(false); + } + + } } + public bool JudgmentLine(LineConnect line1, LineConnect line2) + { + Init(); + if (line1.interfaceType == InterfaceType.负12V && line2.interfaceType != InterfaceType.负12V || + line2.interfaceType == InterfaceType.负12V && line1.interfaceType != InterfaceType.负12V) + { + TipTexts.text = "连接错误,-12V应该与-12V相连!"; + //WireDrawingSystem.instance.currentState = WireDrawingSystem.DrawingState.Idle; + WireDrawingSystem.instance.HandleDelete(); + WireDrawingSystem.instance.ClearSnapPreview(); + return false; + } + else if (line1.interfaceType == InterfaceType.正12V && line2.interfaceType != InterfaceType.正12V + || line2.interfaceType == InterfaceType.正12V && line1.interfaceType != InterfaceType.正12V + ) + { + TipTexts.text = "连接错误,12V应该与12V相连!"; + //WireDrawingSystem.instance.currentState = WireDrawingSystem.DrawingState.Idle; + WireDrawingSystem.instance.HandleDelete(); + WireDrawingSystem.instance.ClearSnapPreview(); + return false; + } + else if (line1.interfaceType == InterfaceType.零V && line2.interfaceType != InterfaceType.GND + || line2.interfaceType == InterfaceType.GND && line1.interfaceType != InterfaceType.零V) + { + TipTexts.text = "连接错误,0V应该与GND相连!"; + // WireDrawingSystem.instance.currentState = WireDrawingSystem.DrawingState.Idle; + WireDrawingSystem.instance.HandleDelete(); + WireDrawingSystem.instance.ClearSnapPreview(); + return false; + } + else if (line1.interfaceType == InterfaceType.IN2_200K && line2.interfaceType != InterfaceType.OUT1 + || line2.interfaceType == InterfaceType.IN2_200K && line1.interfaceType != InterfaceType.OUT1) + { + TipTexts.text = "连接错误,200K应该与OUT1相连!"; + //WireDrawingSystem.instance.currentState = WireDrawingSystem.DrawingState.Idle; + WireDrawingSystem.instance.HandleDelete(); + WireDrawingSystem.instance.ClearSnapPreview(); + return false; + } + else if (line1.interfaceType == InterfaceType.OUT1 && line2.interfaceType != InterfaceType.IN4 + || line2.interfaceType == InterfaceType.OUT1 && line1.interfaceType != InterfaceType.IN4) + { + TipTexts.text = "连接错误,OUT1应该与IN4相连!"; + // WireDrawingSystem.instance.currentState = WireDrawingSystem.DrawingState.Idle; + WireDrawingSystem.instance.HandleDelete(); + WireDrawingSystem.instance.ClearSnapPreview(); + return false; + } + else if (line1.interfaceType == InterfaceType.AD1 && line2.interfaceType != InterfaceType.OUT2 +|| line2.interfaceType == InterfaceType.AD1 && line1.interfaceType != InterfaceType.OUT2) + { + TipTexts.text = "连接错误,200K应该与OUT1相连!"; + //WireDrawingSystem.instance.currentState = WireDrawingSystem.DrawingState.Idle; + WireDrawingSystem.instance.HandleDelete(); + WireDrawingSystem.instance.ClearSnapPreview(); + return false; + } + else if (line1.interfaceType == InterfaceType.零V && line2.interfaceType != InterfaceType.GND + || line2.interfaceType == InterfaceType.GND && line1.interfaceType != InterfaceType.零V) + { + TipTexts.text = "连接错误,0V应该与GND相连!"; + //WireDrawingSystem.instance.currentState = WireDrawingSystem.DrawingState.Idle; + WireDrawingSystem.instance.HandleDelete(); + WireDrawingSystem.instance.ClearSnapPreview(); + return false; + } + else if (line1.interfaceType == InterfaceType.OUT && line2.interfaceType != InterfaceType.IN1 + || line2.interfaceType == InterfaceType.OUT && line1.interfaceType != InterfaceType.IN1) + { + TipTexts.text = "连接错误,OUT应该与IN1相连!"; + // WireDrawingSystem.instance.currentState = WireDrawingSystem.DrawingState.Idle; + WireDrawingSystem.instance.HandleDelete(); + WireDrawingSystem.instance.ClearSnapPreview(); + return false; + } + else if (line1.interfaceType == InterfaceType.AD2 && line2.interfaceType != InterfaceType.IN1 +|| line2.interfaceType == InterfaceType.AD2 && line1.interfaceType != InterfaceType.IN1) + { + TipTexts.text = "连接错误,OUT应该与IN1相连!"; + // WireDrawingSystem.instance.currentState = WireDrawingSystem.DrawingState.Idle; + WireDrawingSystem.instance.HandleDelete(); + WireDrawingSystem.instance.ClearSnapPreview(); + return false; + } + else if ((line1.interfaceType != InterfaceType.AD2 || line1.interfaceType != InterfaceType.OUT || line1.interfaceType != InterfaceType.零V + || line1.interfaceType != InterfaceType.AD1 || line1.interfaceType != InterfaceType.OUT1 || line1.interfaceType != InterfaceType.IN2_200K || + line1.interfaceType != InterfaceType.正12V || line1.interfaceType != InterfaceType.负12V) && (line2.interfaceType != InterfaceType.AD2 || line2.interfaceType != InterfaceType.OUT || line2.interfaceType != InterfaceType.零V + || line2.interfaceType != InterfaceType.AD1 || line2.interfaceType != InterfaceType.OUT1 || line2.interfaceType != InterfaceType.IN2_200K || + line2.interfaceType != InterfaceType.正12V || line2.interfaceType != InterfaceType.负12V)) + { + TipTexts.text = "连接错误,不需要此连线"; + // WireDrawingSystem.instance.currentState = WireDrawingSystem.DrawingState.Idle; + WireDrawingSystem.instance.HandleDelete(); + WireDrawingSystem.instance.ClearSnapPreview(); + return false; + } + else + { + return true; + } + } public void Init() { point2 = null; diff --git a/Assets/Scripts/Line/WireDrawingSystem.cs b/Assets/Scripts/Line/WireDrawingSystem.cs index 8db2913..cdc4531 100644 --- a/Assets/Scripts/Line/WireDrawingSystem.cs +++ b/Assets/Scripts/Line/WireDrawingSystem.cs @@ -131,6 +131,13 @@ public class WireDrawingSystem : MonoBehaviour // 移除原来的LineRenderer相关设置,或者保留作为备选 [Header("传统连线设置(备选)")] public bool useLineRenderer = false; + + public static WireDrawingSystem instance; + + private void Awake() + { + instance = this; + } void Update() { HandleInput(); @@ -626,7 +633,7 @@ public class WireDrawingSystem : MonoBehaviour /// /// 处理删除操作 /// - void HandleDelete() + public void HandleDelete() { // 首先清除所有高亮,确保颜色恢复 ClearAllHighlights(); @@ -1734,7 +1741,7 @@ public class WireDrawingSystem : MonoBehaviour Debug.Log($"连线完成: {currentWireObject.name}"); } // 修改 CancelDrawing 方法,确保正确清理 - void CancelDrawing() + public void CancelDrawing() { if (currentWireObject != null) { @@ -1829,7 +1836,7 @@ public class WireDrawingSystem : MonoBehaviour /// /// 清除吸附点预览 /// - void ClearSnapPreview() + public void ClearSnapPreview() { if (currentSnapPreview != null) {