private void StartShowHideAnimation(bool show, TweenDelegate.TweenCallback OnCompliteAction = null) { var finishPos = show ? 0f : _hidePos; var time = Mathf.Abs(animDuratation * (window.anchoredPosition.x - finishPos)); HOTween.To(window, time, new TweenParms().Prop("anchoredPosition", new Vector2(finishPos, 0)).OnComplete(OnCompliteAction)); }
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; }
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; }
/// <summary> /// Completely resets this tween, except its target (in case of Tweeners). /// </summary> protected virtual void Reset() { _id = ""; _intId = -1; _autoKillOnComplete = true; _enabled = true; _timeScale = HOTween.defTimeScale; _loops = 1; _loopType = HOTween.defLoopType; _updateType = HOTween.defUpdateType; _isPaused = false; _completedLoops = 0; _duration = _originalDuration = _originalNonSpeedBasedDuration = _fullDuration = 0; _elapsed = _fullElapsed = 0; _isEmpty = true; _isReversed = _isLoopingBack = _hasStarted = _isComplete = false; startupDone = false; onStart = null; onStartWParms = null; onStartParms = null; onUpdate = null; onUpdateWParms = null; onUpdateParms = null; onPluginUpdated = null; onPluginUpdatedWParms = null; onPluginUpdatedParms = null; onStepComplete = null; onStepCompleteWParms = null; onStepCompleteParms = null; onComplete = null; onCompleteWParms = null; onCompleteParms = null; onPause = null; onPauseWParms = null; onPauseParms = null; onPlay = null; onPlayWParms = null; onPlayParms = null; onRewinded = null; onRewindedWParms = null; onRewindedParms = null; manageBehaviours = false; managedBehavioursOff = null; managedBehavioursOn = null; managedBehavioursOriginalState = null; manageGameObjects = false; managedGameObjectsOff = null; managedGameObjectsOn = null; managedGameObjectsOriginalState = null; }
/// <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; } }
/// <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; } }
/// <summary> /// Completely resets this Tweener, except its target /// </summary> override protected void Reset() { base.Reset(); isFrom = false; plugins = null; isPartialled = false; pv3Path = null; _delay = _elapsedDelay = delayCount = 0; _pixelPerfect = false; _speedBased = false; _easeType = HOTween.defEaseType; _easeOvershootOrAmplitude = HOTween.defEaseOvershootOrAmplitude; _easePeriod = HOTween.defEasePeriod; _originalEaseType = HOTween.defEaseType; onPluginOverwritten = null; onStepCompleteWParms = null; onPluginOverwrittenParms = null; }
/// <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); }
/// <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); }
/// <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); }
/// <summary> /// Function to call when the full Sequence, 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 SequenceParms OnComplete(TweenDelegate.TweenCallback p_function) { onComplete = p_function; return this; }
/// <summary> /// Function to call each time the sequence 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 SequenceParms OnRewinded(TweenDelegate.TweenCallback p_function) { onRewinded = p_function; return this; }
public HOTSequence InsertCallback(float time, TweenDelegate.TweenCallback callback) { sequenceOps.Add(new SequenceOp(callback, time)); return(this); }
/// <summary> /// Set a start callback for this tween /// </summary> /// <param name="callback"></param> /// <returns></returns> public HOTweenHelper OnStart(TweenDelegate.TweenCallback callback) { ParamUtil.OnStart(callback); return(this); }
public HOTSequence AppendCallback(TweenDelegate.TweenCallback callback) { sequenceOps.Add(new SequenceOp(callback)); return(this); }
public SequenceOp(TweenDelegate.TweenCallback callback, float time) { this.type = OpType.InsertCallback; this.time = time; this.opObject = callback; }
/// <summary> /// Completely resets this Tweener, except its target /// </summary> override protected void Reset() { base.Reset(); if (HOTween.overwriteManager != null) HOTween.overwriteManager.RemoveTween(this); isFrom = false; plugins = null; isPartialled = false; pv3Path = null; _delay = _elapsedDelay = delayCount = 0; _pixelPerfect = false; _speedBased = false; _easeType = HOTween.defEaseType; _easeOvershootOrAmplitude = HOTween.defEaseOvershootOrAmplitude; _easePeriod = HOTween.defEasePeriod; _originalEaseType = HOTween.defEaseType; onPluginOverwritten = null; onStepCompleteWParms = null; onPluginOverwrittenParms = null; }
/// <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); }
public SequenceOp(TweenDelegate.TweenCallback callback) { this.time = -1f; this.type = OpType.AppendCallback; this.opObject = callback; }
// =================================================================================== // 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); }
/// <summary> /// Set a callback for this tween /// </summary> /// <param name="callback"></param> /// <returns></returns> public HOTweenHelper OnComplete(TweenDelegate.TweenCallback callback) { ParamUtil.OnComplete(callback); return(this); }
/// <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); }
/// <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); }
/// <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); }
/// <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; }
/// <summary> /// Function to call when the Sequence 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 SequenceParms OnStart(TweenDelegate.TweenCallback p_function) { onStart = p_function; return this; }
/// <summary> /// Function to call when the Sequence 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 SequenceParms OnPlay(TweenDelegate.TweenCallback p_function) { onPlay = p_function; return this; }
public HOTSequence OnComplete(TweenDelegate.TweenCallback callback) { ParamUtil.OnComplete(callback); return(this); }