public void GetVisiblePanelViewControllers() { var fakeSystem = new FakePanelStackSystem(); var showControllersList = new List <IPanelViewController>(); var opaquePanelType = ScriptableObject.CreateInstance <PanelType>(); opaquePanelType.VisibilityType = PanelType.Visibility.Opaque; var transparentPanelType = ScriptableObject.CreateInstance <PanelType>(); transparentPanelType.VisibilityType = PanelType.Visibility.Transparent; PanelStackUtility.GetVisiblePanelViewControllers(fakeSystem, showControllersList); Assert.IsTrue(showControllersList.Count == 0); fakeSystem.Push(new FakePanelViewController { PanelType = opaquePanelType }); PanelStackUtility.GetVisiblePanelViewControllers(fakeSystem, showControllersList); Assert.IsTrue(showControllersList.Count == 1); //Should have just one showing panel as long as we're showing opaque panels fakeSystem.Push(new FakePanelViewController { PanelType = opaquePanelType }); PanelStackUtility.GetVisiblePanelViewControllers(fakeSystem, showControllersList); Assert.IsTrue(showControllersList.Count == 1, $"Got ShowControllersList Size: {showControllersList.Count}"); //Pushing a transparent panel should show more controllers fakeSystem.Push(new FakePanelViewController { PanelType = transparentPanelType }); PanelStackUtility.GetVisiblePanelViewControllers(fakeSystem, showControllersList); Assert.IsTrue(showControllersList.Count == 2, $"Got ShowControllersList Size: {showControllersList.Count}"); //Pushing a transparent panel should show more controllers fakeSystem.Push(new FakePanelViewController { PanelType = transparentPanelType }); PanelStackUtility.GetVisiblePanelViewControllers(fakeSystem, showControllersList); Assert.IsTrue(showControllersList.Count == 3, $"Got ShowControllersList Size: {showControllersList.Count}"); //Pushing Opaque should now hide all lower panels fakeSystem.Push(new FakePanelViewController { PanelType = opaquePanelType }); PanelStackUtility.GetVisiblePanelViewControllers(fakeSystem, showControllersList); Assert.IsTrue(showControllersList.Count == 1, $"Got ShowControllersList Size: {showControllersList.Count}"); }
public IEnumerator LocksAndUnlocksUIEventManager() { var stackSystem = new FakePanelStackSystem(); var eventManager = new FakeUIEventManager(); var stackController = CreateStackController(stackSystem, eventManager: eventManager); var panelController = new FakePanelViewController { PanelType = ScriptableObject.CreateInstance <PanelType>() }; stackSystem.Push(panelController); Assert.IsTrue(stackSystem.Count == 1); yield return(stackController.TransitionAsync().AsCoroutine()); Assert.IsTrue(eventManager.LockCount == 1); Assert.IsTrue(eventManager.UnlockCount == 1); }
private static PanelStackController CreateStackController(IPanelStackSystem stackSystem = null, IPanelViewContainer viewContainer = null, IUIEventManager eventManager = null) { if (stackSystem == null) { stackSystem = new FakePanelStackSystem(); } if (viewContainer == null) { viewContainer = new FakeViewContainer(); } if (eventManager == null) { eventManager = new FakeUIEventManager(); } return(new PanelStackController(stackSystem, viewContainer, eventManager)); }