diff --git a/meng_yao/Assets/Prefabs/ui/info_enemy.prefab b/meng_yao/Assets/Prefabs/ui/info_enemy.prefab index a13e179e4..d5ea8a8dc 100644 --- a/meng_yao/Assets/Prefabs/ui/info_enemy.prefab +++ b/meng_yao/Assets/Prefabs/ui/info_enemy.prefab @@ -32,6 +32,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 1309847682364505232} - {fileID: 8513957311761855227} m_Father: {fileID: 0} m_RootOrder: 0 @@ -135,8 +136,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 83e31d3b4a39e65459f9c87c56af2436, type: 3} m_Name: m_EditorClassIdentifier: - retbutton: {fileID: 0} - ClosureObj: {fileID: 0} + retbutton: {fileID: 3896712321877988315} + ClosureObj: {fileID: 103310189314411435} _panel: {fileID: 8513957311761855226} closeBtn: {fileID: 103310189314411445} _closePanel: {fileID: 103310189314411435} @@ -155,6 +156,127 @@ MonoBehaviour: - {fileID: 8513957310695274728} - {fileID: 8513957311707228769} HpImage: {fileID: 8513957310128994721} +--- !u!1 &6052374891498150943 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1309847682364505232} + - component: {fileID: 6358018491203885661} + - component: {fileID: 6151087071644036061} + - component: {fileID: 3896712321877988315} + m_Layer: 5 + m_Name: close + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &1309847682364505232 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6052374891498150943} + 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: 103310189314411434} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &6358018491203885661 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6052374891498150943} + m_CullTransparentMesh: 1 +--- !u!114 &6151087071644036061 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6052374891498150943} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0} + 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 &3896712321877988315 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6052374891498150943} + 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: 6151087071644036061} + m_OnClick: + m_PersistentCalls: + m_Calls: [] --- !u!1001 &103310189366456482 PrefabInstance: m_ObjectHideFlags: 0 @@ -176,7 +298,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 8595312307980599897, guid: 38f909461e53c37408c09f5cef30eb35, type: 3} propertyPath: m_RootOrder - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 8595312307980599897, guid: 38f909461e53c37408c09f5cef30eb35, type: 3} propertyPath: m_AnchorMax.x diff --git a/meng_yao/Assets/Prefabs/ui/info_mengyao.prefab b/meng_yao/Assets/Prefabs/ui/info_mengyao.prefab index eba43f99a..d57cd84b3 100644 --- a/meng_yao/Assets/Prefabs/ui/info_mengyao.prefab +++ b/meng_yao/Assets/Prefabs/ui/info_mengyao.prefab @@ -32,6 +32,7 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: + - {fileID: 8242448424888305229} - {fileID: 7805053268599849543} m_Father: {fileID: 0} m_RootOrder: 0 @@ -135,8 +136,8 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: 83e31d3b4a39e65459f9c87c56af2436, type: 3} m_Name: m_EditorClassIdentifier: - retbutton: {fileID: 0} - ClosureObj: {fileID: 0} + retbutton: {fileID: 8258118971642084869} + ClosureObj: {fileID: 8782491854383104488} _panel: {fileID: 7805053268599849540} closeBtn: {fileID: 8782491854383104500} _closePanel: {fileID: 8782491854383104488} @@ -148,6 +149,127 @@ MonoBehaviour: AttackCD: {fileID: 7805053267580272315} textList: [] HpImage: {fileID: 0} +--- !u!1 &8825030748979330930 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 8242448424888305229} + - component: {fileID: 3477742085648687381} + - component: {fileID: 3023142571198707515} + - component: {fileID: 8258118971642084869} + m_Layer: 5 + m_Name: close + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &8242448424888305229 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8825030748979330930} + 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: 8782491854383104503} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!222 &3477742085648687381 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8825030748979330930} + m_CullTransparentMesh: 1 +--- !u!114 &3023142571198707515 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8825030748979330930} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 0} + 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 &8258118971642084869 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 8825030748979330930} + 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: 3023142571198707515} + m_OnClick: + m_PersistentCalls: + m_Calls: [] --- !u!1001 &8782491853943243843 PrefabInstance: m_ObjectHideFlags: 0 @@ -229,7 +351,7 @@ PrefabInstance: objectReference: {fileID: 0} - target: {fileID: 1562946259003229700, guid: 60d99ddd21f6df84195814f4d3ab7d07, type: 3} propertyPath: m_RootOrder - value: 0 + value: 1 objectReference: {fileID: 0} - target: {fileID: 1562946259003229700, guid: 60d99ddd21f6df84195814f4d3ab7d07, type: 3} propertyPath: m_AnchorMax.x diff --git a/meng_yao/Assets/script/A_Fight/CharacterClick.cs b/meng_yao/Assets/script/A_Fight/CharacterClick.cs index f1830152e..9a2959adc 100644 --- a/meng_yao/Assets/script/A_Fight/CharacterClick.cs +++ b/meng_yao/Assets/script/A_Fight/CharacterClick.cs @@ -2,6 +2,7 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; using DG.Tweening; +using UnityEngine.EventSystems; public class CharacterClick : MonoBehaviour { @@ -31,6 +32,12 @@ public class CharacterClick : MonoBehaviour private void OnMouseDown() { + // 检查鼠标是否点击在UI元素上 + if (EventSystem.current.IsPointerOverGameObject()) + { + return; // 如果点击的是UI,直接返回,避免穿透到2D对象 + } + // 确保父节点的碰撞体是 Trigger 类型 Collider2D parentCollider = GetComponent(); if (parentCollider != null && parentCollider.isTrigger)