Elin Decompiled Documentation EA 23.102 Nightly
Loading...
Searching...
No Matches
InputModuleEX.cs
Go to the documentation of this file.
1using System.Collections.Generic;
2using UnityEngine;
3using UnityEngine.EventSystems;
4
5public class InputModuleEX : StandaloneInputModule
6{
7 public static PointerEventData eventData;
8
9 public static GameObject topGameObject;
10
11 public static List<GameObject> list;
12
13 public static InputModuleEX Instance;
14
15 public static void UpdateEventData()
16 {
17 Instance.GetPointerData(-1, out eventData, create: true);
18 list = eventData.hovered;
19 topGameObject = ((list.Count == 0) ? null : list[list.Count - 1]);
20 }
21
22 public static PointerEventData GetPointerEventData(int pointerId = -1)
23 {
24 return eventData;
25 }
26
27 public static List<GameObject> GetList()
28 {
29 return eventData.hovered;
30 }
31
32 public static bool IsPointerOverRoot(Component c)
33 {
34 foreach (GameObject item in list)
35 {
36 if ((bool)item && item.IsChildOf(c.gameObject))
37 {
38 return true;
39 }
40 }
41 return false;
42 }
43
44 public static bool IsPointerOver(Component c)
45 {
46 Transform transform = c.transform;
47 foreach (GameObject item in list)
48 {
49 if ((bool)item && item.transform == transform)
50 {
51 return true;
52 }
53 }
54 return false;
55 }
56
57 public static bool IsPointerChildOf(Component c)
58 {
59 foreach (GameObject item in list)
60 {
61 if ((bool)item && item.IsChildOf(c.gameObject))
62 {
63 return true;
64 }
65 }
66 return false;
67 }
68
69 public static T GetComponentOf<T>() where T : Component
70 {
71 foreach (GameObject item in list)
72 {
73 if ((bool)item)
74 {
75 T component = item.GetComponent<T>();
76 if ((bool)component)
77 {
78 return component;
79 }
80 }
81 }
82 return null;
83 }
84
85 public static T GetTopComponentOf<T>() where T : Component
86 {
87 foreach (GameObject item in list)
88 {
89 if ((bool)item)
90 {
91 return item.GetComponent<T>();
92 }
93 }
94 return null;
95 }
96
97 protected override void Awake()
98 {
99 base.Awake();
100 Instance = this;
102 }
103}
static bool IsPointerChildOf(Component c)
static List< GameObject > list
static void UpdateEventData()
static PointerEventData eventData
Definition: InputModuleEX.cs:7
static T GetComponentOf< T >()
static bool IsPointerOver(Component c)
override void Awake()
static List< GameObject > GetList()
static T GetTopComponentOf< T >()
static GameObject topGameObject
Definition: InputModuleEX.cs:9
static PointerEventData GetPointerEventData(int pointerId=-1)
static InputModuleEX Instance
static bool IsPointerOverRoot(Component c)