diff --git a/Assets/Art/UIPrefab/UITools.prefab b/Assets/Art/UIPrefab/UITools.prefab index a6d862c3..ff313573 100644 --- a/Assets/Art/UIPrefab/UITools.prefab +++ b/Assets/Art/UIPrefab/UITools.prefab @@ -280,7 +280,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 + m_RaycastTarget: 0 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: @@ -502,6 +502,7 @@ GameObject: - component: {fileID: 323542383032252423} - component: {fileID: 6025220162707536696} - component: {fileID: 3617749440597198166} + - component: {fileID: 5740481659040249477} m_Layer: 0 m_Name: ItemPrefab m_TagString: Untagged @@ -626,9 +627,23 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: MarkType: 0 - CustomComponentName: + CustomComponentName: ItemPrefab CustomComment: mComponentName: UnityEngine.UI.Button +--- !u!114 &5740481659040249477 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1901611519389403572} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 456e447344348cf4680f6e09405e7b79, type: 3} + m_Name: + m_EditorClassIdentifier: + objs: + - {fileID: 5478117157784657024} --- !u!1 &2685508885550636136 GameObject: m_ObjectHideFlags: 0 diff --git a/Assets/Scripts/Item/MouseOverItem.cs b/Assets/Scripts/Item/MouseOverItem.cs new file mode 100644 index 00000000..3a4aa4d5 --- /dev/null +++ b/Assets/Scripts/Item/MouseOverItem.cs @@ -0,0 +1,37 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.EventSystems; + +public class MouseOverItem : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler +{ + public List objs; + private void Awake() + { + SetItem(false); + } + public void OnPointerEnter(PointerEventData eventData) + { + + SetItem(true); + + } + + public void OnPointerExit(PointerEventData eventData) + { + + SetItem(false); + + } + + public void SetItem(bool isActive) + { + if (objs != null) + { + foreach (var obj in objs) + { + obj.SetActive(isActive); + } + } + } +} diff --git a/Assets/Scripts/Item/MouseOverItem.cs.meta b/Assets/Scripts/Item/MouseOverItem.cs.meta new file mode 100644 index 00000000..4c062276 --- /dev/null +++ b/Assets/Scripts/Item/MouseOverItem.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 456e447344348cf4680f6e09405e7b79 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scripts/UI/UITools.cs b/Assets/Scripts/UI/UITools.cs index 11f27906..733f4567 100644 --- a/Assets/Scripts/UI/UITools.cs +++ b/Assets/Scripts/UI/UITools.cs @@ -64,7 +64,6 @@ namespace QFramework.Example GameObject right = icon.transform.Find("Right").gameObject; GameObject wrong = icon.transform.Find("Wrong").gameObject; GameObject Selected = icon.transform.Find("Selected").gameObject; - GameObject CurSelect = obj.transform.Find("CurSelect").gameObject; mResLoader.Add2Load(localImageUrl.ToNetImageResName(), (bool success, IRes res) => { @@ -76,7 +75,6 @@ namespace QFramework.Example Button btn = obj.GetComponent