public List <string> FindWidgetTypes() { List <string> list = new List <string>(); UIRect[] components = base.gameObject.GetComponents <UIRect>(); UIRect[] array = components; for (int i = 0; i < array.Length; i++) { UIRect uIRect = array[i]; list.Add(uIRect.GetType().FullName); } UIWidgetContainer[] components2 = base.gameObject.GetComponents <UIWidgetContainer>(); UIWidgetContainer[] array2 = components2; for (int j = 0; j < array2.Length; j++) { UIWidgetContainer uIWidgetContainer = array2[j]; list.Add(uIWidgetContainer.GetType().FullName); } UIInput component = base.gameObject.GetComponent <UIInput>(); if (component) { list.Add(component.GetType().FullName); } list.Add("GameObject"); list.Add("Transform"); return(list); }
public void FindUIRectTest() { var go = new GameObject("FindUIRectTest"); go.AddComponent <Image>(); var com = go.AddComponent <Mask>(); UIRect uirect = FindInteractivityUI.FindUIRect(com.transform); Assert.AreEqual(typeof(MaskUIRect), uirect.GetType()); }
public static void DisplayAnchors(this UIRect rect) { GameAPI.Instance.Logger.Warning($"Displaying anchors for {rect.name} ({rect.GetType().Name})"); GameAPI.Instance.Logger.Info($"Top : {rect.topAnchor?.target?.name} {rect.topAnchor?.absolute} absolute {rect.topAnchor?.relative} relative"); GameAPI.Instance.Logger.Info($"Bottom : {rect.bottomAnchor?.target?.name} {rect.bottomAnchor?.absolute} absolute {rect.bottomAnchor?.relative} relative"); GameAPI.Instance.Logger.Info($"Left : {rect.leftAnchor?.target?.name} {rect.leftAnchor?.absolute} absolute {rect.leftAnchor?.relative} relative"); GameAPI.Instance.Logger.Info($"Right : {rect.rightAnchor?.target?.name} {rect.rightAnchor?.absolute} absolute {rect.rightAnchor?.relative} relative"); if (rect is UIWidget) { UIWidget widget = rect as UIWidget; GameAPI.Instance.Logger.Info($"Width : {widget.width}"); GameAPI.Instance.Logger.Info($"Height : {widget.height}"); } }