From 86c26cd21b99abd34ddbe5aaa2a5cfc601f0c8e9 Mon Sep 17 00:00:00 2001 From: ALEXTANG <574809918@qq.com> Date: Sun, 25 Jun 2023 15:26:13 +0800 Subject: [PATCH] Create UIEventItem.cs --- .../HotFix/GameLogic/UI/Common/UIEventItem.cs | 217 ++++++++++++++++++ 1 file changed, 217 insertions(+) create mode 100644 Assets/GameScripts/HotFix/GameLogic/UI/Common/UIEventItem.cs diff --git a/Assets/GameScripts/HotFix/GameLogic/UI/Common/UIEventItem.cs b/Assets/GameScripts/HotFix/GameLogic/UI/Common/UIEventItem.cs new file mode 100644 index 00000000..2359448f --- /dev/null +++ b/Assets/GameScripts/HotFix/GameLogic/UI/Common/UIEventItem.cs @@ -0,0 +1,217 @@ +using System; +using TEngine; +using UnityEngine.EventSystems; +using UnityEngine.UI; + +namespace GameLogic +{ + class UIEventItem : UIWidget where T : UIEventItem + { + private object _eventParam1; + private object _eventParam2; + private object _eventParam3; + public object EventParam1 => _eventParam1; + public object EventParam2 => _eventParam2; + public object EventParam3 => _eventParam3; + private Action _clickAction; + private Action _pressAction; + private Action _beginDragAction; + private Action _dragAction; + private Action _endDragAction; + + public void BindClickEvent(Action clickAction, object eParam1 = null, object eParam2 = null, object eParam3 = null,Selectable.Transition transition = Selectable.Transition.ColorTint) + { + if (_clickAction != null) + { + _clickAction = clickAction; + } + else + { + _clickAction = clickAction; + var button = DUnityUtil.AddMonoBehaviour