public IEnumerator FindAllOfType() { yield return(new WaitForSecondsRealtime(2)); // - REcanvas 1 // - REtext 4 // - REimage 4 // - REbutton 2 // - REpanel 1 // Select All REcanvas.Selector[] finded = REcanvas.Find(); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 1); REtext.Selector[] finded2 = REtext.Find(); Debug.Log(finded2.Length); Assert.IsTrue(finded2.Length == 4); REimage.Selector[] finded3 = REimage.Find(); Debug.Log(finded3.Length); Assert.IsTrue(finded3.Length == 4); REbutton.Selector[] finded4 = REbutton.Find(); Debug.Log(finded4.Length); Assert.IsTrue(finded4.Length == 2); REpanel.Selector[] finded5 = REpanel.Find(); Debug.Log(finded5.Length); Assert.IsTrue(finded5.Length == 1); // Select All finded = REcanvas.Find(""); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 1); finded2 = REtext.Find(""); Debug.Log(finded2.Length); Assert.IsTrue(finded2.Length == 4); finded3 = REimage.Find(""); Debug.Log(finded3.Length); Assert.IsTrue(finded3.Length == 4); finded4 = REbutton.Find(""); Debug.Log(finded4.Length); Assert.IsTrue(finded4.Length == 2); finded5 = REpanel.Find(""); Debug.Log(finded5.Length); Assert.IsTrue(finded5.Length == 1); yield return(new WaitForSecondsRealtime(2)); }
private void Update() { if (lastTestCase != testCase) { REcanvas.EraseAll(); Start(); } }
// Start is called before the first frame update void Start() { var bb = new REcanvas { propsGameObject = () => new REcanvas.GameObjectSetter { }, }.Draw(); bb.ToDontDestroyOnLoad(); }
void Start() { // Multiple components reactorList1 = ListREcomponent().Draw(); var find = REtext.Find("#Title-One"); Debug.Log("Elements Finded: " + find.Length); foreach (var element in find) { Debug.Log("Type: " + element.textCmp.text); } }
public void OneTimeSetUp() { mainCamera = new GameObject("Main Camera"); var camera = mainCamera.AddComponent <Camera>(); camera.backgroundColor = Color.grey; camera.orthographic = true; camera.depth = -1; mainCamera.AddComponent <AudioListener>(); eventSystem = new GameObject("EventSystem"); eventSystem.AddComponent <EventSystem>(); eventSystem.AddComponent <StandaloneInputModule>(); // Draw the canvas mainCanvas = MainReactorComponent().Draw(); }
public IEnumerator FindOneByType() { yield return(new WaitForSecondsRealtime(2)); // By id Assert.IsTrue(REcanvas.Find("#CanvasSuperior").Length == 1); Debug.Log("One"); Assert.IsTrue(REcanvas.FindOne("#CanvasSuperior") != null); Debug.Log("One"); // By id Assert.IsTrue(REcanvas.Find("#ImagenSuperior").Length == 0); Debug.Log("One"); Assert.IsTrue(REcanvas.FindOne("#ImagenSuperior") == null); Debug.Log("One"); yield return(new WaitForSecondsRealtime(2)); }
public IEnumerator FindByIdOfType() { yield return(new WaitForSecondsRealtime(2)); // By id REcanvas.Selector[] finded = REcanvas.Find("#CanvasSuperior"); Assert.IsTrue(finded.Length == 1); // By id REtext.Selector[] finded2 = REtext.Find("#Title-One"); Assert.IsTrue(finded2.Length == 2); // By id REcanvas.Selector[] finded3 = REcanvas.Find("#ImagenSuperior"); Assert.IsTrue(finded3.Length == 0); // By id REpanel.Selector[] finded4 = REpanel.Find("#PanelBack"); Assert.IsTrue(finded4.Length == 1); // By id REbutton.Selector[] finded5 = REbutton.Find("#MainButton"); Assert.IsTrue(finded5.Length == 0); yield return(new WaitForSecondsRealtime(2)); }
public IEnumerator FindByClassNameOfType() { yield return(new WaitForSecondsRealtime(2)); // One classname var finded = REcanvas.Find(".Back"); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 1); var finded2 = REtext.Find(".H1"); Debug.Log(finded2.Length); Assert.IsTrue(finded2.Length == 2); var finded3 = REtext.Find(".Text"); Debug.Log(finded3.Length); Assert.IsTrue(finded3.Length == 4); var finded4 = REimage.Find(".Title"); Debug.Log(finded4.Length); Assert.IsTrue(finded4.Length == 0); var finded5 = REbutton.Find(".Button"); Debug.Log(finded5.Length); Assert.IsTrue(finded5.Length == 2); var finded6 = REcanvas.Find(".White"); Debug.Log(finded6.Length); Assert.IsTrue(finded6.Length == 0); // With AND var finded7 = REtext.Find(".H1&&.Text&&.Title"); Debug.Log(finded7.Length); Assert.IsTrue(finded7.Length == 1); var finded8 = REbutton.Find(".Button&&Title"); Debug.Log(finded8.Length); Assert.IsTrue(finded8.Length == 1); var finded9 = REimage.Find(".H1&&.Text"); Debug.Log(finded9.Length); Assert.IsTrue(finded9.Length == 0); var finded10 = REcanvas.Find(".H1&&Pink"); Debug.Log(finded10.Length); Assert.IsTrue(finded10.Length == 0); // With or var finded11 = REtext.Find(".Button||Text"); Debug.Log(finded11.Length); Assert.IsTrue(finded11.Length == 4); var finded12 = REpanel.Find(".Back||H1||Text"); Debug.Log(finded12.Length); Assert.IsTrue(finded12.Length == 1); var finded13 = REtext.Find(".Back||H1||Grey"); Debug.Log(finded13.Length); Assert.IsTrue(finded13.Length == 2); yield return(new WaitForSecondsRealtime(2)); }
public IEnumerator Hooks_UseState_InDisabledCanvas() { var alphaState = new UseState <float>(0f); // A Component REcanvas MainReactorComponent() { return(new REcanvas { propsId = () => new REcanvas.IdSetter { id = "ProveCanvas" }, propsCanvasGroup = () => new REcanvas.CanvasGroupSetter { alpha = alphaState.value, }, useState = new IuseState[] { alphaState, }, childs = () => new REbase[] { new REtext(), }, }); } var routerProve = MainReactorComponent(); yield return(new WaitForSecondsRealtime(1)); // Drawing the component Debug.Log("Drawing"); routerProve.Draw(); Assert.IsTrue(REcanvas.FindOne("#ProveCanvas").canvasGroup.alpha == 0f); yield return(new WaitForSecondsRealtime(1)); // Hide the element routerProve.Disable(); Assert.IsFalse(REbase.FindOne("#ProveCanvas").gameObject.activeSelf); // Change the states alphaState.SetState(.33f); Assert.IsTrue(REcanvas.FindOne("#ProveCanvas").canvasGroup.alpha == .33f); // Will disable after one frame, because need to be active to calculate all the rect transform parameters yield return(new WaitForSecondsRealtime(.3f)); Assert.IsFalse(REbase.FindOne("#ProveCanvas").gameObject.activeSelf); alphaState.SetState(.66f); // Will disable after one frame, because need to be active to calculate all the rect transform parameters yield return(new WaitForSecondsRealtime(.3f)); Assert.IsTrue(REcanvas.FindOne("#ProveCanvas").canvasGroup.alpha == .66f); Assert.IsFalse(REbase.FindOne("#ProveCanvas").gameObject.activeSelf); alphaState.PrevState(); // Will disable after one frame, because need to be active to calculate all the rect transform parameters yield return(new WaitForSecondsRealtime(.3f)); Assert.IsTrue(REcanvas.FindOne("#ProveCanvas").canvasGroup.alpha == .33f); Assert.IsFalse(REbase.FindOne("#ProveCanvas").gameObject.activeSelf); // Enable and check routerProve.Enable(); // Will disable after one frame, because need to be active to calculate all the rect transform parameters yield return(new WaitForSecondsRealtime(.3f)); Assert.IsTrue(REcanvas.FindOne("#ProveCanvas").canvasGroup.alpha == .33f); Assert.IsTrue(REbase.FindOne("#ProveCanvas").gameObject.activeSelf); yield return(new WaitForSecondsRealtime(2)); routerProve.Erase(); }
public IEnumerator Hooks_UseState_InHidedCanvas() { var alphaState = new UseState <float>(0f); // A Component REcanvas MainReactorComponent() { return(new REcanvas { propsId = () => new REcanvas.IdSetter { id = "ProveCanvas" }, propsCanvasGroup = () => new REcanvas.CanvasGroupSetter { alpha = alphaState.value, }, useState = new IuseState[] { alphaState, }, childs = () => new REbase[] { new REtext(), }, }); } var routerProve = MainReactorComponent(); yield return(new WaitForSecondsRealtime(1)); // Drawing the component Debug.Log("Drawing"); routerProve.Draw(); Assert.IsTrue(REcanvas.FindOne("#ProveCanvas").canvasGroup.alpha == 0f); yield return(new WaitForSecondsRealtime(1)); // Hide the element routerProve.Hide(); Assert.IsFalse(REbase.FindOne("#ProveCanvas").rootCanvasSelector.canvas.enabled); // Change the states alphaState.SetState(.33f); Assert.IsTrue(REcanvas.FindOne("#ProveCanvas").canvasGroup.alpha == .33f); Assert.IsFalse(REcanvas.FindOne("#ProveCanvas").rootCanvasSelector.canvas.enabled); alphaState.SetState(.66f); Assert.IsTrue(REcanvas.FindOne("#ProveCanvas").canvasGroup.alpha == .66f); Assert.IsFalse(REcanvas.FindOne("#ProveCanvas").rootCanvasSelector.canvas.enabled); alphaState.PrevState(); Assert.IsTrue(REcanvas.FindOne("#ProveCanvas").canvasGroup.alpha == .33f); Assert.IsFalse(REcanvas.FindOne("#ProveCanvas").rootCanvasSelector.canvas.enabled); // Enable and check routerProve.Show(); Assert.IsTrue(REcanvas.FindOne("#ProveCanvas").canvasGroup.alpha == .33f); Assert.IsTrue(REcanvas.FindOne("#ProveCanvas").rootCanvasSelector.canvas.enabled); yield return(new WaitForSecondsRealtime(2)); routerProve.Erase(); }