Exemplo n.º 1
0
        ///<summary>
        /// This method kicks off the process.
        ///</summary>
        public void StartTween(TweenDelegate tweenDelegate, int srcX, int srcY, int destX, int destY, TweenAnimation animType, int timeInterval)
        {
            if (tweenDelegate == null)
            {
                return;
            }

            if (fBusy)
            {
                StopTween();
            }
            fBusy = true;

            fTweenDelegate = tweenDelegate;
            fCounter       = 0;
            fTimeStart     = fCounter;
            fTimeDest      = timeInterval;
            fAnimation     = animType;
            fStartX        = srcX;
            fStartY        = srcY;
            fCurX          = srcX;
            fCurY          = srcY;
            fDestX         = destX;
            fDestY         = destY;

            fTimer.Start();
        }
Exemplo n.º 2
0
        void PrepareTween(object obj,
                          FieldInfo fieldInfo,
                          float tweenFrom,
                          float tweenTo,
                          float duration,
                          EasingFunc easing,
                          TweenDelegate callback)
        {
            int idx = FindTween(obj, fieldInfo.Name);

            if (idx < 0)
            {
                idx = m_Tweens.Count;
                m_Tweens.Add(new Tween());
            }

            Tween tween = m_Tweens[idx];

            tween.Object    = obj;
            tween.FieldName = fieldInfo.Name;
            tween.FieldInfo = fieldInfo;
            if (tween.TweenFrom != tweenFrom || tween.TweenTo != tweenTo)
            {
                tween.TweenFrom = tweenFrom;
                tween.TweenTo   = tweenTo;
                tween.StartTime = Time.time;
            }
            tween.Duration = duration;
            tween.Easing   = easing ?? Easing.Linear.EaseNone;
            tween.Callback = callback;
            m_Tweens[idx]  = tween;
        }
