Example #1
0
    private void GetShowTweens()
    {
        List <Tween> showList = new List <Tween>();


        if (_enableCanvasFade)
        {
            showList.Add(UiTween.SetCanvasFade(_canvasFadeOnShow.Ease, _canvas, true, _canvasFadeOnShow.Time, _canvasFadeOnShow.Delay));
        }
        if (_enableRectPos)
        {
            showList.Add(UiTween.SetRectTPosition(RectTransform, _rectPosOnShow.Ease, _rectPosOnShow.Position, _rectPosOnShow.Time, _rectPosOnShow.Delay, _rectPosOnShow.Snap));
        }
        if (_enableRectScale)
        {
            showList.Add(UiTween.SetRectTScale(RectTransform, _rectScaleOnShow.Ease, _rectScaleOnShow.Scale, _rectScaleOnShow.Time, _rectScaleOnShow.Delay));
        }

        _showTweens = showList.ToArray();
    }
Example #2
0
        public void LoadScene(string sceneName)
        {
            if (_isLoading)
            {
                return;
            }

            _currentScene = sceneName;
            _isLoading    = true;
            if (OnStartLoadScene != null)
            {
                OnStartLoadScene();
            }
            UpdateProgressEvent(0);
            _canvas.gameObject.SetActive(true);
#if DOTWEEN
            _tweener = UiTween.SetCanvasFade(Ease.Linear, _canvas, true, FadeTime, 0);
            _tweener.OnComplete(() => { StartCoroutine(LoadSceneSequence()); }
                                );
        #endif
        }
Example #3
0
    public override void Hide(bool triggerEvents)
    {
        if (IsVisible == false)
        {
            return;
        }

        IsVisible = false;
        _panelSequence.SafeKill();
        GetHideTweens();
        _panelSequence = UiTween.BuildUiSequence(_hideTweens, () =>
        {
            SetChildrenActive(false);
        });


        if (triggerEvents)
        {
            InvokeHideEvent();
        }
    }
Example #4
0
    public override void Show(bool triggerEvents)
    {
        if (IsVisible)
        {
            return;
        }

        IsVisible = true;
        SetChildrenActive(true);

        _panelSequence.SafeKill();
        GetShowTweens();

        _panelSequence = UiTween.BuildUiSequence(_showTweens);


        if (triggerEvents)
        {
            InvokeShowEvent();
        }
    }
Example #5
0
        private IEnumerator LoadSceneSequence()
        {
            yield return(_waitForEndOfFrame);

            yield return(LoadSceneAsync(BlankScene));

            yield return(_waitForEndOfFrame);

            CleanMemory();
            UpdateProgressEvent(0.01f);
            yield return(_waitForEndOfFrame);

            var asyncOperation = LoadSceneAsync(_currentScene);

            while (asyncOperation.isDone == false)
            {
                yield return(_waitForEndOfFrame);

                UpdateProgressEvent(asyncOperation.progress);
            }

            yield return(_waitForEndOfFrame);

            UpdateProgressEvent(1);
#if DOTWEEN
            _tweener = UiTween.SetCanvasFade(Ease.Linear, _canvas, false, FadeTime, DelayBeforeFadeOut);
            _tweener.OnComplete(() =>
            {
                _canvas.gameObject.SetActive(false);
                if (OnFinishLoadScene != null)
                {
                    OnFinishLoadScene();
                }
                _isLoading = false;
            }

                                );
        #endif
        }