1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2025-12-21 01:36:05 +08:00

Added advanced public ChangeStart/End/Values generic method directly to TweenerCore, that generates no allocs

This commit is contained in:
Demigiant 2019-03-07 21:24:54 +01:00
parent 444fff8aba
commit 98f2201364
17 changed files with 107 additions and 4 deletions

View File

@ -231,6 +231,32 @@
Looks for the type within all possible project assembly names
</summary>
</member>
<member name="M:DG.Tweening.Core.TweenerCore`3.ChangeStartValue(`1,System.Single)">
<summary>NO-GC METHOD: changes the start value of a tween and rewinds it (without pausing it).
Has no effect with tweens that are inside Sequences</summary>
<param name="newStartValue">The new start value</param>
<param name="newDuration">If bigger than 0 applies it as the new tween duration</param>
</member>
<member name="M:DG.Tweening.Core.TweenerCore`3.ChangeEndValue(`1,System.Boolean)">
<summary>NO-GC METHOD: changes the end value of a tween and rewinds it (without pausing it).
Has no effect with tweens that are inside Sequences</summary>
<param name="newEndValue">The new end value</param>
<param name="snapStartValue">If TRUE the start value will become the current target's value, otherwise it will stay the same</param>
</member>
<member name="M:DG.Tweening.Core.TweenerCore`3.ChangeEndValue(`1,System.Single,System.Boolean)">
<summary>NO-GC METHOD: changes the end value of a tween and rewinds it (without pausing it).
Has no effect with tweens that are inside Sequences</summary>
<param name="newEndValue">The new end value</param>
<param name="newDuration">If bigger than 0 applies it as the new tween duration</param>
<param name="snapStartValue">If TRUE the start value will become the current target's value, otherwise it will stay the same</param>
</member>
<member name="M:DG.Tweening.Core.TweenerCore`3.ChangeValues(`1,`1,System.Single)">
<summary>NO-GC METHOD: changes the start and end value of a tween and rewinds it (without pausing it).
Has no effect with tweens that are inside Sequences</summary>
<param name="newStartValue">The new start value</param>
<param name="newEndValue">The new end value</param>
<param name="newDuration">If bigger than 0 applies it as the new tween duration</param>
</member>
<member name="T:DG.Tweening.Color2">
<summary>
Struct that stores two colors (used for LineRenderer tweens)

View File

@ -111,6 +111,57 @@ namespace DG.Tweening.Core
return DoChangeValues(this, (T2)newStartValue, (T2)newEndValue, newDuration);
}
#region Advanced Usage (direct from TweenerCore reference)
/// <summary>NO-GC METHOD: changes the start value of a tween and rewinds it (without pausing it).
/// Has no effect with tweens that are inside Sequences</summary>
/// <param name="newStartValue">The new start value</param>
/// <param name="newDuration">If bigger than 0 applies it as the new tween duration</param>
public TweenerCore<T1,T2,TPlugOptions> ChangeStartValue(T2 newStartValue, float newDuration = -1)
{
if (isSequenced) {
if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues);
return this;
}
return DoChangeStartValue(this, newStartValue, newDuration);
}
/// <summary>NO-GC METHOD: changes the end value of a tween and rewinds it (without pausing it).
/// Has no effect with tweens that are inside Sequences</summary>
/// <param name="newEndValue">The new end value</param>
/// <param name="snapStartValue">If TRUE the start value will become the current target's value, otherwise it will stay the same</param>
public TweenerCore<T1,T2,TPlugOptions> ChangeEndValue(T2 newEndValue, bool snapStartValue)
{ return ChangeEndValue(newEndValue, -1, snapStartValue); }
/// <summary>NO-GC METHOD: changes the end value of a tween and rewinds it (without pausing it).
/// Has no effect with tweens that are inside Sequences</summary>
/// <param name="newEndValue">The new end value</param>
/// <param name="newDuration">If bigger than 0 applies it as the new tween duration</param>
/// <param name="snapStartValue">If TRUE the start value will become the current target's value, otherwise it will stay the same</param>
public TweenerCore<T1,T2,TPlugOptions> ChangeEndValue(T2 newEndValue, float newDuration = -1, bool snapStartValue = false)
{
if (isSequenced) {
if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues);
return this;
}
return DoChangeEndValue(this, newEndValue, newDuration, snapStartValue);
}
/// <summary>NO-GC METHOD: changes the start and end value of a tween and rewinds it (without pausing it).
/// Has no effect with tweens that are inside Sequences</summary>
/// <param name="newStartValue">The new start value</param>
/// <param name="newEndValue">The new end value</param>
/// <param name="newDuration">If bigger than 0 applies it as the new tween duration</param>
public TweenerCore<T1,T2,TPlugOptions> ChangeValues(T2 newStartValue, T2 newEndValue, float newDuration = -1)
{
if (isSequenced) {
if (Debugger.logPriority >= 1) Debugger.LogWarning(_TxtCantChangeSequencedValues);
return this;
}
return DoChangeValues(this, newStartValue, newEndValue, newDuration);
}
#endregion
#endregion
// Sets From tweens, immediately sending the target to its endValue and assigning new start/endValues.

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.2.230"; // Last version before modules: 1.1.755
public static readonly string Version = "1.2.235"; // Last version before modules: 1.1.755
///////////////////////////////////////////////
// Options ////////////////////////////////////