Exemplo n.º 3
0
        /// <summary>
        /// Prepare for tweening.
        /// </summary>
        /// <param name="from"></param>
        /// <param name="to"></param>
        /// <param name="durationX"></param>
        /// <param name="durationY"></param>
        /// <param name="durationZ"></param>
        /// <param name="easingX"></param>
        /// <param name="easingY"></param>
        /// <param name="easingZ"></param>
        /// <param name="callback"></param>
        private void StartTween(
            Vector3 from,
            Vector3 to,
            bool resetElapsedTime     = true,
            float durationX           = 1f,
            float durationY           = 1f,
            float durationZ           = 1f,
            TweenDelegate easingX     = null,
            TweenDelegate easingY     = null,
            TweenDelegate easingZ     = null,
            CallBackDelegate callback = null)
        {
            if (tweener != null)
            {
                // Sets The Position From -> To
                tweener.easeFromTo(
                    from,
                    to + mValueOffset,  // add offset to final value.
                    resetElapsedTime,
                    durationX,
                    durationY,
                    durationZ,
                    easingX,
                    easingY,
                    easingZ,
                    mDestinationCallback);

                this.mIsDoneTweening = false;

                this.mContinueTween = false;
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Eases from value to value.
        /// </summary>
        /// <param name="from">From.</param>
        /// <param name="to">To.</param>
        /// <param name="duration">Duration.</param>
        /// <param name="easing">Easing.</param>
        public void easeFromTo(
            Vector3 from, Vector3 to,
            bool resetElapsedTime     = true,
            float durationX           = 1f,
            float durationY           = 1f,
            float durationZ           = 1f,
            TweenDelegate easingX     = null,
            TweenDelegate easingY     = null,
            TweenDelegate easingZ     = null,
            CallBackDelegate callback = null)
        {
            if (easingX == null)
            {
                // give the default value
                easingX = Easing.Linear;
            }

            if (easingY == null)
            {
                // give the default value
                easingY = Easing.Linear;
            }

            if (easingZ == null)
            {
                // give the default value
                easingZ = Easing.Linear;
            }

            _EasingX = easingX;
            _EasingY = easingY;
            _EasingZ = easingZ;
            SetCallback(callback);

            _From = from;
            _To   = to;

            _Duration.x    = durationX;
            _ProgressPct.x = 0f;

            _Duration.y    = durationY;
            _ProgressPct.y = 0f;

            _Duration.z    = durationZ;
            _ProgressPct.z = 0f;

            _AnimatingX = true;
            _AnimatingY = true;
            _AnimatingZ = true;

            if (resetElapsedTime)
            {
                _TimeElapsed.x = 0f;
                _TimeElapsed.y = 0f;
                _TimeElapsed.z = 0f;
            }
        }
Exemplo n.º 5
0
        /* Functions */

        protected override void Awake()
        {
            base.Awake();

            // get all function pointer/formula.
            this.mEasingRed   = JCS_Util.GetEasing(mEaseTypeR);
            this.mEasingGreen = JCS_Util.GetEasing(mEaseTypeG);
            this.mEasingBlue  = JCS_Util.GetEasing(mEaseTypeB);
            this.mEasingAlpha = JCS_Util.GetEasing(mEaseTypeA);
        }
Exemplo n.º 6
0
        private void SetScroll(int x, int y)
        {
            TweenDelegate invoker = delegate(int newX, int newY) {
                UpdateScrollPosition(newX, newY);
            };

            if (InvokeRequired)
            {
                Invoke(invoker, x, y);
            }
            else
            {
                invoker(x, y);
            }
        }
Exemplo n.º 7
0
        /// <summary>
        /// Prepare for tweening.
        /// </summary>
        /// <param name="from"></param>
        /// <param name="to"></param>
        /// <param name="durationX"></param>
        /// <param name="durationY"></param>
        /// <param name="durationZ"></param>
        /// <param name="easingX"></param>
        /// <param name="easingY"></param>
        /// <param name="easingZ"></param>
        /// <param name="callback"></param>
        private void StartTween(
            Vector3 from,
            Vector3 to,
            bool resetElapsedTime     = true,
            float durationX           = 1f,
            float durationY           = 1f,
            float durationZ           = 1f,
            TweenDelegate easingX     = null,
            TweenDelegate easingY     = null,
            TweenDelegate easingZ     = null,
            CallBackDelegate callback = null)
        {
            mDestinationCallback = callback;

            this.mIsDoneTweening = false;
            this.mDoneTweenX     = false;
            this.mDoneTweenY     = false;
            this.mDoneTweenZ     = false;

            this.mContinueTween = false;

            // Sets The Position From -> To
            mTweenerX.easeFromTo(
                from.x,
                to.x + mValueOffset.x,  // add offset to final value.
                resetElapsedTime,
                durationX,
                easingX,
                DoneTweeningX);

            // Sets The Position From -> To
            mTweenerY.easeFromTo(
                from.y,
                to.y + mValueOffset.y,  // add offset to final value.
                resetElapsedTime,
                durationY,
                easingY,
                DoneTweeningY);

            // Sets The Position From -> To
            mTweenerZ.easeFromTo(
                from.z,
                to.z + mValueOffset.z,  // add offset to final value.
                resetElapsedTime,
                durationZ,
                easingZ,
                DoneTweeningZ);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Tween to this vector either position, scale, rotation.
        /// </summary>
        /// <param name="from"> starting vector 3 </param>
        /// <param name="to"> target vector 3 </param>
        /// <param name="resetElapsedTime"> reset elapsed time? (default : true) </param>
        /// <param name="durationX"> how fast it tween on x axis. </param>
        /// <param name="durationY"> how fast it tween on y axis. </param>
        /// <param name="durationZ"> how fast it tween on z axis. </param>
        /// <param name="typeX"> easing type for x axis. </param>
        /// <param name="typeY"> easing type for y axis. </param>
        /// <param name="typeZ"> easing type for z axis. </param>
        /// <param name="callback"> callback function pointer. </param>
        public void DoTween(
            Vector3 from,
            Vector3 to,
            bool resetElapsedTime,
            float durationX,
            float durationY,
            float durationZ,
            JCS_TweenType typeX,
            JCS_TweenType typeY,
            JCS_TweenType typeZ,
            CallBackDelegate callback = null)
        {
            TweenDelegate easingX = JCS_Utility.GetEasing(typeX);
            TweenDelegate easingY = JCS_Utility.GetEasing(typeY);
            TweenDelegate easingZ = JCS_Utility.GetEasing(typeZ);

            StartTween(from, to, resetElapsedTime, durationX, durationY, durationZ, easingX, easingY, easingZ, callback);
        }
Exemplo n.º 9
0
    /// <summary>
    /// Eases from value to value.
    /// </summary>
    /// <param name="from">From.</param>
    /// <param name="to">To.</param>
    /// <param name="duration">Duration.</param>
    /// <param name="easing">Easing.</param>
    public void easeFromTo(Vector3 from, Vector3 to, float duration = 1f, TweenDelegate easing = null, CallBackDelegate callback = null)
    {
        if (easing == null)
        {
            easing = Easing.Linear;
        }

        _Easing   = easing;
        _Callback = callback;

        _From = from;
        _To   = to;

        _Duration    = duration;
        _TimeElapsed = 0f;
        _ProgressPct = 0f;

        _Animating = true;
    }
Exemplo n.º 10
0
	/// <summary>
	/// Eases from value to value.
	/// </summary>
	/// <param name="from">From.</param>
	/// <param name="to">To.</param>
	/// <param name="duration">Duration.</param>
	/// <param name="easing">Easing.</param>
	public void easeFromTo( Vector3 from,  Vector3 to, float duration=1f, TweenDelegate easing=null, CallBackDelegate callback=null )
	{
		if(easing==null)
		{
			easing = Easing.Linear;
		}

		_Easing 	= easing;
		_Callback	= callback;

		_From 	= from;
		_To		= to;

		_Duration 		= duration;
		_TimeElapsed 	= 0f;
		_ProgressPct	= 0f;

		_Animating = true;
	}
Exemplo n.º 11
0
        /// <summary>
        /// Eases from value to value.
        /// </summary>
        /// <param name="from">From.</param>
        /// <param name="to">To.</param>
        /// <param name="duration">Duration.</param>
        /// <param name="easing">Easing.</param>
        public void easeFromTo(float from, float to, bool resetElapsedTime = true, float duration = 1.0f, TweenDelegate easing = null, CallBackDelegate callback = null)
        {
            if (easing == null)
            {
                easing = Easing.Linear;
            }

            _Easing = easing;
            SetCallback(callback);

            _From = from;
            _To   = to;

            _Duration    = duration;
            _ProgressPct = 0.0f;
            _Animating   = true;

            if (resetElapsedTime)
            {
                _TimeElapsed = 0.0f;
            }
        }
Exemplo n.º 12
0
        public bool TweenFrom(object obj,
                              string fieldName,
                              float tweenFrom,
                              float duration,
                              EasingFunc easing      = null,
                              TweenDelegate callback = null)
        {
            if (obj == null)
            {
                return(false);
            }

            FieldInfo fieldInfo = GetField(obj, fieldName);

            if (fieldInfo == null)
            {
                return(false);
            }

            PrepareTween(obj, fieldInfo, tweenFrom, (float)fieldInfo.GetValue(obj), duration, easing, callback);

            return(true);
        }
Exemplo n.º 13
0
 /// <summary>Inserts the given callback at the given time position.</summary>
 /// <param name="p_time">Time position where this callback will be placed
 /// (if longer than the whole sequence duration, the callback will never be called)</param>
 /// <param name="p_callback">The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/></param>
 /// <param name="p_callbackParms">Additional comma separated parameters to pass to the function</param>
 public void InsertCallback(float p_time, TweenDelegate.TweenCallbackWParms p_callback, params object[] p_callbackParms)
 { InsertCallback(p_time, null, p_callback, p_callbackParms); }
Exemplo n.º 14
0
 /// <summary>Appends the given callback to this Sequence.</summary>
 /// <param name="p_callback">The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/></param>
 /// <param name="p_callbackParms">Additional comma separated parameters to pass to the function</param>
 public void AppendCallback(TweenDelegate.TweenCallbackWParms p_callback, params object[] p_callbackParms)
 { InsertCallback(_duration, p_callback, p_callbackParms); }
Exemplo n.º 15
0
 /// <summary>
 /// sets the onTweenFinish Delegate
 /// </summary>
 public OTTween OnFinish(TweenDelegate onTweenFinish)
 {
     this.onTweenFinish = onTweenFinish;
     return this;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Function to call when one of the plugins used in the tween gets overwritten
 /// (available only if OverwriteManager is active).
 /// </summary>
 /// <param name="p_function">
 /// The function to call, who must return <c>void</c> and accept no parameters.
 /// </param>
 public TweenParms OnPluginOverwritten(TweenDelegate.TweenCallback p_function)
 {
     onPluginOverwritten = p_function;
     return this;
 }
Exemplo n.º 17
0
 /// <summary>
 /// Function to call when the full Tweener, loops included, is completed.
 /// </summary>
 /// <param name="p_function">
 /// The function to call, who must return <c>void</c> and accept no parameters.
 /// </param>
 public TweenParms OnComplete(TweenDelegate.TweenCallback p_function)
 {
     onComplete = p_function;
     return this;
 }
Exemplo n.º 18
0
 /// <summary>
 /// Function to call each time the Tweener is rewinded from a non-rewinded state
 /// (either because of a direct call to Rewind,
 /// or because the tween's virtual playehead reached the start due to a playing backwards behaviour).
 /// </summary>
 /// <param name="p_function">
 /// The function to call, who must return <c>void</c> and accept no parameters.
 /// </param>
 public TweenParms OnRewinded(TweenDelegate.TweenCallback p_function)
 {
     onRewinded = p_function;
     return this;
 }
Exemplo n.º 19
0
 /// <summary>
 /// Assigns the given callback to this Tweener/Sequence,
 /// overwriting any existing callbacks of the same type.
 /// </summary>
 protected virtual void ApplyCallback(bool p_wParms, CallbackType p_callbackType, TweenDelegate.TweenCallback p_callback, TweenDelegate.TweenCallbackWParms p_callbackWParms, params object[] p_callbackParms)
 {
     switch (p_callbackType) {
         case CallbackType.OnStart:
             onStart = p_callback;
             onStartWParms = p_callbackWParms;
             onStartParms = p_callbackParms;
             break;
         case CallbackType.OnUpdate:
             onUpdate = p_callback;
             onUpdateWParms = p_callbackWParms;
             onUpdateParms = p_callbackParms;
             break;
         case CallbackType.OnStepComplete:
             onStepComplete = p_callback;
             onStepCompleteWParms = p_callbackWParms;
             onStepCompleteParms = p_callbackParms;
             break;
         case CallbackType.OnComplete:
             onComplete = p_callback;
             onCompleteWParms = p_callbackWParms;
             onCompleteParms = p_callbackParms;
             break;
         case CallbackType.OnPlay:
             onPlay = p_callback;
             onPlayWParms = p_callbackWParms;
             onPlayParms = p_callbackParms;
             break;
         case CallbackType.OnPause:
             onPause = p_callback;
             onPauseWParms = p_callbackWParms;
             onPauseParms = p_callbackParms;
             break;
         case CallbackType.OnRewinded:
             onRewinded = p_callback;
             onRewindedWParms = p_callbackWParms;
             onRewindedParms = p_callbackParms;
             break;
         case CallbackType.OnPluginOverwritten:
             TweenWarning.Log("ApplyCallback > OnPluginOverwritten type is available only with Tweeners and not with Sequences");
             break;
     }
 }
Exemplo n.º 20
0
 /// <summary>
 /// sets the onTweenPong Delegate
 /// </summary>
 public OTTween OnPong(TweenDelegate onTweenPong)
 {
     this.onTweenPong = onTweenPong;
     return this;
 }
Exemplo n.º 21
0
 /// <summary>
 /// Assigns the given callback to this Tweener/Sequence,
 /// overwriting any existing callbacks of the same type.
 /// </summary>
 /// <param name="p_callbackType">The type of callback to apply</param>
 /// <param name="p_callback">The function to call, who must return <c>void</c> and accept no parameters</param>
 public void ApplyCallback(CallbackType p_callbackType, TweenDelegate.TweenCallback p_callback)
 {
     ApplyCallback(false, p_callbackType, p_callback, null, null);
 }
Exemplo n.º 22
0
 /// <summary>
 /// Function to call each time a single loop of the Sequence is completed.
 /// </summary>
 /// <param name="p_function">
 /// The function to call, who must return <c>void</c> and accept no parameters.
 /// </param>
 public SequenceParms OnStepComplete(TweenDelegate.TweenCallback p_function)
 {
     onStepComplete = p_function;
     return this;
 }
Exemplo n.º 23
0
 /// <summary>
 /// Function to call when the Sequence switches from a playing state to a paused state.
 /// </summary>
 /// <param name="p_function">
 /// The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/>.
 /// </param>
 /// <param name="p_funcParms">
 /// Additional comma separated parameters to pass to the function.
 /// </param>
 public SequenceParms OnPause(TweenDelegate.TweenCallbackWParms p_function, params object[] p_funcParms)
 {
     onPauseWParms = p_function;
     onPauseParms = p_funcParms;
     return this;
 }
Exemplo n.º 24
0
 /// <summary>
 /// Function to call when the Sequence switches from a playing state to a paused state.
 /// </summary>
 /// <param name="p_function">
 /// The function to call, who must return <c>void</c> and accept no parameters.
 /// </param>
 public SequenceParms OnPause(TweenDelegate.TweenCallback p_function)
 {
     onPause = p_function;
     return this;
 }
Exemplo n.º 25
0
        // ===================================================================================
        // SEQUENCE METHODS ------------------------------------------------------------------

        /// <summary>Appends the given callback to this Sequence.</summary>
        /// <param name="p_callback">The function to call, who must return <c>void</c> and accept no parameters</param>
        public void AppendCallback(TweenDelegate.TweenCallback p_callback)
        { InsertCallback(_duration, p_callback); }
Exemplo n.º 26
0
        // ***********************************************************************************
        // CONSTRUCTOR
        // ***********************************************************************************

        /// <summary>
        /// Creates a new instance.
        /// </summary>
        /// <param name="p_ease">
        /// The ease function.
        /// </param>
        /// <param name="p_inverseEase">
        /// Inverse ease function.
        /// </param>
        EaseInfo(TweenDelegate.EaseFunc p_ease, TweenDelegate.EaseFunc p_inverseEase)
        {
            ease = p_ease;
            inverseEase = p_inverseEase;
        }
Exemplo n.º 27
0
 /// <summary>
 /// sets the onTweenPlay Delegate
 /// </summary>
 public OTTween OnPlayed(TweenDelegate onTweenPlayed)
 {
     this.onTweenPlayed = onTweenPlayed;
     return this;
 }
Exemplo n.º 28
0
 /// <summary>
 /// Function to call when the Tweener switches from a paused state to a playing state.
 /// </summary>
 /// <param name="p_function">
 /// The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/>.
 /// </param>
 /// <param name="p_funcParms">
 /// Additional comma separated parameters to pass to the function.
 /// </param>
 public TweenParms OnPlay(TweenDelegate.TweenCallbackWParms p_function, params object[] p_funcParms)
 {
     onPlayWParms = p_function;
     onPlayParms = p_funcParms;
     return this;
 }
Exemplo n.º 29
0
 public static void PlayOpenWindowAnim(Transform trans, TweenDelegate.TweenCallback cb = null, bool timeScale = true)
 {
     StringBuilder stringBuilder = new StringBuilder();
     string value = (!(trans.parent != null)) ? trans.name : trans.parent.name;
     string text = stringBuilder.Append(value).Append("Open").ToString();
     stringBuilder.Remove(0, stringBuilder.Length);
     string p_id = stringBuilder.Append(value).Append("Close").ToString();
     if (HOTween.IsTweening(p_id))
     {
         HOTween.Kill(p_id);
     }
     if (!HOTween.IsTweening(text))
     {
         TweenAlpha.Begin(trans.gameObject, 0f, 0f);
         TweenAlpha.Begin(trans.gameObject, 0.3f, 1f);
         if (timeScale)
         {
             HOTween.To(trans, 0f, new TweenParms().Prop("localScale", Vector3.zero));
             HOTween.To(trans, 0.25f, new TweenParms().Prop("localScale", Vector3.one).Ease(EaseType.EaseOutBack).OnComplete(cb)).id = text;
         }
         else
         {
             HOTween.To(trans, 0f, new TweenParms().UpdateType(UpdateType.TimeScaleIndependentUpdate).Prop("localScale", Vector3.zero));
             HOTween.To(trans, 0.25f, new TweenParms().UpdateType(UpdateType.TimeScaleIndependentUpdate).Prop("localScale", Vector3.one).Ease(EaseType.EaseOutBack).OnComplete(cb)).id = text;
         }
     }
 }
Exemplo n.º 30
0
 /// <summary>
 /// Function to call each time the Tweener is rewinded from a non-rewinded state
 /// (either because of a direct call to Rewind,
 /// or because the tween's virtual playehead reached the start due to a playing backwards behaviour).
 /// </summary>
 /// <param name="p_function">
 /// The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/>.
 /// </param>
 /// <param name="p_funcParms">
 /// Additional comma separated parameters to pass to the function.
 /// </param>
 public TweenParms OnRewinded(TweenDelegate.TweenCallbackWParms p_function, params object[] p_funcParms)
 {
     onRewindedWParms = p_function;
     onRewindedParms = p_funcParms;
     return this;
 }
Exemplo n.º 31
0
 /// <summary>
 /// sets the onTweenFinish Delegate
 /// </summary>
 public OTTween OnFinish(TweenDelegate onTweenFinish)
 {
     this.onTweenFinish = onTweenFinish;
     return(this);
 }
Exemplo n.º 32
0
 /// <summary>
 /// Function to call when the full Tweener, loops included, is completed.
 /// </summary>
 /// <param name="p_function">
 /// The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/>.
 /// </param>
 /// <param name="p_funcParms">
 /// Additional comma separated parameters to pass to the function.
 /// </param>
 public TweenParms OnComplete(TweenDelegate.TweenCallbackWParms p_function, params object[] p_funcParms)
 {
     onCompleteWParms = p_function;
     onCompleteParms = p_funcParms;
     return this;
 }
Exemplo n.º 33
0
 /// <summary>
 /// sets the onTweenPong Delegate
 /// </summary>
 public OTTween OnPong(TweenDelegate onTweenPong)
 {
     this.onTweenPong = onTweenPong;
     return(this);
 }
Exemplo n.º 34
0
 /// <summary>
 /// Function to call when one of the plugins used in the tween gets overwritten
 /// (available only if OverwriteManager is active).
 /// </summary>
 /// <param name="p_function">
 /// The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/>.
 /// </param>
 /// <param name="p_funcParms">
 /// Additional comma separated parameters to pass to the function.
 /// </param>
 public TweenParms OnPluginOverwritten(TweenDelegate.TweenCallbackWParms p_function, params object[] p_funcParms)
 {
     onPluginOverwrittenWParms = p_function;
     onPluginOverwrittenParms = p_funcParms;
     return this;
 }
Exemplo n.º 35
0
		public static Tween toWithSpeed (object startValue, object endValue, float speed, Tween.EaseType easeType, TweenDelegate onUpdate = null, TweenDelegate onComplete = null, float delay = 0.0f, bool yoyo = false, int loops = 0)
		{
			TweenDescriptor descriptor = new TweenDescriptor ();
			descriptor.baseOnSpeed = true; 
			descriptor.fromValue = startValue; 
			descriptor.toValue = endValue;
			descriptor.easeType = easeType; 
			descriptor.delay = delay;
			descriptor.speed = speed;
			descriptor.yoyo = yoyo;
			descriptor.loops = loops;
			descriptor.updateMethod = onUpdate;
			descriptor.completeMethod = onComplete;
			return to (descriptor);
		}
Exemplo n.º 36
0
 public HOTSeqItem(float p_startTime, TweenDelegate.TweenCallback p_callback, TweenDelegate.TweenCallbackWParms p_callbackWParms, params object[] p_callbackParms)
 {
     seqItemType = SeqItemType.Callback;
     startTime = p_startTime;
     callback = p_callback;
     callbackWParms = p_callbackWParms;
     callbackParms = p_callbackParms;
 }
Exemplo n.º 37
0
 /// <summary>
 /// Assigns the given callback to this Tweener/Sequence,
 /// overwriting any existing callbacks of the same type.
 /// </summary>
 protected override void ApplyCallback(bool p_wParms, CallbackType p_callbackType, TweenDelegate.TweenCallback p_callback, TweenDelegate.TweenCallbackWParms p_callbackWParms, params object[] p_callbackParms)
 {
     switch (p_callbackType) {
         case CallbackType.OnPluginOverwritten:
             onPluginOverwritten = p_callback;
             onPluginOverwrittenWParms = p_callbackWParms;
             onPluginOverwrittenParms = p_callbackParms;
             break;
         default:
             base.ApplyCallback(p_wParms, p_callbackType, p_callback, p_callbackWParms, p_callbackParms);
             break;
     }
 }
Exemplo n.º 38
0
 /// <summary>Inserts the given callback at the given time position.</summary>
 /// <param name="p_time">Time position where this callback will be placed
 /// (if longer than the whole sequence duration, the callback will never be called)</param>
 /// <param name="p_callback">The function to call, who must return <c>void</c> and accept no parameters</param>
 public void InsertCallback(float p_time, TweenDelegate.TweenCallback p_callback)
 { InsertCallback(p_time, p_callback, null, null); }
Exemplo n.º 39
0
 /// <summary>
 /// Function to call when the Tweener is started for the very first time.
 /// </summary>
 /// <param name="p_function">
 /// The function to call, who must return <c>void</c> and accept no parameters.
 /// </param>
 public TweenParms OnStart(TweenDelegate.TweenCallback p_function)
 {
     onStart = p_function;
     return this;
 }
Exemplo n.º 40
0
 void InsertCallback(float p_time, TweenDelegate.TweenCallback p_callback, TweenDelegate.TweenCallbackWParms p_callbackWParms, params object[] p_callbackParms)
 {
     hasCallbacks = true;
     HOTSeqItem newItem = new HOTSeqItem(p_time, p_callback, p_callbackWParms, p_callbackParms);
     if (items == null) {
         items = new List<HOTSeqItem> { newItem };
     } else {
         bool placed = false;
         int itemsCount = items.Count;
         for (int i = 0; i < itemsCount; ++i) {
             if (items[i].startTime >= p_time) {
                 items.Insert(i, newItem);
                 placed = true;
                 break;
             }
         }
         if (!placed) items.Add(newItem);
     }
     _isEmpty = false;
 }
Exemplo n.º 41
0
 /// <summary>
 /// Function to call when the Tweener is started for the very first time.
 /// </summary>
 /// <param name="p_function">
 /// The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/>.
 /// </param>
 /// <param name="p_funcParms">
 /// Additional comma separated parameters to pass to the function.
 /// </param>
 public TweenParms OnStart(TweenDelegate.TweenCallbackWParms p_function, params object[] p_funcParms)
 {
     onStartWParms = p_function;
     onStartParms = p_funcParms;
     return this;
 }
Exemplo n.º 42
0
        /// <summary>
        /// Return the easing function pointer base on tweener type.
        /// </summary>
        /// <param name="type"> type of the tween formula </param>
        /// <returns> function pointer </returns>
        public static TweenDelegate GetEasing(JCS_TweenType type)
        {
            TweenDelegate easing = null;

            switch (type)
            {
            // default to linear
            case JCS_TweenType.LINEAR:
                easing = Easing.Linear;
                break;

            case JCS_TweenType.EASE_IN_SINE:
                easing = Easing.SineEaseIn;
                break;

            case JCS_TweenType.EASE_IN_CUBIC:
                easing = Easing.CubicEaseIn;
                break;

            case JCS_TweenType.EASE_IN_QUINT:
                easing = Easing.QuintEaseIn;
                break;

            case JCS_TweenType.EASE_IN_CIRC:
                easing = Easing.CircEaseIn;
                break;

            case JCS_TweenType.EASE_IN_BACK:
                easing = Easing.BackEaseIn;
                break;

            case JCS_TweenType.EASE_OUT_SINE:
                easing = Easing.SineEaseInOut;
                break;

            case JCS_TweenType.EASE_OUT_CUBIC:
                easing = Easing.CubicEaseInOut;
                break;

            case JCS_TweenType.EASE_OUT_QUINT:
                easing = Easing.QuintEaseInOut;
                break;

            case JCS_TweenType.EASE_OUT_CIRC:
                easing = Easing.CircEaseOut;
                break;

            case JCS_TweenType.EASE_OUT_BACK:
                easing = Easing.BackEaseOut;
                break;

            case JCS_TweenType.EASE_IN_OUT_SINE:
                easing = Easing.SineEaseInOut;
                break;

            case JCS_TweenType.EASE_IN_OUT_CUBIC:
                easing = Easing.CubicEaseInOut;
                break;

            case JCS_TweenType.EASE_IN_OUT_QUINT:
                easing = Easing.QuintEaseInOut;
                break;

            case JCS_TweenType.EASE_IN_OUT_CIRC:
                easing = Easing.CircEaseInOut;
                break;

            case JCS_TweenType.EASE_IN_OUT_BACK:
                easing = Easing.BackEaseInOut;
                break;

            case JCS_TweenType.EASE_IN_QUAD:
                easing = Easing.QuadEaseIn;
                break;

            case JCS_TweenType.EASE_IN_QUART:
                easing = Easing.QuartEaseIn;
                break;

            case JCS_TweenType.EASE_IN_EXPO:
                easing = Easing.ExpoEaseIn;
                break;

            case JCS_TweenType.EASE_IN_ELASTIC:
                easing = Easing.ElasticEaseIn;
                break;

            case JCS_TweenType.EASE_IN_BOUNCE:
                easing = Easing.BounceEaseIn;
                break;

            case JCS_TweenType.EASE_OUT_QUAD:
                easing = Easing.QuadEaseInOut;
                break;

            case JCS_TweenType.EASE_OUT_QUART:
                easing = Easing.QuartEaseOut;
                break;

            case JCS_TweenType.EASE_OUT_EXPO:
                easing = Easing.ExpoEaseInOut;
                break;

            case JCS_TweenType.EASE_OUT_ELASTIC:
                easing = Easing.ElasticEaseOut;
                break;

            case JCS_TweenType.EASE_OUT_BOUNCE:
                easing = Easing.BounceEaseOut;
                break;

            case JCS_TweenType.EASE_IN_OUT_QUAD:
                easing = Easing.QuadEaseInOut;
                break;

            case JCS_TweenType.EASE_IN_OUT_QUART:
                easing = Easing.QuartEaseInOut;
                break;

            case JCS_TweenType.EASE_IN_OUT_EXPO:
                easing = Easing.ExpoEaseInOut;
                break;

            case JCS_TweenType.EASE_IN_OUT_ELASTIC:
                easing = Easing.ElasticEaseInOut;
                break;

            case JCS_TweenType.EASE_IN_OUT_BOUNCE:
                easing = Easing.BounceEaseInOut;
                break;
            }

            return(easing);
        }
Exemplo n.º 43
0
 /// <summary>
 /// Function to call when the Tweener switches from a paused state to a playing state.
 /// </summary>
 /// <param name="p_function">
 /// The function to call, who must return <c>void</c> and accept no parameters.
 /// </param>
 public TweenParms OnPlay(TweenDelegate.TweenCallback p_function)
 {
     onPlay = p_function;
     return this;
 }
Exemplo n.º 44
0
 /// <summary>
 /// sets the onTweenPlay Delegate
 /// </summary>
 public OTTween OnPlayed(TweenDelegate onTweenPlayed)
 {
     this.onTweenPlayed = onTweenPlayed;
     return(this);
 }
Exemplo n.º 45
0
 /// <summary>
 /// Assigns the given callback to this Tweener/Sequence,
 /// overwriting any existing callbacks of the same type.
 /// </summary>
 /// <param name="p_callbackType">The type of callback to apply</param>
 /// <param name="p_callback">The function to call.
 /// It must return <c>void</c> and has to accept a single parameter of type <see cref="TweenEvent"/></param>
 /// <param name="p_callbackParms">Additional comma separated parameters to pass to the function</param>
 public void ApplyCallback(CallbackType p_callbackType, TweenDelegate.TweenCallbackWParms p_callback, params object[] p_callbackParms)
 {
     ApplyCallback(true, p_callbackType, null, p_callback, p_callbackParms);
 }