Ejemplo n.º 1
0
 protected void ShowViewBack(UI_View _view, AnimationViewType _eAnimationViewType = AnimationViewType.ANIMATED)
 {
     m_curBackView = _view;
     m_curBackView.Show(_eAnimationViewType);
     UpdateAllPopedViewZOrder();
     ShowBlackBG(m_curBackView);
 }
Ejemplo n.º 2
0
    /// <summary>
    /// Pop in a view and hide all underneath views
    /// </summary>
    /// <param name="_view">_view.</param>
    /// <param name="_inventoryElement">_inventory element.</param>
    /// <param name="_eAnimationViewTypeSHOW">_e animation view type SHO.</param>
    /// <param name="_eAnimationViewTypeHIDE">_e animation view type HID.</param>
    protected void ShowViewAndHideAll(UI_View _view, AnimationViewType _eAnimationViewTypeSHOW = AnimationViewType.ANIMATED, AnimationViewType _eAnimationViewTypeHIDE = AnimationViewType.ANIMATED)
    {
        bool bSameView = false;

        if (m_qPopedViews.Count > 0)
        {
            UI_View view1 = m_qPopedViews.Pop();
            if (_view != view1)
            {
                view1.Hide(_eAnimationViewTypeHIDE);
            }
            else
            {
                m_qPopedViews.Push(_view);
                bSameView = true;
            }
        }
        if (!bSameView)
        {
            while (m_qPopedViews.Count > 0)
            {
                m_qPopedViews.Pop().Hide(_eAnimationViewTypeHIDE);
            }
            m_curPopedView = _view;
            m_qPopedViews.Push(m_curPopedView);
            m_curPopedView.Show(_eAnimationViewTypeSHOW);
            UpdateAllPopedViewZOrder();
            ShowBlackBG(m_curPopedView);
        }
    }
Ejemplo n.º 3
0
 /// <summary>
 /// Hide the specified _eAnimationViewType. Only called by the UIManager, don't call it, uimanager call it in the DePopView()
 /// </summary>
 /// <param name="_eAnimationViewType">_e animation view type.</param>
 public virtual void Hide(AnimationViewType _eAnimationViewType = AnimationViewType.ANIMATED)
 {
     if (gameObject.activeInHierarchy)
     {
         Init();
         m_canvasGroup.interactable = false;
         if (m_tweenHide && _eAnimationViewType == AnimationViewType.ANIMATED)
         {
             m_tweenHide.TweenIn();
         }
         else if (m_tweenHide && _eAnimationViewType == AnimationViewType.OVERRIDE_POSITION_LEFT && m_tweenHide.GetType() == typeof(UI_TweenPosition))
         {
             ((UI_TweenPosition)m_tweenHide).m_vFrom = new Vector2(0, 0);
             ((UI_TweenPosition)m_tweenHide).m_vTo   = new Vector2(-1, 0);
             m_tweenHide.TweenIn();
         }
         else if (m_tweenHide && _eAnimationViewType == AnimationViewType.OVERRIDE_POSITION_RIGHT && m_tweenHide.GetType() == typeof(UI_TweenPosition))
         {
             ((UI_TweenPosition)m_tweenHide).m_vFrom = new Vector2(0, 0);
             ((UI_TweenPosition)m_tweenHide).m_vTo   = new Vector2(1, 0);
             m_tweenHide.TweenIn();
         }
         else if (_eAnimationViewType == AnimationViewType.NONE || _eAnimationViewType == AnimationViewType.ANIMATED)
         {
             OnHideFinished();
         }
     }
 }
Ejemplo n.º 4
0
    /// <summary>
    /// Depop in all poped views to the desired view
    /// </summary>
    /// <param name="_view">_view.</param>
    /// <param name="_eAnimationViewTypeSHOW">_e animation view type SHO.</param>
    /// <param name="_eAnimationViewTypeHIDE">_e animation view type HID.</param>
    protected void HideToView(UI_View _view, AnimationViewType _eAnimationViewTypeSHOW = AnimationViewType.ANIMATED, AnimationViewType _eAnimationViewTypeHIDE = AnimationViewType.ANIMATED)
    {
        if (m_qPopedViews.Contains(_view))
        {
            bool bFound = false;
            while (!bFound && m_qPopedViews.Count > 1)
            {
                UI_View view1 = m_qPopedViews.Pop();
                UI_View view2 = m_qPopedViews.Pop();
                if (view2 == _view)
                {
                    m_curPopedView = view2;
                    view1.Hide(_eAnimationViewTypeHIDE);
                    m_qPopedViews.Push(view2);
                    bFound = true;
                }
            }

            if (bFound)
            {
                //Check if desired is active, if not we active it
                if (!m_curPopedView.gameObject.activeInHierarchy)
                {
                    m_curPopedView.Show(_eAnimationViewTypeSHOW);
                }
                else
                {
                    m_curPopedView.Show(AnimationViewType.NONE);
                }
                UpdateAllPopedViewZOrder();
            }
        }
    }
