//======================================== // Self-Define //------------------------------ //---------------------- // Public Functions /// <summary> /// Start sliding the screen in the scene. /// </summary> /// <param name="align"> align type </param> public void StartSlideIn(JCS_Align align, float time) { mTweener.DurationX = time; mTweener.DurationY = time; mTweener.DurationZ = time; // tween back to where we are. mTweener.DoTween(mStartingPosition); }
/// <summary> /// Start sliding the screen out the scene. /// </summary> /// <param name="align"> align type </param> public void StartSlideOut(JCS_Align align, float time) { Vector2 sizeDelta = JCS_Canvas.GuessCanvas().AppRect.sizeDelta; float imageSize = 1200; float distanceX = sizeDelta.x + imageSize; float distanceY = sizeDelta.y + imageSize; // NOTE(jenchieh): this is just some tweeking. mTweener.DurationX = time; mTweener.DurationY = time; mTweener.DurationZ = time; Vector3 tweenTo = this.transform.localPosition; switch (align) { // going left showing from right // ============-------------- case JCS_Align.ALIGN_RIGHT: { tweenTo.x = JCS_Mathf.ToNegative(distanceX); } break; // going right showing from left // -----------============= case JCS_Align.ALIGN_LEFT: { tweenTo.x = JCS_Mathf.ToPositive(distanceX); } break; case JCS_Align.ALIGN_BOTTOM: { tweenTo.y = JCS_Mathf.ToPositive(distanceY); } break; case JCS_Align.ALIGN_TOP: { tweenTo.y = JCS_Mathf.ToNegative(distanceY); } break; } // start sliding mTweener.DoTween(tweenTo); }