Beispiel #1
0
        /*
         * protected virtual void LateUpdate()
         * {
         *
         *  // 判定是否真的转场完毕了。这里会检查是否还有子转场未完成
         *  if (inTrans)
         *  {
         *      ////LogManager.Log("Check Transit Over!! [" + this + "]");
         *      if (!_inTransSelf && transitChildList.Count == 0)
         *      {
         *          inTrans = false;
         *
         *          ////LogManager.Log("[" + this + "] Transit Over now");
         *
         *          dealTransitOver();
         *      }
         *  }
         * }
         */

        public static void StartTransit(GameObject obj, int group, bool isIn, bool needReset, Action cbFinish)
        {
            bool hasTransit = false;

            TransitObject[] tObjs = obj.GetComponents <TransitObject>();
            //Debug.Log("【" + obj.name + "】len=" + tObjs.Length);
            for (int i = 0; i < tObjs.Length; i++)
            {
                TransitObject tObj = tObjs[i];
                if (group < 0 || tObj.transitGroup == group)
                {
                    tObj.needResetBeforeTransit = needReset;
                    tObj.transit(isIn, cbFinish);

                    hasTransit = true;
                }
            }
            if (!hasTransit)
            {
                if (cbFinish != null)
                {
                    cbFinish();
                }
            }
        }
Beispiel #2
0
 // 隐藏一个按钮,播放关闭动画
 public void Hide()
 {
     if (pointEnterTimerKey > 0)
     {
         TimerManager.Instance.RemoveTimer(pointEnterTimerKey);
         pointEnterTimerKey = 0;
     }
     hiding = true;
     //Debug.Log("Begin Hide!");
     TransitObject.StartTransit(this.gameObject, transitOutGroup, false, HideFinish);
 }
Beispiel #3
0
        /// <summary>
        /// 显示一个按钮,播放出现动画
        /// </summary>
        /// <param name="delay">显示延迟,单位为秒</param>
        public void Show(float delay)
        {
            NormalTransit.resetTransit(true);
            NormalTransit.delayType = TransitDelayType.WaitForTime;
            NormalTransit.delayTime = delay;

            TransitObject.StartTransit(this.gameObject, 0, true);

            hasShow = true;
            hiding  = false;

            //Debug.Log("Begin show!");
        }
Beispiel #4
0
        private void OnTapNext(GameObject obj)
        {
            if (IsBusy)
            {
                return;
            }

            TransitObject.StartTransit(obj, 2, true);
            if (curPage < pageCount && cbChangePage != null)
            {
                cbChangePage(curPage + 1);
            }
        }
Beispiel #5
0
        private void OnTapPrev(GameObject obj)
        {
            if (IsBusy)
            {
                return;
            }

            TransitObject.StartTransit(obj, 2, true);
            if (curPage > 1 && cbChangePage != null)
            {
                cbChangePage(curPage - 1);
            }
        }
Beispiel #6
0
        /// <summary>
        /// 调度转场,需设置是否延迟启动
        /// </summary>
        /// <param name='isIn'>
        /// 转入还是转出
        /// </param>
        /// <param name='_cb'>
        /// 转场完成的回调
        /// </param>
        public void transit(bool isIn, Action cb)
        {
            if (reverse)
            {
                isIn = !isIn;
            }

            isTransIn    = isIn;
            inTrans      = true;
            _inTransSelf = true;

            if (foc != null)
            {
                foc.Terminate();
            }

            // 设置完成回调
            foc = FinishObjectUtil.getInstance().createFinishObjectController();
            foc.AddObject(this);
            foc.cbFinish += dealTransitOver;
            foc.cbFinish += cb;

            // 驱动子转场
            int count = 0;

            // 如果有子内容需要转场
            if (needTransitChild)
            {
                TransitObject[] list = GetComponentsInChildren <TransitObject>(true);
                //Debug.Log("Find " + list.Length + " child");
                for (int i = 0; i < list.Length; i++)
                {
                    TransitObject tobj = list[i];

                    if (tobj != null && tobj != this && tobj.transitGroup == this.transitGroup)
                    {
                        if (!tobj.needShowWhenTransitIn && !tobj.gameObject.activeSelf)
                        {
                            continue;
                        }

                        /*
                         * if (tobj.isBusy())
                         * {
                         *  Debug.Log("[" + tobj + "] busy!");
                         *  continue;
                         * }
                         */

                        tobj.transit(isIn, null);

                        foc.AddObject(tobj);

                        count++;
                    }
                }
                //Debug.Log("Transit " + count + " sub object");
            }

            foc.Start();


            switch (delayType)
            {
            case TransitDelayType.WaitForTime:          // 等待时间
                if (timerKey > 0)
                {
                    TimerManager.Instance.RemoveTimer(timerKey);
                }
                isWaitingContinue = true;
                timerKey          = TimerManager.Instance.RegisterTimer(DelayByTime, delayTime, 1);
                //Debug.Log("Regist timer " + timerKey);
                break;

            case TransitDelayType.WaitForCall:          // 等待调用
                isWaitingContinue = true;
                break;

            default:            // 无延迟
                DealShow();
                transitContent(isIn);
                break;
            }
        }