Skip to content

Commit

Permalink
update tween 1.1.10
Browse files Browse the repository at this point in the history
  • Loading branch information
VirtueSky committed Jan 17, 2024
1 parent 624f708 commit bffb83f
Show file tree
Hide file tree
Showing 12 changed files with 208 additions and 219 deletions.
Binary file added VirtueSky/PrimeTween/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion VirtueSky/PrimeTween/Editor/CodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ void generateDotweenMethods() {
namespace PrimeTween {
[PublicAPI]
public static partial class DOTweenAdapter {";
const string dotweenOverload = " public static Tween DOTWEEN_METHOD_NAME([NotNull] this UnityEngine.Camera target, Single endValue, float duration) => Tween.METHOD_NAME(target, endValue, duration, defaultDotweenEase);";
const string dotweenOverload = " public static Tween DOTWEEN_METHOD_NAME([NotNull] this UnityEngine.Camera target, Single endValue, float duration) => Tween.METHOD_NAME(target, endValue, duration);";
str += generateWithDefines(data => {
if (!data.dotweenMethodName.Any()) {
return string.Empty;
Expand Down
2 changes: 1 addition & 1 deletion VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public override void OnInspectorGUI() {
GUILayout.EndHorizontal();

GUILayout.BeginHorizontal();
GUILayout.Label( Constants.maxAliveTweens + "", EditorStyles.label);
GUILayout.Label( Constants.maxAliveTweens, EditorStyles.label);
GUILayout.Label(manager.maxSimultaneousTweensCount.ToString(), EditorStyles.boldLabel);
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
Expand Down
1 change: 1 addition & 0 deletions VirtueSky/PrimeTween/Runtime/Internal/Assert.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ static string TryAddStackTrace([CanBeNull] string msg, int tweenId) {
}

#if UNITY_ASSERTIONS && !PRIME_TWEEN_DISABLE_ASSERTIONS
[ContractAnnotation("condition:false => halt")]
internal static void IsTrue(bool condition, int? tweenId = null, string msg = null) => UnityEngine.Assertions.Assert.IsTrue(condition, AddStackTrace(!condition, msg, tweenId));
internal static void AreEqual<T>(T expected, T actual, string msg = null) => UnityEngine.Assertions.Assert.AreEqual(expected, actual, msg);
internal static void AreNotEqual<T>(T expected, T actual, string msg = null) => UnityEngine.Assertions.Assert.AreNotEqual(expected, actual, msg);
Expand Down
5 changes: 4 additions & 1 deletion VirtueSky/PrimeTween/Runtime/Internal/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ internal static class Constants {
"Use Stop()/Complete()/isPaused/timeScale/elapsedTime/etc. of their parent Sequence instead.\n";
[NotNull]
internal static string buildWarningCanBeDisabledMessage(string settingName) {
return $"To disable this warning, disable the '{nameof(PrimeTweenConfig)}.{settingName}' setting.";
return $"To disable this warning, set '{nameof(PrimeTweenConfig)}.{settingName} = false;'.";
}

internal const string isDeadMessage = "Tween/Sequence is not alive. Please check the 'isAlive' property before calling this API.\n";
Expand Down Expand Up @@ -40,6 +40,9 @@ internal static string buildWarningCanBeDisabledMessage(string settingName) {
internal const string maxAliveTweens = "Max alive tweens";
internal const string sequenceAlreadyStarted = "Sequence has already been started, it's not allowed to manipulate it anymore.";
internal const string recursiveCallError = "Please don't call this API recursively from Tween.Custom() or tween.OnUpdate().";
internal const string nestSequenceTwiceError = "Sequence can be nested in other sequence only once.";
internal const string nestTweenTwiceError = "A tween can be added to a sequence only once and can only belong to one sequence.";
internal const string addDeadTweenToSequenceError = "It's not allowed to add 'dead' tweens to a sequence.";

#if UNITY_EDITOR
internal const string editModeWarning = "Please don't call PrimeTween's API in Edit mode (while the scene is not playing).";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// ReSharper disable UnusedMember.Global
// ReSharper disable UnusedType.Global
// ReSharper disable UnusedParameter.Local
#if PRIME_TWEEN_DOTWEEN_ADAPTER
using System;
using System.Collections;
Expand All @@ -9,8 +8,6 @@

namespace PrimeTween {
public static partial class DOTweenAdapter {
const Ease defaultDotweenEase = Ease.OutQuad;

static int remapFrequency(float frequency) {
return (int) (frequency * 1.35f);
}
Expand Down Expand Up @@ -76,15 +73,15 @@ public static Tween DOPunchScale([NotNull] this Component target, Vector3 punch,
}

public static Tween DORotate([NotNull] this Transform target, Vector3 endValue, float duration) {
return Tween.Rotation(target, Quaternion.Euler(endValue), duration, defaultDotweenEase);
return Tween.Rotation(target, Quaternion.Euler(endValue), duration);
}

public static Tween DOLocalRotate([NotNull] this Transform target, Vector3 endValue, float duration) {
return Tween.LocalRotation(target, Quaternion.Euler(endValue), duration, defaultDotweenEase);
return Tween.LocalRotation(target, Quaternion.Euler(endValue), duration);
}

public static Tween DOScale([NotNull] this Transform target, Single endValue, float duration) {
return Tween.Scale(target, endValue, duration, defaultDotweenEase);
return Tween.Scale(target, endValue, duration);
}

public static int DOKill([NotNull] this Component target, bool complete = false) => doKill_internal(target, complete);
Expand All @@ -98,10 +95,15 @@ internal static int doKill_internal([CanBeNull] object target, bool complete = f
return result;
}

// public static Tween DOTWEEN_METHOD_NAME([NotNull] this UnityEngine.Camera target, Single endValue, float duration) => Tween.METHOD_NAME(target, endValue, duration, defaultDotweenEase);
// public static Tween DOTWEEN_METHOD_NAME([NotNull] this UnityEngine.Camera target, Single endValue, float duration) => Tween.METHOD_NAME(target, endValue, duration);
}

public static class DOTween {
public static Ease defaultEaseType {
get => PrimeTweenConfig.defaultEase;
set => PrimeTweenConfig.defaultEase = value;
}

public static Sequence Sequence() => PrimeTween.Sequence.Create();

public static void Kill([NotNull] object target, bool complete = false) => DOTweenAdapter.doKill_internal(target, complete);
Expand Down Expand Up @@ -156,10 +158,10 @@ public Sequence Join(Tween other) {
/// <summary>Schedules <see cref="other"/> after the last added tween.
/// Internal because this API is hard to understand, but needed for adapter.</summary>
internal Sequence ChainLast(Tween other) {
if (!tryManipulate()) {
return this;
if (tryManipulate()) {
Insert(getLastInSelfOrRoot().durationWithWaitDelay, other);
}
return chain(other, getLastInSelfOrRoot().durationWithWaitDelay);
return this;
}

public Sequence Append(Sequence other) => Chain(other);
Expand Down Expand Up @@ -215,7 +217,7 @@ public Sequence OnStepComplete([NotNull] Action action) {
}

public Sequence PrependInterval(float interval) {
if (!tryManipulate() || !validateCanAddChildren()) {
if (!ValidateCanManipulateSequence()) {
return this;
}
foreach (var t in getSelfChildren()) {
Expand All @@ -236,10 +238,9 @@ public Sequence SetUpdate(bool isIndependentUpdate) {

public IEnumerator WaitForCompletion() => ToYieldInstruction();

/// <summary>It's safe to destroy objects with running animations in PrimeTween, so this adapter method does nothing. More info: https://github.com/KyryloKuzyk/PrimeTween/discussions/4</summary>
[PublicAPI]
public Sequence SetLink(GameObject gameObject) {
return this;
}
public Sequence SetLink(GameObject gameObject) => this;
}

public partial struct Tween {
Expand Down
Loading

0 comments on commit bffb83f

Please sign in to comment.