1
0
mirror of https://github.com/Cardidi/dotween-upm-fork.git synced 2026-02-09 08:38:45 +08:00

Sequence.Join now considers also callbacks insertion time

This commit is contained in:
Demigiant 2015-10-09 12:58:09 +02:00
parent 64294852f5
commit aea9d19754
75 changed files with 222 additions and 9 deletions

View File

@ -2083,7 +2083,7 @@
<param name="t">The tween to prepend</param>
</member>
<member name="M:DG.Tweening.TweenSettingsExtensions.Join(DG.Tweening.Sequence,DG.Tweening.Tween)">
<summary>Inserts the given tween at the same time position of the last tween added to the Sequence.
<summary>Inserts the given tween at the same time position of the last tween or callback added to the Sequence.
Has no effect if the Sequence has already started</summary>
</member>
<member name="M:DG.Tweening.TweenSettingsExtensions.Insert(DG.Tweening.Sequence,System.Single,DG.Tweening.Tween)">

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e6381fa2e1011ab40925fba50a01926e
folderAsset: yes
timeCreated: 1444386041
licenseType: Free
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: fe402d14dcffa8347be8e541d667ef7b
DefaultImporter:
userData:

View File

@ -0,0 +1,27 @@
using DG.Tweening;
using DG.Tweening.Plugins;
using UnityEngine;
using UnityEngine.UI;
public class CustomPluginExampleBrain : MonoBehaviour
{
public Text txtCustomRange ; // Used to show the custom range tween results
CustomRange customRange = new CustomRange(0, 10);
// Store the plugin so you won't have to instantiate it every time you use it
// (you can pass the same plugin instance to each tween, since they just do calculations and don't store data)
static CustomRangePlugin customRangePlugin = new CustomRangePlugin();
void Start()
{
// The difference with the regular generic way is simply
// that you have to pass the plugin to use as an additional first parameter
DOTween.To(customRangePlugin, () => customRange, x => customRange = x, new CustomRange(20, 100), 4);
}
void Update()
{
txtCustomRange.text = customRange.min + "\n" + customRange.max;
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 550efdefde1a031469b9f78b16066882
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,20 @@
public struct CustomRange
{
public float min, max;
public CustomRange(float min, float max)
{
this.min = min;
this.max = max;
}
public static CustomRange operator +(CustomRange c1, CustomRange c2)
{
return new CustomRange(c1.min + c2.min, c1.max + c2.max);
}
public static CustomRange operator -(CustomRange c1, CustomRange c2)
{
return new CustomRange(c1.min - c2.min, c1.max - c2.max);
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8c33f7a63008fad4eac4198a5417ad8c
timeCreated: 1444381777
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,65 @@
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Core.Easing;
using DG.Tweening.Core.Enums;
using DG.Tweening.Plugins.Core;
using DG.Tweening.Plugins.Options;
using System;
using UnityEngine;
/// <summary>
/// Custom DOTween plugin example.
/// This one tweens a CustomRange value, but you can also create plugins just to do weird stuff, other than to tween custom objects
/// </summary>
public class CustomRangePlugin : ABSTweenPlugin<CustomRange, CustomRange, NoOptions>
{
// Leave this empty
public override void Reset(TweenerCore<CustomRange, CustomRange, NoOptions> t) {}
// Sets the values in case of a From tween
public override void SetFrom(TweenerCore<CustomRange, CustomRange, NoOptions> t, bool isRelative)
{
CustomRange prevEndVal = t.endValue;
t.endValue = t.getter();
t.startValue = isRelative ? t.endValue + prevEndVal : prevEndVal;
t.setter(t.startValue);
}
// Used by special plugins, just let it return the given value
public override CustomRange ConvertToStartValue(TweenerCore<CustomRange, CustomRange, NoOptions> t, CustomRange value)
{
return value;
}
// Determines the correct endValue in case this is a relative tween
public override void SetRelativeEndValue(TweenerCore<CustomRange, CustomRange, NoOptions> t)
{
t.endValue = t.startValue + t.changeValue;
}
// Sets the overall change value of the tween
public override void SetChangeValue(TweenerCore<CustomRange, CustomRange, NoOptions> t)
{
t.changeValue = t.endValue - t.startValue;
}
// Converts a regular duration to a speed-based duration
public override float GetSpeedBasedDuration(NoOptions options, float unitsXSecond, CustomRange changeValue)
{
// Not implemented in this case (but you could implement your own logic to convert duration to units x second)
return unitsXSecond;
}
// Calculates the value based on the given time and ease
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<CustomRange> getter, DOSetter<CustomRange> setter, float elapsed, CustomRange startValue, CustomRange changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
{
CustomRange res = getter();
float easeVal = EaseManager.Evaluate(t, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod);
// Here I use startValue directly because CustomRange a struct, so it won't reference the original.
// If CustomRange was a class, I should create a new one to pass to the setter
startValue.min += changeValue.min * easeVal;
startValue.max += changeValue.max * easeVal;
setter(startValue);
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b3ffdccaa6b21544baad840b4b779d25
timeCreated: 1444382093
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -331,6 +331,14 @@
<para>Example usage with lambda:</para><code>x=> myProperty = x</code></param>
<param name="endValue">The end value to reach</param><param name="duration">The tween's duration</param>
</member>
<member name="M:DG.Tweening.DOTween.To(DG.Tweening.Core.DOGetter{System.Double},DG.Tweening.Core.DOSetter{System.Double},System.Single,System.Single)">
<summary>Tweens a property or field to the given value using default plugins</summary>
<param name="getter">A getter for the field or property to tween.
<para>Example usage with lambda:</para><code>()=> myProperty</code></param>
<param name="setter">A setter for the field or property to tween
<para>Example usage with lambda:</para><code>x=> myProperty = x</code></param>
<param name="endValue">The end value to reach</param><param name="duration">The tween's duration</param>
</member>
<member name="M:DG.Tweening.DOTween.To(DG.Tweening.Core.DOGetter{System.Int32},DG.Tweening.Core.DOSetter{System.Int32},System.Int32,System.Single)">
<summary>Tweens a property or field to the given value using default plugins</summary>
<param name="getter">A getter for the field or property to tween.
@ -554,6 +562,11 @@
<summary>Kills all tweens and returns the number of actual tweens killed</summary>
<param name="complete">If TRUE completes the tweens before killing them</param>
</member>
<member name="M:DG.Tweening.DOTween.KillAll(System.Boolean,System.Object[])">
<summary>Kills all tweens and returns the number of actual tweens killed</summary>
<param name="complete">If TRUE completes the tweens before killing them</param>
<param name="idsOrTargetsToExclude">Eventual IDs or targets to exclude from the killing</param>
</member>
<member name="M:DG.Tweening.DOTween.Kill(System.Object,System.Boolean)">
<summary>Kills all tweens with the given ID or target and returns the number of actual tweens killed</summary>
<param name="complete">If TRUE completes the tweens before killing them</param>
@ -907,6 +920,9 @@
Methods that extend Tween objects and allow to control or get data from them
</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions.Complete(DG.Tweening.Tween)">
<summary>Completes the tween</summary>
</member>
<member name="M:DG.Tweening.TweenExtensions.Complete(DG.Tweening.Tween,System.Boolean)">
<summary>Completes the tween</summary>
<param name="withCallbacks">For Sequences only: if TRUE also internal Sequence callbacks will be fired,

View File

@ -10,6 +10,20 @@
These, as all DOTween43 methods, require Unity 4.3 or later.
</summary>
</member>
<member name="M:DG.Tweening.ShortcutExtensions43.DOGradientColor(UnityEngine.Material,UnityEngine.Gradient,System.Single)">
<summary>Tweens a Material's color using the given gradient
(NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
Also stores the image as the tween's target so it can be used for filtered operations</summary>
<param name="gradient">The gradient to use</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions43.DOGradientColor(UnityEngine.Material,UnityEngine.Gradient,System.String,System.Single)">
<summary>Tweens a Material's named color property using the given gradient
(NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
Also stores the image as the tween's target so it can be used for filtered operations</summary>
<param name="gradient">The gradient to use</param>
<param name="property">The name of the material property to tween (like _Tint or _SpecColor)</param>
<param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions43.DOColor(UnityEngine.SpriteRenderer,UnityEngine.Color,System.Single)">
<summary>Tweens a SpriteRenderer's color to the given value.
Also stores the spriteRenderer as the tween's target so it can be used for filtered operations</summary>
@ -20,6 +34,12 @@
Also stores the spriteRenderer as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions43.DOGradientColor(UnityEngine.SpriteRenderer,UnityEngine.Gradient,System.Single)">
<summary>Tweens a SpriteRenderer's color using the given gradient
(NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
Also stores the image as the tween's target so it can be used for filtered operations</summary>
<param name="gradient">The gradient to use</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions43.DOMove(UnityEngine.Rigidbody2D,UnityEngine.Vector2,System.Single,System.Boolean)">
<summary>Tweens a Rigidbody2D's position to the given value.
Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
@ -46,7 +66,8 @@
<member name="M:DG.Tweening.ShortcutExtensions43.DOJump(UnityEngine.Rigidbody2D,UnityEngine.Vector2,System.Single,System.Int32,System.Single,System.Boolean)">
<summary>Tweens a Rigidbody2D's position to the given value, while also applying a jump effect along the Y axis.
Returns a Sequence instead of a Tweener.
Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations</summary>
Also stores the Rigidbody2D as the tween's target so it can be used for filtered operations.
<para>IMPORTANT: a rigidbody2D can't be animated in a jump arc using MovePosition, so the tween will directly set the position</para></summary>
<param name="endValue">The end value to reach</param>
<param name="jumpPower">Power of the jump (the max height of the jump is represented by this plus the final Y offset)</param>
<param name="numJumps">Total number of jumps</param>

View File

@ -51,6 +51,12 @@
Also stores the image as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The end value to reach (0 to 1)</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions46.DOGradientColor(UnityEngine.UI.Image,UnityEngine.Gradient,System.Single)">
<summary>Tweens an Image's colors using the given gradient
(NOTE 1: only uses the colors of the gradient, not the alphas - NOTE 2: creates a Sequence, not a Tweener).
Also stores the image as the tween's target so it can be used for filtered operations</summary>
<param name="gradient">The gradient to use</param><param name="duration">The duration of the tween</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions46.DOFlexibleSize(UnityEngine.UI.LayoutElement,UnityEngine.Vector2,System.Single,System.Boolean)">
<summary>Tweens an LayoutElement's flexibleWidth/Height to the given value.
Also stores the LayoutElement as the tween's target so it can be used for filtered operations</summary>
@ -90,6 +96,18 @@
<param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions46.DOAnchorPosX(UnityEngine.RectTransform,System.Single,System.Single,System.Boolean)">
<summary>Tweens a RectTransform's anchoredPosition X to the given value.
Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions46.DOAnchorPosY(UnityEngine.RectTransform,System.Single,System.Single,System.Boolean)">
<summary>Tweens a RectTransform's anchoredPosition Y to the given value.
Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>
<param name="endValue">The end value to reach</param><param name="duration">The duration of the tween</param>
<param name="snapping">If TRUE the tween will smoothly snap all values to integers</param>
</member>
<member name="M:DG.Tweening.ShortcutExtensions46.DOAnchorPos3D(UnityEngine.RectTransform,UnityEngine.Vector3,System.Single,System.Boolean)">
<summary>Tweens a RectTransform's anchoredPosition3D to the given value.
Also stores the RectTransform as the tween's target so it can be used for filtered operations</summary>

View File

@ -33,7 +33,7 @@ public class UGUI : MonoBehaviour
// Animate the second (relative) text...
relativeText.DOText(" - This text will be added to the existing one", 2).SetRelative().SetEase(Ease.Linear).SetAutoKill(false).Pause();
// Animate the third (scrambled) text...
scrambledText.DOText("This text will appear from scrambled chars", 2, true).SetEase(Ease.Linear).SetAutoKill(false).Pause();
scrambledText.DOText("This text will appear from scrambled chars", 2, true, ScrambleMode.All).SetEase(Ease.Linear).SetAutoKill(false).Pause();
// Animate the slider
slider.DOValue(1, 1.5f).SetEase(Ease.InOutQuad).SetLoops(-1, LoopType.Yoyo).Pause();

View File

@ -1,2 +1,2 @@
m_EditorVersion: 5.1.1f1
m_EditorVersion: 5.2.1f1
m_StandardAssetsVersion: 0

View File

@ -2083,7 +2083,7 @@
<param name="t">The tween to prepend</param>
</member>
<member name="M:DG.Tweening.TweenSettingsExtensions.Join(DG.Tweening.Sequence,DG.Tweening.Tween)">
<summary>Inserts the given tween at the same time position of the last tween added to the Sequence.
<summary>Inserts the given tween at the same time position of the last tween or callback added to the Sequence.
Has no effect if the Sequence has already started</summary>
</member>
<member name="M:DG.Tweening.TweenSettingsExtensions.Insert(DG.Tweening.Sequence,System.Single,DG.Tweening.Tween)">

View File

@ -2083,7 +2083,7 @@
<param name="t">The tween to prepend</param>
</member>
<member name="M:DG.Tweening.TweenSettingsExtensions.Join(DG.Tweening.Sequence,DG.Tweening.Tween)">
<summary>Inserts the given tween at the same time position of the last tween added to the Sequence.
<summary>Inserts the given tween at the same time position of the last tween or callback added to the Sequence.
Has no effect if the Sequence has already started</summary>
</member>
<member name="M:DG.Tweening.TweenSettingsExtensions.Insert(DG.Tweening.Sequence,System.Single,DG.Tweening.Tween)">

View File

@ -32,7 +32,7 @@ namespace DG.Tweening
public class DOTween
{
/// <summary>DOTween's version</summary>
public static readonly string Version = "1.1.000";
public static readonly string Version = "1.1.005";
///////////////////////////////////////////////
// Options ////////////////////////////////////

View File

@ -99,6 +99,7 @@ namespace DG.Tweening
internal static Sequence DoInsertCallback(Sequence inSequence, TweenCallback callback, float atPosition)
{
inSequence.lastTweenInsertTime = atPosition;
SequenceCallback c = new SequenceCallback(atPosition, callback);
c.sequencedPosition = c.sequencedEndPosition = atPosition;
inSequence._sequencedObjs.Add(c);

View File

@ -427,7 +427,7 @@ namespace DG.Tweening
Sequence.DoPrepend(s, t);
return s;
}
/// <summary>Inserts the given tween at the same time position of the last tween added to the Sequence.
/// <summary>Inserts the given tween at the same time position of the last tween or callback added to the Sequence.
/// Has no effect if the Sequence has already started</summary>
public static Sequence Join(this Sequence s, Tween t)
{

View File

@ -2083,7 +2083,7 @@
<param name="t">The tween to prepend</param>
</member>
<member name="M:DG.Tweening.TweenSettingsExtensions.Join(DG.Tweening.Sequence,DG.Tweening.Tween)">
<summary>Inserts the given tween at the same time position of the last tween added to the Sequence.
<summary>Inserts the given tween at the same time position of the last tween or callback added to the Sequence.
Has no effect if the Sequence has already started</summary>
</member>
<member name="M:DG.Tweening.TweenSettingsExtensions.Insert(DG.Tweening.Sequence,System.Single,DG.Tweening.Tween)">

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.