Ejemplo n.º 1
0
        /// <summary>
        /// 按钮点击切换页面专用的方法
        /// </summary>
        /// <param name="toIn"></param>
        /// <param name="toOut"></param>
        /// <param name="leftFront"></param>
        /// <param name="rigtFront"></param>
        /// <param name="isForward"></param>
        /// <param name="action"></param>
        void RealTouchOpenUIForButton(EnumUIType toIn, EnumUIType toOut, EnumUIType leftFront, EnumUIType rigtFront, bool isForward, Action <EnumUIType> action = null)
        {
            TweenPosition tp = dicOpenUIs[toIn].GetComponent <TweenPosition>();

            EventDelegate ev = null;

            #region  当动画切换完成后,执行的一些方法
            ev = new EventDelegate(() =>
            {
                if (action != null)
                {
                    action(toIn);
                }
                CloseUI(toOut);
                OpenUI(leftFront, -1024);
                OpenUI(rigtFront, 1024);
                tp.RemoveOnFinished(ev);
            });
            tp.onFinished.Add(ev);
            #endregion

            if (isForward && toOut != EnumUIType.None) //UI向左移动出去
            {
                dicOpenUIs[toOut].GetComponent <BaseUI>().AminationUI(isForward, -1024);
            }
            else if (!isForward && toOut != EnumUIType.None) //UI向右移动出去
            {
                dicOpenUIs[toOut].GetComponent <BaseUI>().AminationUI(isForward, 1024);
            }
            if (toIn != EnumUIType.None)
            {
                dicOpenUIs[toIn].GetComponent <BaseUI>().AminationUI(isForward);
            }
            cenUI = (int)toIn; //最后进到中间的UI
        }
Ejemplo n.º 2
0
    /*void Update()
     * {
     *  if (Input.GetKeyUp(KeyCode.A))
     *  {
     *      StartCoroutine("Play");
     *  }
     * }*/

    IEnumerator Play()
    {
        //yield return new WaitForEndOfFrame();

        FingerMove.PlayForward();
        FingerAlpha.PlayForward();

        EventDelegate del_2 = new EventDelegate(() =>
        {
            FingerMove.PlayReverse();
            FingerAlpha.PlayReverse();
        });

        EventDelegate del_1 = new EventDelegate(() =>
        {
            ArrowsMove.PlayForward();
            ArrowsMove.SetOnFinished(del_2);
        });

        FingerMove.SetOnFinished(del_1);

        yield return(new WaitForSeconds(2.0f));

        ArrowsMove.ResetToBeginning();
        //FingerMove.ResetToBeginning();
        //FingerAlpha.ResetToBeginning();

        FingerMove.RemoveOnFinished(del_1);
        ArrowsMove.RemoveOnFinished(del_2);
    }
 public void OnTweenEnd()
 {
     if (Tweener != null)
     {
         Tweener.RemoveOnFinished(TweenEndCallback);
         Tweener.enabled = false;
     }
     if (Reset)
     {
         if (Tweener != null && Tweener.gameObject != null)
         {
             Tweener.gameObject.transform.position = Tweener.from;
         }
     }
     m_Status = Status.StopOnNextFrame;
 }
Ejemplo n.º 4
0
        /// <summary>
        /// UI界面动画之间的切换和内部逻辑
        /// </summary>
        /// <param name="toIn">进到屏幕的UI</param>
        /// <param name="toOut">出到屏幕的UI</param>
        /// <param name="uPFront">预加载的UI</param>
        /// <param name="isForward">向左播放为true,向右播放为false</param>
        /// <param name="del">需要删除的UI</param>
        /// <param name="action">打开UI后的事件</param>
        /// <param name="xPosition">预加载UI所在的X轴的位置</param>
        IEnumerator RealTouchOpenUI(EnumUIType toIn, EnumUIType toOut, EnumUIType uPFront, bool isForward, EnumUIType del = EnumUIType.None, Action <EnumUIType> action = null)
        {
            TweenPosition tp = dicOpenUIs[toIn].GetComponent <TweenPosition>();

            EventDelegate ev = null;

            #region  当动画切换完成后,执行的一些方法

            ev = new EventDelegate(() =>
            {
                if (action != null)
                {
                    action(toIn);
                }
                if (isForward)
                {
                    OpenUI(uPFront, 1024);
                }
                else
                {
                    OpenUI(uPFront, -1024);
                }
                CloseUI(del);

                tp.RemoveOnFinished(ev);
            });

            tp.onFinished.Add(ev);
            #endregion

            yield return(CoroutineController.Instance.StartCoroutine(CheckUIState()));

            if (isForward && toOut != EnumUIType.None)//UI向左移动出去
            {
                dicOpenUIs[toOut].GetComponent <BaseUI>().AminationUI(isForward, -1024);
            }
            else if (!isForward && toOut != EnumUIType.None)//UI向右移动出去
            {
                dicOpenUIs[toOut].GetComponent <BaseUI>().AminationUI(isForward, 1024);
            }
            if (toIn != EnumUIType.None)
            {
                dicOpenUIs[toIn].GetComponent <BaseUI>().AminationUI(isForward);
            }
            cenUI = (int)toIn;
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 关闭此界面
 /// </summary>
 public void OnCloseBtn()
 {
     if (Bg.gameObject.activeSelf)
     {
         Left.RemoveOnFinished(new EventDelegate(() => Bg.PlayForward()));
         Bg.PlayReverse();
         Bg.AddOnFinished(() =>
         {
             Bg.gameObject.SetActive(false);
             Left.PlayReverse();
             Left.AddOnFinished(Close);
         });
         TeahouseController.Instance.CurrentTeaId = -1;
     }
     else
     {
         Left.PlayReverse();
         Left.AddOnFinished(Close);
     }
 }
Ejemplo n.º 6
0
        public void AminationUI(bool isForward, int xPosition = 0)
        {
            if (isForward)
            {
                State = EnumObjectState.MoveLefting;
            }
            else
            {
                State = EnumObjectState.MoveRigting;
            }
            EventDelegate ev = null;

            #region  动画完成后执行的操作

            ev = new EventDelegate(() =>
            {
                State = EnumObjectState.Ready;
                tweenPosition.RemoveOnFinished(ev);
            });
            tweenPosition.onFinished.Add(ev);
            #endregion
            TweenPosition.Begin(this.gameObject, 0.35f, new Vector3(xPosition, 0, 0));
        }