Ejemplo n.º 5
0
 /// <summary>
 /// Show the specified _eAnimationViewType. Only called by the UIManager, don't call it, uimanager call it in the PopView() and PushView()
 /// </summary>
 /// <param name="_eAnimationViewType">_e animation view type.</param>
 public virtual void Show(AnimationViewType _eAnimationViewType = AnimationViewType.ANIMATED)
 {
     Init();
     if (m_tweenHide)
     {
         m_tweenHide.Stop();
     }
     m_canvasGroup.alpha        = 1f;
     m_canvasGroup.interactable = false;
     gameObject.SetActive(true);
     OnWillBeShown();
     //if a tween is available for show, we use it, empty string will use the first tween of tweenhud
     if (m_tweenShow && _eAnimationViewType == AnimationViewType.ANIMATED)
     {
         m_tweenShow.TweenIn();
     }
     else if (m_tweenShow && _eAnimationViewType == AnimationViewType.OVERRIDE_POSITION_LEFT && m_tweenShow.GetType() == typeof(UI_TweenPosition))
     {
         ((UI_TweenPosition)m_tweenShow).m_vFrom = new Vector2(-1, 0);
         ((UI_TweenPosition)m_tweenShow).m_vTo   = new Vector2(0, 0);
         m_tweenShow.TweenIn();
     }
     else if (m_tweenShow && _eAnimationViewType == AnimationViewType.OVERRIDE_POSITION_RIGHT && m_tweenShow.GetType() == typeof(UI_TweenPosition))
     {
         ((UI_TweenPosition)m_tweenShow).m_vFrom = new Vector2(1, 0);
         ((UI_TweenPosition)m_tweenShow).m_vTo   = new Vector2(0, 0);
         m_tweenShow.TweenIn();
     }
     else if (_eAnimationViewType == AnimationViewType.NONE || _eAnimationViewType == AnimationViewType.ANIMATED)
     {
         transform.localScale = Vector3.one;
         OnShowFinished();
     }
 }
Ejemplo n.º 6
0
 protected void ShowViewFront(UI_View _view, AnimationViewType _eAnimationViewType = AnimationViewType.ANIMATED)
 {
     m_curFrontView = _view;
     Debug.Log(_view);
     m_curFrontView.Show(_eAnimationViewType);
     UpdateAllPopedViewZOrder();
     ShowBlackBG(m_curFrontView);
 }
Ejemplo n.º 7
0
 protected void HideViewFront(UI_View _view, AnimationViewType _eAnimationViewType = AnimationViewType.ANIMATED)
 {
     if (m_curFrontView && m_curFrontView == _view)
     {
         m_curFrontView.Hide(AnimationViewType.ANIMATED);
         UpdateAllPopedViewZOrder();
         ShowBlackBG(m_curFrontView);
         m_curFrontView = null;
     }
 }
