From 5198a80318131895db6aadb001bcbdda9cb3d35f Mon Sep 17 00:00:00 2001 From: GanX <2423855310@qq.com> Date: Wed, 22 Oct 2025 17:34:58 +0800 Subject: [PATCH] =?UTF-8?q?refactor(Facility):=20=E4=BD=BF=E7=94=A8?= =?UTF-8?q?=E7=BB=A7=E6=89=BF=E8=AE=A9=E6=89=80=E6=9C=89=E6=9C=BA=E5=85=B3?= =?UTF-8?q?=E9=83=BD=E6=8B=A5=E6=9C=89=E4=BA=86=E7=8B=AC=E8=87=AA=E7=9A=84?= =?UTF-8?q?=20=E5=8F=AF=E4=BA=A4=E4=BA=92=20=E5=8F=AF=E7=BC=96=E8=BE=91=20?= =?UTF-8?q?=E5=8F=AF=E8=BF=9E=E6=8E=A5=E8=AE=BE=E5=AE=9A=E3=80=82=E5=A4=A7?= =?UTF-8?q?=E9=9D=A2=E7=A7=AF=E9=87=8D=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Prefab/Gameplay/Button.prefab | 12 +- Assets/Prefab/Gameplay/Console.prefab | 39 +- Assets/Prefab/Gameplay/Door.prefab | 11 +- Assets/Prefab/Gameplay/Emitter.prefab | 10 +- Assets/Prefab/Gameplay/Lever.prefab | 12 +- Assets/Prefab/Gameplay/MovingPlatform.prefab | 11 +- Assets/Prefab/Gameplay/NumberSlot.prefab | 10 +- Assets/Prefab/Gameplay/PressurePlate.prefab | 11 +- Assets/Prefab/UI/NoEditableComponent.prefab | 667 ++++++++++++++++++ .../Prefab/UI/NoEditableComponent.prefab.meta | 7 + Assets/Prefab/UI/PlayerEditPanelViwer.prefab | 140 ++++ Assets/Scenes/Test.unity | 96 ++- .../Script/Gameplay/Connect/ConnectionLine.cs | 57 +- .../Gameplay/Connect/ConnectionLineManager.cs | 1 + .../Script/Gameplay/Connect/ISignalSender.cs | 8 - .../Gameplay/Edit/BaseFacilityController.cs | 70 -- .../Gameplay/Edit/ButtonInteractController.cs | 119 ---- .../Edit/ColliderEditableController.cs | 24 +- .../Script/Gameplay/Edit/ConsoleController.cs | 109 --- .../Gameplay/Edit/DoorInteractController.cs | 118 ---- .../Edit/InteractableBaseController.cs | 30 - .../Edit/InteractableBaseController.cs.meta | 3 - .../Gameplay/Edit/LeverInteractController.cs | 99 --- .../Gameplay/Edit/PressurePlateController.cs | 90 --- .../Edit/RigidbodyEditableController.cs | 29 +- Assets/Script/Gameplay/Facility.meta | 3 + .../Facility/BaseFacilityController.cs | 124 ++++ .../BaseFacilityController.cs.meta | 0 .../Facility/ButtonInteractController.cs | 38 + .../ButtonInteractController.cs.meta | 0 .../Gameplay/Facility/ConsoleController.cs | 50 ++ .../ConsoleController.cs.meta | 0 .../Facility/DoorInteractController.cs | 58 ++ .../DoorInteractController.cs.meta | 0 .../{Edit => Facility}/EmitterController.cs | 26 +- .../EmitterController.cs.meta | 0 .../Facility/LeverInteractController.cs | 36 + .../LeverInteractController.cs.meta | 0 .../MovingPlatformController.cs | 22 +- .../MovingPlatformController.cs.meta | 0 .../NumberSlotController.cs | 34 +- .../NumberSlotController.cs.meta | 0 .../Facility/PressurePlateController.cs | 35 + .../PressurePlateController.cs.meta | 0 .../{Connect => Interface}/IConnectable.cs | 9 +- .../IConnectable.cs.meta | 0 .../Gameplay/Interface/IEditableComponent.cs | 6 +- Assets/Script/Gameplay/Interface/IGaze.cs | 6 + .../Script/Gameplay/Interface/IGaze.cs.meta | 11 + .../Gameplay/Interface/IInteractable.cs | 3 +- .../{Connect => Interface}/ISignalReceiver.cs | 2 +- .../ISignalReceiver.cs.meta | 0 .../Gameplay/Interface/ISignalSender.cs | 8 + .../ISignalSender.cs.meta | 0 .../Player/PlayerConnectController.cs | 45 +- .../Gameplay/Player/PlayerEditController.cs | 38 +- .../Player/PlayerInteractorController.cs | 31 +- .../Player/PlayerWatchModeController.cs | 4 +- .../Gameplay/UI/EditableComponentViewer.cs | 4 +- .../Script/Gameplay/UI/PlayerConnectViewer.cs | 1 + Assets/Script/Gameplay/UI/PlayerEditViewer.cs | 28 +- 61 files changed, 1516 insertions(+), 889 deletions(-) create mode 100644 Assets/Prefab/UI/NoEditableComponent.prefab create mode 100644 Assets/Prefab/UI/NoEditableComponent.prefab.meta delete mode 100644 Assets/Script/Gameplay/Connect/ISignalSender.cs delete mode 100644 Assets/Script/Gameplay/Edit/BaseFacilityController.cs delete mode 100644 Assets/Script/Gameplay/Edit/ButtonInteractController.cs delete mode 100644 Assets/Script/Gameplay/Edit/ConsoleController.cs delete mode 100644 Assets/Script/Gameplay/Edit/DoorInteractController.cs delete mode 100644 Assets/Script/Gameplay/Edit/InteractableBaseController.cs delete mode 100644 Assets/Script/Gameplay/Edit/InteractableBaseController.cs.meta delete mode 100644 Assets/Script/Gameplay/Edit/LeverInteractController.cs delete mode 100644 Assets/Script/Gameplay/Edit/PressurePlateController.cs create mode 100644 Assets/Script/Gameplay/Facility.meta create mode 100644 Assets/Script/Gameplay/Facility/BaseFacilityController.cs rename Assets/Script/Gameplay/{Edit => Facility}/BaseFacilityController.cs.meta (100%) create mode 100644 Assets/Script/Gameplay/Facility/ButtonInteractController.cs rename Assets/Script/Gameplay/{Edit => Facility}/ButtonInteractController.cs.meta (100%) create mode 100644 Assets/Script/Gameplay/Facility/ConsoleController.cs rename Assets/Script/Gameplay/{Edit => Facility}/ConsoleController.cs.meta (100%) create mode 100644 Assets/Script/Gameplay/Facility/DoorInteractController.cs rename Assets/Script/Gameplay/{Edit => Facility}/DoorInteractController.cs.meta (100%) rename Assets/Script/Gameplay/{Edit => Facility}/EmitterController.cs (67%) rename Assets/Script/Gameplay/{Edit => Facility}/EmitterController.cs.meta (100%) create mode 100644 Assets/Script/Gameplay/Facility/LeverInteractController.cs rename Assets/Script/Gameplay/{Edit => Facility}/LeverInteractController.cs.meta (100%) rename Assets/Script/Gameplay/{Edit => Facility}/MovingPlatformController.cs (71%) rename Assets/Script/Gameplay/{Edit => Facility}/MovingPlatformController.cs.meta (100%) rename Assets/Script/Gameplay/{Edit => Facility}/NumberSlotController.cs (51%) rename Assets/Script/Gameplay/{Edit => Facility}/NumberSlotController.cs.meta (100%) create mode 100644 Assets/Script/Gameplay/Facility/PressurePlateController.cs rename Assets/Script/Gameplay/{Edit => Facility}/PressurePlateController.cs.meta (100%) rename Assets/Script/Gameplay/{Connect => Interface}/IConnectable.cs (54%) rename Assets/Script/Gameplay/{Connect => Interface}/IConnectable.cs.meta (100%) create mode 100644 Assets/Script/Gameplay/Interface/IGaze.cs create mode 100644 Assets/Script/Gameplay/Interface/IGaze.cs.meta rename Assets/Script/Gameplay/{Connect => Interface}/ISignalReceiver.cs (79%) rename Assets/Script/Gameplay/{Connect => Interface}/ISignalReceiver.cs.meta (100%) create mode 100644 Assets/Script/Gameplay/Interface/ISignalSender.cs rename Assets/Script/Gameplay/{Connect => Interface}/ISignalSender.cs.meta (100%) diff --git a/Assets/Prefab/Gameplay/Button.prefab b/Assets/Prefab/Gameplay/Button.prefab index 4ffec2a..3602a5b 100644 --- a/Assets/Prefab/Gameplay/Button.prefab +++ b/Assets/Prefab/Gameplay/Button.prefab @@ -119,7 +119,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2791e039b8344f45ad6dc86f5188d82d, type: 3} m_Name: m_EditorClassIdentifier: - isActive: 1 + isEnableEdit: 1 + isOpenInEditor: 1 --- !u!114 &4434834246038522293 MonoBehaviour: m_ObjectHideFlags: 0 @@ -132,6 +133,11 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 7f5359facd804a0cb94d416c9c54a167, type: 3} m_Name: m_EditorClassIdentifier: - Interactable: 1 + isEnableInteract: 1 + isEnableEdit: 1 + isEnableConnect: 1 + isEnablePlayerConnect: 1 + componentName: + needSignalCount: 1 + isOpenInEditor: 1 signalDuration: 1 - isActive: 1 diff --git a/Assets/Prefab/Gameplay/Console.prefab b/Assets/Prefab/Gameplay/Console.prefab index b74856c..748ec47 100644 --- a/Assets/Prefab/Gameplay/Console.prefab +++ b/Assets/Prefab/Gameplay/Console.prefab @@ -11,7 +11,6 @@ GameObject: - component: {fileID: 3847687401012981401} - component: {fileID: 2162166433128526064} - component: {fileID: 6287391807755848414} - - component: {fileID: 1340299133424398822} m_Layer: 0 m_Name: Sphere m_TagString: Untagged @@ -28,7 +27,7 @@ Transform: m_GameObject: {fileID: 4251861204989412305} serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} - m_LocalPosition: {x: 0, y: 0.48, z: 0} + m_LocalPosition: {x: 0, y: 0.45, z: 0} m_LocalScale: {x: 0.47, y: 0.47, z: 0.47} m_ConstrainProportionsScale: 1 m_Children: [] @@ -84,27 +83,6 @@ MeshRenderer: m_SortingLayer: 0 m_SortingOrder: 0 m_AdditionalVertexStreams: {fileID: 0} ---- !u!135 &1340299133424398822 -SphereCollider: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 4251861204989412305} - m_Material: {fileID: 0} - m_IncludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_ExcludeLayers: - serializedVersion: 2 - m_Bits: 0 - m_LayerOverridePriority: 0 - m_IsTrigger: 0 - m_ProvidesContacts: 0 - m_Enabled: 1 - serializedVersion: 3 - m_Radius: 0.5 - m_Center: {x: 0, y: 0, z: 0} --- !u!1 &6268190613584218029 GameObject: m_ObjectHideFlags: 0 @@ -136,7 +114,7 @@ Transform: serializedVersion: 2 m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalPosition: {x: 25, y: 0.8, z: -5} - m_LocalScale: {x: -0.51, y: 0.8, z: 0.46} + m_LocalScale: {x: 0.6, y: 0.6, z: 0.6} m_ConstrainProportionsScale: 0 m_Children: - {fileID: 3847687401012981401} @@ -225,7 +203,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2791e039b8344f45ad6dc86f5188d82d, type: 3} m_Name: m_EditorClassIdentifier: - isActive: 1 + isEnableEdit: 1 + isOpenInEditor: 1 --- !u!114 &3535959014221630543 MonoBehaviour: m_ObjectHideFlags: 0 @@ -238,6 +217,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: cc0b1376aefb4cccb530717966b48bf5, type: 3} m_Name: m_EditorClassIdentifier: + isEnableInteract: 1 + isEnableEdit: 1 + isEnableConnect: 1 + componentName: needSignalCount: 2 - controlTarget: {fileID: 0} - IsActive: 0 + isOpenInEditor: 1 + controlTarget: + - {fileID: 0} + IsBeActive: 0 diff --git a/Assets/Prefab/Gameplay/Door.prefab b/Assets/Prefab/Gameplay/Door.prefab index 2e3642c..59f5450 100644 --- a/Assets/Prefab/Gameplay/Door.prefab +++ b/Assets/Prefab/Gameplay/Door.prefab @@ -119,7 +119,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 3bdc5380046d4cacb0dd579877f320eb, type: 3} m_Name: m_EditorClassIdentifier: - Interactable: 1 + isEnableInteract: 1 + isEnableEdit: 1 + isEnableConnect: 1 + isEnablePlayerConnect: 1 + componentName: + needSignalCount: 1 + isOpenInEditor: 1 --- !u!114 &6634784627554641663 MonoBehaviour: m_ObjectHideFlags: 0 @@ -132,4 +138,5 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2791e039b8344f45ad6dc86f5188d82d, type: 3} m_Name: m_EditorClassIdentifier: - isActive: 1 + isEnableEdit: 1 + isOpenInEditor: 1 diff --git a/Assets/Prefab/Gameplay/Emitter.prefab b/Assets/Prefab/Gameplay/Emitter.prefab index 0063478..a27c14c 100644 --- a/Assets/Prefab/Gameplay/Emitter.prefab +++ b/Assets/Prefab/Gameplay/Emitter.prefab @@ -151,7 +151,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2791e039b8344f45ad6dc86f5188d82d, type: 3} m_Name: m_EditorClassIdentifier: - isActive: 1 + isEnableEdit: 1 + isOpenInEditor: 1 --- !u!114 &7351527485767933101 MonoBehaviour: m_ObjectHideFlags: 0 @@ -164,6 +165,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 1a5a563132c84e50b983b557eb3da442, type: 3} m_Name: m_EditorClassIdentifier: + isEnableInteract: 1 + isEnableEdit: 1 + isEnableConnect: 1 + isEnablePlayerConnect: 1 + componentName: + needSignalCount: 1 + isOpenInEditor: 1 prefabToEmit: {fileID: 7979385610396712053, guid: 9fc63211af583b946b1f381e4bf38ddf, type: 3} emitPoint: {fileID: 119873216418816890} diff --git a/Assets/Prefab/Gameplay/Lever.prefab b/Assets/Prefab/Gameplay/Lever.prefab index f781c95..fce3af6 100644 --- a/Assets/Prefab/Gameplay/Lever.prefab +++ b/Assets/Prefab/Gameplay/Lever.prefab @@ -119,7 +119,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2791e039b8344f45ad6dc86f5188d82d, type: 3} m_Name: m_EditorClassIdentifier: - isActive: 1 + isEnableEdit: 1 + isOpenInEditor: 1 --- !u!114 &4936355834716623489 MonoBehaviour: m_ObjectHideFlags: 0 @@ -132,5 +133,10 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 6b9b9a895b0d40edb9a6d7213afbb256, type: 3} m_Name: m_EditorClassIdentifier: - Interactable: 1 - isActive: 1 + isEnableInteract: 1 + isEnableEdit: 1 + isEnableConnect: 1 + isEnablePlayerConnect: 1 + componentName: + needSignalCount: 1 + isOpenInEditor: 1 diff --git a/Assets/Prefab/Gameplay/MovingPlatform.prefab b/Assets/Prefab/Gameplay/MovingPlatform.prefab index 3208cc5..9ca4778 100644 --- a/Assets/Prefab/Gameplay/MovingPlatform.prefab +++ b/Assets/Prefab/Gameplay/MovingPlatform.prefab @@ -183,7 +183,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2791e039b8344f45ad6dc86f5188d82d, type: 3} m_Name: m_EditorClassIdentifier: - isActive: 1 + isEnableEdit: 1 + isOpenInEditor: 1 --- !u!114 &7403824303730881351 MonoBehaviour: m_ObjectHideFlags: 0 @@ -196,7 +197,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 115d4e847c444833bc8dce4a03a78e55, type: 3} m_Name: m_EditorClassIdentifier: - MoveNeedSignalCount: 1 + isEnableInteract: 1 + isEnableEdit: 1 + isEnableConnect: 1 + isEnablePlayerConnect: 1 + componentName: + needSignalCount: 1 + isOpenInEditor: 1 startPositionObject: {fileID: 3154147150921727065} targetPositionObject: {fileID: 2516956888757501734} moveSpeed: 2 diff --git a/Assets/Prefab/Gameplay/NumberSlot.prefab b/Assets/Prefab/Gameplay/NumberSlot.prefab index 3312e4c..c02c998 100644 --- a/Assets/Prefab/Gameplay/NumberSlot.prefab +++ b/Assets/Prefab/Gameplay/NumberSlot.prefab @@ -119,7 +119,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2791e039b8344f45ad6dc86f5188d82d, type: 3} m_Name: m_EditorClassIdentifier: - isActive: 1 + isEnableEdit: 1 + isOpenInEditor: 1 --- !u!114 &2187320556207737093 MonoBehaviour: m_ObjectHideFlags: 0 @@ -132,5 +133,12 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 301178d89b6b43e0844e3d39aa579442, type: 3} m_Name: m_EditorClassIdentifier: + isEnableInteract: 1 + isEnableEdit: 1 + isEnableConnect: 1 + isEnablePlayerConnect: 1 + componentName: + needSignalCount: 1 + isOpenInEditor: 1 currentNumber: 0 correctNumber: 1 diff --git a/Assets/Prefab/Gameplay/PressurePlate.prefab b/Assets/Prefab/Gameplay/PressurePlate.prefab index b7d1434..8bb0673 100644 --- a/Assets/Prefab/Gameplay/PressurePlate.prefab +++ b/Assets/Prefab/Gameplay/PressurePlate.prefab @@ -119,7 +119,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2791e039b8344f45ad6dc86f5188d82d, type: 3} m_Name: m_EditorClassIdentifier: - isActive: 1 + isEnableEdit: 1 + isOpenInEditor: 1 --- !u!114 &-7803032184951374842 MonoBehaviour: m_ObjectHideFlags: 0 @@ -132,7 +133,13 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 2557c7d42f7a4d8896712ab2ae980b6f, type: 3} m_Name: m_EditorClassIdentifier: - isActive: 1 + isEnableInteract: 1 + isEnableEdit: 1 + isEnableConnect: 1 + isEnablePlayerConnect: 1 + componentName: + needSignalCount: 1 + isOpenInEditor: 1 detectLayer: serializedVersion: 2 m_Bits: 4294967295 diff --git a/Assets/Prefab/UI/NoEditableComponent.prefab b/Assets/Prefab/UI/NoEditableComponent.prefab new file mode 100644 index 0000000..716f9a9 --- /dev/null +++ b/Assets/Prefab/UI/NoEditableComponent.prefab @@ -0,0 +1,667 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &1934425423108845895 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 770571673962954191} + - component: {fileID: 947523830279710221} + - component: {fileID: 5677674190768578251} + - component: {fileID: 8362183086694140916} + m_Layer: 5 + m_Name: Button + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &770571673962954191 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934425423108845895} + 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: 8508076148401833904} + m_Father: {fileID: 2357471203221357077} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 0} + m_AnchorMax: {x: 0.5, y: 0} + m_AnchoredPosition: {x: 0, y: 40} + m_SizeDelta: {x: 160, y: 40} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &947523830279710221 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934425423108845895} + m_CullTransparentMesh: 1 +--- !u!114 &5677674190768578251 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934425423108845895} + 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: 1} + 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: 10905, guid: 0000000000000000f000000000000000, type: 0} + m_Type: 1 + 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!114 &8362183086694140916 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1934425423108845895} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 5677674190768578251} + m_OnClick: + m_PersistentCalls: + m_Calls: [] +--- !u!1 &6132525557672685501 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5678169046530977740} + - component: {fileID: 7805353279722228996} + - component: {fileID: 4172063908253059194} + m_Layer: 5 + m_Name: Background + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5678169046530977740 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6132525557672685501} + 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: 2357471203221357077} + 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, y: 0} + m_SizeDelta: {x: 300, y: 200} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7805353279722228996 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6132525557672685501} + m_CullTransparentMesh: 1 +--- !u!114 &4172063908253059194 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6132525557672685501} + 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: 1} + 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!1 &6592701392799500412 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 9013221774946856699} + - component: {fileID: 8474461875322055306} + - component: {fileID: 6575722341284538116} + m_Layer: 5 + m_Name: Description + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &9013221774946856699 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6592701392799500412} + 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: 2357471203221357077} + 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, y: 0} + m_SizeDelta: {x: 200, y: 60} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8474461875322055306 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6592701392799500412} + m_CullTransparentMesh: 1 +--- !u!114 &6575722341284538116 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6592701392799500412} + 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: "\u65E0\u6CD5\u7F16\u8F91" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 538fd603dd2dddd4daf31aa55f44c7e5, type: 2} + m_sharedMaterial: {fileID: -3917370665499528571, guid: 538fd603dd2dddd4daf31aa55f44c7e5, + type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4278190080 + m_fontColor: {r: 0, g: 0, b: 0, 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: 25 + m_fontSizeBase: 25 + 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!1 &7093852715603489298 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 5378056991286384224} + - component: {fileID: 1298891284052412941} + - component: {fileID: 7792544711971448978} + m_Layer: 5 + m_Name: ComponentName + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &5378056991286384224 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7093852715603489298} + 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: 2357471203221357077} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0.5, y: 1} + m_AnchorMax: {x: 0.5, y: 1} + m_AnchoredPosition: {x: 0, y: -30} + m_SizeDelta: {x: 300, y: 60} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &1298891284052412941 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7093852715603489298} + m_CullTransparentMesh: 1 +--- !u!114 &7792544711971448978 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 7093852715603489298} + 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: "\u7EC4\u4EF6\u540D\u79F0" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 538fd603dd2dddd4daf31aa55f44c7e5, type: 2} + m_sharedMaterial: {fileID: -3917370665499528571, guid: 538fd603dd2dddd4daf31aa55f44c7e5, + type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4278190080 + m_fontColor: {r: 0, g: 0, b: 0, 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: 30 + m_fontSizeBase: 30 + 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!1 &8811045486480890602 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8508076148401833904} + - component: {fileID: 2381210780796803991} + - component: {fileID: 2655692800121320235} + 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 &8508076148401833904 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8811045486480890602} + 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: 770571673962954191} + 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!222 &2381210780796803991 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8811045486480890602} + m_CullTransparentMesh: 1 +--- !u!114 &2655692800121320235 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8811045486480890602} + 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: "\u5F00\u5173" + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 538fd603dd2dddd4daf31aa55f44c7e5, type: 2} + m_sharedMaterial: {fileID: -3917370665499528571, guid: 538fd603dd2dddd4daf31aa55f44c7e5, + type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4281479730 + m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, 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: 24 + m_fontSizeBase: 24 + 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!1 &9090475309613840875 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2357471203221357077} + - component: {fileID: 7207724647678174378} + - component: {fileID: 7268654960820436425} + m_Layer: 5 + m_Name: NoEditableComponent + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &2357471203221357077 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9090475309613840875} + 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: 5678169046530977740} + - {fileID: 5378056991286384224} + - {fileID: 9013221774946856699} + - {fileID: 770571673962954191} + m_Father: {fileID: 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, y: 0} + m_SizeDelta: {x: 300, y: 200} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &7207724647678174378 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9090475309613840875} + m_CullTransparentMesh: 1 +--- !u!114 &7268654960820436425 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 9090475309613840875} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 126d8afe0e304d548dc13c4df6405e17, type: 3} + m_Name: + m_EditorClassIdentifier: + componentName: {fileID: 7792544711971448978} + componentState: {fileID: 6575722341284538116} + closeButton: {fileID: 8362183086694140916} diff --git a/Assets/Prefab/UI/NoEditableComponent.prefab.meta b/Assets/Prefab/UI/NoEditableComponent.prefab.meta new file mode 100644 index 0000000..b043d7d --- /dev/null +++ b/Assets/Prefab/UI/NoEditableComponent.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8382cf3f0eefdd0498877030975314d5 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefab/UI/PlayerEditPanelViwer.prefab b/Assets/Prefab/UI/PlayerEditPanelViwer.prefab index 18eca0e..64cf4b0 100644 --- a/Assets/Prefab/UI/PlayerEditPanelViwer.prefab +++ b/Assets/Prefab/UI/PlayerEditPanelViwer.prefab @@ -1,5 +1,141 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: +--- !u!1 &663099673900070655 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 2476559113307999899} + - component: {fileID: 8229001564949697445} + - component: {fileID: 2915580200069342525} + m_Layer: 5 + m_Name: CanNotEdit + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &2476559113307999899 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 663099673900070655} + 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: 1276987115395320878} + 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, y: 0} + m_SizeDelta: {x: 400, y: 250} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &8229001564949697445 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 663099673900070655} + m_CullTransparentMesh: 1 +--- !u!114 &2915580200069342525 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 663099673900070655} + 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: 'Can Not Edit + +' + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, 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: 36 + m_fontSizeBase: 36 + 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!1 &756030608054991821 GameObject: m_ObjectHideFlags: 0 @@ -30,6 +166,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 8170672926465396806} + - {fileID: 2476559113307999899} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -52,8 +189,11 @@ MonoBehaviour: IsOpenOnFirstLoad: 0 componentEditViewerPrefab: {fileID: 3732398851892431074, guid: cde7c0684d092944d8c165da0c0368f6, type: 3} + notEditableComponentEditViewer: {fileID: 9090475309613840875, guid: 8382cf3f0eefdd0498877030975314d5, + type: 3} noEditableTargetPanel: {fileID: 6815803542166296534} panelRadius: 130 + componentViewers: [] --- !u!1 &6815803542166296534 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scenes/Test.unity b/Assets/Scenes/Test.unity index 53b03ac..d6cce81 100644 --- a/Assets/Scenes/Test.unity +++ b/Assets/Scenes/Test.unity @@ -1110,6 +1110,16 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} + - target: {fileID: 605469399670797709, guid: b3e24e2df98d14e4ebc08cc68c071afa, + type: 3} + propertyPath: isEnableEdit + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 605469399670797709, guid: b3e24e2df98d14e4ebc08cc68c071afa, + type: 3} + propertyPath: isEnablePlayerConnect + value: 1 + objectReference: {fileID: 0} - target: {fileID: 2729643726423589850, guid: b3e24e2df98d14e4ebc08cc68c071afa, type: 3} propertyPath: m_Name @@ -1219,6 +1229,74 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: b3e24e2df98d14e4ebc08cc68c071afa, type: 3} +--- !u!1001 &2110019781 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 0} + m_Modifications: + - target: {fileID: 2356242250385391551, guid: be07db3098b709a40a6965f50f8c9640, + type: 3} + propertyPath: m_LocalPosition.x + value: 30 + objectReference: {fileID: 0} + - target: {fileID: 2356242250385391551, guid: be07db3098b709a40a6965f50f8c9640, + type: 3} + propertyPath: m_LocalPosition.y + value: 0.8 + objectReference: {fileID: 0} + - target: {fileID: 2356242250385391551, guid: be07db3098b709a40a6965f50f8c9640, + type: 3} + propertyPath: m_LocalPosition.z + value: -5 + objectReference: {fileID: 0} + - target: {fileID: 2356242250385391551, guid: be07db3098b709a40a6965f50f8c9640, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 2356242250385391551, guid: be07db3098b709a40a6965f50f8c9640, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2356242250385391551, guid: be07db3098b709a40a6965f50f8c9640, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2356242250385391551, guid: be07db3098b709a40a6965f50f8c9640, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2356242250385391551, guid: be07db3098b709a40a6965f50f8c9640, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2356242250385391551, guid: be07db3098b709a40a6965f50f8c9640, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 2356242250385391551, guid: be07db3098b709a40a6965f50f8c9640, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6227019518059310355, guid: be07db3098b709a40a6965f50f8c9640, + type: 3} + propertyPath: m_Name + value: Lever (2) + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: be07db3098b709a40a6965f50f8c9640, type: 3} --- !u!1001 &366996911271636373 PrefabInstance: m_ObjectHideFlags: 0 @@ -1345,11 +1423,6 @@ PrefabInstance: propertyPath: m_LocalEulerAnglesHint.z value: 0 objectReference: {fileID: 0} - - target: {fileID: 3535959014221630543, guid: 85652dd0e36597644aa5b3bc9603797b, - type: 3} - propertyPath: controlTarget - value: - objectReference: {fileID: 2578337202726380612} - target: {fileID: 6268190613584218029, guid: 85652dd0e36597644aa5b3bc9603797b, type: 3} propertyPath: m_Name @@ -1632,18 +1705,6 @@ PrefabInstance: m_AddedGameObjects: [] m_AddedComponents: [] m_SourcePrefab: {fileID: 100100000, guid: 5ee760c56bad73f48a453ce5657e05b8, type: 3} ---- !u!114 &2578337202726380612 stripped -MonoBehaviour: - m_CorrespondingSourceObject: {fileID: 7403824303730881351, guid: 5ee760c56bad73f48a453ce5657e05b8, - type: 3} - m_PrefabInstance: {fileID: 2578337202726380610} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 115d4e847c444833bc8dce4a03a78e55, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1001 &3372472533242412945 PrefabInstance: m_ObjectHideFlags: 0 @@ -2096,5 +2157,6 @@ SceneRoots: - {fileID: 865274353} - {fileID: 6350903300567888677} - {fileID: 1549323716} + - {fileID: 2110019781} - {fileID: 730184548946979397} - {fileID: 3372472533242412945} diff --git a/Assets/Script/Gameplay/Connect/ConnectionLine.cs b/Assets/Script/Gameplay/Connect/ConnectionLine.cs index 6850fcd..18dd0cd 100644 --- a/Assets/Script/Gameplay/Connect/ConnectionLine.cs +++ b/Assets/Script/Gameplay/Connect/ConnectionLine.cs @@ -1,10 +1,11 @@ using System; using UnityEngine; +using Script.Gameplay.Interface; namespace Script.Gameplay.Connect { // 只负责在场景中绘制连接线,并处理信号传递 - public class ConnectionLine : MonoBehaviour + public class ConnectionLine : MonoBehaviour, ISignalReceiver, ISignalSender { [SerializeField] private MonoBehaviour monoPointA; [SerializeField] private MonoBehaviour monoPointB; @@ -25,7 +26,7 @@ namespace Script.Gameplay.Connect public void SetConnectable(IConnectable pointA, IConnectable pointB) { - if(pointA == null || pointB == null) + if (pointA == null || pointB == null) { Debug.Log("ConnectionLine requires two valid IConnectable points."); return; @@ -41,7 +42,7 @@ namespace Script.Gameplay.Connect pointB.ConnectionLines.Add(this); SetLineRendererPositions(); } - + private void SetLineRendererPositions() { if (_pointA != null && _pointB != null) @@ -53,26 +54,46 @@ namespace Script.Gameplay.Connect }); } } - - public void SignalActive(bool active, GameObject sender) - { - if (_pointA != null && _pointB != null) - { - if (sender == _pointA.GetGameObject()) - { - _pointB.OnSignalReceived(active, sender); - } - else if (sender == _pointB.GetGameObject()) - { - _pointA.OnSignalReceived(active, sender); - } - } - } + + // public void SignalActive(bool active, GameObject sender) + // { + // if (_pointA != null && _pointB != null) + // { + // if (sender == _pointA.GetGameObject()) + // { + // _pointB.OnSignalReceived(active, sender); + // } + // else if (sender == _pointB.GetGameObject()) + // { + // _pointA.OnSignalReceived(active, sender); + // } + // } + // } private void OnDestroy() { _pointA.ConnectionLines.Remove(this); _pointB.ConnectionLines.Remove(this); } + + public void OnSignalReceived(bool active, GameObject sender) + { + SendSignal(active,this.gameObject); + } + + public void SendSignal(bool active,GameObject sender) + { + var a = _pointA as ISignalReceiver; + var b = _pointB as ISignalReceiver; + ISignalReceiver senderR = sender.GetComponent(); + if (a != senderR) + { + a.OnSignalReceived(active, this.gameObject); + } + if (b != senderR) + { + b.OnSignalReceived(active, this.gameObject); + } + } } } \ No newline at end of file diff --git a/Assets/Script/Gameplay/Connect/ConnectionLineManager.cs b/Assets/Script/Gameplay/Connect/ConnectionLineManager.cs index 3788223..cf49f7d 100644 --- a/Assets/Script/Gameplay/Connect/ConnectionLineManager.cs +++ b/Assets/Script/Gameplay/Connect/ConnectionLineManager.cs @@ -1,6 +1,7 @@ using System; using UnityEngine; using System.Collections.Generic; +using Script.Gameplay.Interface; using Core; namespace Script.Gameplay.Connect diff --git a/Assets/Script/Gameplay/Connect/ISignalSender.cs b/Assets/Script/Gameplay/Connect/ISignalSender.cs deleted file mode 100644 index 3b18cba..0000000 --- a/Assets/Script/Gameplay/Connect/ISignalSender.cs +++ /dev/null @@ -1,8 +0,0 @@ -using UnityEngine; -namespace Script.Gameplay.Connect -{ - public interface ISignalSender - { - public void SendSignal(bool active); - } -} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Edit/BaseFacilityController.cs b/Assets/Script/Gameplay/Edit/BaseFacilityController.cs deleted file mode 100644 index 9c2d80a..0000000 --- a/Assets/Script/Gameplay/Edit/BaseFacilityController.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System.Collections.Generic; -using Script.Gameplay.Connect; -using Script.Gameplay.Interface; -using UnityEngine; -public class BaseFacilityController : MonoBehaviour, IInteractable, IEditableComponent, IConnectable, ISignalSender -{ - public bool IsEnablePlayerConnect { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); } - public List ConnectionLines { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); } - public bool IsEnableActive { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); } - public bool IsEnableEdit { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); } - bool IEditableComponent.IsComponentActive { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); } - string IEditableComponent.ComponentName { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); } - - LockLevel IEditableComponent.LockLevel => throw new System.NotImplementedException(); - - public string GetConnectableName() - { - throw new System.NotImplementedException(); - } - - public GameObject GetGameObject() - { - throw new System.NotImplementedException(); - } - - public string GetInteractPrompt() - { - throw new System.NotImplementedException(); - } - - public Vector3 GetPosition() - { - throw new System.NotImplementedException(); - } - - public void Interact(GameObject interactor) - { - throw new System.NotImplementedException(); - } - - public void OnGazeEnter(GameObject editor) - { - throw new System.NotImplementedException(); - } - - public void OnGazeEnter() - { - throw new System.NotImplementedException(); - } - - public void OnGazeExit(GameObject editor) - { - throw new System.NotImplementedException(); - } - - public void OnGazeExit() - { - throw new System.NotImplementedException(); - } - - public void OnSignalReceived(bool active, GameObject sender) - { - throw new System.NotImplementedException(); - } - - public void SendSignal(bool active) - { - throw new System.NotImplementedException(); - } -} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Edit/ButtonInteractController.cs b/Assets/Script/Gameplay/Edit/ButtonInteractController.cs deleted file mode 100644 index 212f58f..0000000 --- a/Assets/Script/Gameplay/Edit/ButtonInteractController.cs +++ /dev/null @@ -1,119 +0,0 @@ -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using Script.Gameplay.Interface; -using Script.Gameplay.Connect; - -namespace Script.Gameplay.Edit -{ - public class ButtonInteractController : MonoBehaviour, IInteractable, IEditableComponent, IConnectable, - ISignalSender - { - #region Interactable - - public bool Interactable = true; - [SerializeField] private float signalDuration = 1.0f; // 信号持续时间(秒) - - public string GetInteractPrompt() - { - return "按F按下按钮"; - } - - public void Interact(GameObject interactor) - { - if (!Interactable) return; - StartCoroutine(SendSignalCoroutine()); - Debug.Log("Button pressed"); - } - - public void OnGazeEnter(GameObject editor) - { - // 可选:高亮按钮等 - } - - public void OnGazeExit(GameObject editor) - { - // 可选:取消高亮 - } - - private IEnumerator SendSignalCoroutine() - { - SendSignal(true); - Interactable = false; - // 按钮压下的动画或效果可以在这里添加 - - yield return new WaitForSeconds(signalDuration); - SendSignal(false); - Interactable = true; - // 按钮弹起的动画或效果可以在这里添加 - } - - #endregion - - #region EditableComponent - - [SerializeField] private bool isActive = true; - - public bool IsComponentActive - { - get => isActive; - set - { - isActive = value; - Interactable = isActive; - } - } - - public string ComponentName { get; set; } = "Button"; - public LockLevel LockLevel => LockLevel.Red; - - #endregion - - #region Connectable - - public bool IsEnablePlayerConnect { get; set; } = true; - - public void OnGazeEnter() - { - } - - public void OnGazeExit() - { - } - - public Vector3 GetPosition() - { - return transform.position; - } - - public GameObject GetGameObject() - { - return gameObject; - } - - public string GetConnectableName() - { - return gameObject.name; - } - - public List ConnectionLines { get; set; } = new List(); - - public void OnSignalReceived(bool active, GameObject sender) - { - // 按钮通常不接收信号,因此这里可以留空 - } - - public void SendSignal(bool active) - { - if (ConnectionLines != null) - { - foreach (var line in ConnectionLines) - { - line.SignalActive(active, this.gameObject); - } - } - } - - #endregion - } -} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Edit/ColliderEditableController.cs b/Assets/Script/Gameplay/Edit/ColliderEditableController.cs index b9ba483..0e51223 100644 --- a/Assets/Script/Gameplay/Edit/ColliderEditableController.cs +++ b/Assets/Script/Gameplay/Edit/ColliderEditableController.cs @@ -6,22 +6,28 @@ namespace Script.Gameplay.Edit [RequireComponent(typeof(Collider))] public class ColliderEditableController : MonoBehaviour, IEditableComponent { - [SerializeField] private bool isActive = true; + [SerializeField] private bool isEnableEdit = true; - public bool IsComponentActive + public bool IsEnableEdit { - get => isActive; + get => isEnableEdit; + set => isEnableEdit = value; + } + + [SerializeField] private bool isOpenInEditor = true; + + public bool IsOpenInEditor + { + get => isOpenInEditor; set { - isActive = value; - // 具体被编辑的逻辑:开启或关闭碰撞体 + isOpenInEditor = value; if (_collider != null) - _collider.enabled = isActive; + _collider.enabled = isOpenInEditor; } } public string ComponentName { get; set; } = "Collider"; - public LockLevel LockLevel { get; } = LockLevel.Red; private Collider _collider; @@ -29,7 +35,7 @@ namespace Script.Gameplay.Edit { _collider = GetComponent(); // 应用序列化的初始状态 - _collider.enabled = isActive; + _collider.enabled = IsOpenInEditor; } #if UNITY_EDITOR @@ -38,7 +44,7 @@ namespace Script.Gameplay.Edit // 在编辑器中即时生效 _collider = _collider == null ? GetComponent() : _collider; if (_collider != null) - _collider.enabled = isActive; + _collider.enabled = IsOpenInEditor; } #endif } diff --git a/Assets/Script/Gameplay/Edit/ConsoleController.cs b/Assets/Script/Gameplay/Edit/ConsoleController.cs deleted file mode 100644 index 32914e1..0000000 --- a/Assets/Script/Gameplay/Edit/ConsoleController.cs +++ /dev/null @@ -1,109 +0,0 @@ -using System.Collections.Generic; -using Script.Gameplay.Connect; -using Script.Gameplay.Interface; -using UnityEngine; - -namespace Script.Gameplay.Edit -{ - public class ConsoleController : MonoBehaviour, IConnectable, IEditableComponent, IInteractable - { - [SerializeField] private int needSignalCount = 1; - private int currentSignalCount; - [SerializeField] private MonoBehaviour controlTarget; - public ISignalReceiver controlTargetSignalReceiver; - [SerializeField] private bool IsActive; - private bool lastSendSignal = false; - - public bool IsComponentActive { get; set; } - private string componentName = "Console"; - public string ComponentName - { - get => string.IsNullOrEmpty(componentName) ? gameObject.name : componentName; - set => componentName = value; - } - - public LockLevel LockLevel { get; set; } - - public bool IsEnablePlayerConnect { get; set; } = true; - public List ConnectionLines { get; set; } = new List(); - - void Awake() - { - controlTargetSignalReceiver = controlTarget as ISignalReceiver; - if (controlTargetSignalReceiver == null) - { - Debug.LogError("Control target does not implement ISignalReceiver"); - } - } - - public void OnGazeEnter() - { - // no-op - } - - public void OnGazeExit() - { - // no-op - } - - public Vector3 GetPosition() - { - return this.gameObject.transform.position; - } - - public GameObject GetGameObject() - { - return gameObject; - } - - public string GetConnectableName() - { - return gameObject.name; - } - - public void OnSignalReceived(bool active, GameObject sender) - { - if (active) - { - currentSignalCount++; - } - else - { - currentSignalCount--; - } - if (currentSignalCount >= needSignalCount) - { - IsActive = true; - } - else - { - IsActive = false; - } - } - - public string GetInteractPrompt() - { - return "Interact to Active"; - } - - public void Interact(GameObject interactor) - { - if (IsActive && controlTargetSignalReceiver != null) - { - var signal = !lastSendSignal; - controlTargetSignalReceiver.OnSignalReceived(signal, this.gameObject); - lastSendSignal = signal; - } - } - - public void OnGazeEnter(GameObject editor) - { - // no-op - } - - public void OnGazeExit(GameObject editor) - { - // no-op - } - } -} diff --git a/Assets/Script/Gameplay/Edit/DoorInteractController.cs b/Assets/Script/Gameplay/Edit/DoorInteractController.cs deleted file mode 100644 index e788c1e..0000000 --- a/Assets/Script/Gameplay/Edit/DoorInteractController.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System; -using System.Collections.Generic; -using Script.Gameplay.Player; -using UnityEngine; -using Script.Gameplay.Interface; -using Script.Gameplay.Connect; - -namespace Script.Gameplay.Edit -{ - public class DoorInteractController : MonoBehaviour, IInteractable, IEditableComponent, IConnectable - { - #region Interactable - - public bool Interactable = true; - private bool isOpened = false; - - public string GetInteractPrompt() - { - return "按F进行交互"; - } - - public void Interact(GameObject interactor) - { - if (!Interactable) return; - if (isOpened) - { - CloseDoor(); - isOpened = false; - } - else - { - OpenDoor(); - isOpened = true; - } - } - - public void OnGazeEnter(GameObject editor) - { - // - } - - public void OnGazeExit(GameObject editor) - { - // - } - - private void OpenDoor() - { - // 逆时针旋转90度 - transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles + new Vector3(0, -90, 0)); - // Debug.Log("Open door"); - } - - private void CloseDoor() - { - // 顺时针旋转90度 - transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles + new Vector3(0, 90, 0)); - // Debug.Log("Close door"); - } - - #endregion - - #region EditableComponent - - private bool isActive = true; - - public bool IsComponentActive - { - get => isActive; - set - { - isActive = value; - //具体被编辑的逻辑 - Interactable = isActive; - } - } - - public string ComponentName { get; set; } = "DoorSwitch"; - public LockLevel LockLevel => LockLevel.Red; - - #endregion - - #region Connectable - - public bool IsEnablePlayerConnect { get; set; } = true; - - public void OnGazeEnter() - { - } - - public void OnGazeExit() - { - } - - public Vector3 GetPosition() - { - return transform.position; - } - - public GameObject GetGameObject() - { - return gameObject; - } - - public string GetConnectableName() - { - return gameObject.name; - } - - public List ConnectionLines { get; set; } = new List(); - public void OnSignalReceived(bool active, GameObject sender) - { - Interact(sender); - } - - #endregion - } -} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Edit/InteractableBaseController.cs b/Assets/Script/Gameplay/Edit/InteractableBaseController.cs deleted file mode 100644 index 191f34b..0000000 --- a/Assets/Script/Gameplay/Edit/InteractableBaseController.cs +++ /dev/null @@ -1,30 +0,0 @@ -using UnityEngine; -using Script.Gameplay.Interface; - -namespace Script.Gameplay.Edit -{ - public abstract class InteractableBaseController : MonoBehaviour, IInteractable - { - public bool Interactable = true; - public string GetInteractPrompt() - { - return "按F进行交互"; - } - - public virtual void Interact(GameObject interactor) - { - if (!Interactable) return; - Debug.Log($"{gameObject.name} 被 {interactor.name} 交互了!"); - } - - public void OnGazeEnter(GameObject editor) - { - // 修改鼠标指针或高亮显示物体等 - } - - public void OnGazeExit(GameObject editor) - { - // 恢复鼠标指针或取消高亮显示物体等 - } - } -} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Edit/InteractableBaseController.cs.meta b/Assets/Script/Gameplay/Edit/InteractableBaseController.cs.meta deleted file mode 100644 index 0f01e19..0000000 --- a/Assets/Script/Gameplay/Edit/InteractableBaseController.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f5781ad9dd2842a584b8ef333ae75e60 -timeCreated: 1760693365 \ No newline at end of file diff --git a/Assets/Script/Gameplay/Edit/LeverInteractController.cs b/Assets/Script/Gameplay/Edit/LeverInteractController.cs deleted file mode 100644 index f19c6cf..0000000 --- a/Assets/Script/Gameplay/Edit/LeverInteractController.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; -using Script.Gameplay.Interface; -using Script.Gameplay.Connect; - -namespace Script.Gameplay.Edit -{ - public class LeverInteractController : MonoBehaviour, IInteractable, IEditableComponent, IConnectable, ISignalSender - { - #region Interactable - - public bool Interactable = true; - private bool isPulled = false; - - public string GetInteractPrompt() - { - return "按F拉动拉杆"; - } - - public void Interact(GameObject interactor) - { - if (!Interactable) return; - isPulled = !isPulled; - SendSignal(isPulled); - // 可选:拉杆动画 - Debug.Log(isPulled ? "Lever pulled down" : "Lever reset"); - } - - public void OnGazeEnter(GameObject editor) - { - // 可选:高亮拉杆 - } - - public void OnGazeExit(GameObject editor) - { - // 可选:取消高亮 - } - - #endregion - - #region EditableComponent - - [SerializeField] private bool isActive = true; - - public bool IsComponentActive - { - get => isActive; - set - { - isActive = value; - Interactable = isActive; - } - } - - public string ComponentName { get; set; } = "Lever"; - public LockLevel LockLevel => LockLevel.Red; - - #endregion - - #region Connectable - - public bool IsEnablePlayerConnect { get; set; } = true; - - public void OnGazeEnter() - { - } - - public void OnGazeExit() - { - } - - public Vector3 GetPosition() => transform.position; - public GameObject GetGameObject() - { - return gameObject; - } - - public string GetConnectableName() => gameObject.name; - public List ConnectionLines { get; set; }= new List(); - - public void OnSignalReceived(bool active, GameObject sender) - { - // - } - - public void SendSignal(bool active) - { - if (ConnectionLines != null) - { - foreach (var line in ConnectionLines) - { - line.SignalActive(active, this.gameObject); - } - } - } - - #endregion - } -} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Edit/PressurePlateController.cs b/Assets/Script/Gameplay/Edit/PressurePlateController.cs deleted file mode 100644 index ad8a576..0000000 --- a/Assets/Script/Gameplay/Edit/PressurePlateController.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System.Collections.Generic; -using UnityEngine; -using Script.Gameplay.Interface; -using Script.Gameplay.Connect; - -namespace Script.Gameplay.Edit -{ - public class PressurePlateController : MonoBehaviour, IEditableComponent, IConnectable, ISignalSender - { - [SerializeField] private bool isActive = true; - [SerializeField] private LayerMask detectLayer = ~0; // 检测所有层,可在Inspector中指定 - [SerializeField] private Vector3 plateSize = new Vector3(1, 0.2f, 1); - [SerializeField] private Vector3 plateOffset = Vector3.up * 0.1f; - - private bool lastState = false; - - private void FixedUpdate() - { - if (!isActive) return; - bool hasObject = Physics.CheckBox(transform.position + plateOffset, plateSize * 0.5f, Quaternion.identity, - detectLayer); - if (hasObject != lastState) - { - SendSignal(hasObject); - lastState = hasObject; - } - } - - #region EditableComponent - - public bool IsComponentActive - { - get => isActive; - set => isActive = value; - } - - public string ComponentName { get; set; } = "PressurePlate"; - public LockLevel LockLevel => LockLevel.Red; - - #endregion - - #region Connectable - - public bool IsEnablePlayerConnect { get; set; } = true; - - public void OnGazeEnter() - { - } - - public void OnGazeExit() - { - } - - public Vector3 GetPosition() => transform.position; - - public GameObject GetGameObject() - { - return gameObject; - } - - public string GetConnectableName() => gameObject.name; - public List ConnectionLines { get; set; } = new List(); - - public void OnSignalReceived(bool active, GameObject sender) - { - // - } - - public void SendSignal(bool active) - { - if (ConnectionLines != null) - { - foreach (var line in ConnectionLines) - { - line.SignalActive(active, this.gameObject); - } - } - } - - #endregion - -#if UNITY_EDITOR - private void OnDrawGizmosSelected() - { - Gizmos.color = Color.yellow; - Gizmos.DrawWireCube(transform.position + plateOffset, plateSize); - } -#endif - } -} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Edit/RigidbodyEditableController.cs b/Assets/Script/Gameplay/Edit/RigidbodyEditableController.cs index d21d02b..ad6aec0 100644 --- a/Assets/Script/Gameplay/Edit/RigidbodyEditableController.cs +++ b/Assets/Script/Gameplay/Edit/RigidbodyEditableController.cs @@ -6,37 +6,44 @@ namespace Script.Gameplay.Edit [RequireComponent(typeof(Rigidbody))] public class RigidbodyEditableController : MonoBehaviour, IEditableComponent { - [SerializeField] private bool isActive = true; + [SerializeField] private bool isEnableEdit = true; - public bool IsComponentActive + public bool IsEnableEdit { - get => isActive; + get => isEnableEdit; + set => isEnableEdit = value; + } + + [SerializeField] private bool isOpenInEditor = true; + + public bool IsOpenInEditor + { + get => isOpenInEditor; set { - isActive = value; - //具体被编辑的逻辑 - _rigidbody.isKinematic = !isActive; + isOpenInEditor = value; + if (_rigidbody != null) + _rigidbody.isKinematic = !isOpenInEditor; } } public string ComponentName { get; set; } = "Rigidbody"; - public LockLevel LockLevel { get; } = LockLevel.Red; private Rigidbody _rigidbody; - + private void Awake() { _rigidbody = GetComponent(); //应用序列化的初始状态 - _rigidbody.isKinematic = !isActive; + _rigidbody.isKinematic = !IsEnableEdit; } - + #if UNITY_EDITOR private void OnValidate() { //在编辑器中即时生效 _rigidbody = _rigidbody == null ? GetComponent() : _rigidbody; if (_rigidbody != null) - _rigidbody.isKinematic = !isActive; + _rigidbody.isKinematic = !IsEnableEdit; } #endif } diff --git a/Assets/Script/Gameplay/Facility.meta b/Assets/Script/Gameplay/Facility.meta new file mode 100644 index 0000000..4da8404 --- /dev/null +++ b/Assets/Script/Gameplay/Facility.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: c829ee0298a44567819336e69a2a7058 +timeCreated: 1761125401 \ No newline at end of file diff --git a/Assets/Script/Gameplay/Facility/BaseFacilityController.cs b/Assets/Script/Gameplay/Facility/BaseFacilityController.cs new file mode 100644 index 0000000..25a6d7f --- /dev/null +++ b/Assets/Script/Gameplay/Facility/BaseFacilityController.cs @@ -0,0 +1,124 @@ +using System.Collections.Generic; +using Script.Gameplay.Connect; +using Script.Gameplay.Interface; +using UnityEngine; + +namespace Script.Gameplay.Facility +{ + public class BaseFacilityController : MonoBehaviour, IInteractable, IEditableComponent, IConnectable, ISignalSender, + ISignalReceiver, IGaze + { + [SerializeField] protected bool isEnableInteract = true; + [SerializeField] protected bool isEnableEdit = true; + [SerializeField] protected bool isEnableConnect = true; + [SerializeField] protected string componentName; + [SerializeField] protected int needSignalCount = 1; + [SerializeField] protected bool isOpenInEditor = true; + protected int CurrentSignalCount = 0; + + public virtual bool IsEnableInteract + { + get => isEnableInteract; + set => isEnableInteract = value; + } + + public virtual bool IsEnableEdit + { + get => isEnableEdit; + set => isEnableEdit = value; + } + + public virtual bool IsOpenInEditor + { + get => isOpenInEditor; + set + { + isOpenInEditor = value; + IsEnableInteract = value; + IsEnableConnect = value; + } + } + + public virtual bool IsEnableConnect + { + get => isEnableConnect; + set => isEnableConnect = value; + } + + public string ComponentName + { + get + { + // 如果没有自定义名称,则使用组件名称 + return string.IsNullOrEmpty(componentName) ? GetType().Name : componentName; + } + set => componentName = value; + } + + public List ConnectionLines { get; set; } = new List(); + + public string GetConnectableName() + { + return gameObject.name; + } + + public GameObject GetGameObject() + { + return gameObject; + } + + public virtual string GetInteractPrompt() + { + return $"Interact with {componentName}"; + } + + public Vector3 GetPosition() + { + return transform.position; + } + + public virtual void Interact(GameObject interactor) + { + // Implement interaction logic here + } + + public virtual void OnGazeEnter(GameObject go) + { + // Handle gaze enter + } + + public virtual void OnGazeExit(GameObject go) + { + // Handle gaze exit + } + + public virtual void OnSignalReceived(bool active, GameObject sender) + { + if (active) + { + CurrentSignalCount++; + } + else + { + CurrentSignalCount = Mathf.Max(0, CurrentSignalCount - 1); + } + + if (CurrentSignalCount < needSignalCount) + { + return; + } + // Implement signal received logic here + } + + public virtual void SendSignal(bool active, GameObject sender) + { + if (ConnectionLines != null) + { + foreach (var line in ConnectionLines) + { + line.OnSignalReceived(active, this.gameObject); + } + } + } + } +} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Edit/BaseFacilityController.cs.meta b/Assets/Script/Gameplay/Facility/BaseFacilityController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Edit/BaseFacilityController.cs.meta rename to Assets/Script/Gameplay/Facility/BaseFacilityController.cs.meta diff --git a/Assets/Script/Gameplay/Facility/ButtonInteractController.cs b/Assets/Script/Gameplay/Facility/ButtonInteractController.cs new file mode 100644 index 0000000..f361524 --- /dev/null +++ b/Assets/Script/Gameplay/Facility/ButtonInteractController.cs @@ -0,0 +1,38 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using Script.Gameplay.Interface; +using Script.Gameplay.Connect; + +namespace Script.Gameplay.Facility +{ + public class ButtonInteractController : BaseFacilityController + { + [SerializeField] private float signalDuration = 1.0f; // 信号持续时间(秒) + private bool IsPressing = true; + + public override string GetInteractPrompt() + { + return "按F按下按钮"; + } + + public override void Interact(GameObject interactor) + { + if (!IsPressing) return; + StartCoroutine(SendSignalCoroutine()); + Debug.Log("Button pressed"); + } + + private IEnumerator SendSignalCoroutine() + { + SendSignal(true, this.gameObject); + IsPressing = false; + // 按钮压下的动画或效果可以在这里添加 + + yield return new WaitForSeconds(signalDuration); + SendSignal(false, this.gameObject); + IsPressing = true; + // 按钮弹起的动画或效果可以在这里添加 + } + } +} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Edit/ButtonInteractController.cs.meta b/Assets/Script/Gameplay/Facility/ButtonInteractController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Edit/ButtonInteractController.cs.meta rename to Assets/Script/Gameplay/Facility/ButtonInteractController.cs.meta diff --git a/Assets/Script/Gameplay/Facility/ConsoleController.cs b/Assets/Script/Gameplay/Facility/ConsoleController.cs new file mode 100644 index 0000000..c55b42b --- /dev/null +++ b/Assets/Script/Gameplay/Facility/ConsoleController.cs @@ -0,0 +1,50 @@ +using System.Collections.Generic; +using Script.Gameplay.Connect; +using Script.Gameplay.Interface; +using UnityEngine; + +namespace Script.Gameplay.Facility +{ + public class ConsoleController : BaseFacilityController + { + [SerializeField] private List controlTarget; + [SerializeField] private bool IsBeActive = false; + private List controlTargetSignalReceiver = new List(); + private bool lastSendSignal = false; + + void Awake() + { + foreach (var target in controlTarget) + { + if (target is ISignalReceiver receiver) + { + controlTargetSignalReceiver.Add(receiver); + } + else + { + if(target != null) + Debug.Log(target.name + " is not a supported control target"); + } + } + } + + public override void OnSignalReceived(bool active, GameObject sender) + { + base.OnSignalReceived(active, sender); + IsBeActive = active; + } + + public override void Interact(GameObject interactor) + { + if (IsBeActive && controlTargetSignalReceiver != null) + { + var signal = !lastSendSignal; + foreach (var receiver in controlTargetSignalReceiver) + { + receiver.OnSignalReceived(signal, this.gameObject); + } + lastSendSignal = signal; + } + } + } +} diff --git a/Assets/Script/Gameplay/Edit/ConsoleController.cs.meta b/Assets/Script/Gameplay/Facility/ConsoleController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Edit/ConsoleController.cs.meta rename to Assets/Script/Gameplay/Facility/ConsoleController.cs.meta diff --git a/Assets/Script/Gameplay/Facility/DoorInteractController.cs b/Assets/Script/Gameplay/Facility/DoorInteractController.cs new file mode 100644 index 0000000..924c9c4 --- /dev/null +++ b/Assets/Script/Gameplay/Facility/DoorInteractController.cs @@ -0,0 +1,58 @@ +using System; +using System.Collections.Generic; +using Script.Gameplay.Player; +using UnityEngine; +using Script.Gameplay.Interface; +using Script.Gameplay.Connect; + +namespace Script.Gameplay.Facility +{ + public class DoorInteractController : BaseFacilityController + { + private bool isOpened = false; + public override string GetInteractPrompt() + { + return "按F进行交互"; + } + + public override void Interact(GameObject interactor) + { + if (isOpened) + { + CloseDoor(); + isOpened = false; + } + else + { + OpenDoor(); + isOpened = true; + } + } + + public override void OnGazeEnter(GameObject go) + { + // 可扩展:门被注视时的逻辑 + } + + public override void OnGazeExit(GameObject go) + { + // 可扩展:门离开注视时的逻辑 + } + + private void OpenDoor() + { + transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles + new Vector3(0, -90, 0)); + } + + private void CloseDoor() + { + transform.rotation = Quaternion.Euler(transform.rotation.eulerAngles + new Vector3(0, 90, 0)); + } + + + public override void OnSignalReceived(bool active, GameObject sender) + { + Interact(sender); + } + } +} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Edit/DoorInteractController.cs.meta b/Assets/Script/Gameplay/Facility/DoorInteractController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Edit/DoorInteractController.cs.meta rename to Assets/Script/Gameplay/Facility/DoorInteractController.cs.meta diff --git a/Assets/Script/Gameplay/Edit/EmitterController.cs b/Assets/Script/Gameplay/Facility/EmitterController.cs similarity index 67% rename from Assets/Script/Gameplay/Edit/EmitterController.cs rename to Assets/Script/Gameplay/Facility/EmitterController.cs index 9082a23..9242712 100644 --- a/Assets/Script/Gameplay/Edit/EmitterController.cs +++ b/Assets/Script/Gameplay/Facility/EmitterController.cs @@ -4,9 +4,9 @@ using UnityEngine; using Script.Gameplay.Connect; using Script.Gameplay.Interface; -namespace Script.Gameplay.Edit +namespace Script.Gameplay.Facility { - public class EmitterController : MonoBehaviour, IEditableComponent, IConnectable + public class EmitterController : BaseFacilityController { [Header("发射器设置")] [SerializeField] private GameObject prefabToEmit; @@ -18,26 +18,12 @@ namespace Script.Gameplay.Edit [SerializeField] private float destroyDelay = 5f; // 生成对象多少秒后销毁 private Coroutine emitCoroutine; - - // 不可交互 - // 可编辑 - public bool IsComponentActive { get; set; } = true; - public string ComponentName { get; set; } = "Emitter"; - public LockLevel LockLevel => LockLevel.Red; - - // 可连线 - public List ConnectionLines { get; set; } = new List(); - public bool IsEnablePlayerConnect { get; set; } = true; - public void OnGazeEnter() { } - public void OnGazeExit() { } - public Vector3 GetPosition() => transform.position; - public GameObject GetGameObject() => gameObject; - public string GetConnectableName() => gameObject.name; - + // 接收信号 - public void OnSignalReceived(bool active, GameObject sender) + public override void OnSignalReceived(bool active, GameObject sender) { - if(!IsComponentActive) return; + base.OnSignalReceived(active, sender); + if(!isOpenInEditor) return; if (active) { if (emitCoroutine == null) diff --git a/Assets/Script/Gameplay/Edit/EmitterController.cs.meta b/Assets/Script/Gameplay/Facility/EmitterController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Edit/EmitterController.cs.meta rename to Assets/Script/Gameplay/Facility/EmitterController.cs.meta diff --git a/Assets/Script/Gameplay/Facility/LeverInteractController.cs b/Assets/Script/Gameplay/Facility/LeverInteractController.cs new file mode 100644 index 0000000..195b8fb --- /dev/null +++ b/Assets/Script/Gameplay/Facility/LeverInteractController.cs @@ -0,0 +1,36 @@ +using System.Collections.Generic; +using UnityEngine; +using Script.Gameplay.Interface; +using Script.Gameplay.Connect; + +namespace Script.Gameplay.Facility +{ + public class LeverInteractController : BaseFacilityController + { + private bool isPulled = false; + + public override string GetInteractPrompt() + { + return "按F拉动拉杆"; + } + + public override void Interact(GameObject interactor) + { + if (!IsEnableInteract) return; + isPulled = !isPulled; + SendSignal(isPulled, this.gameObject); + // 可选:拉杆动画 + //Debug.Log(isPulled ? "Lever pulled down" : "Lever reset"); + } + + public override void OnGazeEnter(GameObject go) + { + // 可选:高亮拉杆 + } + + public override void OnGazeExit(GameObject go) + { + // 可选:取消高亮 + } + } +} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Edit/LeverInteractController.cs.meta b/Assets/Script/Gameplay/Facility/LeverInteractController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Edit/LeverInteractController.cs.meta rename to Assets/Script/Gameplay/Facility/LeverInteractController.cs.meta diff --git a/Assets/Script/Gameplay/Edit/MovingPlatformController.cs b/Assets/Script/Gameplay/Facility/MovingPlatformController.cs similarity index 71% rename from Assets/Script/Gameplay/Edit/MovingPlatformController.cs rename to Assets/Script/Gameplay/Facility/MovingPlatformController.cs index 7239843..28790c5 100644 --- a/Assets/Script/Gameplay/Edit/MovingPlatformController.cs +++ b/Assets/Script/Gameplay/Facility/MovingPlatformController.cs @@ -2,13 +2,13 @@ using UnityEngine; using Script.Gameplay.Connect; using Script.Gameplay.Interface; -namespace Script.Gameplay.Edit +namespace Script.Gameplay.Facility { - public class MovingPlatformController : MonoBehaviour, IEditableComponent, ISignalReceiver + public class MovingPlatformController : BaseFacilityController { [SerializeField] private GameObject startPositionObject; [SerializeField] private GameObject targetPositionObject; - public float moveSpeed = 2f; + [SerializeField] public float moveSpeed = 2f; private Vector3 startPosition; private Vector3 targetPosition; @@ -35,8 +35,9 @@ namespace Script.Gameplay.Edit } } - public void OnSignalReceived(bool active, GameObject sender) + public override void OnSignalReceived(bool active, GameObject sender) { + base.OnSignalReceived(active, sender); if (active) { isMoving = true; @@ -47,20 +48,15 @@ namespace Script.Gameplay.Edit } } - // IEditableComponent - private bool isEditable = true; - public bool IsComponentActive + // 可选:如果需要编辑激活状态,可以重写属性 + public override bool IsEnableEdit { - get => isEditable; + get => base.IsEnableEdit; set { - isEditable = value; + base.IsEnableEdit = value; isMoving = value; } } - - public string ComponentName { get; set; } = "MovingPlatform"; - public LockLevel LockLevel => LockLevel.Red; } } - diff --git a/Assets/Script/Gameplay/Edit/MovingPlatformController.cs.meta b/Assets/Script/Gameplay/Facility/MovingPlatformController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Edit/MovingPlatformController.cs.meta rename to Assets/Script/Gameplay/Facility/MovingPlatformController.cs.meta diff --git a/Assets/Script/Gameplay/Edit/NumberSlotController.cs b/Assets/Script/Gameplay/Facility/NumberSlotController.cs similarity index 51% rename from Assets/Script/Gameplay/Edit/NumberSlotController.cs rename to Assets/Script/Gameplay/Facility/NumberSlotController.cs index 6b704a0..ffe6a7f 100644 --- a/Assets/Script/Gameplay/Edit/NumberSlotController.cs +++ b/Assets/Script/Gameplay/Facility/NumberSlotController.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using UnityEngine; using Script.Gameplay.Connect; -namespace Script.Gameplay.Edit +namespace Script.Gameplay.Facility { // 号码枚举类型 public enum NumberType @@ -20,27 +20,16 @@ namespace Script.Gameplay.Edit } // 号码槽 - public class NumberSlotController : MonoBehaviour, IConnectable, ISignalSender + public class NumberSlotController : BaseFacilityController { [Header("号码槽设置")] [SerializeField] private NumberType currentNumber = NumberType.Zero; [SerializeField] private NumberType correctNumber = NumberType.One; - public List ConnectionLines { get; set; } = new List(); - - // 不可编辑,不可交互 - // 可连接,可发信号 - - public bool IsEnablePlayerConnect { get; set; } = true; - public void OnGazeEnter() { } - public void OnGazeExit() { } - public Vector3 GetPosition() => transform.position; - public GameObject GetGameObject() => gameObject; - public string GetConnectableName() => gameObject.name; - // 接收信号 - public void OnSignalReceived(bool active, GameObject sender) + public override void OnSignalReceived(bool active, GameObject sender) { + base.OnSignalReceived(active, sender); if (active) { SwitchToNextNumber(); @@ -58,20 +47,7 @@ namespace Script.Gameplay.Edit private void CheckNumberAndSendSignal() { bool isCorrect = currentNumber == correctNumber; - SendSignal(isCorrect); - } - - // 发出信号 - public void SendSignal(bool active) - { - if (ConnectionLines != null) - { - foreach (var line in ConnectionLines) - { - line.SignalActive(active, this.gameObject); - } - } + SendSignal(isCorrect, this.gameObject); } } } - diff --git a/Assets/Script/Gameplay/Edit/NumberSlotController.cs.meta b/Assets/Script/Gameplay/Facility/NumberSlotController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Edit/NumberSlotController.cs.meta rename to Assets/Script/Gameplay/Facility/NumberSlotController.cs.meta diff --git a/Assets/Script/Gameplay/Facility/PressurePlateController.cs b/Assets/Script/Gameplay/Facility/PressurePlateController.cs new file mode 100644 index 0000000..1fca97d --- /dev/null +++ b/Assets/Script/Gameplay/Facility/PressurePlateController.cs @@ -0,0 +1,35 @@ +using System.Collections.Generic; +using UnityEngine; +using Script.Gameplay.Connect; + +namespace Script.Gameplay.Facility +{ + public class PressurePlateController : BaseFacilityController + { + [SerializeField] private LayerMask detectLayer = ~0; // 检测所有层,可在Inspector中指定 + [SerializeField] private Vector3 plateSize = new Vector3(1, 0.2f, 1); + [SerializeField] private Vector3 plateOffset = Vector3.up * 0.1f; + + private bool lastState = false; + + private void FixedUpdate() + { + if (!isEnableInteract) return; + bool hasObject = Physics.CheckBox(transform.position + plateOffset, plateSize * 0.5f, Quaternion.identity, detectLayer); + if (hasObject != lastState) + { + SendSignal(hasObject, this.gameObject); + lastState = hasObject; + } + } + + +#if UNITY_EDITOR + private void OnDrawGizmosSelected() + { + Gizmos.color = Color.yellow; + Gizmos.DrawWireCube(transform.position + plateOffset, plateSize); + } +#endif + } +} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Edit/PressurePlateController.cs.meta b/Assets/Script/Gameplay/Facility/PressurePlateController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Edit/PressurePlateController.cs.meta rename to Assets/Script/Gameplay/Facility/PressurePlateController.cs.meta diff --git a/Assets/Script/Gameplay/Connect/IConnectable.cs b/Assets/Script/Gameplay/Interface/IConnectable.cs similarity index 54% rename from Assets/Script/Gameplay/Connect/IConnectable.cs rename to Assets/Script/Gameplay/Interface/IConnectable.cs index 687fd00..1a5ddd9 100644 --- a/Assets/Script/Gameplay/Connect/IConnectable.cs +++ b/Assets/Script/Gameplay/Interface/IConnectable.cs @@ -1,13 +1,12 @@ using UnityEngine; using System.Collections.Generic; +using Script.Gameplay.Connect; -namespace Script.Gameplay.Connect +namespace Script.Gameplay.Interface { - public interface IConnectable : ISignalReceiver + public interface IConnectable { - public bool IsEnablePlayerConnect { get; set; } - void OnGazeEnter(); // 玩家开始注视时触发 - void OnGazeExit(); // 玩家停止注视时触发 + public bool IsEnableConnect { get; set; } Vector3 GetPosition(); // 获取连接点位置 GameObject GetGameObject(); // 获取连接点物体 string GetConnectableName(); // 获取连接点名称 diff --git a/Assets/Script/Gameplay/Connect/IConnectable.cs.meta b/Assets/Script/Gameplay/Interface/IConnectable.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Connect/IConnectable.cs.meta rename to Assets/Script/Gameplay/Interface/IConnectable.cs.meta diff --git a/Assets/Script/Gameplay/Interface/IEditableComponent.cs b/Assets/Script/Gameplay/Interface/IEditableComponent.cs index cb59fbe..2137fb3 100644 --- a/Assets/Script/Gameplay/Interface/IEditableComponent.cs +++ b/Assets/Script/Gameplay/Interface/IEditableComponent.cs @@ -9,8 +9,10 @@ namespace Script.Gameplay.Interface public interface IEditableComponent { - public bool IsEditableActive { get; set; } + public bool IsEnableEdit { get; set; } + //public bool IsComponentActive { get; set; } + public bool IsOpenInEditor { get; set; } public string ComponentName { get; set; } - public LockLevel LockLevel { get; } + //public LockLevel LockLevel { get; } } } \ No newline at end of file diff --git a/Assets/Script/Gameplay/Interface/IGaze.cs b/Assets/Script/Gameplay/Interface/IGaze.cs new file mode 100644 index 0000000..4faec36 --- /dev/null +++ b/Assets/Script/Gameplay/Interface/IGaze.cs @@ -0,0 +1,6 @@ +using UnityEngine; +public interface IGaze +{ + void OnGazeEnter(GameObject go); // 玩家开始注视时触发 + void OnGazeExit(GameObject go); // 玩家停止注视时触发 +} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Interface/IGaze.cs.meta b/Assets/Script/Gameplay/Interface/IGaze.cs.meta new file mode 100644 index 0000000..8e5a74f --- /dev/null +++ b/Assets/Script/Gameplay/Interface/IGaze.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a1fd2746b1d1f3641a61981f69313868 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Script/Gameplay/Interface/IInteractable.cs b/Assets/Script/Gameplay/Interface/IInteractable.cs index c56257f..e17adea 100644 --- a/Assets/Script/Gameplay/Interface/IInteractable.cs +++ b/Assets/Script/Gameplay/Interface/IInteractable.cs @@ -3,9 +3,8 @@ namespace Script.Gameplay.Interface { public interface IInteractable { + public bool IsEnableInteract { get; set; } string GetInteractPrompt(); // 返回提示文字,例如“按E打开门” void Interact(GameObject interactor); // 当玩家交互时触发 - void OnGazeEnter(GameObject editor); // 玩家开始注视时触发 - void OnGazeExit(GameObject editor); // 玩家停止注视时触发 } } \ No newline at end of file diff --git a/Assets/Script/Gameplay/Connect/ISignalReceiver.cs b/Assets/Script/Gameplay/Interface/ISignalReceiver.cs similarity index 79% rename from Assets/Script/Gameplay/Connect/ISignalReceiver.cs rename to Assets/Script/Gameplay/Interface/ISignalReceiver.cs index 959edd0..4e6313f 100644 --- a/Assets/Script/Gameplay/Connect/ISignalReceiver.cs +++ b/Assets/Script/Gameplay/Interface/ISignalReceiver.cs @@ -1,5 +1,5 @@ using UnityEngine; -namespace Script.Gameplay.Connect +namespace Script.Gameplay.Interface { public interface ISignalReceiver { diff --git a/Assets/Script/Gameplay/Connect/ISignalReceiver.cs.meta b/Assets/Script/Gameplay/Interface/ISignalReceiver.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Connect/ISignalReceiver.cs.meta rename to Assets/Script/Gameplay/Interface/ISignalReceiver.cs.meta diff --git a/Assets/Script/Gameplay/Interface/ISignalSender.cs b/Assets/Script/Gameplay/Interface/ISignalSender.cs new file mode 100644 index 0000000..582e3d2 --- /dev/null +++ b/Assets/Script/Gameplay/Interface/ISignalSender.cs @@ -0,0 +1,8 @@ +using UnityEngine; +namespace Script.Gameplay.Interface +{ + public interface ISignalSender + { + public void SendSignal(bool active, GameObject sender); + } +} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Connect/ISignalSender.cs.meta b/Assets/Script/Gameplay/Interface/ISignalSender.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Connect/ISignalSender.cs.meta rename to Assets/Script/Gameplay/Interface/ISignalSender.cs.meta diff --git a/Assets/Script/Gameplay/Player/PlayerConnectController.cs b/Assets/Script/Gameplay/Player/PlayerConnectController.cs index 7bc5668..41464c7 100644 --- a/Assets/Script/Gameplay/Player/PlayerConnectController.cs +++ b/Assets/Script/Gameplay/Player/PlayerConnectController.cs @@ -2,6 +2,7 @@ using System.Linq; using Core; using UnityEngine; using Script.Gameplay.Connect; +using Script.Gameplay.Interface; using Script.Gameplay.Input; using System; @@ -9,14 +10,14 @@ namespace Script.Gameplay.Player { public class PlayerConnectController : MonoBehaviour { - private bool isEnableConnecting = false; - public bool IsEnableConnecting + private bool _isEnablePlayerConnecting = false; + public bool IsEnablePlayerConnecting { - get => isEnableConnecting; + get => _isEnablePlayerConnecting; set { - isEnableConnecting = value; - if (isEnableConnecting == false) + _isEnablePlayerConnecting = value; + if (_isEnablePlayerConnecting == false) { // 重置当前目标 CurrentTarget = null; @@ -83,26 +84,16 @@ namespace Script.Gameplay.Player void DetectConnectable() { if (raycaster == null) return; - if(!IsEnableConnecting) return; + if(!IsEnablePlayerConnecting) return; GameObject lookAtObj = raycaster.CurrentLookAtObject; IConnectable hitConnectable = lookAtObj != null ? lookAtObj.GetComponent() : null; // 注视对象变化时触发进入/离开(使用接口方法) - if (hitConnectable != previousGazedTarget) - { - if (previousGazedTarget != null) - { - previousGazedTarget.OnGazeExit(); - } - - if (hitConnectable != null) - { - hitConnectable.OnGazeEnter(); - } - - previousGazedTarget = hitConnectable; - } + // if (hitConnectable != previousGazedTarget) + // { + // previousGazedTarget = hitConnectable; + // } CurrentTarget = hitConnectable; } @@ -110,8 +101,8 @@ namespace Script.Gameplay.Player public void SetPointA(IConnectable target) { if (target == null) return; - if (!IsEnableConnecting) return; - if (!target.IsEnablePlayerConnect) return; + if (!IsEnablePlayerConnecting) return; + if (!target.IsEnableConnect) return; outTarget = target; OnSetPointA?.Invoke(outTarget); } @@ -119,9 +110,9 @@ namespace Script.Gameplay.Player public void SetPointB(IConnectable target) { if (target == null) return; - if (!IsEnableConnecting) return; - if (!target.IsEnablePlayerConnect) return; - + if (!IsEnablePlayerConnecting) return; + if (!target.IsEnableConnect) return; + inputTarget = target; OnSetPointB?.Invoke(inputTarget); } @@ -129,13 +120,13 @@ namespace Script.Gameplay.Player public void CutConnectLine(IConnectable target) { if (target == null) return; - if(!IsEnableConnecting) return; + if(!IsEnablePlayerConnecting) return; ConnectionLineManager.Instance.CutTargetConnectionLines(target); } private void CreateConnection() { - if(!IsEnableConnecting) return; + if(!IsEnablePlayerConnecting) return; if (outTarget != null && inputTarget != null && outTarget != inputTarget) { //计算距离 diff --git a/Assets/Script/Gameplay/Player/PlayerEditController.cs b/Assets/Script/Gameplay/Player/PlayerEditController.cs index 2350df4..65b14e6 100644 --- a/Assets/Script/Gameplay/Player/PlayerEditController.cs +++ b/Assets/Script/Gameplay/Player/PlayerEditController.cs @@ -45,31 +45,31 @@ namespace Script.Gameplay.Player if (raycaster == null) return; GameObject lookAtObj = raycaster.CurrentLookAtObject; - if(lookAtObj == null) return; - GameObject hitEditable = null; - if (lookAtObj.GetComponent() != null) + if (lookAtObj != null) { - hitEditable = lookAtObj; - } - - // 如果命中对象与之前注视的不一样,触发进入/离开事件 - if (hitEditable != previousGazedTarget) - { - if (previousGazedTarget != null) + if (lookAtObj.GetComponent() != null) { - // previousGazedTarget.OnGazeExit(this); + hitEditable = lookAtObj; } - - if (hitEditable != null) - { - // hitEditable.OnGazeEnter(this); - } - - previousGazedTarget = hitEditable; } - currentTarget = hitEditable; + + // // 如果命中对象与之前注视的不一样,触发进入/离开事件 + // if (hitEditable != previousGazedTarget) + // { + // if (previousGazedTarget != null) + // { + // // previousGazedTarget.OnGazeExit(this); + // } + // + // if (hitEditable != null) + // { + // // hitEditable.OnGazeEnter(this); + // } + // + // previousGazedTarget = hitEditable; + // } } private void EditTarget() diff --git a/Assets/Script/Gameplay/Player/PlayerInteractorController.cs b/Assets/Script/Gameplay/Player/PlayerInteractorController.cs index 812ec55..5ada275 100644 --- a/Assets/Script/Gameplay/Player/PlayerInteractorController.cs +++ b/Assets/Script/Gameplay/Player/PlayerInteractorController.cs @@ -47,10 +47,9 @@ namespace Script.Gameplay.Player var input = InputManager.Instance.Input; input.Player.Interact.performed += ctx => { - if (CurrentTarget != null) - { - CurrentTarget.Interact(this.gameObject); - } + if(CurrentTarget == null) return; + if (!CurrentTarget.IsEnableInteract) return; + CurrentTarget.Interact(this.gameObject); }; ControllerLocator.Instance.Register(this); @@ -72,17 +71,17 @@ namespace Script.Gameplay.Player // 如果命中对象与之前注视的不一样,触发进入/离开事件 if (hitInteractable != previousGazedTarget) { - if (previousGazedTarget != null) - { - previousGazedTarget.OnGazeExit(this.gameObject); - } - - if (hitInteractable != null) - { - hitInteractable.OnGazeEnter(this.gameObject); - // 这里可以显示交互提示UI,例如 “E - 开门” - //Debug.Log(hitInteractable.GetInteractPrompt()); - } + // if (previousGazedTarget != null) + // { + // previousGazedTarget.OnGazeExit(this.gameObject); + // } + // + // if (hitInteractable != null) + // { + // hitInteractable.OnGazeEnter(this.gameObject); + // // 这里可以显示交互提示UI,例如 “E - 开门” + // //Debug.Log(hitInteractable.GetInteractPrompt()); + // } previousGazedTarget = hitInteractable; } @@ -95,7 +94,7 @@ namespace Script.Gameplay.Player isEnablePlayerInteraction = isEnabled; if (!isEnabled && previousGazedTarget != null) { - previousGazedTarget.OnGazeExit(this.gameObject); + // previousGazedTarget.OnGazeExit(this.gameObject); previousGazedTarget = null; CurrentTarget = null; } diff --git a/Assets/Script/Gameplay/Player/PlayerWatchModeController.cs b/Assets/Script/Gameplay/Player/PlayerWatchModeController.cs index ecf6bfd..6d57fdf 100644 --- a/Assets/Script/Gameplay/Player/PlayerWatchModeController.cs +++ b/Assets/Script/Gameplay/Player/PlayerWatchModeController.cs @@ -76,7 +76,7 @@ namespace Script.Gameplay.Player if (playerConnectController != null) { - playerConnectController.IsEnableConnecting = false; + playerConnectController.IsEnablePlayerConnecting = false; } break; case WatchMode.Outside: @@ -92,7 +92,7 @@ namespace Script.Gameplay.Player if (playerConnectController != null) { - playerConnectController.IsEnableConnecting = true; + playerConnectController.IsEnablePlayerConnecting = true; } break; diff --git a/Assets/Script/Gameplay/UI/EditableComponentViewer.cs b/Assets/Script/Gameplay/UI/EditableComponentViewer.cs index a802d0f..9b2f22b 100644 --- a/Assets/Script/Gameplay/UI/EditableComponentViewer.cs +++ b/Assets/Script/Gameplay/UI/EditableComponentViewer.cs @@ -24,7 +24,7 @@ namespace UI private void OnClickButton() { - _component.IsComponentActive = !_component.IsComponentActive; + _component.IsOpenInEditor = !_component.IsOpenInEditor; RefreshUI(); } @@ -33,7 +33,7 @@ namespace UI if (_component != null) { componentName.text = _component.ComponentName; - componentState.text = _component.IsComponentActive ? "Active" : "Inactive"; + componentState.text = _component.IsOpenInEditor ? "Active" : "Inactive"; } } } diff --git a/Assets/Script/Gameplay/UI/PlayerConnectViewer.cs b/Assets/Script/Gameplay/UI/PlayerConnectViewer.cs index 18729d8..331bce6 100644 --- a/Assets/Script/Gameplay/UI/PlayerConnectViewer.cs +++ b/Assets/Script/Gameplay/UI/PlayerConnectViewer.cs @@ -2,6 +2,7 @@ using System; using Core; using Script.Gameplay.Player; using Script.Gameplay.Connect; +using Script.Gameplay.Interface; using TMPro; using UnityEngine; diff --git a/Assets/Script/Gameplay/UI/PlayerEditViewer.cs b/Assets/Script/Gameplay/UI/PlayerEditViewer.cs index a331dbc..3cd1a56 100644 --- a/Assets/Script/Gameplay/UI/PlayerEditViewer.cs +++ b/Assets/Script/Gameplay/UI/PlayerEditViewer.cs @@ -13,6 +13,7 @@ namespace UI public class PlayerEditViewer : UIBase { [SerializeField] private GameObject componentEditViewerPrefab; + [SerializeField] private GameObject notEditableComponentEditViewer; [SerializeField] private GameObject noEditableTargetPanel; [SerializeField] private float panelRadius = 100f; public List componentViewers = new List(); @@ -30,18 +31,16 @@ namespace UI public void OnBeginEdit(GameObject target) { this.gameObject.SetActive(true); - if (target != null) - { - ClearComponentUI(); - GenerateComponentUI(EditableManager.GetEditableComponents(target)); - } - else + if (target == null) { if (noEditableTargetPanel != null) { noEditableTargetPanel.SetActive(true); } } + + ClearComponentUI(); + GenerateComponentUI(EditableManager.GetEditableComponents(target)); } public void OnEndEdit(GameObject target) @@ -63,7 +62,7 @@ namespace UI this.editController.OnEndEditTarget += OnEndEdit; //Debug.Log("PlayerEditViewer obtained PlayerEditController."); } - + private void ClearComponentUI() { foreach (var viewer in componentViewers) @@ -99,13 +98,24 @@ namespace UI float angleDeg = angleStep * i; float angleRad = Mathf.Deg2Rad * angleDeg; Vector2 localPos = new Vector2(Mathf.Cos(angleRad), Mathf.Sin(angleRad)) * radius; + IEditableComponent component = components[i]; - var go = Instantiate(componentEditViewerPrefab, transform); + GameObject go; + + if (component.IsEnableEdit) + { + go = Instantiate(componentEditViewerPrefab, transform); + } + else + { + go = Instantiate(notEditableComponentEditViewer, transform); + } + go.name = $"{componentEditViewerPrefab.name}_{i}"; var viewer = go.GetComponent(); if (viewer != null) { - viewer.SetComponent(components[i]); // 注入此UI需要的组件数据 + viewer.SetComponent(component); // 注入此UI需要的组件数据 componentViewers.Add(viewer); }