123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- using UnityEngine;
- using UnityEvent = UnityEngine.Event;
- namespace UnityEditor.U2D.Sprites
- {
- internal interface IEvent
- {
- EventType type { get; }
- string commandName { get; }
- bool control { get; }
- bool alt { get; }
- bool shift { get; }
- KeyCode keyCode { get; }
- Vector2 mousePosition { get; }
- int button { get; }
- EventModifiers modifiers { get; }
- EventType GetTypeForControl(int id);
- void Use();
- }
- internal class Event : IEvent
- {
- UnityEvent m_Event;
- public Event()
- {
- m_Event = UnityEvent.current;
- }
- public EventType type
- {
- get { return m_Event.type; }
- }
- public string commandName
- {
- get { return m_Event.commandName; }
- }
- public bool control
- {
- get { return m_Event.control; }
- }
- public bool alt
- {
- get { return m_Event.alt; }
- }
- public bool shift
- {
- get { return m_Event.shift; }
- }
- public KeyCode keyCode
- {
- get { return m_Event.keyCode; }
- }
- public Vector2 mousePosition
- {
- get { return m_Event.mousePosition; }
- }
- public int button
- {
- get { return m_Event.button; }
- }
- public void Use()
- {
- m_Event.Use();
- }
- public EventModifiers modifiers
- {
- get { return m_Event.modifiers; }
- }
- public EventType GetTypeForControl(int id)
- {
- return m_Event.GetTypeForControl(id);
- }
- }
- internal interface IEventSystem
- {
- IEvent current { get; }
- }
- internal class EventSystem : IEventSystem
- {
- public IEvent current
- {
- get { return new Event(); }
- }
- }
- }
|