Ejemplo n.º 8
0
 protected void HideViewBack(AnimationViewType _eAnimationViewType = AnimationViewType.ANIMATED)
 {
     if (m_curBackView)
     {
         m_curBackView.Hide(AnimationViewType.ANIMATED);
         UpdateAllPopedViewZOrder();
         ShowBlackBG(m_curBackView);
         m_curBackView = null;
     }
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Depop in all views, only the pushed view will be shown
 /// </summary>
 /// <param name="_eAnimationViewType">_e animation view type.</param>
 protected virtual void HideAllViews(AnimationViewType _eAnimationViewType = AnimationViewType.ANIMATED)
 {
     while (m_qPopedViews.Count > 0)
     {
         UI_View view = m_qPopedViews.Pop();
         if (view)
         {
             view.Hide(_eAnimationViewType);
         }
     }
     m_curPopedView = null;
 }
Ejemplo n.º 10
0
    /// <summary>
    /// Depop in a view, last view in stack will be shown
    /// </summary>
    /// <param name="_view">_view.</param>
    /// <param name="_eAnimationViewTypeSHOW">_e animation view type SHO.</param>
    /// <param name="_eAnimationViewTypeHIDE">_e animation view type HID.</param>
    protected void HideView(UI_View _view, AnimationViewType _eAnimationViewTypeSHOW = AnimationViewType.ANIMATED, AnimationViewType _eAnimationViewTypeHIDE = AnimationViewType.ANIMATED)
    {
        if (m_qPopedViews.Contains(_view) && m_qPopedViews.Count > 0 && _view.gameObject.activeInHierarchy)
        {
            List <UI_View> lViews = new List <UI_View>();
            bool           bFound = false;

            while (!bFound && m_qPopedViews.Count > 0)
            {
                UI_View view = m_qPopedViews.Pop();
                if (view == _view)
                {
                    view.Hide(_eAnimationViewTypeHIDE);
                    HideBlackBG(view);
                    bFound = true;
                }
                else
                {
                    lViews.Add(view);
                }
            }

            if (lViews.Count > 0)
            {
                for (int i = lViews.Count - 1; i >= 0; i--)
                {
                    m_qPopedViews.Push(lViews[i]);
                }
            }

            if (m_qPopedViews.Count == 0)
            {
                m_curPopedView = null;
            }
            else
            {
                //Check if last pop is active, if not we active it
                UI_View view = m_qPopedViews.Pop();
                m_curPopedView = view;
                if (!view.gameObject.activeInHierarchy)
                {
                    view.Show(_eAnimationViewTypeSHOW);
                }
                else
                {
                    view.Show(AnimationViewType.NONE);
                }
                m_qPopedViews.Push(view);
                UpdateAllPopedViewZOrder();
                ShowBlackBG(m_curPopedView);
            }
        }
    }
Ejemplo n.º 11
0
 /// <summary>
 /// Pop a view over the pushed view, if no pushed view => it will be set as the pushed view
 /// </summary>
 /// <param name="_view">_view.</param>
 /// <param name="_inventoryElement">_inventory element.</param>
 /// <param name="_eAnimationViewType">_e animation view type.</param>
 protected void ShowView(UI_View _view, AnimationViewType _eAnimationViewType = AnimationViewType.ANIMATED)
 {
     if (m_curPopedView == _view)
     {
         //View already shown, we want to update the display but don't play the animation
         m_curPopedView.Show(AnimationViewType.ANIMATED);
     }
     else
     {
         m_curPopedView = _view;
         m_qPopedViews.Push(m_curPopedView);
         m_curPopedView.Show(_eAnimationViewType);
         UpdateAllPopedViewZOrder();
     }
     ShowBlackBG(m_curPopedView);
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Pop a view over the pushed view, if no pushed view => it will be set as the pushed view
 /// </summary>
 /// <param name="_view">_view.</param>
 /// <param name="_inventoryElement">_inventory element.</param>
 /// <param name="_eAnimationViewTypeSHOW">_e animation view type SHO.</param>
 /// <param name="_eAnimationViewTypeHIDE">_e animation view type HID.</param>
 protected void ShowViewAndHideLast(UI_View _view, AnimationViewType _eAnimationViewTypeSHOW = AnimationViewType.ANIMATED, AnimationViewType _eAnimationViewTypeHIDE = AnimationViewType.ANIMATED)
 {
     if (m_curPopedView != _view && !_view.gameObject.activeInHierarchy)
     {
         m_curPopedView = _view;
         if (m_qPopedViews.Count > 0)
         {
             UI_View view = m_qPopedViews.Pop();
             view.Hide(_eAnimationViewTypeHIDE);
             m_qPopedViews.Push(view);
         }
         m_qPopedViews.Push(_view);
         m_curPopedView.Show(_eAnimationViewTypeSHOW);
         UpdateAllPopedViewZOrder();
         ShowBlackBG(m_curPopedView);
     }
 }
Ejemplo n.º 13
0
 public override void Hide(AnimationViewType _eAnimationViewType = AnimationViewType.ANIMATED)
 {
     base.Hide(_eAnimationViewType);
     m_bInterpolateArrow = false;
 }