mirror of
https://github.com/Cardidi/dotween-upm-fork.git
synced 2025-12-20 17:26:03 +08:00
[bugfix] Better (and faster) solution to previous TweenerCore.Reset allocation issue, which has no problems with IL2CPP
This commit is contained in:
parent
94c2faae8f
commit
5f28d4bba8
@ -891,6 +891,14 @@
|
|||||||
<param name="perc">The percentage (0 to 1) at which to get the point</param>
|
<param name="perc">The percentage (0 to 1) at which to get the point</param>
|
||||||
<param name="convertToConstantPerc">If TRUE constant speed is taken into account, otherwise not</param>
|
<param name="convertToConstantPerc">If TRUE constant speed is taken into account, otherwise not</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:DG.Tweening.Plugins.Options.IPlugOptions">
|
||||||
|
<summary>
|
||||||
|
Base interface for all tween plugins options
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:DG.Tweening.Plugins.Options.IPlugOptions.Reset">
|
||||||
|
<summary>Resets the plugin</summary>
|
||||||
|
</member>
|
||||||
<member name="T:DG.Tweening.Plugins.Vector3ArrayPlugin">
|
<member name="T:DG.Tweening.Plugins.Vector3ArrayPlugin">
|
||||||
<summary>
|
<summary>
|
||||||
This plugin generates some GC allocations at startup
|
This plugin generates some GC allocations at startup
|
||||||
|
|||||||
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.
@ -891,6 +891,14 @@
|
|||||||
<param name="perc">The percentage (0 to 1) at which to get the point</param>
|
<param name="perc">The percentage (0 to 1) at which to get the point</param>
|
||||||
<param name="convertToConstantPerc">If TRUE constant speed is taken into account, otherwise not</param>
|
<param name="convertToConstantPerc">If TRUE constant speed is taken into account, otherwise not</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:DG.Tweening.Plugins.Options.IPlugOptions">
|
||||||
|
<summary>
|
||||||
|
Base interface for all tween plugins options
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:DG.Tweening.Plugins.Options.IPlugOptions.Reset">
|
||||||
|
<summary>Resets the plugin</summary>
|
||||||
|
</member>
|
||||||
<member name="T:DG.Tweening.Plugins.Vector3ArrayPlugin">
|
<member name="T:DG.Tweening.Plugins.Vector3ArrayPlugin">
|
||||||
<summary>
|
<summary>
|
||||||
This plugin generates some GC allocations at startup
|
This plugin generates some GC allocations at startup
|
||||||
|
|||||||
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.
@ -891,6 +891,14 @@
|
|||||||
<param name="perc">The percentage (0 to 1) at which to get the point</param>
|
<param name="perc">The percentage (0 to 1) at which to get the point</param>
|
||||||
<param name="convertToConstantPerc">If TRUE constant speed is taken into account, otherwise not</param>
|
<param name="convertToConstantPerc">If TRUE constant speed is taken into account, otherwise not</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:DG.Tweening.Plugins.Options.IPlugOptions">
|
||||||
|
<summary>
|
||||||
|
Base interface for all tween plugins options
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:DG.Tweening.Plugins.Options.IPlugOptions.Reset">
|
||||||
|
<summary>Resets the plugin</summary>
|
||||||
|
</member>
|
||||||
<member name="T:DG.Tweening.Plugins.Vector3ArrayPlugin">
|
<member name="T:DG.Tweening.Plugins.Vector3ArrayPlugin">
|
||||||
<summary>
|
<summary>
|
||||||
This plugin generates some GC allocations at startup
|
This plugin generates some GC allocations at startup
|
||||||
|
|||||||
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.
@ -5,6 +5,7 @@
|
|||||||
// This work is subject to the terms at http://dotween.demigiant.com/license.php
|
// This work is subject to the terms at http://dotween.demigiant.com/license.php
|
||||||
|
|
||||||
using DG.Tweening.Core.Enums;
|
using DG.Tweening.Core.Enums;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
|
|
||||||
namespace DG.Tweening.Core
|
namespace DG.Tweening.Core
|
||||||
{
|
{
|
||||||
@ -22,7 +23,7 @@ namespace DG.Tweening.Core
|
|||||||
|
|
||||||
// Prevents a tween to use a From setup even if passed
|
// Prevents a tween to use a From setup even if passed
|
||||||
internal static TweenerCore<T1, T2, TPlugOptions> NoFrom<T1, T2, TPlugOptions>(this TweenerCore<T1, T2, TPlugOptions> t)
|
internal static TweenerCore<T1, T2, TPlugOptions> NoFrom<T1, T2, TPlugOptions>(this TweenerCore<T1, T2, TPlugOptions> t)
|
||||||
where TPlugOptions : struct
|
where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
t.isFromAllowed = false;
|
t.isFromAllowed = false;
|
||||||
return t;
|
return t;
|
||||||
@ -30,7 +31,7 @@ namespace DG.Tweening.Core
|
|||||||
|
|
||||||
// Sets the tween as blendable
|
// Sets the tween as blendable
|
||||||
internal static TweenerCore<T1, T2, TPlugOptions> Blendable<T1, T2, TPlugOptions>(this TweenerCore<T1, T2, TPlugOptions> t)
|
internal static TweenerCore<T1, T2, TPlugOptions> Blendable<T1, T2, TPlugOptions>(this TweenerCore<T1, T2, TPlugOptions> t)
|
||||||
where TPlugOptions : struct
|
where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
t.isBlendable = true;
|
t.isBlendable = true;
|
||||||
return t;
|
return t;
|
||||||
|
|||||||
@ -7,6 +7,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DG.Tweening.Core.Enums;
|
using DG.Tweening.Core.Enums;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace DG.Tweening.Core
|
namespace DG.Tweening.Core
|
||||||
@ -52,7 +53,7 @@ namespace DG.Tweening.Core
|
|||||||
// Returns a new Tweener, from the pool if there's one available,
|
// Returns a new Tweener, from the pool if there's one available,
|
||||||
// otherwise by instantiating a new one
|
// otherwise by instantiating a new one
|
||||||
internal static TweenerCore<T1,T2,TPlugOptions> GetTweener<T1,T2,TPlugOptions>()
|
internal static TweenerCore<T1,T2,TPlugOptions> GetTweener<T1,T2,TPlugOptions>()
|
||||||
where TPlugOptions : struct
|
where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
TweenerCore<T1,T2,TPlugOptions> t;
|
TweenerCore<T1,T2,TPlugOptions> t;
|
||||||
// Search inside pool
|
// Search inside pool
|
||||||
|
|||||||
@ -10,6 +10,7 @@ using DG.Tweening.Core.Surrogates;
|
|||||||
using System;
|
using System;
|
||||||
using DG.Tweening.Core.Enums;
|
using DG.Tweening.Core.Enums;
|
||||||
using DG.Tweening.Plugins.Core;
|
using DG.Tweening.Plugins.Core;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
@ -20,7 +21,7 @@ namespace DG.Tweening.Core
|
|||||||
// T1: type of value to tween
|
// T1: type of value to tween
|
||||||
// T2: format in which value is stored while tweening
|
// T2: format in which value is stored while tweening
|
||||||
// TPlugOptions: options type
|
// TPlugOptions: options type
|
||||||
public class TweenerCore<T1,T2,TPlugOptions> : Tweener where TPlugOptions : struct
|
public class TweenerCore<T1,T2,TPlugOptions> : Tweener where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
// SETUP DATA ////////////////////////////////////////////////
|
// SETUP DATA ////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -131,7 +132,8 @@ namespace DG.Tweening.Core
|
|||||||
|
|
||||||
if (tweenPlugin != null) tweenPlugin.Reset(this);
|
if (tweenPlugin != null) tweenPlugin.Reset(this);
|
||||||
// plugOptions = new TPlugOptions(); // Generates GC because converts to an Activator.CreateInstance
|
// plugOptions = new TPlugOptions(); // Generates GC because converts to an Activator.CreateInstance
|
||||||
plugOptions = Utils.InstanceCreator<TPlugOptions>.Create(); // Fixes GC allocation using workaround
|
// plugOptions = Utils.InstanceCreator<TPlugOptions>.Create(); // Fixes GC allocation using workaround (doesn't work with IL2CPP)
|
||||||
|
plugOptions.Reset(); // Alternate fix that uses IPlugOptions Reset
|
||||||
getter = null;
|
getter = null;
|
||||||
setter = null;
|
setter = null;
|
||||||
hasManuallySetStartValue = false;
|
hasManuallySetStartValue = false;
|
||||||
|
|||||||
@ -4,8 +4,6 @@
|
|||||||
// License Copyright (c) Daniele Giardini.
|
// License Copyright (c) Daniele Giardini.
|
||||||
// This work is subject to the terms at http://dotween.demigiant.com/license.php
|
// This work is subject to the terms at http://dotween.demigiant.com/license.php
|
||||||
|
|
||||||
using System;
|
|
||||||
using System.Linq.Expressions;
|
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace DG.Tweening.Core
|
namespace DG.Tweening.Core
|
||||||
@ -40,11 +38,12 @@ namespace DG.Tweening.Core
|
|||||||
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
|
// █████████████████████████████████████████████████████████████████████████████████████████████████████████████████████
|
||||||
|
|
||||||
// Uses code from BK > http://stackoverflow.com/a/1280832
|
// Uses code from BK > http://stackoverflow.com/a/1280832
|
||||||
public class InstanceCreator<T> where T : new()
|
// (scrapped > doesn't work with IL2CPP)
|
||||||
{
|
// public class InstanceCreator<T> where T : new()
|
||||||
static readonly Expression<Func<T>> _TExpression = () => new T();
|
// {
|
||||||
static readonly Func<T> _TBuilder = _TExpression.Compile();
|
// static readonly Expression<Func<T>> _TExpression = () => new T();
|
||||||
public static T Create() { return _TBuilder(); }
|
// static readonly Func<T> _TBuilder = _TExpression.Compile();
|
||||||
}
|
// public static T Create() { return _TBuilder(); }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -32,7 +32,7 @@ namespace DG.Tweening
|
|||||||
public class DOTween
|
public class DOTween
|
||||||
{
|
{
|
||||||
/// <summary>DOTween's version</summary>
|
/// <summary>DOTween's version</summary>
|
||||||
public static readonly string Version = "1.1.510";
|
public static readonly string Version = "1.1.520";
|
||||||
|
|
||||||
///////////////////////////////////////////////
|
///////////////////////////////////////////////
|
||||||
// Options ////////////////////////////////////
|
// Options ////////////////////////////////////
|
||||||
@ -399,7 +399,7 @@ namespace DG.Tweening
|
|||||||
public static TweenerCore<T1, T2, TPlugOptions> To<T1, T2, TPlugOptions>(
|
public static TweenerCore<T1, T2, TPlugOptions> To<T1, T2, TPlugOptions>(
|
||||||
ABSTweenPlugin<T1, T2, TPlugOptions> plugin, DOGetter<T1> getter, DOSetter<T1> setter, T2 endValue, float duration
|
ABSTweenPlugin<T1, T2, TPlugOptions> plugin, DOGetter<T1> getter, DOSetter<T1> setter, T2 endValue, float duration
|
||||||
)
|
)
|
||||||
where TPlugOptions : struct
|
where TPlugOptions : struct, IPlugOptions
|
||||||
{ return ApplyTo(getter, setter, endValue, duration, plugin); }
|
{ return ApplyTo(getter, setter, endValue, duration, plugin); }
|
||||||
|
|
||||||
/// <summary>Tweens only one axis of a Vector3 to the given value using default plugins.</summary>
|
/// <summary>Tweens only one axis of a Vector3 to the given value using default plugins.</summary>
|
||||||
@ -957,7 +957,7 @@ namespace DG.Tweening
|
|||||||
static TweenerCore<T1, T2, TPlugOptions> ApplyTo<T1, T2, TPlugOptions>(
|
static TweenerCore<T1, T2, TPlugOptions> ApplyTo<T1, T2, TPlugOptions>(
|
||||||
DOGetter<T1> getter, DOSetter<T1> setter, T2 endValue, float duration, ABSTweenPlugin<T1, T2, TPlugOptions> plugin = null
|
DOGetter<T1> getter, DOSetter<T1> setter, T2 endValue, float duration, ABSTweenPlugin<T1, T2, TPlugOptions> plugin = null
|
||||||
)
|
)
|
||||||
where TPlugOptions : struct
|
where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
InitCheck();
|
InitCheck();
|
||||||
TweenerCore<T1, T2, TPlugOptions> tweener = TweenManager.GetTweener<T1, T2, TPlugOptions>();
|
TweenerCore<T1, T2, TPlugOptions> tweener = TweenManager.GetTweener<T1, T2, TPlugOptions>();
|
||||||
|
|||||||
@ -96,6 +96,7 @@
|
|||||||
<Compile Include="Plugins\Core\PathCore\ControlPoint.cs" />
|
<Compile Include="Plugins\Core\PathCore\ControlPoint.cs" />
|
||||||
<Compile Include="Plugins\DoublePlugin.cs" />
|
<Compile Include="Plugins\DoublePlugin.cs" />
|
||||||
<Compile Include="Plugins\LongPlugin.cs" />
|
<Compile Include="Plugins\LongPlugin.cs" />
|
||||||
|
<Compile Include="Plugins\Options\IPlugOptions.cs" />
|
||||||
<Compile Include="Plugins\Options\PathOptions.cs" />
|
<Compile Include="Plugins\Options\PathOptions.cs" />
|
||||||
<Compile Include="Plugins\Options\QuaternionOptions.cs" />
|
<Compile Include="Plugins\Options\QuaternionOptions.cs" />
|
||||||
<Compile Include="Plugins\Options\UintOptions.cs" />
|
<Compile Include="Plugins\Options\UintOptions.cs" />
|
||||||
|
|||||||
@ -6,12 +6,13 @@
|
|||||||
|
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
using DG.Tweening.Core.Enums;
|
using DG.Tweening.Core.Enums;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
|
|
||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening.Plugins.Core
|
namespace DG.Tweening.Plugins.Core
|
||||||
{
|
{
|
||||||
// Public so it can be extended by custom plugins
|
// Public so it can be extended by custom plugins
|
||||||
public abstract class ABSTweenPlugin<T1,T2,TPlugOptions> : ITweenPlugin where TPlugOptions : struct
|
public abstract class ABSTweenPlugin<T1,T2,TPlugOptions> : ITweenPlugin where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
public abstract void Reset(TweenerCore<T1, T2, TPlugOptions> t); // Resets specific TweenerCore stuff, not the plugin itself
|
public abstract void Reset(TweenerCore<T1, T2, TPlugOptions> t); // Resets specific TweenerCore stuff, not the plugin itself
|
||||||
public abstract void SetFrom(TweenerCore<T1, T2, TPlugOptions> t, bool isRelative);
|
public abstract void SetFrom(TweenerCore<T1, T2, TPlugOptions> t, bool isRelative);
|
||||||
|
|||||||
@ -30,6 +30,7 @@ using DOColorPlugin = DG.Tweening.Plugins.ColorPlugin;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using DG.Tweening.Core;
|
using DG.Tweening.Core;
|
||||||
|
using DG.Tweening.Plugins.Options;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
namespace DG.Tweening.Plugins.Core
|
namespace DG.Tweening.Plugins.Core
|
||||||
@ -61,7 +62,7 @@ namespace DG.Tweening.Plugins.Core
|
|||||||
// ===================================================================================
|
// ===================================================================================
|
||||||
// INTERNAL METHODS ------------------------------------------------------------------
|
// INTERNAL METHODS ------------------------------------------------------------------
|
||||||
|
|
||||||
internal static ABSTweenPlugin<T1,T2,TPlugOptions> GetDefaultPlugin<T1,T2,TPlugOptions>() where TPlugOptions : struct
|
internal static ABSTweenPlugin<T1,T2,TPlugOptions> GetDefaultPlugin<T1,T2,TPlugOptions>() where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
Type t1 = typeof(T1);
|
Type t1 = typeof(T1);
|
||||||
Type t2 = typeof(T2);
|
Type t2 = typeof(T2);
|
||||||
@ -127,7 +128,7 @@ namespace DG.Tweening.Plugins.Core
|
|||||||
// Public so it can be used by custom plugins Get method
|
// Public so it can be used by custom plugins Get method
|
||||||
public static ABSTweenPlugin<T1, T2, TPlugOptions> GetCustomPlugin<TPlugin, T1, T2, TPlugOptions>()
|
public static ABSTweenPlugin<T1, T2, TPlugOptions> GetCustomPlugin<TPlugin, T1, T2, TPlugOptions>()
|
||||||
where TPlugin : ITweenPlugin, new()
|
where TPlugin : ITweenPlugin, new()
|
||||||
where TPlugOptions : struct
|
where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
Type t = typeof(TPlugin);
|
Type t = typeof(TPlugin);
|
||||||
ITweenPlugin plugin;
|
ITweenPlugin plugin;
|
||||||
|
|||||||
@ -7,8 +7,13 @@
|
|||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening.Plugins.Options
|
namespace DG.Tweening.Plugins.Options
|
||||||
{
|
{
|
||||||
public struct ColorOptions
|
public struct ColorOptions : IPlugOptions
|
||||||
{
|
{
|
||||||
public bool alphaOnly;
|
public bool alphaOnly;
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
alphaOnly = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,8 +7,13 @@
|
|||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening.Plugins.Options
|
namespace DG.Tweening.Plugins.Options
|
||||||
{
|
{
|
||||||
public struct FloatOptions
|
public struct FloatOptions : IPlugOptions
|
||||||
{
|
{
|
||||||
public bool snapping;
|
public bool snapping;
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
snapping = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
15
_DOTween.Assembly/DOTween/Plugins/Options/IPlugOptions.cs
Normal file
15
_DOTween.Assembly/DOTween/Plugins/Options/IPlugOptions.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Author: Daniele Giardini - http://www.demigiant.com
|
||||||
|
// Created: 2016/12/08 11:50
|
||||||
|
// License Copyright (c) Daniele Giardini
|
||||||
|
// This work is subject to the terms at http://dotween.demigiant.com/license.php
|
||||||
|
namespace DG.Tweening.Plugins.Options
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Base interface for all tween plugins options
|
||||||
|
/// </summary>
|
||||||
|
public interface IPlugOptions
|
||||||
|
{
|
||||||
|
/// <summary>Resets the plugin</summary>
|
||||||
|
void Reset();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -7,5 +7,8 @@
|
|||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening.Plugins.Options
|
namespace DG.Tweening.Plugins.Options
|
||||||
{
|
{
|
||||||
public struct NoOptions {}
|
public struct NoOptions : IPlugOptions
|
||||||
|
{
|
||||||
|
public void Reset() {}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -17,7 +17,7 @@ namespace DG.Tweening.Plugins.Options
|
|||||||
LookAtPosition
|
LookAtPosition
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct PathOptions
|
public struct PathOptions : IPlugOptions
|
||||||
{
|
{
|
||||||
public PathMode mode;
|
public PathMode mode;
|
||||||
public OrientType orientType;
|
public OrientType orientType;
|
||||||
@ -33,5 +33,22 @@ namespace DG.Tweening.Plugins.Options
|
|||||||
|
|
||||||
internal Quaternion startupRot; // Used to reset orientation when rewinding
|
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
|
internal float startupZRot; // Used to store Z value in case of lock Z, in order to rotate things differently
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
mode = PathMode.Ignore;
|
||||||
|
orientType = OrientType.None;
|
||||||
|
lockPositionAxis = lockRotationAxis = AxisConstraint.None;
|
||||||
|
isClosedPath = false;
|
||||||
|
lookAtPosition = Vector3.zero;
|
||||||
|
lookAtTransform = null;
|
||||||
|
lookAhead = 0;
|
||||||
|
hasCustomForwardDirection = false;
|
||||||
|
forward = Quaternion.identity;
|
||||||
|
useLocalPosition = false;
|
||||||
|
parent = null;
|
||||||
|
startupRot = Quaternion.identity;
|
||||||
|
startupZRot = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -9,10 +9,17 @@ using UnityEngine;
|
|||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening.Plugins.Options
|
namespace DG.Tweening.Plugins.Options
|
||||||
{
|
{
|
||||||
public struct QuaternionOptions
|
public struct QuaternionOptions : IPlugOptions
|
||||||
{
|
{
|
||||||
internal RotateMode rotateMode;
|
internal RotateMode rotateMode;
|
||||||
internal AxisConstraint axisConstraint; // Used by SpecialStartupMode SetLookAt
|
internal AxisConstraint axisConstraint; // Used by SpecialStartupMode SetLookAt
|
||||||
internal Vector3 up; // Used by SpecialStartupMode SetLookAt
|
internal Vector3 up; // Used by SpecialStartupMode SetLookAt
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
rotateMode = RotateMode.Fast;
|
||||||
|
axisConstraint = AxisConstraint.None;
|
||||||
|
up = Vector3.zero;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,8 +7,13 @@
|
|||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening.Plugins.Options
|
namespace DG.Tweening.Plugins.Options
|
||||||
{
|
{
|
||||||
public struct RectOptions
|
public struct RectOptions : IPlugOptions
|
||||||
{
|
{
|
||||||
public bool snapping;
|
public bool snapping;
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
snapping = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,7 +7,7 @@
|
|||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening.Plugins.Options
|
namespace DG.Tweening.Plugins.Options
|
||||||
{
|
{
|
||||||
public struct StringOptions
|
public struct StringOptions : IPlugOptions
|
||||||
{
|
{
|
||||||
public bool richTextEnabled;
|
public bool richTextEnabled;
|
||||||
public ScrambleMode scrambleMode;
|
public ScrambleMode scrambleMode;
|
||||||
@ -15,5 +15,13 @@ namespace DG.Tweening.Plugins.Options
|
|||||||
|
|
||||||
// Stored by StringPlugin
|
// Stored by StringPlugin
|
||||||
internal int startValueStrippedLength, changeValueStrippedLength; // No-tag lengths of start and change value
|
internal int startValueStrippedLength, changeValueStrippedLength; // No-tag lengths of start and change value
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
richTextEnabled = false;
|
||||||
|
scrambleMode = ScrambleMode.None;
|
||||||
|
scrambledChars = null;
|
||||||
|
startValueStrippedLength = changeValueStrippedLength = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,8 +6,13 @@
|
|||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening.Plugins.Options
|
namespace DG.Tweening.Plugins.Options
|
||||||
{
|
{
|
||||||
public struct UintOptions
|
public struct UintOptions : IPlugOptions
|
||||||
{
|
{
|
||||||
public bool isNegativeChangeValue; // Necessary because uints can't obviously be negative
|
public bool isNegativeChangeValue; // Necessary because uints can't obviously be negative
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
isNegativeChangeValue = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,11 +7,18 @@
|
|||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening.Plugins.Options
|
namespace DG.Tweening.Plugins.Options
|
||||||
{
|
{
|
||||||
public struct Vector3ArrayOptions
|
public struct Vector3ArrayOptions : IPlugOptions
|
||||||
{
|
{
|
||||||
public AxisConstraint axisConstraint;
|
public AxisConstraint axisConstraint;
|
||||||
public bool snapping;
|
public bool snapping;
|
||||||
|
|
||||||
internal float[] durations; // Duration of each segment
|
internal float[] durations; // Duration of each segment
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
axisConstraint = AxisConstraint.None;
|
||||||
|
snapping = false;
|
||||||
|
durations = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -7,9 +7,15 @@
|
|||||||
#pragma warning disable 1591
|
#pragma warning disable 1591
|
||||||
namespace DG.Tweening.Plugins.Options
|
namespace DG.Tweening.Plugins.Options
|
||||||
{
|
{
|
||||||
public struct VectorOptions
|
public struct VectorOptions : IPlugOptions
|
||||||
{
|
{
|
||||||
public AxisConstraint axisConstraint;
|
public AxisConstraint axisConstraint;
|
||||||
public bool snapping;
|
public bool snapping;
|
||||||
|
|
||||||
|
public void Reset()
|
||||||
|
{
|
||||||
|
axisConstraint = AxisConstraint.None;
|
||||||
|
snapping = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -69,7 +69,7 @@ namespace DG.Tweening
|
|||||||
internal static bool Setup<T1, T2, TPlugOptions>(
|
internal static bool Setup<T1, T2, TPlugOptions>(
|
||||||
TweenerCore<T1, T2, TPlugOptions> t, DOGetter<T1> getter, DOSetter<T1> setter, T2 endValue, float duration, ABSTweenPlugin<T1, T2, TPlugOptions> plugin = null
|
TweenerCore<T1, T2, TPlugOptions> t, DOGetter<T1> getter, DOSetter<T1> setter, T2 endValue, float duration, ABSTweenPlugin<T1, T2, TPlugOptions> plugin = null
|
||||||
)
|
)
|
||||||
where TPlugOptions : struct
|
where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
if (plugin != null) t.tweenPlugin = plugin;
|
if (plugin != null) t.tweenPlugin = plugin;
|
||||||
else {
|
else {
|
||||||
@ -99,7 +99,7 @@ namespace DG.Tweening
|
|||||||
// CALLED BY TweenerCore
|
// CALLED BY TweenerCore
|
||||||
// Returns the elapsed time minus delay in case of success,
|
// Returns the elapsed time minus delay in case of success,
|
||||||
// -1 if there are missing references and the tween needs to be killed
|
// -1 if there are missing references and the tween needs to be killed
|
||||||
internal static float DoUpdateDelay<T1, T2, TPlugOptions>(TweenerCore<T1, T2, TPlugOptions> t, float elapsed) where TPlugOptions : struct
|
internal static float DoUpdateDelay<T1, T2, TPlugOptions>(TweenerCore<T1, T2, TPlugOptions> t, float elapsed) where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
float tweenDelay = t.delay;
|
float tweenDelay = t.delay;
|
||||||
if (elapsed > tweenDelay) {
|
if (elapsed > tweenDelay) {
|
||||||
@ -116,7 +116,7 @@ namespace DG.Tweening
|
|||||||
// (unless it's a FROM tween, in which case it will be called BEFORE any eventual delay).
|
// (unless it's a FROM tween, in which case it will be called BEFORE any eventual delay).
|
||||||
// Returns TRUE in case of success,
|
// Returns TRUE in case of success,
|
||||||
// FALSE if there are missing references and the tween needs to be killed
|
// FALSE if there are missing references and the tween needs to be killed
|
||||||
internal static bool DoStartup<T1, T2, TPlugOptions>(TweenerCore<T1, T2, TPlugOptions> t) where TPlugOptions : struct
|
internal static bool DoStartup<T1, T2, TPlugOptions>(TweenerCore<T1, T2, TPlugOptions> t) where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
t.startupDone = true;
|
t.startupDone = true;
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ namespace DG.Tweening
|
|||||||
// CALLED BY TweenerCore
|
// CALLED BY TweenerCore
|
||||||
internal static Tweener DoChangeStartValue<T1, T2, TPlugOptions>(
|
internal static Tweener DoChangeStartValue<T1, T2, TPlugOptions>(
|
||||||
TweenerCore<T1, T2, TPlugOptions> t, T2 newStartValue, float newDuration
|
TweenerCore<T1, T2, TPlugOptions> t, T2 newStartValue, float newDuration
|
||||||
) where TPlugOptions : struct
|
) where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
t.hasManuallySetStartValue = true;
|
t.hasManuallySetStartValue = true;
|
||||||
t.startValue = newStartValue;
|
t.startValue = newStartValue;
|
||||||
@ -178,7 +178,7 @@ namespace DG.Tweening
|
|||||||
// CALLED BY TweenerCore
|
// CALLED BY TweenerCore
|
||||||
internal static Tweener DoChangeEndValue<T1, T2, TPlugOptions>(
|
internal static Tweener DoChangeEndValue<T1, T2, TPlugOptions>(
|
||||||
TweenerCore<T1, T2, TPlugOptions> t, T2 newEndValue, float newDuration, bool snapStartValue
|
TweenerCore<T1, T2, TPlugOptions> t, T2 newEndValue, float newDuration, bool snapStartValue
|
||||||
) where TPlugOptions : struct
|
) where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
t.endValue = newEndValue;
|
t.endValue = newEndValue;
|
||||||
t.isRelative = false;
|
t.isRelative = false;
|
||||||
@ -215,7 +215,7 @@ namespace DG.Tweening
|
|||||||
|
|
||||||
internal static Tweener DoChangeValues<T1, T2, TPlugOptions>(
|
internal static Tweener DoChangeValues<T1, T2, TPlugOptions>(
|
||||||
TweenerCore<T1, T2, TPlugOptions> t, T2 newStartValue, T2 newEndValue, float newDuration
|
TweenerCore<T1, T2, TPlugOptions> t, T2 newStartValue, T2 newEndValue, float newDuration
|
||||||
) where TPlugOptions : struct
|
) where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
t.hasManuallySetStartValue = true;
|
t.hasManuallySetStartValue = true;
|
||||||
t.isRelative = t.isFrom = false;
|
t.isRelative = t.isFrom = false;
|
||||||
@ -243,7 +243,7 @@ namespace DG.Tweening
|
|||||||
// Commands shared by DOStartup/ChangeStart/End/Values if the tween has already started up
|
// Commands shared by DOStartup/ChangeStart/End/Values if the tween has already started up
|
||||||
// and thus some settings needs to be reapplied.
|
// and thus some settings needs to be reapplied.
|
||||||
// Returns TRUE in case of SUCCESS, FALSE if there were managed errors
|
// Returns TRUE in case of SUCCESS, FALSE if there were managed errors
|
||||||
static bool DOStartupSpecials<T1, T2, TPlugOptions>(TweenerCore<T1, T2, TPlugOptions> t) where TPlugOptions : struct
|
static bool DOStartupSpecials<T1, T2, TPlugOptions>(TweenerCore<T1, T2, TPlugOptions> t) where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
switch (t.specialStartupMode) {
|
switch (t.specialStartupMode) {
|
||||||
@ -262,11 +262,11 @@ namespace DG.Tweening
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} catch {
|
} catch {
|
||||||
// Erro in SpecialPluginUtils (usually due to target being destroyed)
|
// Error in SpecialPluginUtils (usually due to target being destroyed)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void DOStartupDurationBased<T1, T2, TPlugOptions>(TweenerCore<T1, T2, TPlugOptions> t) where TPlugOptions : struct
|
static void DOStartupDurationBased<T1, T2, TPlugOptions>(TweenerCore<T1, T2, TPlugOptions> t) where TPlugOptions : struct, IPlugOptions
|
||||||
{
|
{
|
||||||
if (t.isSpeedBased) t.duration = t.tweenPlugin.GetSpeedBasedDuration(t.plugOptions, t.duration, t.changeValue);
|
if (t.isSpeedBased) t.duration = t.tweenPlugin.GetSpeedBasedDuration(t.plugOptions, t.duration, t.changeValue);
|
||||||
t.fullDuration = t.loops > -1 ? t.duration * t.loops : Mathf.Infinity;
|
t.fullDuration = t.loops > -1 ? t.duration * t.loops : Mathf.Infinity;
|
||||||
|
|||||||
@ -891,6 +891,14 @@
|
|||||||
<param name="perc">The percentage (0 to 1) at which to get the point</param>
|
<param name="perc">The percentage (0 to 1) at which to get the point</param>
|
||||||
<param name="convertToConstantPerc">If TRUE constant speed is taken into account, otherwise not</param>
|
<param name="convertToConstantPerc">If TRUE constant speed is taken into account, otherwise not</param>
|
||||||
</member>
|
</member>
|
||||||
|
<member name="T:DG.Tweening.Plugins.Options.IPlugOptions">
|
||||||
|
<summary>
|
||||||
|
Base interface for all tween plugins options
|
||||||
|
</summary>
|
||||||
|
</member>
|
||||||
|
<member name="M:DG.Tweening.Plugins.Options.IPlugOptions.Reset">
|
||||||
|
<summary>Resets the plugin</summary>
|
||||||
|
</member>
|
||||||
<member name="T:DG.Tweening.Plugins.Vector3ArrayPlugin">
|
<member name="T:DG.Tweening.Plugins.Vector3ArrayPlugin">
|
||||||
<summary>
|
<summary>
|
||||||
This plugin generates some GC allocations at startup
|
This plugin generates some GC allocations at startup
|
||||||
|
|||||||
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