コード例 #1
0
ファイル: UIAnimation.cs プロジェクト: hooei/BrainCube
 void OnDestroy()
 {
     if (closeAnimationType != CloseAnimationType.None)
     {
         closeScript = gameObject.GetComponent <UIClose>();
         if (closeScript != null)
         {
             closeScript.willStartCallBack += HanleWindowWillClose;
         }
     }
 }
コード例 #2
0
ファイル: BaseMenu.cs プロジェクト: hooei/BrainCube
    public virtual void Close()
    {
        UIClose close = this.GetComponent <UIClose>();

        if (close != null)
        {
            close.Close();
        }
        else
        {
            Show(false);
        }
    }
コード例 #3
0
ファイル: UIAnimation.cs プロジェクト: hooei/BrainCube
    void OnEnable()
    {
        if (callbackTarget != null && !showBeginCallbackMethod.Equals(string.Empty))
        {
            callbackTarget.SendMessage(showBeginCallbackMethod, SendMessageOptions.DontRequireReceiver);
        }
        switch (showAnimationType)
        {
        case ShowAnimationType.FadeIn:
            CheckTweenAlpha();
            SetAlphaRecursively(0f);
            TweenAlpha.Begin(gameObject, animationTime, 1);
            tweenAlpha.eventReceiver    = this.gameObject;
            tweenAlpha.callWhenFinished = "FadeInEnd";
            tweenAlpha.method           = UITweener.Method.EaseInOut;
            break;

        case ShowAnimationType.FlyIn:
            CheckTweenPosition();
            Vector3 startPosition = gameObject.transform.localPosition;
            Vector3 endPosition   = positionCached ? cachedPosition : gameObject.transform.localPosition;
            switch (flyInDirection)
            {
            case FlyDirection.Left:
                startPosition.x = -Screen.width;
                break;

            case FlyDirection.Right:
                startPosition.x = Screen.width;
                break;

            case FlyDirection.Top:
                startPosition.y = Screen.height;
                break;

            case FlyDirection.Bottom:
                startPosition.y = -Screen.height;
                break;
            }
            gameObject.transform.localPosition = startPosition;
            TweenPosition.Begin(gameObject, animationTime, endPosition);
            tweenPosition.method           = UITweener.Method.EaseInOut;
            tweenPosition.eventReceiver    = this.gameObject;
            tweenPosition.callWhenFinished = "FlyInEnd";
            break;

        case ShowAnimationType.ScaleIn:
            CheckTweenScale();
            Vector3 endScale = new Vector3(1, 1, 1);
            gameObject.transform.localScale = startScale;
            TweenScale.Begin(gameObject, animationTime, endScale);
            tweenScale.method           = UITweener.Method.EaseOutBack;
            tweenScale.eventReceiver    = this.gameObject;
            tweenScale.callWhenFinished = "ScaleInEnd";
            break;

        default:
            break;
        }
        if (closeAnimationType != CloseAnimationType.None)
        {
            closeScript = gameObject.GetComponent <UIClose>();
            if (closeScript != null)
            {
                closeScript.willStartCallBack += HanleWindowWillClose;
                cachedWindowCloseCallBack      = closeScript.endCallBack;
            }
        }
    }