/// <summary>
        /// Registers a screen. If transform is passed, the layer will
        /// reparent it to itself. Screens can only be shown after they're registered.
        /// </summary>
        /// <param name="screenId">Screen identifier.</param>
        /// <param name="controller">Controller.</param>
        /// <param name="screenTransform">Screen transform. If not null, will be reparented to proper layer</param>
        public void RegisterScreen(string screenId, IUIScreenController controller, Transform screenTransform)
        {
            IWindowController window = controller as IWindowController;

            if (window != null)
            {
                windowLayer.RegisterScreen(screenId, window);
                if (screenTransform != null)
                {
                    windowLayer.ReparentScreen(controller, screenTransform);
                }

                return;
            }

            IPanelController panel = controller as IPanelController;

            if (panel != null)
            {
                panelLayer.RegisterScreen(screenId, panel);
                if (screenTransform != null)
                {
                    panelLayer.ReparentScreen(controller, screenTransform);
                }
            }
        }
Exemplo n.º 2
0
 private void OnScreenDestroyed(IUIScreenController screen)
 {
     if (!string.IsNullOrEmpty(screen.screenID) && registeredScreens.ContainsKey(screen.screenID))
     {
         UnregisterScreen(screen.screenID, (TScreen)screen);
     }
 }
Exemplo n.º 3
0
 private void AddTransition(IUIScreenController screen)
 {
     screensTransitioning.Add(screen);
     if (RequestScreenBlock != null)
     {
         RequestScreenBlock();
     }
 }
Exemplo n.º 4
0
 private void RemoveTransition(IUIScreenController screen)
 {
     screensTransitioning.Remove(screen);
     if (!IsScreenTransitionInProgress)
     {
         RequestScreenUnblock?.Invoke();
     }
 }
Exemplo n.º 5
0
 private void OnOutAnimationFinished(IUIScreenController screen)
 {
     RemoveTransition(screen);
     if (screen is IWindowController window && window.IsPopup)
     {
         priorityParaLayer.RefreshDarken();
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Change screen
 /// </summary>
 /// <param name="screen">new screen</param>
 private void ChangeCurrentScreen(IUIScreenController screen)
 {
     _currentScreen = screen;
     if (eventChangeScreen != null)
     {
         eventChangeScreen.Invoke(this, EventArgs.Empty);
     }
 }
Exemplo n.º 7
0
    private void OnClosingAnimationFinished(IUIScreenController screen)
    {
        RemoveTransition(screen);

        var window = screen as IWindowController;

        if (window.IsPopup)
        {
            priorityParaLayer.RefreshDarken();
        }
    }
Exemplo n.º 8
0
        public override void ReparentScreen(IUIScreenController controller, Transform screenTransform)
        {
            var ctl = controller as IPanelController;

            if (ctl != null)
            {
                ReparentToParaLayer(ctl.Priority, screenTransform);
            }
            else
            {
                base.ReparentScreen(controller, screenTransform);
            }
        }
Exemplo n.º 9
0
    /// <summary>
    /// Show previous screen with animation
    /// </summary>
    /// <param name="navigationController"></param>
    private void ShowNavigationOfPreviousScreen(IUIScreenController previousScreen, UIScreenAnimationSettings animationSetting, object data)
    {
        if (CheckOfScreen(previousScreen.screenID))
        {
            return;
        }

        previousScreen.SetData(data);

        //get revert animation settings
        UIScreenAnimationSettings revertAnimationSEtting = new UIScreenAnimationSettings();

        revertAnimationSEtting.SetRevertType(animationSetting);

        UIScreenAnimationManager.Instance.StartAnimateNavigation(revertAnimationSEtting, previousScreen, _currentScreen);
        ChangeCurrentScreen(previousScreen);
    }
Exemplo n.º 10
0
        public override void ReparentScreen(IUIScreenController controller, Transform screenTransform)
        {
            IWindowController window = controller as IWindowController;

            if (window == null)
            {
                Debug.LogError("[WindowUILayer] Screen " + screenTransform.name + " is not a Window!");
            }
            else
            {
                if (window.IsPopup)
                {
                    priorityParaLayer.AddScreen(screenTransform);
                    return;
                }
            }

            base.ReparentScreen(controller, screenTransform);
        }
    /*Logic
     * */
    public void StartAnimateNavigation(UIScreenAnimationSettings settings, IUIScreenController nextUIScreen = null, IUIScreenController currentUIScreen = null)
    {
        _animtionSettings = settings;
        _nextUIScreen     = nextUIScreen.baseGameObject;
        _currentUIScreen  = currentUIScreen.baseGameObject;

        _nextUIScreenTween.rectTransform = nextUIScreen.baseRectTransform;
        _nextUIScreenTween.ChangeSetState(false);
        _currentUIScreenTween.rectTransform = currentUIScreen.baseRectTransform;
        _currentUIScreenTween.ChangeSetState(false);
        //set layer position
        UIScreensLayerPositions();
        //set uration of tweens
        SetDuration();
        //set tween settings
        SetAnimationParams();
        //start animations
        StartAnimation();
    }
Exemplo n.º 12
0
 private void OnCloseRequestedByWindow(IUIScreenController screen)
 {
     HideScreen(screen as IWindowController);
 }
Exemplo n.º 13
0
 private void OnInAnimationFinished(IUIScreenController screen)
 {
     RemoveTransition(screen);
 }
Exemplo n.º 14
0
 public virtual void ReparentScreen(IUIScreenController controller, Transform screenTransform)
 {
     screenTransform.SetParent(transform, false);
 }
Exemplo n.º 15
0
 private void AddTransition(IUIScreenController screen)
 {
     screensTransitioning.Add(screen);
     RequestScreenBlock?.Invoke();
 }
Exemplo n.º 16
0
 /// <summary>
 /// Reparents given Transform to this Layer.
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="screenTransform"></param>
 public virtual void ReparentScreen(IUIScreenController controller,
                                    Transform screenTransform)
 {   //it's okay to have parameters that don't get used this go around.
     screenTransform.SetParent(transform, false);
 }