Keine Beschreibung
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

BaseEventData.cs 1.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. namespace UnityEngine.EventSystems
  2. {
  3. /// <summary>
  4. /// A class that can be used for sending simple events via the event system.
  5. /// </summary>
  6. public abstract class AbstractEventData
  7. {
  8. protected bool m_Used;
  9. /// <summary>
  10. /// Reset the event.
  11. /// </summary>
  12. public virtual void Reset()
  13. {
  14. m_Used = false;
  15. }
  16. /// <summary>
  17. /// Use the event.
  18. /// </summary>
  19. /// <remarks>
  20. /// Internally sets a flag that can be checked via used to see if further processing should happen.
  21. /// </remarks>
  22. public virtual void Use()
  23. {
  24. m_Used = true;
  25. }
  26. /// <summary>
  27. /// Is the event used?
  28. /// </summary>
  29. public virtual bool used
  30. {
  31. get { return m_Used; }
  32. }
  33. }
  34. /// <summary>
  35. /// A class that contains the base event data that is common to all event types in the new EventSystem.
  36. /// </summary>
  37. public class BaseEventData : AbstractEventData
  38. {
  39. private readonly EventSystem m_EventSystem;
  40. public BaseEventData(EventSystem eventSystem)
  41. {
  42. m_EventSystem = eventSystem;
  43. }
  44. /// <summary>
  45. /// >A reference to the BaseInputModule that sent this event.
  46. /// </summary>
  47. public BaseInputModule currentInputModule
  48. {
  49. get { return m_EventSystem.currentInputModule; }
  50. }
  51. /// <summary>
  52. /// The object currently considered selected by the EventSystem.
  53. /// </summary>
  54. public GameObject selectedObject
  55. {
  56. get { return m_EventSystem.currentSelectedGameObject; }
  57. set { m_EventSystem.SetSelectedGameObject(value, this); }
  58. }
  59. }
  60. }