From 345930843d4984ade9213ff53c1c53021848e86a Mon Sep 17 00:00:00 2001 From: GanX <2423855310@qq.com> Date: Sat, 18 Oct 2025 08:55:38 +0800 Subject: [PATCH] =?UTF-8?q?feat():=E5=AE=8C=E6=88=903=E7=A7=8D=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=E7=9A=84=E5=9F=BA=E6=9C=AC=E8=BF=90=E8=A1=8C=E6=A1=86?= =?UTF-8?q?=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Prefab/UI.meta | 8 + Assets/Prefab/UI/EditComponent.prefab | 92 +++++ Assets/Prefab/UI/EditComponent.prefab.meta | 7 + Assets/Prefab/UI/PlayerEditPanelViwer.prefab | 135 +++++++ .../UI/PlayerEditPanelViwer.prefab.meta | 7 + Assets/Scenes/Level1.unity | 164 ++------- Assets/Scenes/UIScene.unity | 342 ++++++++++++------ .../Facility/DoorInteractController.cs | 44 +++ .../Facility/DoorInteractController.cs.meta | 3 + .../Script/Gameplay/Facility/EditComponent.cs | 7 - .../Gameplay/Facility/FacilityController.cs | 69 ---- .../Facility/FacilityEditableController.cs | 44 +++ ...eta => FacilityEditableController.cs.meta} | 0 .../Gameplay/Facility/FacilityModifier.cs | 27 -- .../Facility/FacilityModifier.cs.meta | 3 - .../Gameplay/Facility/IEditableComponent.cs | 15 + ...ent.cs.meta => IEditableComponent.cs.meta} | 0 .../Facility/InteractableBaseController.cs | 30 ++ .../InteractableBaseController.cs.meta | 3 + Assets/Script/Gameplay/Interface/IEditable.cs | 5 +- .../Gameplay/Player/PlayerEditController.cs | 13 +- .../Player/PlayerInteractorController.cs | 8 +- ...itcher.cs => PlayerWatchModeController.cs} | 37 +- ...meta => PlayerWatchModeController.cs.meta} | 0 Assets/Script/Gameplay/UI.meta | 3 + .../UI/EditableComponentViewer.cs} | 4 +- .../UI/EditableComponentViewer.cs.meta} | 0 Assets/Script/Gameplay/UI/PlayerEditViewer.cs | 181 +++++++++ .../UI/PlayerEditViewer.cs.meta} | 0 .../{ => Gameplay}/UI/PlayerHpViewer.cs | 2 +- .../{ => Gameplay}/UI/PlayerHpViewer.cs.meta | 0 .../Gameplay/UI/PlayerWatchModeViewer.cs | 33 ++ .../Gameplay/UI/PlayerWatchModeViewer.cs.meta | 3 + .../{ => Gameplay}/UI/StartGameButton.cs | 0 .../{ => Gameplay}/UI/StartGameButton.cs.meta | 0 Assets/Script/UI.meta | 3 - Assets/Script/UI/PlayerEditPanelViewer.cs | 24 -- Assets/Script/UI/UI.asmdef | 17 - Assets/Script/UI/UI.asmdef.meta | 3 - 39 files changed, 909 insertions(+), 427 deletions(-) create mode 100644 Assets/Prefab/UI.meta create mode 100644 Assets/Prefab/UI/EditComponent.prefab create mode 100644 Assets/Prefab/UI/EditComponent.prefab.meta create mode 100644 Assets/Prefab/UI/PlayerEditPanelViwer.prefab create mode 100644 Assets/Prefab/UI/PlayerEditPanelViwer.prefab.meta create mode 100644 Assets/Script/Gameplay/Facility/DoorInteractController.cs create mode 100644 Assets/Script/Gameplay/Facility/DoorInteractController.cs.meta delete mode 100644 Assets/Script/Gameplay/Facility/EditComponent.cs delete mode 100644 Assets/Script/Gameplay/Facility/FacilityController.cs create mode 100644 Assets/Script/Gameplay/Facility/FacilityEditableController.cs rename Assets/Script/Gameplay/Facility/{FacilityController.cs.meta => FacilityEditableController.cs.meta} (100%) delete mode 100644 Assets/Script/Gameplay/Facility/FacilityModifier.cs delete mode 100644 Assets/Script/Gameplay/Facility/FacilityModifier.cs.meta create mode 100644 Assets/Script/Gameplay/Facility/IEditableComponent.cs rename Assets/Script/Gameplay/Facility/{EditComponent.cs.meta => IEditableComponent.cs.meta} (100%) create mode 100644 Assets/Script/Gameplay/Facility/InteractableBaseController.cs create mode 100644 Assets/Script/Gameplay/Facility/InteractableBaseController.cs.meta rename Assets/Script/Gameplay/Player/{PlayerWatchModeSwitcher.cs => PlayerWatchModeController.cs} (65%) rename Assets/Script/Gameplay/Player/{PlayerWatchModeSwitcher.cs.meta => PlayerWatchModeController.cs.meta} (100%) create mode 100644 Assets/Script/Gameplay/UI.meta rename Assets/Script/{UI/FacilityComponentEditViewer.cs => Gameplay/UI/EditableComponentViewer.cs} (84%) rename Assets/Script/{UI/FacilityComponentEditViewer.cs.meta => Gameplay/UI/EditableComponentViewer.cs.meta} (100%) create mode 100644 Assets/Script/Gameplay/UI/PlayerEditViewer.cs rename Assets/Script/{UI/PlayerEditPanelViewer.cs.meta => Gameplay/UI/PlayerEditViewer.cs.meta} (100%) rename Assets/Script/{ => Gameplay}/UI/PlayerHpViewer.cs (95%) rename Assets/Script/{ => Gameplay}/UI/PlayerHpViewer.cs.meta (100%) create mode 100644 Assets/Script/Gameplay/UI/PlayerWatchModeViewer.cs create mode 100644 Assets/Script/Gameplay/UI/PlayerWatchModeViewer.cs.meta rename Assets/Script/{ => Gameplay}/UI/StartGameButton.cs (100%) rename Assets/Script/{ => Gameplay}/UI/StartGameButton.cs.meta (100%) delete mode 100644 Assets/Script/UI.meta delete mode 100644 Assets/Script/UI/PlayerEditPanelViewer.cs delete mode 100644 Assets/Script/UI/UI.asmdef delete mode 100644 Assets/Script/UI/UI.asmdef.meta diff --git a/Assets/Prefab/UI.meta b/Assets/Prefab/UI.meta new file mode 100644 index 0000000..49e1eb6 --- /dev/null +++ b/Assets/Prefab/UI.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: dd3c25578c29f1b46bf226a4019a48aa +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefab/UI/EditComponent.prefab b/Assets/Prefab/UI/EditComponent.prefab new file mode 100644 index 0000000..4647e4a --- /dev/null +++ b/Assets/Prefab/UI/EditComponent.prefab @@ -0,0 +1,92 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &3732398851892431074 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4187954858673434835} + - component: {fileID: 333526988709526953} + - component: {fileID: 4291694443444656529} + - component: {fileID: 2396565921764771254} + m_Layer: 5 + m_Name: EditComponent + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &4187954858673434835 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3732398851892431074} + 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: 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: 100, y: 100} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &333526988709526953 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3732398851892431074} + m_CullTransparentMesh: 1 +--- !u!114 &4291694443444656529 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3732398851892431074} + 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!114 &2396565921764771254 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 3732398851892431074} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 126d8afe0e304d548dc13c4df6405e17, type: 3} + m_Name: + m_EditorClassIdentifier: + component: {fileID: 0} + IsOpen: 0 diff --git a/Assets/Prefab/UI/EditComponent.prefab.meta b/Assets/Prefab/UI/EditComponent.prefab.meta new file mode 100644 index 0000000..f6be6a4 --- /dev/null +++ b/Assets/Prefab/UI/EditComponent.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cde7c0684d092944d8c165da0c0368f6 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Prefab/UI/PlayerEditPanelViwer.prefab b/Assets/Prefab/UI/PlayerEditPanelViwer.prefab new file mode 100644 index 0000000..26d9cea --- /dev/null +++ b/Assets/Prefab/UI/PlayerEditPanelViwer.prefab @@ -0,0 +1,135 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &756030608054991821 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1276987115395320878} + - component: {fileID: 7373803104432976654} + m_Layer: 5 + m_Name: PlayerEditPanelViwer + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1276987115395320878 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 756030608054991821} + 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: 8170672926465396806} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &7373803104432976654 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 756030608054991821} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 29d585e25c3a4840871167630b3c7a49, type: 3} + m_Name: + m_EditorClassIdentifier: + IsOpenOnFirstLoad: 0 + componentEditViewerPrefab: {fileID: 3732398851892431074, guid: cde7c0684d092944d8c165da0c0368f6, + type: 3} + noEditableTargetPanel: {fileID: 6815803542166296534} + panelRadius: 100 +--- !u!1 &6815803542166296534 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8170672926465396806} + - component: {fileID: 7451891650900267429} + - component: {fileID: 6184840204151197881} + m_Layer: 5 + m_Name: NoEditableTargetPanel + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 0 +--- !u!224 &8170672926465396806 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6815803542166296534} + 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 &7451891650900267429 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6815803542166296534} + m_CullTransparentMesh: 1 +--- !u!114 &6184840204151197881 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6815803542166296534} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, 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_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 35 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 0 + m_MaxSize: 50 + m_Alignment: 4 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: No Editable Target diff --git a/Assets/Prefab/UI/PlayerEditPanelViwer.prefab.meta b/Assets/Prefab/UI/PlayerEditPanelViwer.prefab.meta new file mode 100644 index 0000000..99ab96e --- /dev/null +++ b/Assets/Prefab/UI/PlayerEditPanelViwer.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: faba7bc710ad07f4491499290cd8b296 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/Level1.unity b/Assets/Scenes/Level1.unity index 7706884..d820ca5 100644 --- a/Assets/Scenes/Level1.unity +++ b/Assets/Scenes/Level1.unity @@ -229,74 +229,6 @@ Transform: m_Children: [] m_Father: {fileID: 2021089518} m_LocalEulerAnglesHint: {x: 0, y: -39.767, z: 0} ---- !u!1 &382458518 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 382458521} - - component: {fileID: 382458520} - - component: {fileID: 382458519} - m_Layer: 0 - m_Name: EventSystem - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!114 &382458519 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 382458518} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} - m_Name: - m_EditorClassIdentifier: - m_SendPointerHoverToParent: 1 - m_HorizontalAxis: Horizontal - m_VerticalAxis: Vertical - m_SubmitButton: Submit - m_CancelButton: Cancel - m_InputActionsPerSecond: 10 - m_RepeatDelay: 0.5 - m_ForceModuleActive: 0 ---- !u!114 &382458520 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 382458518} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} - m_Name: - m_EditorClassIdentifier: - m_FirstSelected: {fileID: 0} - m_sendNavigationEvents: 1 - m_DragThreshold: 10 ---- !u!4 &382458521 -Transform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 382458518} - serializedVersion: 2 - 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: 0} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} --- !u!1 &410087039 GameObject: m_ObjectHideFlags: 0 @@ -415,6 +347,26 @@ MonoBehaviour: m_LightCookieSize: {x: 1, y: 1} m_LightCookieOffset: {x: 0, y: 0} m_SoftShadowQuality: 1 +--- !u!1 &431100842 stripped +GameObject: + m_CorrespondingSourceObject: {fileID: 2729643726423589850, guid: b3e24e2df98d14e4ebc08cc68c071afa, + type: 3} + m_PrefabInstance: {fileID: 2088331975902746738} + m_PrefabAsset: {fileID: 0} +--- !u!114 &431100848 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 431100842} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 3bdc5380046d4cacb0dd579877f320eb, type: 3} + m_Name: + m_EditorClassIdentifier: + Interactable: 1 + lockLevel: 0 --- !u!1 &856668955 GameObject: m_ObjectHideFlags: 0 @@ -1175,74 +1127,6 @@ Transform: - {fileID: 1234629635} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1001 &2084876468 -PrefabInstance: - m_ObjectHideFlags: 0 - serializedVersion: 2 - m_Modification: - serializedVersion: 3 - m_TransformParent: {fileID: 0} - m_Modifications: - - target: {fileID: 151205406321954705, guid: 396fdaee2868c534e927e0c2d4da65da, - type: 3} - propertyPath: m_LocalPosition.x - value: -1.5440545 - objectReference: {fileID: 0} - - target: {fileID: 151205406321954705, guid: 396fdaee2868c534e927e0c2d4da65da, - type: 3} - propertyPath: m_LocalPosition.y - value: 0.5792608 - objectReference: {fileID: 0} - - target: {fileID: 151205406321954705, guid: 396fdaee2868c534e927e0c2d4da65da, - type: 3} - propertyPath: m_LocalPosition.z - value: 1.0709323 - objectReference: {fileID: 0} - - target: {fileID: 151205406321954705, guid: 396fdaee2868c534e927e0c2d4da65da, - type: 3} - propertyPath: m_LocalRotation.w - value: 1 - objectReference: {fileID: 0} - - target: {fileID: 151205406321954705, guid: 396fdaee2868c534e927e0c2d4da65da, - type: 3} - propertyPath: m_LocalRotation.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 151205406321954705, guid: 396fdaee2868c534e927e0c2d4da65da, - type: 3} - propertyPath: m_LocalRotation.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 151205406321954705, guid: 396fdaee2868c534e927e0c2d4da65da, - type: 3} - propertyPath: m_LocalRotation.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 151205406321954705, guid: 396fdaee2868c534e927e0c2d4da65da, - type: 3} - propertyPath: m_LocalEulerAnglesHint.x - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 151205406321954705, guid: 396fdaee2868c534e927e0c2d4da65da, - type: 3} - propertyPath: m_LocalEulerAnglesHint.y - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 151205406321954705, guid: 396fdaee2868c534e927e0c2d4da65da, - type: 3} - propertyPath: m_LocalEulerAnglesHint.z - value: 0 - objectReference: {fileID: 0} - - target: {fileID: 8031699868756389050, guid: 396fdaee2868c534e927e0c2d4da65da, - type: 3} - propertyPath: m_Name - value: NormalCardBook - objectReference: {fileID: 0} - m_RemovedComponents: [] - m_RemovedGameObjects: [] - m_AddedGameObjects: [] - m_AddedComponents: [] - m_SourcePrefab: {fileID: 100100000, guid: 396fdaee2868c534e927e0c2d4da65da, type: 3} --- !u!1001 &2088331975902746738 PrefabInstance: m_ObjectHideFlags: 0 @@ -1320,7 +1204,11 @@ PrefabInstance: m_RemovedGameObjects: - {fileID: 7518175844631896712, guid: b3e24e2df98d14e4ebc08cc68c071afa, type: 3} m_AddedGameObjects: [] - m_AddedComponents: [] + m_AddedComponents: + - targetCorrespondingSourceObject: {fileID: 2729643726423589850, guid: b3e24e2df98d14e4ebc08cc68c071afa, + type: 3} + insertIndex: -1 + addedObject: {fileID: 431100848} m_SourcePrefab: {fileID: 100100000, guid: b3e24e2df98d14e4ebc08cc68c071afa, type: 3} --- !u!1001 &4976374363246253691 PrefabInstance: @@ -1558,6 +1446,4 @@ SceneRoots: - {fileID: 4976374363246253691} - {fileID: 8808393704070049945} - {fileID: 1969328118} - - {fileID: 382458521} - - {fileID: 2084876468} - {fileID: 2088331975902746738} diff --git a/Assets/Scenes/UIScene.unity b/Assets/Scenes/UIScene.unity index f3500cf..efd1120 100644 --- a/Assets/Scenes/UIScene.unity +++ b/Assets/Scenes/UIScene.unity @@ -132,7 +132,7 @@ GameObject: m_Component: - component: {fileID: 40417856} - component: {fileID: 40417855} - - component: {fileID: 40417854} + - component: {fileID: 40417857} m_Layer: 0 m_Name: EventSystem m_TagString: Untagged @@ -140,26 +140,6 @@ GameObject: m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!114 &40417854 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 40417853} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} - m_Name: - m_EditorClassIdentifier: - m_SendPointerHoverToParent: 1 - m_HorizontalAxis: Horizontal - m_VerticalAxis: Vertical - m_SubmitButton: Submit - m_CancelButton: Cancel - m_InputActionsPerSecond: 10 - m_RepeatDelay: 0.5 - m_ForceModuleActive: 0 --- !u!114 &40417855 MonoBehaviour: m_ObjectHideFlags: 0 @@ -190,7 +170,55 @@ Transform: m_Children: [] m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!1 &165485609 +--- !u!114 &40417857 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 40417853} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 + m_MoveRepeatDelay: 0.5 + m_MoveRepeatRate: 0.1 + m_XRTrackingOrigin: {fileID: 0} + m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, + type: 3} + m_PointAction: {fileID: -1654692200621890270, guid: ca9f5fa95ffab41fb9a615ab714db018, + type: 3} + m_MoveAction: {fileID: -8784545083839296357, guid: ca9f5fa95ffab41fb9a615ab714db018, + type: 3} + m_SubmitAction: {fileID: 392368643174621059, guid: ca9f5fa95ffab41fb9a615ab714db018, + type: 3} + m_CancelAction: {fileID: 7727032971491509709, guid: ca9f5fa95ffab41fb9a615ab714db018, + type: 3} + m_LeftClickAction: {fileID: 3001919216989983466, guid: ca9f5fa95ffab41fb9a615ab714db018, + type: 3} + m_MiddleClickAction: {fileID: -2185481485913320682, guid: ca9f5fa95ffab41fb9a615ab714db018, + type: 3} + m_RightClickAction: {fileID: -4090225696740746782, guid: ca9f5fa95ffab41fb9a615ab714db018, + type: 3} + m_ScrollWheelAction: {fileID: 6240969308177333660, guid: ca9f5fa95ffab41fb9a615ab714db018, + type: 3} + m_TrackedDevicePositionAction: {fileID: 6564999863303420839, guid: ca9f5fa95ffab41fb9a615ab714db018, + type: 3} + m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018, + type: 3} + m_DeselectOnBackgroundClick: 1 + m_PointerBehavior: 0 + m_CursorLockBehavior: 0 + m_ScrollDeltaPerTick: 6 +--- !u!224 &165485610 stripped +RectTransform: + m_CorrespondingSourceObject: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + m_PrefabInstance: {fileID: 1937221272884345375} + m_PrefabAsset: {fileID: 0} +--- !u!1 &257151344 GameObject: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -198,48 +226,92 @@ GameObject: m_PrefabAsset: {fileID: 0} serializedVersion: 6 m_Component: - - component: {fileID: 165485610} - - component: {fileID: 165485611} + - component: {fileID: 257151345} + - component: {fileID: 257151348} + - component: {fileID: 257151347} + - component: {fileID: 257151346} m_Layer: 5 - m_Name: PlayerEditPanelViwer + m_Name: WatchMode m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 m_IsActive: 1 ---- !u!224 &165485610 +--- !u!224 &257151345 RectTransform: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 165485609} + m_GameObject: {fileID: 257151344} 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: 1748531705} - m_Father: {fileID: 1067459529} + m_Children: [] + m_Father: {fileID: 1780593834} 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_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 256.49097, y: 145} + m_SizeDelta: {x: 464.6504, y: 81.36188} m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &165485611 +--- !u!114 &257151346 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} m_PrefabInstance: {fileID: 0} m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 165485609} + m_GameObject: {fileID: 257151344} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 29d585e25c3a4840871167630b3c7a49, type: 3} + m_Script: {fileID: 11500000, guid: b1493e2f66aa46bf9c89362bd0d9013d, type: 3} m_Name: m_EditorClassIdentifier: - IsOpenOnFirstLoad: 0 + IsOpenOnFirstLoad: 1 + modeText: {fileID: 257151347} +--- !u!114 &257151347 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 257151344} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, 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_FontData: + m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0} + m_FontSize: 30 + m_FontStyle: 0 + m_BestFit: 0 + m_MinSize: 3 + m_MaxSize: 50 + m_Alignment: 3 + m_AlignByGeometry: 0 + m_RichText: 1 + m_HorizontalOverflow: 0 + m_VerticalOverflow: 0 + m_LineSpacing: 1 + m_Text: 'Watch Mode:' +--- !u!222 &257151348 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 257151344} + m_CullTransparentMesh: 1 --- !u!1 &1067459524 GameObject: m_ObjectHideFlags: 0 @@ -445,7 +517,7 @@ GameObject: - component: {fileID: 1200522804} - component: {fileID: 1200522803} m_Layer: 5 - m_Name: Text (Legacy) + m_Name: Hp m_TagString: Untagged m_Icon: {fileID: 0} m_NavMeshLayer: 0 @@ -526,81 +598,6 @@ CanvasRenderer: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 1200522801} m_CullTransparentMesh: 1 ---- !u!1 &1748531704 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 1748531705} - - component: {fileID: 1748531707} - - component: {fileID: 1748531706} - m_Layer: 5 - m_Name: EditComponent - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &1748531705 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1748531704} - 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: 165485610} - 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: 100, y: 100} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!114 &1748531706 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1748531704} - 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!222 &1748531707 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1748531704} - m_CullTransparentMesh: 1 --- !u!1 &1780593830 GameObject: m_ObjectHideFlags: 0 @@ -697,6 +694,7 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 1200522802} + - {fileID: 257151345} m_Father: {fileID: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} @@ -717,6 +715,124 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: layer: 1 +--- !u!1001 &1937221272884345375 +PrefabInstance: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_Modification: + serializedVersion: 3 + m_TransformParent: {fileID: 1067459529} + m_Modifications: + - target: {fileID: 756030608054991821, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_Name + value: PlayerEditPanelViwer + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_Pivot.x + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_Pivot.y + value: 0.5 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_AnchorMax.x + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_AnchorMax.y + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_AnchorMin.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_SizeDelta.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_SizeDelta.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_LocalPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_LocalPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_LocalPosition.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_LocalRotation.w + value: 1 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_LocalRotation.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_LocalRotation.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_LocalRotation.z + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_LocalEulerAnglesHint.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_LocalEulerAnglesHint.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 1276987115395320878, guid: faba7bc710ad07f4491499290cd8b296, + type: 3} + propertyPath: m_LocalEulerAnglesHint.z + value: 0 + objectReference: {fileID: 0} + m_RemovedComponents: [] + m_RemovedGameObjects: [] + m_AddedGameObjects: [] + m_AddedComponents: [] + m_SourcePrefab: {fileID: 100100000, guid: faba7bc710ad07f4491499290cd8b296, type: 3} --- !u!1660057539 &9223372036854775807 SceneRoots: m_ObjectHideFlags: 0 diff --git a/Assets/Script/Gameplay/Facility/DoorInteractController.cs b/Assets/Script/Gameplay/Facility/DoorInteractController.cs new file mode 100644 index 0000000..5d41c9e --- /dev/null +++ b/Assets/Script/Gameplay/Facility/DoorInteractController.cs @@ -0,0 +1,44 @@ +using System; +using Gameplay.Player; +using UnityEngine; +using Interface; + +namespace Script.Gameplay.Facility +{ + public class DoorInteractController : InteractableBaseController, IEditableComponent + { + [SerializeField] private LockLevel lockLevel; + private bool isOpened = false; + public override void Interact(GameObject interactor) + { + if (isOpened) + { + CloseDoor(); + isOpened = false; + } + else + { + OpenDoor(); + isOpened = true; + } + } + + public LockLevel LockLevel => lockLevel; + + public void SetActive(bool active) + { + // 实现激活或禁用门的逻辑 + Interactable = active; + } + + private void OpenDoor() + { + Debug.Log("Open door"); + } + + private void CloseDoor() + { + Debug.Log("Close door"); + } + } +} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Facility/DoorInteractController.cs.meta b/Assets/Script/Gameplay/Facility/DoorInteractController.cs.meta new file mode 100644 index 0000000..40561c1 --- /dev/null +++ b/Assets/Script/Gameplay/Facility/DoorInteractController.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 3bdc5380046d4cacb0dd579877f320eb +timeCreated: 1760693181 \ No newline at end of file diff --git a/Assets/Script/Gameplay/Facility/EditComponent.cs b/Assets/Script/Gameplay/Facility/EditComponent.cs deleted file mode 100644 index 9692864..0000000 --- a/Assets/Script/Gameplay/Facility/EditComponent.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace Script.Gameplay.Facility -{ - public class EditComponent - { - - } -} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Facility/FacilityController.cs b/Assets/Script/Gameplay/Facility/FacilityController.cs deleted file mode 100644 index 56ad55f..0000000 --- a/Assets/Script/Gameplay/Facility/FacilityController.cs +++ /dev/null @@ -1,69 +0,0 @@ -using System; -using Gameplay.Player; -using UnityEngine; -using Interface; - -namespace Script.Gameplay.Facility -{ - public class FacilityController : MonoBehaviour, IInteractable, IEditable - { - public FacilityModifier facilityModifier; - - private void Awake() - { - if (facilityModifier == null) - { - facilityModifier = GetComponent(); - } - } - - private void Start() - { - } - - public string GetInteractPrompt() - { - return ""; - } - - public void Interact(GameObject interactor) - { - - } - - public void OnGazeEnter(GameObject editor) - { - // 物体弹出按F可交互菜单 - } - - public void OnGazeExit(GameObject editor) - { - // 物体取消菜单 - } - - public void OnGazeEnter(PlayerEditController editor) - { - - } - - public void OnGazeExit(PlayerEditController editor) - { - - } - - public void BeginEdit() - { - - } - - public void EndEdit() - { - - } - - public IEditable GetEditable() - { - return this; - } - } -} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Facility/FacilityEditableController.cs b/Assets/Script/Gameplay/Facility/FacilityEditableController.cs new file mode 100644 index 0000000..72c25fc --- /dev/null +++ b/Assets/Script/Gameplay/Facility/FacilityEditableController.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections.Generic; +using Gameplay.Player; +using UnityEngine; +using Interface; + +namespace Script.Gameplay.Facility +{ + public class FacilityEditableController : MonoBehaviour, IEditable + { + public void OnGazeEnter(PlayerEditController editor) + { + + } + + public void OnGazeExit(PlayerEditController editor) + { + + } + + public void BeginEdit() + { + + } + + public void EndEdit() + { + + } + + public List GetEditableComponents() + { + var components = new List(); + foreach (var mb in GetComponentsInChildren(true)) + { + if (mb is IEditableComponent editableComponent) + { + components.Add(editableComponent); + } + } + return components; + } + } +} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Facility/FacilityController.cs.meta b/Assets/Script/Gameplay/Facility/FacilityEditableController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Facility/FacilityController.cs.meta rename to Assets/Script/Gameplay/Facility/FacilityEditableController.cs.meta diff --git a/Assets/Script/Gameplay/Facility/FacilityModifier.cs b/Assets/Script/Gameplay/Facility/FacilityModifier.cs deleted file mode 100644 index cd02e98..0000000 --- a/Assets/Script/Gameplay/Facility/FacilityModifier.cs +++ /dev/null @@ -1,27 +0,0 @@ -using UnityEngine; - -namespace Script.Gameplay.Facility -{ - public class FacilityModifier : MonoBehaviour - { - private Transform _transform; - private Collider _collider; - private Rigidbody _rigidbody; - - public void ModifyComponent(bool isOpen, T component) where T : Component - { - var targetComponent = this.GetComponent(); - if (targetComponent != null) - { - if (isOpen) - { - targetComponent.gameObject.SetActive(true); - } - else - { - targetComponent.gameObject.SetActive(false); - } - } - } - } -} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Facility/FacilityModifier.cs.meta b/Assets/Script/Gameplay/Facility/FacilityModifier.cs.meta deleted file mode 100644 index 042d2fe..0000000 --- a/Assets/Script/Gameplay/Facility/FacilityModifier.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: b1db33a437984a1a8fae09ab8c5de7e4 -timeCreated: 1760667210 \ No newline at end of file diff --git a/Assets/Script/Gameplay/Facility/IEditableComponent.cs b/Assets/Script/Gameplay/Facility/IEditableComponent.cs new file mode 100644 index 0000000..2267353 --- /dev/null +++ b/Assets/Script/Gameplay/Facility/IEditableComponent.cs @@ -0,0 +1,15 @@ +namespace Script.Gameplay.Facility +{ + public enum LockLevel + { + Red, + Blue, + Yellow, + } + + public interface IEditableComponent + { + public LockLevel LockLevel { get; } + public void SetActive(bool active); + } +} \ No newline at end of file diff --git a/Assets/Script/Gameplay/Facility/EditComponent.cs.meta b/Assets/Script/Gameplay/Facility/IEditableComponent.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Facility/EditComponent.cs.meta rename to Assets/Script/Gameplay/Facility/IEditableComponent.cs.meta diff --git a/Assets/Script/Gameplay/Facility/InteractableBaseController.cs b/Assets/Script/Gameplay/Facility/InteractableBaseController.cs new file mode 100644 index 0000000..b807ced --- /dev/null +++ b/Assets/Script/Gameplay/Facility/InteractableBaseController.cs @@ -0,0 +1,30 @@ +using UnityEngine; +using Interface; + +namespace Script.Gameplay.Facility +{ + 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/Facility/InteractableBaseController.cs.meta b/Assets/Script/Gameplay/Facility/InteractableBaseController.cs.meta new file mode 100644 index 0000000..0f01e19 --- /dev/null +++ b/Assets/Script/Gameplay/Facility/InteractableBaseController.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: f5781ad9dd2842a584b8ef333ae75e60 +timeCreated: 1760693365 \ No newline at end of file diff --git a/Assets/Script/Gameplay/Interface/IEditable.cs b/Assets/Script/Gameplay/Interface/IEditable.cs index 5fc6657..4575877 100644 --- a/Assets/Script/Gameplay/Interface/IEditable.cs +++ b/Assets/Script/Gameplay/Interface/IEditable.cs @@ -1,5 +1,8 @@ using UnityEngine; using Gameplay.Player; +using System.Collections.Generic; +using Script.Gameplay.Facility; + namespace Interface { public interface IEditable @@ -8,6 +11,6 @@ namespace Interface void OnGazeExit(PlayerEditController editor); // 玩家停止注视时触发 void BeginEdit(); void EndEdit(); - IEditable GetEditable(); + List GetEditableComponents(); } } \ No newline at end of file diff --git a/Assets/Script/Gameplay/Player/PlayerEditController.cs b/Assets/Script/Gameplay/Player/PlayerEditController.cs index c4ddab7..7cc28a7 100644 --- a/Assets/Script/Gameplay/Player/PlayerEditController.cs +++ b/Assets/Script/Gameplay/Player/PlayerEditController.cs @@ -1,3 +1,4 @@ +using Core; using UnityEngine; using Interface; using Script.Gameplay.Input; @@ -21,11 +22,8 @@ namespace Gameplay.Player inputManager = InputManager.Instance; if (playerCamera == null) playerCamera = GameObject.FindWithTag("MainCamera").GetComponent(); - - inputManager.Input.Player.SwitchWatchMode.performed += ctx => - { - if (currentTarget != null) currentTarget.BeginEdit(); - }; + + ControllerLocator.Instance.Register(this); } void Update() @@ -73,6 +71,11 @@ namespace Gameplay.Player } } + public IEditable GetCurrentTarget() + { + return currentTarget; + } + void OnDrawGizmos() { if(!isDrawGizmos) return; diff --git a/Assets/Script/Gameplay/Player/PlayerInteractorController.cs b/Assets/Script/Gameplay/Player/PlayerInteractorController.cs index 6b8de8d..b90a335 100644 --- a/Assets/Script/Gameplay/Player/PlayerInteractorController.cs +++ b/Assets/Script/Gameplay/Player/PlayerInteractorController.cs @@ -21,7 +21,13 @@ namespace Gameplay.Player playerCamera = GameObject.FindWithTag("MainCamera").GetComponent(); var input = InputManager.Instance.Input; - input.Player.SwitchWatchMode.performed += ctx => currentTarget.Interact(this.gameObject);; + input.Player.Interact.performed += ctx => + { + if (currentTarget != null) + { + currentTarget.Interact(this.gameObject); + } + }; } void Update() diff --git a/Assets/Script/Gameplay/Player/PlayerWatchModeSwitcher.cs b/Assets/Script/Gameplay/Player/PlayerWatchModeController.cs similarity index 65% rename from Assets/Script/Gameplay/Player/PlayerWatchModeSwitcher.cs rename to Assets/Script/Gameplay/Player/PlayerWatchModeController.cs index d24e966..45abbfc 100644 --- a/Assets/Script/Gameplay/Player/PlayerWatchModeSwitcher.cs +++ b/Assets/Script/Gameplay/Player/PlayerWatchModeController.cs @@ -1,6 +1,7 @@ using System; using Script.Gameplay.Input; using UnityEngine; +using Core; namespace Gameplay.Player { @@ -10,34 +11,46 @@ namespace Gameplay.Player Inside, Outside } - public class PlayerWatchModeSwitcher : MonoBehaviour + public class PlayerWatchModeController : MonoBehaviour { [SerializeField] private Camera cam; + public event Action OnEnterInsideWatchMode; + public event Action OnExitInsideWatchMode; private InputManager inputManager; private WatchMode currentMode = WatchMode.Normal; + public WatchMode CurrentWatchMode + { + get => currentMode; + set + { + if (value != WatchMode.Inside) + { + OnExitInsideWatchMode?.Invoke(); + } + if (value == WatchMode.Inside) + { + OnEnterInsideWatchMode?.Invoke(); + } + currentMode = value; + SwitchWatchMode(currentMode); + } + } private void Start() { inputManager = InputManager.Instance; - SetWatchMode(currentMode); var input = inputManager.Input; input.Player.SwitchWatchMode.performed += ctx => { - currentMode = (WatchMode)(((int)currentMode + 1) % 3); - SetWatchMode(currentMode); + var modeTemp = (WatchMode)(((int)CurrentWatchMode + 1) % 3); + CurrentWatchMode = modeTemp; };; + + ControllerLocator.Instance.Register(this); } - public void SetWatchMode(WatchMode mode) - { - currentMode = mode; - SwitchWatchMode(mode); - } - - // 实现按Tap键实现在WatchMode 3个模式切换,并通过SwitchWatchMode设置正确的相机模式 - private void SwitchWatchMode(WatchMode watchMode) { switch (watchMode) diff --git a/Assets/Script/Gameplay/Player/PlayerWatchModeSwitcher.cs.meta b/Assets/Script/Gameplay/Player/PlayerWatchModeController.cs.meta similarity index 100% rename from Assets/Script/Gameplay/Player/PlayerWatchModeSwitcher.cs.meta rename to Assets/Script/Gameplay/Player/PlayerWatchModeController.cs.meta diff --git a/Assets/Script/Gameplay/UI.meta b/Assets/Script/Gameplay/UI.meta new file mode 100644 index 0000000..73720c8 --- /dev/null +++ b/Assets/Script/Gameplay/UI.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 492ef2bd8fce4535b1b8c32d2a3e36ef +timeCreated: 1760695944 \ No newline at end of file diff --git a/Assets/Script/UI/FacilityComponentEditViewer.cs b/Assets/Script/Gameplay/UI/EditableComponentViewer.cs similarity index 84% rename from Assets/Script/UI/FacilityComponentEditViewer.cs rename to Assets/Script/Gameplay/UI/EditableComponentViewer.cs index b8a7386..d4738c6 100644 --- a/Assets/Script/UI/FacilityComponentEditViewer.cs +++ b/Assets/Script/Gameplay/UI/EditableComponentViewer.cs @@ -3,11 +3,11 @@ using UnityEngine; using UnityEngine; namespace UI { - public class FacilityComponentEditViewer : MonoBehaviour + public class EditableComponentViewer : MonoBehaviour { public Component component; public bool IsOpen; - + public void SetComponent() { if (component != null) diff --git a/Assets/Script/UI/FacilityComponentEditViewer.cs.meta b/Assets/Script/Gameplay/UI/EditableComponentViewer.cs.meta similarity index 100% rename from Assets/Script/UI/FacilityComponentEditViewer.cs.meta rename to Assets/Script/Gameplay/UI/EditableComponentViewer.cs.meta diff --git a/Assets/Script/Gameplay/UI/PlayerEditViewer.cs b/Assets/Script/Gameplay/UI/PlayerEditViewer.cs new file mode 100644 index 0000000..150cfd3 --- /dev/null +++ b/Assets/Script/Gameplay/UI/PlayerEditViewer.cs @@ -0,0 +1,181 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using Core; +using Interface; +using Gameplay.Player; +using Script.Gameplay.Facility; +using UnityEngine; +using Script.Gameplay.Input; + +namespace UI +{ + // 用于显示和编辑 Facility 上的各个 IEditComponent 组件的 UI 面板 + public class PlayerEditViewer : UIBase + { + private PlayerEditController controller; + private PlayerWatchModeController watchModeController; + private IEditable editable; + private List components = new List(); + private List componentViewers = new List(); + [SerializeField] private GameObject componentEditViewerPrefab; + [SerializeField] private GameObject noEditableTargetPanel; + [SerializeField] private float panelRadius = 100f; + + private InputManager inputManager; + + private void Awake() + { + inputManager = InputManager.Instance; + ControllerLocator.Instance.TryGetWait(GetPlayerEditControllerHandle); + ControllerLocator.Instance.TryGetWait(GetPlayerWatchModeControllerHandle); + } + + private void Start() + { + inputManager = InputManager.Instance; + } + + public void OnEnterInsideWatchMode() + { + this.gameObject.SetActive(true); + if (GetEditableFromController() != null) + { + GetEditableComponentsFromEditable(); + ClearComponentUI(); + GenerateComponentUI(); + } + else + { + //TODO: 这里可能需要显示“无可编辑对象”之类的提示 + if (noEditableTargetPanel != null) + { + noEditableTargetPanel.SetActive(true); + } + } + + inputManager.SetCursorState(true, CursorLockMode.Confined); + inputManager.SetInputForLook(false); + inputManager.SetInputForMove(false); + } + + public void OnExitInsideWatchMode() + { + this.gameObject.SetActive(false); + + ClearComponentUI(); + if (noEditableTargetPanel != null) + { + noEditableTargetPanel.SetActive(false); + } + + inputManager.SetCursorState(true, CursorLockMode.Locked); + inputManager.SetInputForLook(true); + inputManager.SetInputForMove(true); + } + + // 获取 PlayerEditController 的回调 + private void GetPlayerEditControllerHandle(PlayerEditController editController) + { + controller = editController; + //Debug.Log("PlayerEditViewer obtained PlayerEditController."); + } + + // 获取 PlayerWatchModeController 的回调 + private void GetPlayerWatchModeControllerHandle(PlayerWatchModeController watchModeCtrl) + { + watchModeController = watchModeCtrl; + watchModeController.OnEnterInsideWatchMode += OnEnterInsideWatchMode; + watchModeController.OnExitInsideWatchMode += OnExitInsideWatchMode; + //Debug.Log("PlayerEditViewer subscribed to WatchMode events."); + } + + private IEditable GetEditableFromController() + { + if (controller == null) + { + Debug.Log($"controller is null in {nameof(PlayerEditViewer)}"); + return null; + } + + return editable = controller.GetCurrentTarget(); + } + + private void GetEditableComponentsFromEditable() + { + if (editable == null) + { + Debug.Log($"editable is null in {nameof(PlayerEditViewer)}"); + return; + } + + components = editable.GetEditableComponents() + .Where(c => c != null) + .ToList(); + } + + private void ClearComponentUI() + { + foreach (var viewer in componentViewers) + { + if (viewer != null) + { + if (Application.isPlaying) Destroy(viewer.gameObject); + else DestroyImmediate(viewer.gameObject); + } + } + + componentViewers.Clear(); + } + + // TODO: 根据 components 生成 UI, 根据拥有的 IEditComponent 的数量动态生成 UI 元素。布局为环绕着面板中心排列(自适应间隔)。 + private void GenerateComponentUI() + { + if (components == null || components.Count == 0 || componentEditViewerPrefab == null) return; + + // 计算半径:如果有 RectTransform 就根据面板大小自适应,否则使用默认值 + float radius = panelRadius; + var rect = GetComponent(); + if (rect != null) + { + radius = Mathf.Min(rect.rect.width, rect.rect.height) * 0.4f; + } + + int n = components.Count; + float angleStep = 360f / n; + + for (int i = 0; i < n; i++) + { + float angleDeg = angleStep * i; + float angleRad = Mathf.Deg2Rad * angleDeg; + Vector2 localPos = new Vector2(Mathf.Cos(angleRad), Mathf.Sin(angleRad)) * radius; + + var go = Instantiate(componentEditViewerPrefab, transform); + go.name = $"{componentEditViewerPrefab.name}_{i}"; + var viewer = go.GetComponent(); + if (viewer != null) + { + componentViewers.Add(viewer); + } + + // 如果是 UI 元素,优先设置 RectTransform.anchoredPosition + var childRect = go.GetComponent(); + if (childRect != null) + { + childRect.anchoredPosition = localPos; + childRect.localRotation = Quaternion.identity; + childRect.localScale = Vector3.one; + } + else + { + go.transform.localPosition = new Vector3(localPos.x, localPos.y, 0f); + go.transform.localRotation = Quaternion.identity; + go.transform.localScale = Vector3.one; + } + + // 如果预制件包含接收组件的方法(例如 SetComponent),通过 SendMessage 传递。若无则忽略。 + //go.SendMessage("SetComponent", components[i], SendMessageOptions.DontRequireReceiver); + } + } + } +} \ No newline at end of file diff --git a/Assets/Script/UI/PlayerEditPanelViewer.cs.meta b/Assets/Script/Gameplay/UI/PlayerEditViewer.cs.meta similarity index 100% rename from Assets/Script/UI/PlayerEditPanelViewer.cs.meta rename to Assets/Script/Gameplay/UI/PlayerEditViewer.cs.meta diff --git a/Assets/Script/UI/PlayerHpViewer.cs b/Assets/Script/Gameplay/UI/PlayerHpViewer.cs similarity index 95% rename from Assets/Script/UI/PlayerHpViewer.cs rename to Assets/Script/Gameplay/UI/PlayerHpViewer.cs index 4345b59..bf85773 100644 --- a/Assets/Script/UI/PlayerHpViewer.cs +++ b/Assets/Script/Gameplay/UI/PlayerHpViewer.cs @@ -11,7 +11,7 @@ namespace UI private PlayerController _playerController; public Text hpText; - private void Start() + private void Awake() { ControllerLocator.Instance.TryGetWait(OnGet); } diff --git a/Assets/Script/UI/PlayerHpViewer.cs.meta b/Assets/Script/Gameplay/UI/PlayerHpViewer.cs.meta similarity index 100% rename from Assets/Script/UI/PlayerHpViewer.cs.meta rename to Assets/Script/Gameplay/UI/PlayerHpViewer.cs.meta diff --git a/Assets/Script/Gameplay/UI/PlayerWatchModeViewer.cs b/Assets/Script/Gameplay/UI/PlayerWatchModeViewer.cs new file mode 100644 index 0000000..f19460d --- /dev/null +++ b/Assets/Script/Gameplay/UI/PlayerWatchModeViewer.cs @@ -0,0 +1,33 @@ +using System; +using Core; +using Gameplay.Player; +using UnityEngine; +using UnityEngine.UI; + +namespace UI +{ + public class PlayerWatchModeViewer : UIBase + { + private PlayerWatchModeController watchModeController; + [SerializeField] private Text modeText; + + private void Awake() + { + ControllerLocator.Instance.TryGetWait(OnGet); + } + + private void Update() + { + if (watchModeController != null) + { + modeText.text = "Watch Mode: " + watchModeController.CurrentWatchMode.ToString(); + } + } + + private void OnGet(PlayerWatchModeController watchModeCtrl) + { + watchModeController = watchModeCtrl; + //Debug.Log("PlayerWatchModeViewer obtained PlayerWatchModeController."); + } + } +} \ No newline at end of file diff --git a/Assets/Script/Gameplay/UI/PlayerWatchModeViewer.cs.meta b/Assets/Script/Gameplay/UI/PlayerWatchModeViewer.cs.meta new file mode 100644 index 0000000..8fd7047 --- /dev/null +++ b/Assets/Script/Gameplay/UI/PlayerWatchModeViewer.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: b1493e2f66aa46bf9c89362bd0d9013d +timeCreated: 1760696175 \ No newline at end of file diff --git a/Assets/Script/UI/StartGameButton.cs b/Assets/Script/Gameplay/UI/StartGameButton.cs similarity index 100% rename from Assets/Script/UI/StartGameButton.cs rename to Assets/Script/Gameplay/UI/StartGameButton.cs diff --git a/Assets/Script/UI/StartGameButton.cs.meta b/Assets/Script/Gameplay/UI/StartGameButton.cs.meta similarity index 100% rename from Assets/Script/UI/StartGameButton.cs.meta rename to Assets/Script/Gameplay/UI/StartGameButton.cs.meta diff --git a/Assets/Script/UI.meta b/Assets/Script/UI.meta deleted file mode 100644 index 98ef068..0000000 --- a/Assets/Script/UI.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 5895badf61464ca6ad9af54cca1a8474 -timeCreated: 1760361415 \ No newline at end of file diff --git a/Assets/Script/UI/PlayerEditPanelViewer.cs b/Assets/Script/UI/PlayerEditPanelViewer.cs deleted file mode 100644 index 8ccc38e..0000000 --- a/Assets/Script/UI/PlayerEditPanelViewer.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using UnityEngine; -using Core; -using Gameplay.Player; -using Script.Gameplay.Facility; - -namespace UI -{ - public class PlayerEditPanelViewer : UIBase - { - private PlayerEditController controller; - private FacilityController currentFacilityController; - private void Start() - { - - } - - // 根据currentFacilityController 生成其对应的组件 - private void GenerateComponent() - { - - } - } -} \ No newline at end of file diff --git a/Assets/Script/UI/UI.asmdef b/Assets/Script/UI/UI.asmdef deleted file mode 100644 index 6bb63f7..0000000 --- a/Assets/Script/UI/UI.asmdef +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "UI", - "rootNamespace": "", - "references": [ - "GUID:fd0e97c21c15497f9406b8ee23c1f67e", - "GUID:ceb6a2c14699464ca35be17af198f904" - ], - "includePlatforms": [], - "excludePlatforms": [], - "allowUnsafeCode": false, - "overrideReferences": false, - "precompiledReferences": [], - "autoReferenced": true, - "defineConstraints": [], - "versionDefines": [], - "noEngineReferences": false -} \ No newline at end of file diff --git a/Assets/Script/UI/UI.asmdef.meta b/Assets/Script/UI/UI.asmdef.meta deleted file mode 100644 index 90ffeb5..0000000 --- a/Assets/Script/UI/UI.asmdef.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 65e534cfaf6f474895bcfa96809b48ca -timeCreated: 1760361420 \ No newline at end of file