Esempio n. 1
0
        private async Task TransitionDefault(IPanelViewController hideController, IPanelViewController showController)
        {
            Task hideTask = null;
            Task showTask = null;

            if (hideController != null)
            {
                hideTask = hideController.HideAsync();
            }

            if (showController != null)
            {
                showController.SetParentViewContainer(container);
                showTask = showController.ShowAsync();
            }

            if (hideTask != null)
            {
                await hideTask.ConfigureAwait(true);
            }

            if (showTask != null)
            {
                await showTask.ConfigureAwait(true);
            }
        }
Esempio n. 2
0
 private void Start()
 {
     controller = GetComponent <IPanelViewController>();
     if (controller != null)
     {
         provider.Add(controller);
     }
 }
Esempio n. 3
0
 public async Task ShowAsync(IPanelViewController panelViewController)
 {
     currentViewController = panelViewController;
     foreach (var swapController in controllers)
     {
         await swapController.TransitionAsync();
     }
 }
Esempio n. 4
0
 private async Task LoadView(IPanelViewController controller)
 {
     if (controller.IsViewLoaded)
     {
         return;
     }
     controller.SetParentViewContainer(container);
     await controller.LoadViewAsync();
 }
Esempio n. 5
0
 /// <summary>
 /// This method allows popping and pushing as one action with no transition required between.
 /// </summary>
 /// <param name="popCount">number of panels to pop</param>
 /// <param name="controller">controller to push</param>
 public async Task PopAndPushAsync(int popCount, IPanelViewController controller)
 {
     if (popCount > stack.Count)
     {
         popCount = stack.Count;
     }
     stack.RemoveRange(stack.Count - popCount, popCount);
     stack.Add(controller);
     await TransitionAsync().ConfigureAwait(false);
 }
Esempio n. 6
0
        public async void Swap()
        {
            IPanelViewController swapController = controller;

            if (swapController == null)
            {
                swapController = controllerProvider.Get(panelType);
            }
            await swapSystem.ShowAsync(swapController);

            Refresh();
        }
Esempio n. 7
0
        public async Task TransitionAsync()
        {
            try
            {
                //Not using null propagation because this would bypass the unity null check
                // ReSharper disable once UseNullPropagation
                if (null != eventManager)
                {
                    eventManager.Lock();
                }

                var hideController = activePanelController;
                var showController = panelSwapSystem.CurrentViewController;

                //Load Views
                if (showController != null)
                {
                    await LoadView(showController).ConfigureAwait(true);
                }

                var transitionTask = TransitionDefault(hideController, showController);
                await transitionTask.ConfigureAwait(true);

                activePanelController = showController;
            }
            catch (Exception e)
            {
                Debug.LogException(e);
            }
            finally
            {
                //Not using null propagation because this would bypass the unity null check
                // ReSharper disable once UseNullPropagation
                if (null != eventManager)
                {
                    eventManager.Unlock();
                }
            }
        }
 public ChangeVisibilityCommand([NotNull] IPanelViewController panelViewController)
 {
     if (panelViewController == null) throw new ArgumentNullException("panelViewController");
     m_PanelViewController = panelViewController;
 }
 public void Remove(IPanelViewController controller)
 {
     controllers.Remove(controller.PanelType);
 }
Esempio n. 10
0
 /// <summary>
 /// Clear all panels from the stack and then push a panel on top
 /// </summary>
 public async void ClearAndPush(IPanelViewController viewController)
 {
     await ClearAndPushAsync(viewController);
 }
Esempio n. 11
0
 /// <summary>
 /// Push panel options onto top of panel stack
 /// </summary>
 /// <param name="controller"></param>
 public async void Push(IPanelViewController controller)
 {
     await PushAsync(controller).ConfigureAwait(false);
 }
Esempio n. 12
0
 /// <summary>
 /// Clear all panels from the stack and then push a panel on top
 /// </summary>
 /// <returns>Awaitable task that completes when the panel transitions complete</returns>
 public async Task ClearAndPushAsync(IPanelViewController viewController)
 {
     stack.Clear();
     stack.Add(viewController);
     await TransitionAsync().ConfigureAwait(false);
 }
Esempio n. 13
0
 public async void Show(IPanelViewController controller)
 {
     await ShowAsync(controller).ConfigureAwait(false);
 }
Esempio n. 14
0
 /// <summary>
 /// Push panel options onto top of panel stack
 /// </summary>
 /// <param name="options"></param>
 /// <returns>Task that completes when panel is done being pushed</returns>
 public async Task PushAsync(IPanelViewController controller)
 {
     stack.Add(controller);
     await TransitionAsync();
 }
Esempio n. 15
0
 /// <summary>
 /// Push panel options onto top of panel stack
 /// </summary>
 /// <param name="controller"></param>
 public async void Push(IPanelViewController controller)
 {
     await PushAsync(controller);
 }
Esempio n. 16
0
 /// <summary>
 /// This method allows popping and pushing as one action with no transition required between.
 /// </summary>
 /// <param name="popCount">number of panels to pop</param>
 /// <param name="controller">controller to push</param>
 public async void PopAndPush(int popCount, IPanelViewController controller)
 {
     await PopAndPushAsync(popCount, controller).ConfigureAwait(false);
 }
Esempio n. 17
0
 public async void Show(IPanelViewController controller)
 {
     await ShowAsync(controller);
 }
Esempio n. 18
0
 /// <summary>
 /// Clear all panels from the stack and then push a panel on top
 /// </summary>
 public async void ClearAndPush(IPanelViewController viewController)
 {
     await ClearAndPushAsync(viewController).ConfigureAwait(false);
 }
 public ChangeOrientationToLeftCommand(IPanelViewController panelViewController)
 {
     m_PanelViewController = panelViewController;
 }
Esempio n. 20
0
 /// <summary>
 /// Push panel options onto top of panel stack
 /// </summary>
 /// <param name="options"></param>
 /// <returns>Task that completes when panel is done being pushed</returns>
 public async Task PushAsync(IPanelViewController controller)
 {
     stack.Add(controller);
     await TransitionAsync().ConfigureAwait(false);
 }
 public void Add(IPanelViewController controller)
 {
     controllers.Add(controller.PanelType, controller);
 }
Esempio n. 22
0
 public void Push(IPanelViewController panelController)
 {
     panelController.ShowAsync(true).Wait();
     controllerList.Add(panelController);
 }
Esempio n. 23
0
 /// <summary>
 /// This method allows popping and pushing as one action with no transition required between.
 /// </summary>
 /// <param name="popCount">number of panels to pop</param>
 /// <param name="controller">controller to push</param>
 public async void PopAndPush(int popCount, IPanelViewController controller)
 {
     await PopAndPushAsync(popCount, controller);
 }