예제 #1
0
        /// <summary>
        /// 启动Blank动画。
        /// </summary>
        /// <param name="curTask"></param>
        private void StartBlankAnimation(UISwitchTask curTask)
        {
            if (curTask == null)
            {
                return;
            }

            StopAllAnimationAndDisableBlankCover(curTask);

            var from = curTask.FromWindow;
            var to   = curTask.ToWindow;

            var blankCover = _gameCanvas.GetWindowSwitchCover();

            if (!blankCover.gameObject.activeSelf)
            {
                blankCover.gameObject.SetActive(true);
            }

            curTask.StopAllAnimation();

            var blank = DOTween.Sequence();

            blank
            .Append(blankCover.DOFade(1, BlankAppearTime))
            .AppendCallback(() =>
            {
                if (from)
                {
                    from.anchoredPosition = BornPosition;
                }

                if (to)
                {
                    if (!to.gameObject.activeSelf)
                    {
                        to.gameObject.SetActive(true);
                    }

                    to.anchoredPosition = Vector2.zero;

                    if (curTask.OnEnableTarget != null)
                    {
                        curTask.OnEnableTarget(curTask);
                    }
                }
            })
            .Append(blankCover.DOFade(0, BlankFadeTime))
            .OnComplete(() =>
            {
                if (blankCover.gameObject.activeSelf)
                {
                    blankCover.gameObject.SetActive(false);
                }
            });

            blank.Play();
            curTask.BlankSequence = blank;
        }
예제 #2
0
        private void StopAllAnimationAndDisableBlankCover(UISwitchTask curTask)
        {
            if (curTask != null)
            {
                curTask.StopAllAnimation();
            }

            var cover = _gameCanvas.GetWindowSwitchCover();

            if (cover && cover.gameObject.activeSelf)
            {
                cover.gameObject.SetActive(false);
            }
        }