Beispiel #1
0
    public void PlayAnimation(BBUIButton _bBButton, UnityEvent onStartCallback = null, UnityEvent onCompleteCallback = null)
    {
        bBButton = _bBButton;
        switch (ButtonAnimationType)
        {
        case ButtonAnimationType.Punch:
            PunchAnimation = uiAnimationData.Animation.Copy();
            if (PunchAnimation == null)
            {
                return;
            }
            UIAnimator.StopAnimations(bBButton.RectTransform, AnimationType.Punch);
            if (PunchAnimation.Move.Enabled)
            {
                bBButton.ResetPosition();
            }
            if (PunchAnimation.Rotate.Enabled)
            {
                bBButton.ResetRotation();
            }
            if (PunchAnimation.Scale.Enabled)
            {
                bBButton.ResetScale();
            }
            UIAnimator.MovePunch(bBButton.RectTransform, PunchAnimation, bBButton.StartPosition);
            UIAnimator.RotatePunch(bBButton.RectTransform, PunchAnimation, bBButton.StartRotation);
            UIAnimator.ScalePunch(bBButton.RectTransform, PunchAnimation, bBButton.StartScale);
            Coroutiner.Start(InvokeCallbacks(PunchAnimation, onStartCallback, onCompleteCallback));
            break;

        case ButtonAnimationType.State:
            StateAnimation = uiAnimationData.Animation.Copy();
            if (StateAnimation == null)
            {
                return;
            }
            UIAnimator.StopAnimations(bBButton.RectTransform, AnimationType.State);
            UIAnimator.MoveState(bBButton.RectTransform, StateAnimation, bBButton.StartPosition);
            UIAnimator.RotateState(bBButton.RectTransform, StateAnimation, bBButton.StartRotation);
            UIAnimator.ScaleState(bBButton.RectTransform, StateAnimation, bBButton.StartScale);
            UIAnimator.FadeState(bBButton.RectTransform, StateAnimation, bBButton.StartAlpha);
            Coroutiner.Start(InvokeCallbacks(StateAnimation, onStartCallback, onCompleteCallback));
            break;
        }
    }
Beispiel #2
0
    public void PlayAnimation(BBUIButton _bBButton)
    {
        bBButton = _bBButton;
        switch (ButtonAnimationType)
        {
        case ButtonAnimationType.Punch:
            PunchAnimation = uiAnimationData.Animation.Copy();
            if (PunchAnimation == null)
            {
                return;
            }
            UIAnimator.StopAnimations(bBButton.RectTransform, AnimationType.Punch);
            if (PunchAnimation.Move.Enabled)
            {
                bBButton.ResetPosition();
            }
            if (PunchAnimation.Rotate.Enabled)
            {
                bBButton.ResetRotation();
            }
            if (PunchAnimation.Scale.Enabled)
            {
                bBButton.ResetScale();
            }
            UIAnimator.MovePunch(bBButton.RectTransform, PunchAnimation, bBButton.StartPosition);
            UIAnimator.RotatePunch(bBButton.RectTransform, PunchAnimation, bBButton.StartRotation);
            UIAnimator.ScalePunch(bBButton.RectTransform, PunchAnimation, bBButton.StartScale);
            break;

        case ButtonAnimationType.State:
            StateAnimation = uiAnimationData.Animation.Copy();
            if (StateAnimation == null)
            {
                return;
            }
            UIAnimator.StopAnimations(bBButton.RectTransform, AnimationType.State);
            UIAnimator.MoveState(bBButton.RectTransform, StateAnimation, bBButton.StartPosition);
            UIAnimator.RotateState(bBButton.RectTransform, StateAnimation, bBButton.StartRotation);
            UIAnimator.ScaleState(bBButton.RectTransform, StateAnimation, bBButton.StartScale);
            UIAnimator.FadeState(bBButton.RectTransform, StateAnimation, bBButton.StartAlpha);
            break;
        }
    }