mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-20 01:06:02 +08:00
Fixed path orientation issue when rewinding
This commit is contained in:
parent
934091a63e
commit
b56c49e441
@ -2187,5 +2187,21 @@
|
||||
Public only so custom shortcuts can access some of these methods
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:DG.Tweening.Core.Enums.UpdateNotice">
|
||||
<summary>
|
||||
Additional notices passed to plugins when updating.
|
||||
Public so it can be used by custom plugins. Internally, only PathPlugin uses it
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.None">
|
||||
<summary>
|
||||
None
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.RewindStep">
|
||||
<summary>
|
||||
Lets the plugin know that we restarted or rewinded
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2187,5 +2187,21 @@
|
||||
Public only so custom shortcuts can access some of these methods
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:DG.Tweening.Core.Enums.UpdateNotice">
|
||||
<summary>
|
||||
Additional notices passed to plugins when updating.
|
||||
Public so it can be used by custom plugins. Internally, only PathPlugin uses it
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.None">
|
||||
<summary>
|
||||
None
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.RewindStep">
|
||||
<summary>
|
||||
Lets the plugin know that we restarted or rewinded
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -2187,5 +2187,21 @@
|
||||
Public only so custom shortcuts can access some of these methods
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:DG.Tweening.Core.Enums.UpdateNotice">
|
||||
<summary>
|
||||
Additional notices passed to plugins when updating.
|
||||
Public so it can be used by custom plugins. Internally, only PathPlugin uses it
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.None">
|
||||
<summary>
|
||||
None
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.RewindStep">
|
||||
<summary>
|
||||
Lets the plugin know that we restarted or rewinded
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,6 +1,7 @@
|
||||
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;
|
||||
@ -63,7 +64,7 @@ public class CustomPlugin : ABSTweenPlugin<Vector3,Vector3,NoOptions>
|
||||
return res;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
Vector3 res = getter();
|
||||
float easeVal = EaseManager.Evaluate(t, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod);
|
||||
|
||||
@ -6,6 +6,7 @@ using System.Collections;
|
||||
public class Follow : BrainBase
|
||||
{
|
||||
public Transform target, follow;
|
||||
public float someInt;
|
||||
|
||||
void Start()
|
||||
{
|
||||
@ -14,7 +15,15 @@ public class Follow : BrainBase
|
||||
|
||||
tween.OnUpdate(() =>
|
||||
{
|
||||
tween.ChangeEndValue(follow.position, true);
|
||||
// someInt = 0;
|
||||
// someInt = follow.position.x + tween.ElapsedPercentage();
|
||||
// tween.ChangeEndValue(follow.position, true);
|
||||
SomeFunction<Vector3>(follow.position);
|
||||
});
|
||||
}
|
||||
|
||||
void SomeFunction<T>(T obj)
|
||||
{
|
||||
someInt = 1;
|
||||
}
|
||||
}
|
||||
21
_DOTween.Assembly/DOTween/Core/Enums/UpdateNotice.cs
Normal file
21
_DOTween.Assembly/DOTween/Core/Enums/UpdateNotice.cs
Normal file
@ -0,0 +1,21 @@
|
||||
// Author: Daniele Giardini - http://www.demigiant.com
|
||||
// Created: 2015/05/27 12:23
|
||||
|
||||
namespace DG.Tweening.Core.Enums
|
||||
{
|
||||
/// <summary>
|
||||
/// Additional notices passed to plugins when updating.
|
||||
/// Public so it can be used by custom plugins. Internally, only PathPlugin uses it
|
||||
/// </summary>
|
||||
public enum UpdateNotice
|
||||
{
|
||||
/// <summary>
|
||||
/// None
|
||||
/// </summary>
|
||||
None,
|
||||
/// <summary>
|
||||
/// Lets the plugin know that we restarted or rewinded
|
||||
/// </summary>
|
||||
RewindStep
|
||||
}
|
||||
}
|
||||
@ -167,18 +167,18 @@ namespace DG.Tweening.Core
|
||||
|
||||
// Applies the tween set by DoGoto.
|
||||
// Returns TRUE if the tween needs to be killed
|
||||
internal override bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode)
|
||||
internal override bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode, UpdateNotice updateNotice)
|
||||
{
|
||||
float updatePosition = useInversePosition ? duration - position : position;
|
||||
if (DOTween.useSafeMode) {
|
||||
try {
|
||||
tweenPlugin.EvaluateAndApply(plugOptions, this, isRelative, getter, setter, updatePosition, startValue, changeValue, duration, useInversePosition);
|
||||
tweenPlugin.EvaluateAndApply(plugOptions, this, isRelative, getter, setter, updatePosition, startValue, changeValue, duration, useInversePosition, updateNotice);
|
||||
} catch {
|
||||
// Target/field doesn't exist anymore: kill tween
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
tweenPlugin.EvaluateAndApply(plugOptions, this, isRelative, getter, setter, updatePosition, startValue, changeValue, duration, useInversePosition);
|
||||
tweenPlugin.EvaluateAndApply(plugOptions, this, isRelative, getter, setter, updatePosition, startValue, changeValue, duration, useInversePosition, updateNotice);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -32,7 +32,7 @@ namespace DG.Tweening
|
||||
public class DOTween
|
||||
{
|
||||
/// <summary>DOTween's version</summary>
|
||||
public static readonly string Version = "1.0.745";
|
||||
public static readonly string Version = "1.0.750";
|
||||
|
||||
///////////////////////////////////////////////
|
||||
// Options ////////////////////////////////////
|
||||
|
||||
@ -68,6 +68,7 @@
|
||||
<Compile Include="Core\Enums\FilterType.cs" />
|
||||
<Compile Include="Core\Enums\OperationType.cs" />
|
||||
<Compile Include="Core\Enums\SpecialStartupMode.cs" />
|
||||
<Compile Include="Core\Enums\UpdateNotice.cs" />
|
||||
<Compile Include="Core\Enums\UpdateMode.cs" />
|
||||
<Compile Include="Core\Extensions.cs" />
|
||||
<Compile Include="Core\SequenceCallback.cs" />
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
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 UnityEngine;
|
||||
@ -49,7 +50,7 @@ namespace DG.Tweening.Plugins
|
||||
return 1f / unitsXSecond;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter<Color2> getter, DOSetter<Color2> setter, float elapsed, Color2 startValue, Color2 changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter<Color2> getter, DOSetter<Color2> setter, float elapsed, Color2 startValue, Color2 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
|
||||
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
|
||||
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 UnityEngine;
|
||||
@ -49,7 +50,7 @@ namespace DG.Tweening.Plugins
|
||||
return 1f / unitsXSecond;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter<Color> getter, DOSetter<Color> setter, float elapsed, Color startValue, Color changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter<Color> getter, DOSetter<Color> setter, float elapsed, Color startValue, Color changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
|
||||
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Core.Easing;
|
||||
using DG.Tweening.Core.Enums;
|
||||
using DG.Tweening.Core.Surrogates;
|
||||
using DG.Tweening.Plugins.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
@ -47,7 +48,7 @@ namespace DG.Tweening.Plugins
|
||||
return 1f / unitsXSecond;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter<ColorWrapper> getter, DOSetter<ColorWrapper> setter, float elapsed, ColorWrapper startValue, ColorWrapper changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(ColorOptions options, Tween t, bool isRelative, DOGetter<ColorWrapper> getter, DOSetter<ColorWrapper> setter, float elapsed, ColorWrapper startValue, ColorWrapper changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
if (t.loopType == LoopType.Incremental) startValue.value += changeValue.value * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
|
||||
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
// This work is subject to the terms at http://dotween.demigiant.com/license.php
|
||||
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Core.Enums;
|
||||
|
||||
#pragma warning disable 1591
|
||||
namespace DG.Tweening.Plugins.Core
|
||||
@ -19,6 +20,6 @@ namespace DG.Tweening.Plugins.Core
|
||||
public abstract void SetChangeValue(TweenerCore<T1, T2, TPlugOptions> t);
|
||||
public abstract float GetSpeedBasedDuration(TPlugOptions options, float unitsXSecond, T2 changeValue);
|
||||
// usingInversePosition is used by PathPlugin to calculate correctly the current waypoint reached
|
||||
public abstract void EvaluateAndApply(TPlugOptions options, Tween t, bool isRelative, DOGetter<T1> getter, DOSetter<T1> setter, float elapsed, T2 startValue, T2 changeValue, float duration, bool usingInversePosition);
|
||||
public abstract void EvaluateAndApply(TPlugOptions options, Tween t, bool isRelative, DOGetter<T1> getter, DOSetter<T1> setter, float elapsed, T2 startValue, T2 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice);
|
||||
}
|
||||
}
|
||||
@ -7,6 +7,7 @@
|
||||
using System;
|
||||
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 UnityEngine;
|
||||
@ -48,7 +49,7 @@ namespace DG.Tweening.Plugins
|
||||
return res;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(FloatOptions options, Tween t, bool isRelative, DOGetter<float> getter, DOSetter<float> setter, float elapsed, float startValue, float changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(FloatOptions options, Tween t, bool isRelative, DOGetter<float> getter, DOSetter<float> setter, float elapsed, float startValue, float changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
|
||||
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
using System;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Core.Easing;
|
||||
using DG.Tweening.Core.Enums;
|
||||
using DG.Tweening.Plugins.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
|
||||
@ -47,7 +48,7 @@ namespace DG.Tweening.Plugins
|
||||
return res;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<int> getter, DOSetter<int> setter, float elapsed, int startValue, int changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<int> getter, DOSetter<int> setter, float elapsed, int startValue, int changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
|
||||
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Core.Easing;
|
||||
using DG.Tweening.Core.Enums;
|
||||
using DG.Tweening.Plugins.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
|
||||
@ -44,7 +45,7 @@ namespace DG.Tweening.Plugins
|
||||
return res;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<long> getter, DOSetter<long> setter, float elapsed, long startValue, long changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<long> getter, DOSetter<long> setter, float elapsed, long startValue, long changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
|
||||
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
|
||||
|
||||
@ -31,6 +31,7 @@ namespace DG.Tweening.Plugins.Options
|
||||
public bool useLocalPosition;
|
||||
public Transform parent; // Only used with OrientType.ToPath and useLocalPosition set as TRUE
|
||||
|
||||
internal Quaternion startupRot; // Used to reset orientation when rewinding
|
||||
internal float startupZRot; // Used to store Z value in case of lock Z, in order to rotate things differently
|
||||
}
|
||||
}
|
||||
@ -6,6 +6,7 @@
|
||||
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Core.Easing;
|
||||
using DG.Tweening.Core.Enums;
|
||||
using DG.Tweening.Plugins.Core;
|
||||
using DG.Tweening.Plugins.Core.PathCore;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
@ -87,6 +88,7 @@ namespace DG.Tweening.Plugins
|
||||
// Finalize path
|
||||
path.FinalizePath(t.plugOptions.isClosedPath, t.plugOptions.lockPositionAxis, currVal);
|
||||
|
||||
t.plugOptions.startupRot = trans.rotation;
|
||||
t.plugOptions.startupZRot = trans.eulerAngles.z;
|
||||
|
||||
// Set changeValue as a reference to endValue
|
||||
@ -98,7 +100,7 @@ namespace DG.Tweening.Plugins
|
||||
return changeValue.length / unitsXSecond;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(PathOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Path startValue, Path changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(PathOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Path startValue, Path changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
float pathPerc = EaseManager.Evaluate(t.easeType, t.customEase, elapsed, duration, t.easeOvershootOrAmplitude, t.easePeriod);
|
||||
float constantPathPerc = changeValue.ConvertToConstantPathPerc(pathPerc);
|
||||
@ -106,7 +108,7 @@ namespace DG.Tweening.Plugins
|
||||
changeValue.targetPosition = newPos; // Used to draw editor gizmos
|
||||
setter(newPos);
|
||||
|
||||
if (options.mode != PathMode.Ignore && options.orientType != OrientType.None) SetOrientation(options, t, changeValue, constantPathPerc, newPos);
|
||||
if (options.mode != PathMode.Ignore && options.orientType != OrientType.None) SetOrientation(options, t, changeValue, constantPathPerc, newPos, updateNotice);
|
||||
|
||||
// Determine if current waypoint changed and eventually dispatch callback
|
||||
bool isForward = !usingInversePosition;
|
||||
@ -119,11 +121,16 @@ namespace DG.Tweening.Plugins
|
||||
}
|
||||
|
||||
// Public so it can be called by GotoWaypoint
|
||||
public void SetOrientation(PathOptions options, Tween t, Path path, float pathPerc, Vector3 tPos)
|
||||
public void SetOrientation(PathOptions options, Tween t, Path path, float pathPerc, Vector3 tPos, UpdateNotice updateNotice)
|
||||
{
|
||||
Transform trans = (Transform)t.target;
|
||||
Quaternion newRot = Quaternion.identity;
|
||||
|
||||
if (updateNotice == UpdateNotice.RewindStep) {
|
||||
// Reset orientation before continuing
|
||||
trans.rotation = options.startupRot;
|
||||
}
|
||||
|
||||
switch (options.orientType) {
|
||||
case OrientType.LookAtPosition:
|
||||
path.lookAtPosition = options.lookAtPosition; // Used to draw editor gizmos
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
|
||||
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 UnityEngine;
|
||||
@ -79,7 +80,7 @@ namespace DG.Tweening.Plugins
|
||||
return changeValue.magnitude / unitsXSecond;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(QuaternionOptions options, Tween t, bool isRelative, DOGetter<Quaternion> getter, DOSetter<Quaternion> setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(QuaternionOptions options, Tween t, bool isRelative, DOGetter<Quaternion> getter, DOSetter<Quaternion> setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
Vector3 endValue = startValue;
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Core.Easing;
|
||||
using DG.Tweening.Core.Enums;
|
||||
using DG.Tweening.Core.Surrogates;
|
||||
using DG.Tweening.Plugins.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
@ -77,7 +78,7 @@ namespace DG.Tweening.Plugins
|
||||
return changeValue.value.magnitude / unitsXSecond;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(QuaternionOptions options, Tween t, bool isRelative, DOGetter<QuaternionWrapper> getter, DOSetter<QuaternionWrapper> setter, float elapsed, Vector3Wrapper startValue, Vector3Wrapper changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(QuaternionOptions options, Tween t, bool isRelative, DOGetter<QuaternionWrapper> getter, DOSetter<QuaternionWrapper> setter, float elapsed, Vector3Wrapper startValue, Vector3Wrapper changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
Vector3 endValue = startValue.value;
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
using System;
|
||||
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 UnityEngine;
|
||||
@ -73,7 +74,7 @@ namespace DG.Tweening.Plugins
|
||||
return diag / unitsXSecond;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<RectOffset> getter, DOSetter<RectOffset> setter, float elapsed, RectOffset startValue, RectOffset changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<RectOffset> getter, DOSetter<RectOffset> setter, float elapsed, RectOffset startValue, RectOffset changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
_r.left = startValue.left;
|
||||
_r.right = startValue.right;
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
using System;
|
||||
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 UnityEngine;
|
||||
@ -71,7 +72,7 @@ namespace DG.Tweening.Plugins
|
||||
return diag / unitsXSecond;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(RectOptions options, Tween t, bool isRelative, DOGetter<Rect> getter, DOSetter<Rect> setter, float elapsed, Rect startValue, Rect changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(RectOptions options, Tween t, bool isRelative, DOGetter<Rect> getter, DOSetter<Rect> setter, float elapsed, Rect startValue, Rect changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
if (t.loopType == LoopType.Incremental) {
|
||||
int iterations = t.isComplete ? t.completedLoops - 1 : t.completedLoops;
|
||||
|
||||
@ -10,6 +10,7 @@ using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
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 UnityEngine;
|
||||
@ -64,7 +65,7 @@ namespace DG.Tweening.Plugins
|
||||
}
|
||||
|
||||
// ChangeValue is the same as endValue in this plugin
|
||||
public override void EvaluateAndApply(StringOptions options, Tween t, bool isRelative, DOGetter<string> getter, DOSetter<string> setter, float elapsed, string startValue, string changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(StringOptions options, Tween t, bool isRelative, DOGetter<string> getter, DOSetter<string> setter, float elapsed, string startValue, string changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
_Buffer.Remove(0, _Buffer.Length);
|
||||
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
using System;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Core.Easing;
|
||||
using DG.Tweening.Core.Enums;
|
||||
using DG.Tweening.Plugins.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
|
||||
@ -47,7 +48,7 @@ namespace DG.Tweening.Plugins
|
||||
return res;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<uint> getter, DOSetter<uint> setter, float elapsed, uint startValue, uint changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<uint> getter, DOSetter<uint> setter, float elapsed, uint startValue, uint changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
if (t.loopType == LoopType.Incremental) startValue += (uint)(changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops));
|
||||
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
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 UnityEngine;
|
||||
@ -45,7 +46,7 @@ namespace DG.Tweening.Plugins
|
||||
return res;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<ulong> getter, DOSetter<ulong> setter, float elapsed, ulong startValue, ulong changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(NoOptions options, Tween t, bool isRelative, DOGetter<ulong> getter, DOSetter<ulong> setter, float elapsed, ulong startValue, ulong changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
if (t.loopType == LoopType.Incremental) startValue += changeValue * (uint)(t.isComplete ? t.completedLoops - 1 : t.completedLoops);
|
||||
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
using System;
|
||||
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 UnityEngine;
|
||||
@ -73,7 +74,7 @@ namespace DG.Tweening.Plugins
|
||||
return changeValue.magnitude / unitsXSecond;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector2> getter, DOSetter<Vector2> setter, float elapsed, Vector2 startValue, Vector2 changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector2> getter, DOSetter<Vector2> setter, float elapsed, Vector2 startValue, Vector2 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
|
||||
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
using System;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Core.Easing;
|
||||
using DG.Tweening.Core.Enums;
|
||||
using DG.Tweening.Core.Surrogates;
|
||||
using DG.Tweening.Plugins.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
@ -71,7 +72,7 @@ namespace DG.Tweening.Plugins
|
||||
return changeValue.value.magnitude / unitsXSecond;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector2Wrapper> getter, DOSetter<Vector2Wrapper> setter, float elapsed, Vector2Wrapper startValue, Vector2Wrapper changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector2Wrapper> getter, DOSetter<Vector2Wrapper> setter, float elapsed, Vector2Wrapper startValue, Vector2Wrapper changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
if (t.loopType == LoopType.Incremental) startValue.value += changeValue.value * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
|
||||
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
using System;
|
||||
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 UnityEngine;
|
||||
@ -65,7 +66,7 @@ namespace DG.Tweening.Plugins
|
||||
return totDuration;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(Vector3ArrayOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Vector3[] startValue, Vector3[] changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(Vector3ArrayOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Vector3[] startValue, Vector3[] changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
Vector3 incrementValue = Vector3.zero;
|
||||
if (t.loopType == LoopType.Incremental) {
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
using System;
|
||||
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 UnityEngine;
|
||||
@ -80,7 +81,7 @@ namespace DG.Tweening.Plugins
|
||||
return changeValue.magnitude / unitsXSecond;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector3> getter, DOSetter<Vector3> setter, float elapsed, Vector3 startValue, Vector3 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
|
||||
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
using System;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Core.Easing;
|
||||
using DG.Tweening.Core.Enums;
|
||||
using DG.Tweening.Core.Surrogates;
|
||||
using DG.Tweening.Plugins.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
@ -78,7 +79,7 @@ namespace DG.Tweening.Plugins
|
||||
return changeValue.value.magnitude / unitsXSecond;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector3Wrapper> getter, DOSetter<Vector3Wrapper> setter, float elapsed, Vector3Wrapper startValue, Vector3Wrapper changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector3Wrapper> getter, DOSetter<Vector3Wrapper> setter, float elapsed, Vector3Wrapper startValue, Vector3Wrapper changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
if (t.loopType == LoopType.Incremental) startValue.value += changeValue.value * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
|
||||
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
using System;
|
||||
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 UnityEngine;
|
||||
@ -87,7 +88,7 @@ namespace DG.Tweening.Plugins
|
||||
return changeValue.magnitude / unitsXSecond;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector4> getter, DOSetter<Vector4> setter, float elapsed, Vector4 startValue, Vector4 changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector4> getter, DOSetter<Vector4> setter, float elapsed, Vector4 startValue, Vector4 changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
if (t.loopType == LoopType.Incremental) startValue += changeValue * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
|
||||
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using DG.Tweening.Core;
|
||||
using DG.Tweening.Core.Easing;
|
||||
using DG.Tweening.Core.Enums;
|
||||
using DG.Tweening.Core.Surrogates;
|
||||
using DG.Tweening.Plugins.Core;
|
||||
using DG.Tweening.Plugins.Options;
|
||||
@ -84,7 +85,7 @@ namespace DG.Tweening.Plugins
|
||||
return changeValue.value.magnitude / unitsXSecond;
|
||||
}
|
||||
|
||||
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector4Wrapper> getter, DOSetter<Vector4Wrapper> setter, float elapsed, Vector4Wrapper startValue, Vector4Wrapper changeValue, float duration, bool usingInversePosition)
|
||||
public override void EvaluateAndApply(VectorOptions options, Tween t, bool isRelative, DOGetter<Vector4Wrapper> getter, DOSetter<Vector4Wrapper> setter, float elapsed, Vector4Wrapper startValue, Vector4Wrapper changeValue, float duration, bool usingInversePosition, UpdateNotice updateNotice)
|
||||
{
|
||||
if (t.loopType == LoopType.Incremental) startValue.value += changeValue.value * (t.isComplete ? t.completedLoops - 1 : t.completedLoops);
|
||||
if (t.isSequenced && t.sequenceParent.loopType == LoopType.Incremental) {
|
||||
|
||||
@ -134,7 +134,7 @@ namespace DG.Tweening
|
||||
return DoStartup(this);
|
||||
}
|
||||
|
||||
internal override bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode)
|
||||
internal override bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode, UpdateNotice updateNotice)
|
||||
{
|
||||
return DoApplyTween(this, prevPosition, prevCompletedLoops, newCompletedSteps, useInversePosition, updateMode);
|
||||
}
|
||||
|
||||
@ -163,8 +163,9 @@ namespace DG.Tweening
|
||||
internal abstract bool Startup();
|
||||
|
||||
// Applies the tween set by DoGoto.
|
||||
// Returns TRUE if the tween needs to be killed
|
||||
internal abstract bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode);
|
||||
// Returns TRUE if the tween needs to be killed.
|
||||
// UpdateNotice is only used by Tweeners, since Sequences re-evaluate for it
|
||||
internal abstract bool ApplyTween(float prevPosition, int prevCompletedLoops, int newCompletedSteps, bool useInversePosition, UpdateMode updateMode, UpdateNotice updateNotice);
|
||||
|
||||
#endregion
|
||||
|
||||
@ -231,7 +232,10 @@ namespace DG.Tweening
|
||||
&& (t.position < t.duration ? t.completedLoops % 2 != 0 : t.completedLoops % 2 == 0);
|
||||
|
||||
// Get values from plugin and set them
|
||||
if (t.ApplyTween(prevPosition, prevCompletedLoops, newCompletedSteps, useInversePosition, updateMode)) return true;
|
||||
UpdateNotice updateNotice =
|
||||
!wasRewinded && (t.loopType == LoopType.Restart && t.completedLoops != prevCompletedLoops || t.position <= 0 && t.completedLoops <= 0)
|
||||
? UpdateNotice.RewindStep : UpdateNotice.None;
|
||||
if (t.ApplyTween(prevPosition, prevCompletedLoops, newCompletedSteps, useInversePosition, updateMode, updateNotice)) return true;
|
||||
|
||||
// Additional callbacks
|
||||
if (t.onUpdate != null && updateMode != UpdateMode.IgnoreOnUpdate) {
|
||||
|
||||
@ -2187,5 +2187,21 @@
|
||||
Public only so custom shortcuts can access some of these methods
|
||||
</summary>
|
||||
</member>
|
||||
<member name="T:DG.Tweening.Core.Enums.UpdateNotice">
|
||||
<summary>
|
||||
Additional notices passed to plugins when updating.
|
||||
Public so it can be used by custom plugins. Internally, only PathPlugin uses it
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.None">
|
||||
<summary>
|
||||
None
|
||||
</summary>
|
||||
</member>
|
||||
<member name="F:DG.Tweening.Core.Enums.UpdateNotice.RewindStep">
|
||||
<summary>
|
||||
Lets the plugin know that we restarted or rewinded
|
||||
</summary>
|
||||
</member>
|
||||
</members>
|
||||
</doc>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user