public override void Awake(UIEventComponent self) { UIEventComponent.Instance = self; GameObject uiRoot = GameObject.Find("/Global/UI"); ReferenceCollector referenceCollector = uiRoot.GetComponent <ReferenceCollector>(); self.UILayers.Add((int)UILayer.Hidden, referenceCollector.Get <GameObject>(UILayer.Hidden.ToString()).transform); self.UILayers.Add((int)UILayer.Low, referenceCollector.Get <GameObject>(UILayer.Low.ToString()).transform); self.UILayers.Add((int)UILayer.Mid, referenceCollector.Get <GameObject>(UILayer.Mid.ToString()).transform); self.UILayers.Add((int)UILayer.High, referenceCollector.Get <GameObject>(UILayer.High.ToString()).transform); var uiEvents = Game.EventSystem.GetTypes(typeof(UIEventAttribute)); foreach (Type type in uiEvents) { object[] attrs = type.GetCustomAttributes(typeof(UIEventAttribute), false); if (attrs.Length == 0) { continue; } UIEventAttribute uiEventAttribute = attrs[0] as UIEventAttribute; AUIEvent aUIEvent = Activator.CreateInstance(type) as AUIEvent; self.UIEvents.Add(uiEventAttribute.UIType, aUIEvent); } }
public override void Awake(UIEventComponent self) { UIEventComponent.Instance = self; var uiEvents = Game.EventSystem.GetTypes(typeof(UIEventAttribute)); foreach (Type type in uiEvents) { object[] attrs = type.GetCustomAttributes(typeof(UIEventAttribute), false); if (attrs.Length == 0) { continue; } UIEventAttribute uiEventAttribute = attrs[0] as UIEventAttribute; AUIEvent aUIEvent = Activator.CreateInstance(type) as AUIEvent; self.UIEvents.Add(uiEventAttribute.UIType, aUIEvent); } }