diff options
Diffstat (limited to 'Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs')
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs new file mode 100644 index 0000000..f353314 --- /dev/null +++ b/Assets/uGUI-2017.1/UnityEngine.UI/EventSystem/EventData/BaseEventData.cs @@ -0,0 +1,42 @@ +namespace UnityEngine.EventSystems +{ + public abstract class AbstractEventData + { + protected bool m_Used; // 当前事件是否被处理(被吞) + + public virtual void Reset() + { + m_Used = false; + } + + public virtual void Use() + { + m_Used = true; + } + + public virtual bool used + { + get { return m_Used; } + } + } + + public class BaseEventData : AbstractEventData + { + private readonly EventSystem m_EventSystem; + public BaseEventData(EventSystem eventSystem) + { + m_EventSystem = eventSystem; + } + + public BaseInputModule currentInputModule + { + get { return m_EventSystem.currentInputModule; } + } + + public GameObject selectedObject + { + get { return m_EventSystem.currentSelectedGameObject; } + set { m_EventSystem.SetSelectedGameObject(value, this); } // 会发送一个selecthandler事件 + } + } +} |