View File

@ -158,7 +158,7 @@ namespace DG.Tweening
}
// CALLED BY TweenerCore
internal static Tweener DoChangeStartValue<T1, T2, TPlugOptions>(
internal static TweenerCore<T1, T2, TPlugOptions> DoChangeStartValue<T1, T2, TPlugOptions>(
TweenerCore<T1, T2, TPlugOptions> t, T2 newStartValue, float newDuration
) where TPlugOptions : struct, IPlugOptions
{
@ -184,7 +184,7 @@ namespace DG.Tweening
}
// CALLED BY TweenerCore
internal static Tweener DoChangeEndValue<T1, T2, TPlugOptions>(
internal static TweenerCore<T1, T2, TPlugOptions> DoChangeEndValue<T1, T2, TPlugOptions>(
TweenerCore<T1, T2, TPlugOptions> t, T2 newEndValue, float newDuration, bool snapStartValue
) where TPlugOptions : struct, IPlugOptions
{
@ -221,7 +221,7 @@ namespace DG.Tweening
return t;
}
internal static Tweener DoChangeValues<T1, T2, TPlugOptions>(
internal static TweenerCore<T1, T2, TPlugOptions> DoChangeValues<T1, T2, TPlugOptions>(
TweenerCore<T1, T2, TPlugOptions> t, T2 newStartValue, T2 newEndValue, float newDuration
) where TPlugOptions : struct, IPlugOptions
{

View File

@ -231,6 +231,32 @@
Looks for the type within all possible project assembly names
</summary>
</member>
<member name="M:DG.Tweening.Core.TweenerCore`3.ChangeStartValue(`1,System.Single)">
<summary>NO-GC METHOD: changes the start value of a tween and rewinds it (without pausing it).
Has no effect with tweens that are inside Sequences</summary>
<param name="newStartValue">The new start value</param>
<param name="newDuration">If bigger than 0 applies it as the new tween duration</param>
</member>
<member name="M:DG.Tweening.Core.TweenerCore`3.ChangeEndValue(`1,System.Boolean)">
<summary>NO-GC METHOD: changes the end value of a tween and rewinds it (without pausing it).
Has no effect with tweens that are inside Sequences</summary>
<param name="newEndValue">The new end value</param>
<param name="snapStartValue">If TRUE the start value will become the current target's value, otherwise it will stay the same</param>
</member>
<member name="M:DG.Tweening.Core.TweenerCore`3.ChangeEndValue(`1,System.Single,System.Boolean)">
<summary>NO-GC METHOD: changes the end value of a tween and rewinds it (without pausing it).
Has no effect with tweens that are inside Sequences</summary>
<param name="newEndValue">The new end value</param>
<param name="newDuration">If bigger than 0 applies it as the new tween duration</param>
<param name="snapStartValue">If TRUE the start value will become the current target's value, otherwise it will stay the same</param>
</member>
<member name="M:DG.Tweening.Core.TweenerCore`3.ChangeValues(`1,`1,System.Single)">
<summary>NO-GC METHOD: changes the start and end value of a tween and rewinds it (without pausing it).
Has no effect with tweens that are inside Sequences</summary>
<param name="newStartValue">The new start value</param>
<param name="newEndValue">The new end value</param>
<param name="newDuration">If bigger than 0 applies it as the new tween duration</param>
</member>
<member name="T:DG.Tweening.Color2">
<summary>
Struct that stores two colors (used for LineRenderer tweens)

Binary file not shown.