public IEnumerator Hooks_UseUpdate_31InDisabledElements_DontRun() { var counter = 0; // A Component REcanvas MainReactorComponent() { return(new REcanvas { childs = () => new REbase[] { new REtext { propsId = () => new REtext.IdSetter { id = "ProveText" }, propsText = () => new REtext.TextSetter { text = "Hello World!", }, useUpdate = new REtext.UseUpdate.Hook { onUpdate = (s) => { // Increment the value each frame if (counter < 10) { counter++; } }, } }, }, }); } var routerProve = MainReactorComponent(); yield return(new WaitForSecondsRealtime(1)); // Draw the component Debug.Log("Drawing"); routerProve.Draw(); // Hide the element routerProve.Disable(); Assert.IsFalse(((REcanvas.Selector)REbase.Find("#ProveText")[0].rootCanvasSelector).canvas.enabled); // First check and hook must be runned yield return(new WaitForSecondsRealtime(1.0f)); Assert.IsFalse(counter == 10); yield return(new WaitForSecondsRealtime(2)); routerProve.Erase(); }
public IEnumerator FindOne() { yield return(new WaitForSecondsRealtime(2)); // By id Assert.IsTrue(REbase.Find("#CanvasSuperior").Length == 1); Assert.IsTrue(REbase.FindOne("#CanvasSuperior") != null); // By id Assert.IsTrue(REbase.Find("#ImagenSuperior").Length == 1); Assert.IsTrue(REbase.FindOne("#ImagenSuperior") != null); // By id Assert.IsTrue(REbase.Find("#PanelBack").Length == 1); Assert.IsTrue(REbase.FindOne("#PanelBack") != null); yield return(new WaitForSecondsRealtime(2)); }
public IEnumerator FindAll() { yield return(new WaitForSecondsRealtime(2)); // Select All var finded = REbase.Find(); Assert.IsTrue(finded.Length == 12); // Select All finded = REbase.Find(""); Assert.IsTrue(finded.Length == 12); yield return(new WaitForSecondsRealtime(2)); }
public IEnumerator FindById() { yield return(new WaitForSecondsRealtime(2)); // By id var finded = REbase.Find("#CanvasSuperior"); Assert.IsTrue(finded.Length == 1); // By id finded = REbase.Find("#Title-One"); Assert.IsTrue(finded.Length == 2); // By id finded = REbase.Find("#ImagenSuperior"); Assert.IsTrue(finded.Length == 1); // By id finded = REbase.Find("#PanelBack"); Assert.IsTrue(finded.Length == 1); // By id finded = REbase.Find("#MainButton"); Assert.IsTrue(finded.Length == 0); yield return(new WaitForSecondsRealtime(2)); }
public IEnumerator Hooks_UseEffect_31InDisabledElements_DontRun() { // A Component REcanvas MainReactorComponent() { var count = 0; return(new REcanvas { childs = () => new REbase[] { new REtext { propsId = () => new REtext.IdSetter { id = "ProveText" }, propsText = () => new REtext.TextSetter { text = "Hello World!", }, useEffect = new REtext.UseEffect.Hook[] { new REtext.UseEffect.Hook { // Is executd each 1second per default in unscaled time mode deltaFunction = (d, s) => { count++; s.textCmp.text = "C: " + count; }, } } }, }, }); } var routerProve = MainReactorComponent(); yield return(new WaitForSecondsRealtime(1)); // Draw the component routerProve.Draw(); Debug.Log("Drawing"); Assert.IsTrue(REtext.FindOne("#ProveText").textCmp.text == "Hello World!"); // First check and hook must be runner 1 yield return(new WaitForSecondsRealtime(1.2f)); Assert.IsTrue(REtext.FindOne("#ProveText").textCmp.text == "C: 1"); // Hide the element routerProve.Disable(); Assert.IsFalse(REbase.Find("#ProveText")[0].gameObject.activeInHierarchy); // Second check and hook must be runner 2 yield return(new WaitForSecondsRealtime(1f)); Assert.IsTrue(REtext.FindOne("#ProveText").textCmp.text == "C: 1"); // Enable and check routerProve.Enable(); Assert.IsTrue(REbase.Find("#ProveText")[0].gameObject.activeInHierarchy); // Thirh check and hook must be runner 3 yield return(new WaitForSecondsRealtime(1f)); Assert.IsTrue(REtext.FindOne("#ProveText").textCmp.text == "C: 2"); yield return(new WaitForSecondsRealtime(2)); routerProve.Erase(); }
public IEnumerator FindByClassName() { yield return(new WaitForSecondsRealtime(2)); // One classname var finded = REbase.Find(".Back"); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 2); finded = REbase.Find(".H1"); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 2); finded = REbase.Find(".Text"); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 4); finded = REbase.Find(".Title"); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 2); finded = REbase.Find(".Button"); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 2); finded = REbase.Find(".White"); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 0); // With AND finded = REbase.Find(".H1&&.Text&&.Title"); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 1); finded = REbase.Find(".Button&&Title"); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 1); finded = REbase.Find(".H1&&.Text"); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 2); finded = REbase.Find(".H1&&Pink"); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 0); // With or finded = REbase.Find(".Button||Text"); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 6); finded = REbase.Find(".Back||H1||Text"); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 6); finded = REbase.Find(".Back||H1||Grey"); Debug.Log(finded.Length); Assert.IsTrue(finded.Length == 4); yield return(new WaitForSecondsRealtime(2)); }