Esempio n. 1
0
    public void Hide(Action OnComplete = null)
    {
        if (isBusy)
        {
            return;
        }

        isBusy = true;
        LeanTweenType ease = PlatinioUI.GetEase(exitAnimation);

        //set initial pos
        switch (exitTo)
        {
        case PlatinioUI.Direction.BOTTOM:
            LeanTween.moveY(gameObject, -platinioUI.verticalOffset, entryAnimationTime).setEase(ease).setOnComplete(() =>
            {
                if (OnComplete != null)
                {
                    OnComplete();
                }
                isBusy = false;
                gameObject.SetActive(false);
            });

            break;

        case PlatinioUI.Direction.LEFT:
            LeanTween.moveX(gameObject, -platinioUI.horizontalOffset, entryAnimationTime).setEase(ease).setOnComplete(() =>
            {
                isBusy = false;
                gameObject.SetActive(false);
            });
            break;

        case PlatinioUI.Direction.RIGHT:
            LeanTween.moveX(gameObject, platinioUI.horizontalOffset, entryAnimationTime).setEase(ease).setOnComplete(() =>
            {
                if (OnComplete != null)
                {
                    OnComplete();
                }
                isBusy = false;
                gameObject.SetActive(false);
            });
            break;

        case PlatinioUI.Direction.UP:
            LeanTween.moveY(gameObject, platinioUI.verticalOffset, entryAnimationTime).setEase(ease).setOnComplete(() =>
            {
                if (OnComplete != null)
                {
                    OnComplete();
                }
                isBusy = false;
                gameObject.SetActive(false);
            });
            break;
        }
    }
Esempio n. 2
0
    public void Show(Action OnComplete = null)
    {
        if (isBusy)
        {
            return;
        }

        isBusy = true;
        LeanTweenType ease = PlatinioUI.GetEase(entryAnimation);

        //set initial pos
        switch (entryFrom)
        {
        case PlatinioUI.Direction.BOTTOM:
            transform.position = new Vector3(targetPos.x, -platinioUI.verticalOffset, 0);
            gameObject.SetActive(true);
            LeanTween.moveY(gameObject, targetPos.y, entryAnimationTime).setEase(ease).setOnComplete(() =>
            {
                if (OnComplete != null)
                {
                    OnComplete();
                }
                isBusy = false;
            });
            break;

        case PlatinioUI.Direction.LEFT:
            transform.position = new Vector3(-platinioUI.horizontalOffset, targetPos.y, 0);
            gameObject.SetActive(true);
            LeanTween.moveX(gameObject, targetPos.x, entryAnimationTime).setEase(ease).setOnComplete(() =>
            {
                if (OnComplete != null)
                {
                    OnComplete();
                }
                isBusy = false;
            });
            break;

        case PlatinioUI.Direction.RIGHT:
            transform.position = new Vector3(platinioUI.horizontalOffset, targetPos.y, 0);
            gameObject.SetActive(true);
            LeanTween.moveX(gameObject, targetPos.x, entryAnimationTime).setEase(ease).setOnComplete(() =>
            {
                if (OnComplete != null)
                {
                    OnComplete();
                }
                isBusy = false;
            });
            break;

        case PlatinioUI.Direction.UP:
            transform.position = new Vector3(targetPos.x, platinioUI.verticalOffset, 0);
            gameObject.SetActive(true);
            LeanTween.moveY(gameObject, targetPos.y, entryAnimationTime).setEase(ease).setOnComplete(() =>
            {
                if (OnComplete != null)
                {
                    OnComplete();
                }
                isBusy = false;
            });
            break;
        }
    }