Skip to content

Commit

Permalink
-update: Prime tween 1.1.19
Browse files Browse the repository at this point in the history
  • Loading branch information
DucNV2000 committed May 29, 2024
1 parent 5b9d484 commit 2842e42
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
13 changes: 10 additions & 3 deletions VirtueSky/PrimeTween/Editor/CodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ internal void generateAllMethods() {
}

const string generatorBeginLabel = "// CODE GENERATOR BEGIN";
const string textMeshProScriptingDefine = "#if TEXT_MESH_PRO_INSTALLED || (UNITY_6000_0_OR_NEWER && UNITY_UGUI_INSTALLED)";

[ContextMenu(nameof(generateTweenComponent))]
void generateTweenComponent() {
Expand Down Expand Up @@ -105,9 +106,11 @@ void generateTweenComponent() {
switch (dependency) {
case Dependency.PRIME_TWEEN_EXPERIMENTAL:
case Dependency.UI_ELEMENTS_MODULE_INSTALLED:
case Dependency.TEXT_MESH_PRO_INSTALLED:
str += $" #if {dependency}\n";
break;
case Dependency.TEXT_MESH_PRO_INSTALLED:
str += $" {textMeshProScriptingDefine}\n";
break;
default:
str += $" #if !UNITY_2019_1_OR_NEWER || {dependency}\n";
break;
Expand Down Expand Up @@ -272,9 +275,11 @@ internal static (PropType, Type) TweenTypeToTweenData(TweenType tweenType) {
switch (dependency) {
case Dependency.PRIME_TWEEN_EXPERIMENTAL:
case Dependency.UI_ELEMENTS_MODULE_INSTALLED:
case Dependency.TEXT_MESH_PRO_INSTALLED:
utilsText += $" #if {dependency}\n";
break;
case Dependency.TEXT_MESH_PRO_INSTALLED:
utilsText += $" {textMeshProScriptingDefine}\n";
break;
default:
utilsText += $" #if !UNITY_2019_1_OR_NEWER || {dependency}\n";
break;
Expand Down Expand Up @@ -385,9 +390,11 @@ static string generateWithDefines([NotNull] Func<MethodGenerationData, string> g
switch (dependency) {
case Dependency.PRIME_TWEEN_EXPERIMENTAL:
case Dependency.UI_ELEMENTS_MODULE_INSTALLED:
case Dependency.TEXT_MESH_PRO_INSTALLED:
result += $"\n #if {dependency}";
break;
case Dependency.TEXT_MESH_PRO_INSTALLED:
result += $"\n {textMeshProScriptingDefine}";
break;
default:
result += $"\n #if !UNITY_2019_1_OR_NEWER || {dependency}";
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public static partial class DOTweenAdapter {
#endif
#if UI_ELEMENTS_MODULE_INSTALLED
#endif
#if TEXT_MESH_PRO_INSTALLED
#if TEXT_MESH_PRO_INSTALLED || (UNITY_6000_0_OR_NEWER && UNITY_UGUI_INSTALLED)
public static Tween DOMaxVisibleCharacters([NotNull] this TMPro.TMP_Text target, int endValue, float duration) => Tween.TextMaxVisibleCharacters(target, endValue, duration);

#endif
Expand Down
2 changes: 1 addition & 1 deletion VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1751,7 +1751,7 @@ public static Tween VisualElementBackgroundColor([NotNull] UnityEngine.UIElement
}

#endif
#if TEXT_MESH_PRO_INSTALLED
#if TEXT_MESH_PRO_INSTALLED || (UNITY_6000_0_OR_NEWER && UNITY_UGUI_INSTALLED)
public static Tween TextMaxVisibleCharacters([NotNull] TMPro.TMP_Text target, int endValue, float duration, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false)
=> TextMaxVisibleCharacters(target, new TweenSettings<int>(endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)));
public static Tween TextMaxVisibleCharacters([NotNull] TMPro.TMP_Text target, int endValue, float duration, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false)
Expand Down
2 changes: 1 addition & 1 deletion VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public static Tween Scale([NotNull] Transform target, TweenSettings<float> unifo
public static Tween Rotation([NotNull] Transform target, TweenSettings<Vector3> eulerAnglesSettings) => Rotation(target, toQuaternion(eulerAnglesSettings));
public static Tween LocalRotation([NotNull] Transform target, TweenSettings<Vector3> localEulerAnglesSettings) => LocalRotation(target, toQuaternion(localEulerAnglesSettings));
static TweenSettings<Quaternion> toQuaternion(TweenSettings<Vector3> s) => new TweenSettings<Quaternion>(Quaternion.Euler(s.startValue), Quaternion.Euler(s.endValue), s.settings) { startFromCurrent = s.startFromCurrent };
#if TEXT_MESH_PRO_INSTALLED
#if TEXT_MESH_PRO_INSTALLED || (UNITY_6000_0_OR_NEWER && UNITY_UGUI_INSTALLED)
public static Tween TextMaxVisibleCharacters([NotNull] TMPro.TMP_Text target, TweenSettings<int> settings) {
int oldCount = target.textInfo.characterCount;
target.ForceMeshUpdate();
Expand Down
6 changes: 5 additions & 1 deletion VirtueSky/PrimeTween/Runtime/Internal/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,12 +196,16 @@ internal static (PropType, Type) TweenTypeToTweenData(TweenType tweenType) {
case TweenType.VisualElementBackgroundColor:
return (PropType.Color, typeof(UnityEngine.UIElements.VisualElement));
#endif
#if TEXT_MESH_PRO_INSTALLED
#if TEXT_MESH_PRO_INSTALLED || (UNITY_6000_0_OR_NEWER && UNITY_UGUI_INSTALLED)
case TweenType.TextMaxVisibleCharacters:
return (PropType.Int, typeof(TMPro.TMP_Text));
#endif
case TweenType.None:
return (PropType.None, null);
#if PRIME_TWEEN_PRO
case TweenType.TweenComponent:
return (PropType.None, typeof(PrimeTween.TweenComponent));
#endif
case TweenType.Delay:
return (PropType.Float, null);
case TweenType.Callback:
Expand Down
2 changes: 1 addition & 1 deletion VirtueSky/PrimeTween/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.1.18
v1.1.19

0 comments on commit 2842e42

Please sign in to comment.