/// <summary> /// Switch the animation state. /// </summary> /// <param name="type"> type of the animation. </param> public void SwitchState(JCS_CursorCustomizeType type) { RuntimeAnimatorController anim = null; bool notFound = false; switch (type) { case JCS_CursorCustomizeType.NORMAL_SELECT: { if (mNormalSelect == null) { notFound = true; } anim = mNormalSelect; } break; case JCS_CursorCustomizeType.HELP_SELECT: { if (mHelpSelect == null) { notFound = true; } anim = mHelpSelect; } break; case JCS_CursorCustomizeType.WORKING_IN_BACKGROUND: { if (mWorkingInBackground == null) { notFound = true; } anim = mWorkingInBackground; } break; case JCS_CursorCustomizeType.BUSY: { if (mBusy == null) { notFound = true; } anim = mBusy; } break; case JCS_CursorCustomizeType.PRECISION_SELECT: { if (mPrecisionSelect == null) { notFound = true; } anim = mPrecisionSelect; } break; case JCS_CursorCustomizeType.TEXT_SELECT: { if (mTextSelect == null) { notFound = true; } anim = mTextSelect; } break; case JCS_CursorCustomizeType.HANDWRITING: { if (mHandwriting == null) { notFound = true; } anim = mHandwriting; } break; case JCS_CursorCustomizeType.UNAVAILABLE: { if (mUnavaliable == null) { notFound = true; } anim = mUnavaliable; } break; case JCS_CursorCustomizeType.VERTICAL_RESIZE: { if (mVerticalResize == null) { notFound = true; } anim = mVerticalResize; } break; case JCS_CursorCustomizeType.HORIZONTAL_RESIZE: { if (mHorizontalResize == null) { notFound = true; } anim = mHorizontalResize; } break; case JCS_CursorCustomizeType.DIAGONAL_RESIZE_1: { if (mDiagonalResize1 == null) { notFound = true; } anim = mDiagonalResize1; } break; case JCS_CursorCustomizeType.DIAGONAL_RESIZE_2: { if (mDiagonalResize2 == null) { notFound = true; } anim = mDiagonalResize2; } break; case JCS_CursorCustomizeType.MOVE: { if (mMove == null) { notFound = true; } anim = mMove; } break; case JCS_CursorCustomizeType.ALTERNATE_SELECT: { if (mAlternateSelect == null) { notFound = true; } anim = mAlternateSelect; } break; case JCS_CursorCustomizeType.LINK_SELECT: { if (mNormalSelect == null) { notFound = true; } anim = mLinkSelect; } break; } if (notFound) { JCS_Debug.LogError( type.ToString() + " animation does not assign..."); return; } // set animation mAnimator.runtimeAnimatorController = anim; this.mCursorCustomizeType = type; }
/// <summary> /// Switch the animation state. /// </summary> /// <param name="type"> type of the animation. </param> public void SwitchState(JCS_CursorCustomizeType type) { this.m2DAnimator.DoAnimation((int)type); this.mCursorCustomizeType = type; }