Пример #1
0
    public void Close()
    {
        if (!hasShow)
        {
            return;
        }

        var tween = Hide();

        hasShow = false;         // hide也要判断hasShow,所以逻辑要放到hide之后

        if (instance == this)
        {
            instance = null;
        }

        if (tween == null)
        {
            release();
        }
        else
        {
            tween.OnComplete(() => {
                release();
            });
        }
    }
Пример #2
0
    private void animateIn()
    {
        autoFit();

        switch (Animate)
        {
        case AnimType.Up2Down:
        case AnimType.Left2Right:
        case AnimType.Right2Left:
        case AnimType.Custom:
        case AnimType.Down2Up:
            GetComponent <RectTransform>().DOAnchorPos(endPosition, duration);
            break;

        case AnimType.Popup:
            gameObject.Popup();
            break;
        }

        // 保存起来,singleton只允许出现一个
        if (singleton)
        {
            instance = this;
        }
    }