From b413ce3f79172244d7230eb69d36263f17a2e85f Mon Sep 17 00:00:00 2001 From: DucNV Date: Tue, 3 Dec 2024 10:18:30 +0700 Subject: [PATCH 01/10] - update prime tween 1.2.1 Co-Authored-By: VirtueSky <126542083+VirtueSky@users.noreply.github.com> --- .../PrimeTween/Editor/AssemblyInfo.cs.meta | 2 +- .../Editor/CodeGenerator.asset.meta | 2 +- VirtueSky/PrimeTween/Editor/CodeGenerator.cs | 1 + .../PrimeTween/Editor/CodeGenerator.cs.meta | 2 +- .../PrimeTween/Editor/CodeTemplates.cs.meta | 2 +- .../Editor/PrimeTweenManagerInspector.cs.meta | 2 +- .../Editor/TweenSettingsPropDrawer.cs | 25 +++++++------- .../Editor/TweenSettingsPropDrawer.cs.meta | 2 +- .../TweenSettingsTypesPropDrawer.cs.meta | 2 +- .../Editor/TweenShakeSettingsPropDrawer.cs | 2 +- .../TweenShakeSettingsPropDrawer.cs.meta | 2 +- .../ValueContainerStartEndPropDrawer.cs | 34 ++++++++++++------- .../ValueContainerStartEndPropDrawer.cs.meta | 2 +- VirtueSky/PrimeTween/Runtime/Easing.cs.meta | 2 +- VirtueSky/PrimeTween/Runtime/Internal.meta | 2 +- .../Runtime/Internal/AssemblyInfo.cs.meta | 2 +- .../Runtime/Internal/Assert.cs.meta | 2 +- .../Runtime/Internal/AsyncAwaitSupport.cs | 2 +- .../Internal/AsyncAwaitSupport.cs.meta | 2 +- .../PrimeTween/Runtime/Internal/Constants.cs | 4 +++ .../Runtime/Internal/Constants.cs.meta | 2 +- .../Runtime/Internal/CoroutinesSupport.cs | 16 +++++---- .../Internal/CoroutinesSupport.cs.meta | 2 +- .../Runtime/Internal/DOTweenAdapter.meta | 2 +- .../DOTweenAdapter/DOTweenAdapter.cs.meta | 2 +- .../DOTweenAdapterGenerated.cs.meta | 2 +- .../Runtime/Internal/Extensions.cs.meta | 2 +- .../Runtime/Internal/ITween.cs.meta | 2 +- .../Runtime/Internal/Obsolete.cs.meta | 2 +- .../Runtime/Internal/PrimeTweenManager.cs | 3 +- .../Internal/PrimeTweenManager.cs.meta | 2 +- .../Runtime/Internal/PropType.cs.meta | 2 +- .../Runtime/Internal/ReusableTween.cs | 3 +- .../Runtime/Internal/ReusableTween.cs.meta | 2 +- .../Runtime/Internal/StackTraces.cs.meta | 2 +- .../Runtime/Internal/StandardEasing.cs.meta | 2 +- .../Runtime/Internal/TweenGenerated.cs | 1 + .../Runtime/Internal/TweenGenerated.cs.meta | 2 +- .../Runtime/Internal/TweenMethods.cs | 2 +- .../Runtime/Internal/TweenMethods.cs.meta | 2 +- .../PrimeTween/Runtime/Internal/Utils.cs | 2 ++ .../PrimeTween/Runtime/Internal/Utils.cs.meta | 2 +- .../Runtime/Internal/ValueContainer.cs | 6 ++-- .../Runtime/Internal/ValueContainer.cs.meta | 2 +- .../Runtime/PrimeTweenConfig.cs.meta | 2 +- VirtueSky/PrimeTween/Runtime/Sequence.cs | 2 +- VirtueSky/PrimeTween/Runtime/Sequence.cs.meta | 2 +- VirtueSky/PrimeTween/Runtime/Shake.cs | 8 +++-- VirtueSky/PrimeTween/Runtime/Shake.cs.meta | 2 +- .../PrimeTween/Runtime/ShakeSettings.cs.meta | 2 +- VirtueSky/PrimeTween/Runtime/Tween.cs | 2 +- VirtueSky/PrimeTween/Runtime/Tween.cs.meta | 2 +- VirtueSky/PrimeTween/Runtime/TweenSettings.cs | 6 ++-- .../PrimeTween/Runtime/TweenSettings.cs.meta | 2 +- .../PrimeTween/Runtime/TweenSettingsT.cs.meta | 2 +- 55 files changed, 108 insertions(+), 87 deletions(-) diff --git a/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta b/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta index b825c589..7ed2f240 100644 --- a/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta +++ b/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: a3c27f8cb2a846f589acacc063d08498 +guid: 77f31680944e5534e8ed7d89b9d6a99a timeCreated: 1683538561 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta b/VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta index 0702eb76..8b2d7c57 100644 --- a/VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta +++ b/VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: b7964af3ed0024db49a5758e8a4de1c6 +guid: 5b5aaa5611b385541ab2b0cb1d8755e1 NativeFormatImporter: externalObjects: {} mainObjectFileID: 11400000 diff --git a/VirtueSky/PrimeTween/Editor/CodeGenerator.cs b/VirtueSky/PrimeTween/Editor/CodeGenerator.cs index d44d57c5..0b16493d 100644 --- a/VirtueSky/PrimeTween/Editor/CodeGenerator.cs +++ b/VirtueSky/PrimeTween/Editor/CodeGenerator.cs @@ -304,6 +304,7 @@ internal static (PropType, Type) TweenTypeToTweenData(TweenType tweenType) { (TweenType.ShakeLocalRotation, PropType.Quaternion, typeof(Transform)), (TweenType.ShakeScale, PropType.Vector3, typeof(Transform)), (TweenType.ShakeCustom, PropType.Vector3, typeof(Transform)), + (TweenType.ShakeCamera, PropType.Float, typeof(Camera)), (TweenType.CustomFloat, PropType.Float, null), (TweenType.CustomColor, PropType.Color, null), (TweenType.CustomVector2, PropType.Vector2, null), diff --git a/VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta b/VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta index 38d5027b..adc33218 100644 --- a/VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta +++ b/VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: f81c141b47ab4aee9ea1454818ce73d3 +guid: 91062890830ba3f44ae278f19424d5ad timeCreated: 1673348438 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta b/VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta index f01230aa..beaef6e5 100644 --- a/VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta +++ b/VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 566b3920ae914b24909cd26d64c86e77 +guid: 13ce4156fb592254ab2f13dd0ab0bf52 timeCreated: 1677166276 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta b/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta index fb4ed9fe..46c8d37c 100644 --- a/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta +++ b/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 98b4466711c04e95b1d84f31e10116ba +guid: 7c9dce2090ecb50459c38684398a3adb timeCreated: 1683813842 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs b/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs index aa0b5f6d..84e12752 100644 --- a/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs +++ b/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs @@ -1,3 +1,4 @@ +using System; using JetBrains.Annotations; using PrimeTween; using UnityEditor; @@ -56,30 +57,30 @@ public override void OnGUI(Rect position, [NotNull] SerializedProperty property, internal static void DrawDuration(Rect rect, [NotNull] SerializedProperty property) { if (GUI.enabled) { - if (property.floatValue == 0f) { - property.floatValue = 1f; - } else if (property.floatValue < 0) { - property.floatValue = 0.01f; - } + ClampProperty(property, 1f); } PropertyField(rect, property); } + internal static void ClampProperty(SerializedProperty prop, float defaultValue, float min = 0.01f, float max = float.MaxValue) { + prop.floatValue = prop.floatValue == 0f ? defaultValue : Mathf.Clamp(prop.floatValue, min, max); + } + internal static void drawEaseTillEnd([NotNull] SerializedProperty property, ref Rect rect) { DrawEaseAndCycles(property, ref rect); drawStartDelayTillEnd(ref rect, property); } - internal static void DrawEaseAndCycles(SerializedProperty property, ref Rect rect, bool addSpace = true) { + internal static void DrawEaseAndCycles(SerializedProperty property, ref Rect rect, bool addSpace = true, bool draw = true) { { // ease property.NextVisible(true); - PropertyField(rect, property); + if (draw) PropertyField(rect, property); moveToNextLine(ref rect); // customEase bool isCustom = property.intValue == (int) Ease.Custom; property.NextVisible(true); if (isCustom) { - PropertyField(rect, property); + if (draw) PropertyField(rect, property); moveToNextLine(ref rect); } } @@ -87,13 +88,13 @@ internal static void DrawEaseAndCycles(SerializedProperty property, ref Rect rec rect.y += standardVerticalSpacing * 2; } { // cycles - var cycles = drawCycles(rect, property); + var cycles = drawCycles(rect, property, draw); moveToNextLine(ref rect); { // cycleMode property.NextVisible(true); if (cycles != 0 && cycles != 1) { - PropertyField(rect, property); + if (draw) PropertyField(rect, property); moveToNextLine(ref rect); } } @@ -123,14 +124,14 @@ internal static void drawStartDelayTillEnd(ref Rect rect, [NotNull] SerializedPr } } - internal static int drawCycles(Rect rect, [NotNull] SerializedProperty property) { + internal static int drawCycles(Rect rect, [NotNull] SerializedProperty property, bool draw = true) { property.NextVisible(false); if (property.intValue == 0) { property.intValue = 1; } else if (property.intValue < -1) { property.intValue = -1; } - PropertyField(rect, property); + if (draw) PropertyField(rect, property); return property.intValue; } diff --git a/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs.meta b/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs.meta index 26faeedb..a179809d 100644 --- a/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs.meta +++ b/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 142499da0ff44fac99f2ac376bbce331 +guid: f8f4d614305226a4abf7d56ed174e508 timeCreated: 1677570253 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta b/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta index 21bad296..e4c7e094 100644 --- a/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta +++ b/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 9e0988c54c7744db9aa91eae79ed7e5e +guid: f5dfc251024fd904d945310438915610 timeCreated: 1677747774 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs b/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs index 1a7ee081..e868d843 100644 --- a/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs +++ b/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs @@ -6,7 +6,7 @@ using static UnityEditor.EditorGUIUtility; [CustomPropertyDrawer(typeof(ShakeSettings))] -internal class TweenShakeSettingsPropDrawer : PropertyDrawer { +internal class TweenShakeSettingsPropDrawer : PropertyDrawer { // todo rename to ShakeSettingsPropDrawer public override float GetPropertyHeight([NotNull] SerializedProperty property, GUIContent label) { if (!property.isExpanded) { return singleLineHeight; diff --git a/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs.meta b/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs.meta index ee61c161..6f042fb0 100644 --- a/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs.meta +++ b/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: ccef20e0855347cdae977a49716d656f +guid: c4cf2c2465d1a5940b94c9560c2a879f timeCreated: 1677573071 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs b/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs index fbb9fb88..fcc40300 100644 --- a/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs +++ b/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs @@ -7,11 +7,14 @@ public class ValueContainerStartEndPropDrawer : PropertyDrawer { public override float GetPropertyHeight(SerializedProperty prop, GUIContent label) { prop.Next(true); - var propType = Utils.TweenTypeToTweenData((TweenType)prop.enumValueIndex).Item1; - if (propType == PropType.None) { - return 0f; - } + var tweenType = (TweenType)prop.enumValueIndex; prop.Next(false); + return GetHeight(prop, label, tweenType); + } + + internal static float GetHeight(SerializedProperty prop, GUIContent label, TweenType tweenType) { + var propType = Utils.TweenTypeToTweenData(tweenType).Item1; + Assert.AreNotEqual(PropType.None, propType); bool startFromCurrent = prop.boolValue; bool hasStartValue = !startFromCurrent; if (hasStartValue) { @@ -49,16 +52,18 @@ SerializedPropertyType ToSerializedPropType() { public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { prop.Next(true); - var propType = Utils.TweenTypeToTweenData((TweenType)prop.enumValueIndex).Item1; - if (propType == PropType.None) { - return; - } + var tweenType = (TweenType)prop.enumValueIndex; prop.Next(false); + Draw(ref pos, prop, tweenType); + } + internal static void Draw(ref Rect pos, SerializedProperty prop, TweenType tweenType) { + var propType = Utils.TweenTypeToTweenData(tweenType).Item1; + Assert.AreNotEqual(PropType.None, propType); const float toggleWidth = 18f; EditorGUIUtility.labelWidth -= toggleWidth; var togglePos = new Rect(pos.x + 2, pos.y, toggleWidth - 2, EditorGUIUtility.singleLineHeight); - var guiContent = EditorGUI.BeginProperty(togglePos, new GUIContent(), prop); + var guiContent = EditorGUI.BeginProperty(togglePos, new GUIContent(), prop); // todo is it possible to display tooltip? tooltip is only displayed over the label, but I need to display it over the ToggleLeft EditorGUI.BeginChangeCheck(); bool newStartFromCurrent = !EditorGUI.ToggleLeft(togglePos, guiContent, !prop.boolValue); if (EditorGUI.EndChangeCheck()) { @@ -68,12 +73,11 @@ public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) pos.x += toggleWidth; pos.width -= toggleWidth; + prop.Next(false); if (newStartFromCurrent) { pos.height = EditorGUIUtility.singleLineHeight; - using (new EditorGUI.DisabledScope(false)) { - EditorGUI.LabelField(pos, new GUIContent(prop.displayName, prop.tooltip)); - } + EditorGUI.LabelField(pos, new GUIContent(prop.displayName, prop.tooltip)); prop.Next(false); } else { DrawValueContainer(ref pos, prop, propType); @@ -81,6 +85,10 @@ public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) pos.y += pos.height + EditorGUIUtility.standardVerticalSpacing; DrawValueContainer(ref pos, prop, propType); + pos.y += pos.height + EditorGUIUtility.standardVerticalSpacing; + + pos.x -= toggleWidth; + pos.width += toggleWidth; } static void DrawValueContainer(ref Rect pos, SerializedProperty prop, PropType propType) { @@ -107,7 +115,7 @@ ValueContainer DrawField(Rect position) { case PropType.Vector3: return EditorGUI.Vector3Field(position, guiContent, valueContainer.Vector3Val).ToContainer(); case PropType.Vector4: - case PropType.Quaternion: + case PropType.Quaternion: // todo don't draw quaternion return EditorGUI.Vector4Field(position, guiContent, valueContainer.Vector4Val).ToContainer(); case PropType.Rect: return EditorGUI.RectField(position, guiContent, valueContainer.RectVal).ToContainer(); diff --git a/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs.meta b/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs.meta index 4ab8b2b7..51e748d1 100644 --- a/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs.meta +++ b/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 6c08ff7f819145b987090598c6a13397 +guid: f165141ebcaf41e4ea0f7b0b044542b3 timeCreated: 1710625562 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Easing.cs.meta b/VirtueSky/PrimeTween/Runtime/Easing.cs.meta index f5453fea..253e3195 100644 --- a/VirtueSky/PrimeTween/Runtime/Easing.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Easing.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 5d7874887c74422a835daf3c70912dcf +guid: 0d15a36c09227af4a8b87a62c526710b timeCreated: 1695050976 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal.meta b/VirtueSky/PrimeTween/Runtime/Internal.meta index b5665c6a..e5f94483 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 7e94f642418940748d478b3f5e1a2cf7 +guid: 3df97bf12b41bc0409245d60fe7ac4a4 timeCreated: 1677165257 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/AssemblyInfo.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/AssemblyInfo.cs.meta index dc446672..1c6e8385 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/AssemblyInfo.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/AssemblyInfo.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 61f306d3fcd147d6819d3c8d1ec82489 +guid: 58f810eb1f699af42b88d44af5580099 timeCreated: 1674163732 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/Assert.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/Assert.cs.meta index cb671b48..008f0b75 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/Assert.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/Assert.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: c593ca227a744d37b174fc677404e1a9 +guid: ae72793d7d769434fb6654f624e0d743 timeCreated: 1686059830 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/AsyncAwaitSupport.cs b/VirtueSky/PrimeTween/Runtime/Internal/AsyncAwaitSupport.cs index b74db856..45de3bc7 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/AsyncAwaitSupport.cs +++ b/VirtueSky/PrimeTween/Runtime/Internal/AsyncAwaitSupport.cs @@ -38,7 +38,7 @@ public void OnCompleted([NotNull] Action continuation) { var wait = animate(tween.tween, ref infiniteSettings, t => { if (t._isAlive) { var target = t.target as ReusableTween; - if (t.intParam != target.id) { + if (t.longParam != target.id || !target._isAlive) { t.ForceComplete(); } } diff --git a/VirtueSky/PrimeTween/Runtime/Internal/AsyncAwaitSupport.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/AsyncAwaitSupport.cs.meta index c9a778c9..2e2c7161 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/AsyncAwaitSupport.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/AsyncAwaitSupport.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 3aad1100da5540a191e769695ce94322 +guid: bb010708e48fbe340bff3f70eebffdcf timeCreated: 1678262334 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/Constants.cs b/VirtueSky/PrimeTween/Runtime/Internal/Constants.cs index 12e238bb..01b14865 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/Constants.cs +++ b/VirtueSky/PrimeTween/Runtime/Internal/Constants.cs @@ -17,7 +17,11 @@ internal static string buildWarningCanBeDisabledMessage(string settingName) { internal const string isDeadMessage = "Tween/Sequence is not alive. Please check the 'isAlive' property before calling this API.\n"; internal const string unscaledTimeTooltip = "The tween will use real time, ignoring Time.timeScale."; + internal const string easeTooltip = "The easing curve of an animation.\n\n" + + "Default is Ease." + nameof(Ease.OutQuad) + ". The Default ease can be modified via '" + nameof(PrimeTweenConfig) + "." + nameof(PrimeTweenConfig.defaultEase) + "' setting.\n\n" + + "Set to " + nameof(Ease) + "." + nameof(Ease.Custom) + " to control the easing with custom " + nameof(AnimationCurve) + "."; internal const string cyclesTooltip = "Setting cycles to -1 will repeat the tween indefinitely."; + internal const string cycleModeTooltip = "See the documentation of each cycle mode by hoovering the dropdown."; internal const string defaultCtorError = "Tween or Sequence is not created properly.\n" + "- Use Sequence." + nameof(Sequence.Create) + "() to start a Sequence.\n" + "- Use static 'Tween.' methods to start a Tween.\n"; diff --git a/VirtueSky/PrimeTween/Runtime/Internal/Constants.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/Constants.cs.meta index e897b480..8876661c 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/Constants.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/Constants.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 60bd878528e14f21ae03c089de19f253 +guid: 7d2ab94679b58654cbfc1b98c24eb89c timeCreated: 1677010307 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/CoroutinesSupport.cs b/VirtueSky/PrimeTween/Runtime/Internal/CoroutinesSupport.cs index e56a6b47..042d0929 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/CoroutinesSupport.cs +++ b/VirtueSky/PrimeTween/Runtime/Internal/CoroutinesSupport.cs @@ -64,11 +64,11 @@ object IEnumerator.Current { } internal class TweenCoroutineEnumerator : IEnumerator { - Tween tween; + internal Tween tween; bool isRunning; internal void SetTween(Tween _tween) { - Assert.IsFalse(isRunning); + Assert.IsFalse(isRunning); // todo turn to error? Assert.IsTrue(!tween.IsCreated || tween.id == _tween.id); Assert.IsTrue(_tween.isAlive); tween = _tween; @@ -83,14 +83,18 @@ bool IEnumerator.MoveNext() { return result; } - internal void resetEnumerator() { - tween = default; - isRunning = false; + internal bool resetEnumerator() { + if (tween.IsCreated) { + tween = default; + isRunning = false; + return true; + } + return false; } object IEnumerator.Current { get { - Assert.IsTrue(tween.isAlive); + Assert.IsTrue(tween.isAlive); // todo throws if debugger is attached Assert.IsTrue(isRunning); return null; } diff --git a/VirtueSky/PrimeTween/Runtime/Internal/CoroutinesSupport.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/CoroutinesSupport.cs.meta index 8bcee2eb..3d8cb4fb 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/CoroutinesSupport.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/CoroutinesSupport.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 6b4374d6f2544e95a115ca74b92bec0c +guid: 0c3310f69bd0ea548af51ff19b127d27 timeCreated: 1678282601 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter.meta b/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter.meta index f8110487..31bcee4d 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 7e46be11dbfe47849bc893876e4b3011 +guid: b316fd2e021e99848ba03d579f441b4b timeCreated: 1675753203 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapter.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapter.cs.meta index 331ff4df..7bed85b9 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapter.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapter.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: f2642faa77224669a504c829da9b8d90 +guid: 5fce049859d454043842bf904db8d698 timeCreated: 1675686833 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapterGenerated.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapterGenerated.cs.meta index d1ca182e..9ac88e42 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapterGenerated.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapterGenerated.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 3c238e2b584a4987b714406da2cf9c56 +guid: 69fc3e1f971153441ae050fc68b9220c timeCreated: 1675754085 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/Extensions.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/Extensions.cs.meta index 1653550f..50480fa4 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/Extensions.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/Extensions.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: af006e099ef04f6aa7cecc43e8cb6097 +guid: d9e2e1d7a00c85642a00f247c7e80d17 timeCreated: 1677165403 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/ITween.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/ITween.cs.meta index 3b1f60a0..6b408921 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/ITween.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/ITween.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 3cd334e55fa448c3a55e6c14ebaf6638 +guid: 98f6c14cc912d5a4daa4050d4b593ce3 timeCreated: 1701681398 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/Obsolete.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/Obsolete.cs.meta index 721bb9d6..37e1126c 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/Obsolete.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/Obsolete.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: e6abe1297f08438d974455dc4b2f5396 +guid: 4af956d8a2ea39541902ec77a7f84714 timeCreated: 1693407269 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/PrimeTweenManager.cs b/VirtueSky/PrimeTween/Runtime/Internal/PrimeTweenManager.cs index 3167d4e2..a25f9daf 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/PrimeTweenManager.cs +++ b/VirtueSky/PrimeTween/Runtime/Internal/PrimeTweenManager.cs @@ -162,7 +162,8 @@ void update(List tweens, float deltaTime, float unscaledDeltaTime } #endif // ReSharper disable once PossibleNullReferenceException - if (tween.updateAndCheckIfRunning(tween.settings.useUnscaledTime ? unscaledDeltaTime : deltaTime)) { + // delay release for one frame if coroutineEnumerator.resetEnumerator() + if (tween.updateAndCheckIfRunning(tween.settings.useUnscaledTime ? unscaledDeltaTime : deltaTime) || tween.coroutineEnumerator.resetEnumerator()) { if (i != newIndex) { tweens[i] = null; tweens[newIndex] = tween; diff --git a/VirtueSky/PrimeTween/Runtime/Internal/PrimeTweenManager.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/PrimeTweenManager.cs.meta index ea264f3e..bae4f181 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/PrimeTweenManager.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/PrimeTweenManager.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: f3f57bce977c474ba249eb63545eff3c +guid: 5ad66649102498443a587bf23ba0e252 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/VirtueSky/PrimeTween/Runtime/Internal/PropType.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/PropType.cs.meta index 766fda29..87ee424a 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/PropType.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/PropType.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 4eb6f75d186a4c3e88cdf4a5b2b36332 +guid: 1d4f1f1cb8407c94fb68028614c5b25d timeCreated: 1674162838 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/ReusableTween.cs b/VirtueSky/PrimeTween/Runtime/Internal/ReusableTween.cs index f574a0cd..e8aca042 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/ReusableTween.cs +++ b/VirtueSky/PrimeTween/Runtime/Internal/ReusableTween.cs @@ -744,6 +744,7 @@ internal void EmergencyStop(bool isTargetDestroyed = false) { } mainSequence = parent; } + Assert.IsTrue(mainSequence.isAlive); Assert.IsTrue(mainSequence.root.tween.isMainSequenceRoot()); mainSequence.emergencyStop(); } else if (_isAlive) { @@ -766,7 +767,7 @@ internal void kill() { } void revive() { - // Debug.Log($"[{Time.frameCount}] revive {GetDescription()}"); + // print($"revive {GetDescription()}"); Assert.IsFalse(_isAlive); _isAlive = true; #if UNITY_EDITOR diff --git a/VirtueSky/PrimeTween/Runtime/Internal/ReusableTween.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/ReusableTween.cs.meta index 4e3e3844..45d1b23e 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/ReusableTween.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/ReusableTween.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 257a3dcfeff44807bbedf9be546b410d +guid: f3e8c1c374b78c8468173c1c377165ed timeCreated: 1676595389 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/StackTraces.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/StackTraces.cs.meta index b73aca43..fadf2c69 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/StackTraces.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/StackTraces.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 7a28f74456ca46d08fc316235384c5ee +guid: 731d618fd47d4d84687095e4dd58a867 timeCreated: 1703321204 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/StandardEasing.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/StandardEasing.cs.meta index ded7f935..b033bf3d 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/StandardEasing.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/StandardEasing.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: e7f65c344edd417ebef88555406178af +guid: ac5ad1796b7ea7e4fbfae7197ed609f1 timeCreated: 1673270662 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs b/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs index cffa87a9..fd376a9e 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs +++ b/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs @@ -21,6 +21,7 @@ internal enum TweenType { ShakeLocalRotation, ShakeScale, ShakeCustom, + ShakeCamera, CustomFloat, CustomColor, diff --git a/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs.meta index 0e433cfd..503eedb9 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 51610f0e9d8e4ccead49e9fcc96d54e3 +guid: 4ac7b9d16652abb43a56e1131365ea37 timeCreated: 1673617985 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs b/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs index 51a6e9c3..5ae122d2 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs +++ b/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs @@ -421,7 +421,7 @@ static Tween AnimateTimeScale(Tween tween, TweenSettings settings, TweenT } var result = animate(tween.tween, ref settings, t => { var target = t.target as ReusableTween; - if (t.intParam != target.id) { + if (t.longParam != target.id || !target._isAlive) { t.EmergencyStop(); return; } diff --git a/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs.meta index 0cf732b6..138b14f6 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 964bf290d93964b8b9ab9ba1b3e231c7 +guid: 4b92226f9bf37474abfc8e8761a5a405 timeCreated: 1672225881 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs b/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs index 6010a432..5e01698c 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs +++ b/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs @@ -214,6 +214,8 @@ internal static (PropType, Type) TweenTypeToTweenData(TweenType tweenType) { return (PropType.Vector3, typeof(UnityEngine.Transform)); case TweenType.ShakeCustom: return (PropType.Vector3, typeof(UnityEngine.Transform)); + case TweenType.ShakeCamera: + return (PropType.Float, typeof(UnityEngine.Camera)); case TweenType.CustomFloat: return (PropType.Float, null); case TweenType.CustomColor: diff --git a/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs.meta index 9a0e5b63..10812489 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 7f3bfd9524c14644bfbab698076886f3 +guid: 70d8fab0e50ec67439b58a6c9948545d timeCreated: 1711272020 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/ValueContainer.cs b/VirtueSky/PrimeTween/Runtime/Internal/ValueContainer.cs index 28123a02..f4971cad 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/ValueContainer.cs +++ b/VirtueSky/PrimeTween/Runtime/Internal/ValueContainer.cs @@ -7,10 +7,8 @@ namespace PrimeTween { internal struct ValueContainerStartEnd { [SerializeField] internal TweenType tweenType; // todo HideInInspector? [SerializeField, Tooltip(Constants.startFromCurrentTooltip)] internal bool startFromCurrent; - [Tooltip(Constants.startValueTooltip)] - [SerializeField] internal ValueContainer startValue; - [Tooltip(Constants.endValueTooltip)] - [SerializeField] internal ValueContainer endValue; + [SerializeField, Tooltip(Constants.startValueTooltip)] internal ValueContainer startValue; + [SerializeField, Tooltip(Constants.endValueTooltip)] internal ValueContainer endValue; } [Serializable, StructLayout(LayoutKind.Explicit)] diff --git a/VirtueSky/PrimeTween/Runtime/Internal/ValueContainer.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/ValueContainer.cs.meta index 70d5f692..25444cc1 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/ValueContainer.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/ValueContainer.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 483fe305105a484489884630559c0d62 +guid: e7b35fe033748b642889264ad634c8fc timeCreated: 1676455173 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/PrimeTweenConfig.cs.meta b/VirtueSky/PrimeTween/Runtime/PrimeTweenConfig.cs.meta index e2317866..28dc7a35 100644 --- a/VirtueSky/PrimeTween/Runtime/PrimeTweenConfig.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/PrimeTweenConfig.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 9a87535e581e4e4a85e83b154ee80edb +guid: 358ab55e20cf0ea479e29566e6c422b1 timeCreated: 1679991780 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Sequence.cs b/VirtueSky/PrimeTween/Runtime/Sequence.cs index f562080a..0dbe9be1 100644 --- a/VirtueSky/PrimeTween/Runtime/Sequence.cs +++ b/VirtueSky/PrimeTween/Runtime/Sequence.cs @@ -172,7 +172,7 @@ void addLinkedReference(Tween tween) { Assert.IsFalse(tween.tween.prev.IsCreated); last.tween.next = tween; tween.tween.prev = last; - root.tween.intParam = 0; + root.tween.intParam = emptySequenceTag - emptySequenceTag; // set to 0 in a way to be able to search the code better } Tween getLast() { diff --git a/VirtueSky/PrimeTween/Runtime/Sequence.cs.meta b/VirtueSky/PrimeTween/Runtime/Sequence.cs.meta index 9834672d..18db503a 100644 --- a/VirtueSky/PrimeTween/Runtime/Sequence.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Sequence.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 8a2d3576d8ee453a9d515299e94e87bc +guid: 049d34d9c60b9a348982b241df76a064 timeCreated: 1675416609 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Shake.cs b/VirtueSky/PrimeTween/Runtime/Shake.cs index 66c0980e..47227843 100644 --- a/VirtueSky/PrimeTween/Runtime/Shake.cs +++ b/VirtueSky/PrimeTween/Runtime/Shake.cs @@ -16,11 +16,13 @@ public partial struct Tween { public static Sequence ShakeCamera([NotNull] Camera camera, float strengthFactor, float duration = 0.5f, float frequency = ShakeSettings.defaultFrequency, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = PrimeTweenConfig.defaultUseUnscaledTimeForShakes) { var transform = camera.transform; if (camera.orthographic) { - var orthoPosStrength = strengthFactor * camera.orthographicSize * 0.03f; - return ShakeLocalPosition(transform, new ShakeSettings(new Vector3(orthoPosStrength, orthoPosStrength), duration, frequency, startDelay: startDelay, endDelay: endDelay, useUnscaledTime: useUnscaledTime)) + float orthoPosStrength = strengthFactor * camera.orthographicSize * 0.03f; + return Sequence.Create() + .Group(ShakeLocalPosition(transform, new ShakeSettings(new Vector3(orthoPosStrength, orthoPosStrength), duration, frequency, startDelay: startDelay, endDelay: endDelay, useUnscaledTime: useUnscaledTime))) .Group(ShakeLocalRotation(transform, new ShakeSettings(new Vector3(0, 0, strengthFactor * 0.6f), duration, frequency, startDelay: startDelay, endDelay: endDelay, useUnscaledTime: useUnscaledTime))); } - return Sequence.Create(ShakeLocalRotation(transform, new ShakeSettings(strengthFactor * Vector3.one, duration, frequency, startDelay: startDelay, endDelay: endDelay, useUnscaledTime: useUnscaledTime))); + return Sequence.Create() + .Group(ShakeLocalRotation(transform, new ShakeSettings(strengthFactor * Vector3.one, duration, frequency, startDelay: startDelay, endDelay: endDelay, useUnscaledTime: useUnscaledTime))); } public static Tween ShakeLocalPosition([NotNull] Transform target, Vector3 strength, float duration, float frequency = ShakeSettings.defaultFrequency, bool enableFalloff = true, Ease easeBetweenShakes = Ease.Default, float asymmetryFactor = 0f, int cycles = 1, diff --git a/VirtueSky/PrimeTween/Runtime/Shake.cs.meta b/VirtueSky/PrimeTween/Runtime/Shake.cs.meta index 8e7486b3..0b147ad6 100644 --- a/VirtueSky/PrimeTween/Runtime/Shake.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Shake.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 570c6fe2825b44d7adcb65883493f007 +guid: 9be3d88a4acbb44469970f31e8a15b1f timeCreated: 1677514909 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/ShakeSettings.cs.meta b/VirtueSky/PrimeTween/Runtime/ShakeSettings.cs.meta index 9b1f3f48..4143ce5b 100644 --- a/VirtueSky/PrimeTween/Runtime/ShakeSettings.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/ShakeSettings.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 06521c91fffc428a8de282cc2a0d7f01 +guid: 023b767872d4b10488fae4daf6dab34e timeCreated: 1674160114 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Tween.cs b/VirtueSky/PrimeTween/Runtime/Tween.cs index a3201888..e73b267a 100644 --- a/VirtueSky/PrimeTween/Runtime/Tween.cs +++ b/VirtueSky/PrimeTween/Runtime/Tween.cs @@ -264,7 +264,7 @@ public void SetRemainingCycles(int cycles) { if (tween.tweenType == TweenType.Delay && tween.HasOnComplete) { Debug.LogError("Applying cycles to Delay will not repeat the OnComplete() callback, but instead will increase the Delay duration.\n" + "OnComplete() is called only once when ALL tween cycles complete. To repeat the OnComplete() callback, please use the Sequence.Create(cycles: numCycles) and put the tween inside a Sequence.\n" + - "More info: https://forum.unity.com/threads/1479609/page-3#post-9415922\n"); + "More info: https://discussions.unity.com/t/926420/101\n"); } if (cycles == -1) { tween.settings.cycles = -1; diff --git a/VirtueSky/PrimeTween/Runtime/Tween.cs.meta b/VirtueSky/PrimeTween/Runtime/Tween.cs.meta index c235edec..048af43d 100644 --- a/VirtueSky/PrimeTween/Runtime/Tween.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Tween.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 5f913a3a034a4c42b75653a290884c42 +guid: 0e8dbd7bd7d248c448cd00fe0383c019 timeCreated: 1673432255 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/TweenSettings.cs b/VirtueSky/PrimeTween/Runtime/TweenSettings.cs index 994cdc2c..a87ac6dc 100644 --- a/VirtueSky/PrimeTween/Runtime/TweenSettings.cs +++ b/VirtueSky/PrimeTween/Runtime/TweenSettings.cs @@ -18,15 +18,13 @@ namespace PrimeTween { [Serializable] public struct TweenSettings { public float duration; - [Tooltip("The easing curve of an animation.\n\n" + - "Default is Ease." + nameof(Ease.OutQuad) + ". The Default ease can be modified via '" + nameof(PrimeTweenConfig) + "." + nameof(PrimeTweenConfig.defaultEase) + "' setting.\n\n" + - "Set to " + nameof(Ease) + "." + nameof(Ease.Custom) + " to control the easing with custom " + nameof(AnimationCurve) + ".")] + [Tooltip(Constants.easeTooltip)] public Ease ease; [Tooltip("A custom Animation Curve that will work as an easing curve.")] [CanBeNull] public AnimationCurve customEase; [Tooltip(Constants.cyclesTooltip)] public int cycles; - [Tooltip("See the documentation of each cycle mode by hoovering the dropdown.")] + [Tooltip(Constants.cycleModeTooltip)] public CycleMode cycleMode; [Tooltip(Constants.startDelayTooltip)] public float startDelay; diff --git a/VirtueSky/PrimeTween/Runtime/TweenSettings.cs.meta b/VirtueSky/PrimeTween/Runtime/TweenSettings.cs.meta index 31412815..91f5adab 100644 --- a/VirtueSky/PrimeTween/Runtime/TweenSettings.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/TweenSettings.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: a711147e8806494290f395316ea27b55 +guid: 7204690df6a5ef5448def73688fb61a6 timeCreated: 1673432104 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/TweenSettingsT.cs.meta b/VirtueSky/PrimeTween/Runtime/TweenSettingsT.cs.meta index 6c0c4b65..b5c8aa13 100644 --- a/VirtueSky/PrimeTween/Runtime/TweenSettingsT.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/TweenSettingsT.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: e2e695fd1b8540c287178353a35071e9 +guid: 22546e8240f5f474ca2f8c7e9980d442 timeCreated: 1683451931 \ No newline at end of file From 2016a797b6a1524158f9bb393ea2d9c33e65a4f6 Mon Sep 17 00:00:00 2001 From: DucNV Date: Tue, 3 Dec 2024 15:20:36 +0700 Subject: [PATCH 02/10] Update AdmobNativeOverlayVariable.cs Co-Authored-By: VirtueSky <126542083+VirtueSky@users.noreply.github.com> --- .../Admob/AdmodUnitVariable/AdmobNativeOverlayVariable.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/VirtueSky/Advertising/Runtime/Admob/AdmodUnitVariable/AdmobNativeOverlayVariable.cs b/VirtueSky/Advertising/Runtime/Admob/AdmodUnitVariable/AdmobNativeOverlayVariable.cs index 360fedf4..f290482b 100644 --- a/VirtueSky/Advertising/Runtime/Admob/AdmodUnitVariable/AdmobNativeOverlayVariable.cs +++ b/VirtueSky/Advertising/Runtime/Admob/AdmodUnitVariable/AdmobNativeOverlayVariable.cs @@ -174,7 +174,7 @@ public void RenderAd(RectTransform uiElement, int width, int height) /// Can use position and size of uiElement for native overlay ads /// /// RectTransform of uiElement, used to determine position for native overlay ads - /// Canvas containing popups with cameras attached + /// Canvas containing camera render uiElement public void RenderAd(RectTransform uiElement, Canvas canvas, bool useSizeUiElement = true) { #if VIRTUESKY_ADS && VIRTUESKY_ADMOB @@ -201,7 +201,7 @@ public void RenderAd(RectTransform uiElement, Canvas canvas, bool useSizeUiEleme /// Can use position of uiElement and custom size for native overlay ads /// /// RectTransform of uiElement, used to determine position for native overlay ads - /// Canvas containing popups with cameras attached + /// Canvas containing camera render uiElement /// Custom width for native overlay ads /// Custom height for native overlay ads public void RenderAd(RectTransform uiElement, Canvas canvas, int width, int height) @@ -214,7 +214,6 @@ public void RenderAd(RectTransform uiElement, Canvas canvas, int width, int heig float dpi = Screen.dpi / 160f; var admobX = (int)((screenPosition.x - width / 2) / dpi); var admobY = (int)(((Screen.height - (int)screenPosition.y) - height / 2) / dpi); - _nativeOverlayAd?.RenderTemplate(Style(), new AdSize(width, height), admobX, admobY); #endif } From e910698dda3f40b2a72da2ed1c29d76b10f40f84 Mon Sep 17 00:00:00 2001 From: DucNV Date: Wed, 4 Dec 2024 09:15:03 +0700 Subject: [PATCH 03/10] Update version.txt --- VirtueSky/PrimeTween/version.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VirtueSky/PrimeTween/version.txt b/VirtueSky/PrimeTween/version.txt index 0408c30b..24e56e03 100644 --- a/VirtueSky/PrimeTween/version.txt +++ b/VirtueSky/PrimeTween/version.txt @@ -1 +1 @@ -v1.2.0 \ No newline at end of file +v1.2.1 \ No newline at end of file From 404bd4882b206ad3fda3df8915e11c086cce7a9f Mon Sep 17 00:00:00 2001 From: DucNV Date: Wed, 4 Dec 2024 10:19:52 +0700 Subject: [PATCH 04/10] Update FollowTargetComponent.cs Co-Authored-By: VirtueSky <126542083+VirtueSky@users.noreply.github.com> --- VirtueSky/Component/FollowTargetComponent.cs | 47 ++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/VirtueSky/Component/FollowTargetComponent.cs b/VirtueSky/Component/FollowTargetComponent.cs index b3754d5b..95ebeed7 100644 --- a/VirtueSky/Component/FollowTargetComponent.cs +++ b/VirtueSky/Component/FollowTargetComponent.cs @@ -34,6 +34,53 @@ public class FollowTargetComponent : BaseMono ShowIf(nameof(typeFollowTarget), TypeFollowTarget.SmoothDamp), SerializeField] private float maxSpeed = Mathf.Infinity; + public Transform TargetTransform + { + get => targetTrans; + set => targetTrans = value; + } + + public Vector3 OffsetTrans + { + get => offsetTrans; + set => offsetTrans = value; + } + + public DirectionFollowTarget DirectionFollowTarget + { + get => directionFollowTarget; + set => directionFollowTarget = value; + } + + public TypeFollowTarget TypeFollowTarget + { + get => typeFollowTarget; + set => typeFollowTarget = value; + } + + public float InterpolateValue + { + get => interpolateValue; + set => interpolateValue = value; + } + + public Vector3 CurrentVelocity + { + get => currentVelocity; + set => currentVelocity = value; + } + + public float SmoothTime + { + get => smoothTime; + set => smoothTime = value; + } + + public float MaxSpeed + { + get => maxSpeed; + set => maxSpeed = value; + } private void Awake() { From b9797cc029720fdf34501a343893fd1e346c4e0d Mon Sep 17 00:00:00 2001 From: DucNV Date: Fri, 6 Dec 2024 16:30:08 +0700 Subject: [PATCH 05/10] - update native overlay ads - add method SetPosition to SetTemplatePosition native overlay ads Co-Authored-By: VirtueSky <126542083+VirtueSky@users.noreply.github.com> --- .../AdmobNativeOverlayVariable.cs | 93 ++++++++++++++----- 1 file changed, 68 insertions(+), 25 deletions(-) diff --git a/VirtueSky/Advertising/Runtime/Admob/AdmodUnitVariable/AdmobNativeOverlayVariable.cs b/VirtueSky/Advertising/Runtime/Admob/AdmodUnitVariable/AdmobNativeOverlayVariable.cs index f290482b..437285ba 100644 --- a/VirtueSky/Advertising/Runtime/Admob/AdmodUnitVariable/AdmobNativeOverlayVariable.cs +++ b/VirtueSky/Advertising/Runtime/Admob/AdmodUnitVariable/AdmobNativeOverlayVariable.cs @@ -129,7 +129,7 @@ public void RenderAd() { #if VIRTUESKY_ADS && VIRTUESKY_ADS if (_nativeOverlayAd == null) return; - _nativeOverlayAd.RenderTemplate(Style(), ConvertSize(), ConvertPosition()); + _nativeOverlayAd.RenderTemplate(Style(), ConvertSize(), ConvertPosition(adsPosition)); #endif } @@ -141,11 +141,7 @@ public void RenderAd(RectTransform uiElement) { #if VIRTUESKY_ADS && VIRTUESKY_ADS if (_nativeOverlayAd == null) return; - var screenPosition = uiElement.ToWorldPosition(); - - float dpi = Screen.dpi / 160f; - var admobX = (int)(screenPosition.x / dpi); - var admobY = (int)((Screen.height - (int)screenPosition.y) / dpi); + (int admobX, int admobY) = ConvertUiElementPosToNativeAdsPos(uiElement); _nativeOverlayAd.RenderTemplate(Style(), admobX, admobY); #endif } @@ -160,11 +156,7 @@ public void RenderAd(RectTransform uiElement, int width, int height) { #if VIRTUESKY_ADS && VIRTUESKY_ADS if (_nativeOverlayAd == null) return; - var screenPosition = uiElement.ToWorldPosition(); - - float dpi = Screen.dpi / 160f; - var admobX = (int)(screenPosition.x / dpi); - var admobY = (int)((Screen.height - (int)screenPosition.y) / dpi); + (int admobX, int admobY) = ConvertUiElementPosToNativeAdsPos(uiElement); _nativeOverlayAd.RenderTemplate(Style(), new AdSize(width, height), admobX, admobY); #endif } @@ -174,17 +166,12 @@ public void RenderAd(RectTransform uiElement, int width, int height) /// Can use position and size of uiElement for native overlay ads /// /// RectTransform of uiElement, used to determine position for native overlay ads - /// Canvas containing camera render uiElement - public void RenderAd(RectTransform uiElement, Canvas canvas, bool useSizeUiElement = true) + /// Camera render uiElement + public void RenderAd(RectTransform uiElement, Camera camera, bool useSizeUiElement = true) { #if VIRTUESKY_ADS && VIRTUESKY_ADMOB if (_nativeOverlayAd == null) return; - var worldPosition = uiElement.TransformPoint(uiElement.position); - Vector2 screenPosition = canvas.worldCamera.WorldToScreenPoint(worldPosition); - - float dpi = Screen.dpi / 160f; - var admobX = (int)((screenPosition.x - (uiElement.rect.width / 2)) / dpi); - var admobY = (int)(((Screen.height - (int)screenPosition.y) - (uiElement.rect.height / 2)) / dpi); + (int admobX, int admobY) = ConvertUiElementPosToNativeAdsPos(uiElement, camera); if (useSizeUiElement) { _nativeOverlayAd?.RenderTemplate(Style(), new AdSize((int)uiElement.rect.width, (int)uiElement.rect.height), admobX, admobY); @@ -201,20 +188,76 @@ public void RenderAd(RectTransform uiElement, Canvas canvas, bool useSizeUiEleme /// Can use position of uiElement and custom size for native overlay ads /// /// RectTransform of uiElement, used to determine position for native overlay ads - /// Canvas containing camera render uiElement + /// Camera render uiElement /// Custom width for native overlay ads /// Custom height for native overlay ads - public void RenderAd(RectTransform uiElement, Canvas canvas, int width, int height) + public void RenderAd(RectTransform uiElement, Camera camera, int width, int height) { #if VIRTUESKY_ADS && VIRTUESKY_ADMOB if (_nativeOverlayAd == null) return; + (int admobX, int admobY) = ConvertUiElementPosToNativeAdsPos(uiElement, camera, width, height); + _nativeOverlayAd?.RenderTemplate(Style(), new AdSize(width, height), admobX, admobY); +#endif + } + + (int, int) ConvertUiElementPosToNativeAdsPos(RectTransform uiElement, Camera camera, int width, int height) + { var worldPosition = uiElement.TransformPoint(uiElement.position); - Vector2 screenPosition = canvas.worldCamera.WorldToScreenPoint(worldPosition); + Vector2 screenPosition = camera.WorldToScreenPoint(worldPosition); float dpi = Screen.dpi / 160f; var admobX = (int)((screenPosition.x - width / 2) / dpi); var admobY = (int)(((Screen.height - (int)screenPosition.y) - height / 2) / dpi); - _nativeOverlayAd?.RenderTemplate(Style(), new AdSize(width, height), admobX, admobY); + return (admobX, admobY); + } + + (int, int) ConvertUiElementPosToNativeAdsPos(RectTransform uiElement, Camera camera) + { + var worldPosition = uiElement.TransformPoint(uiElement.position); + Vector2 screenPosition = camera.WorldToScreenPoint(worldPosition); + + float dpi = Screen.dpi / 160f; + var admobX = (int)((screenPosition.x - (int)uiElement.rect.width / 2) / dpi); + var admobY = (int)(((Screen.height - (int)screenPosition.y) - (int)uiElement.rect.height / 2) / dpi); + return (admobX, admobY); + } + + (int, int) ConvertUiElementPosToNativeAdsPos(RectTransform uiElement) + { + var screenPosition = uiElement.ToWorldPosition(); + float dpi = Screen.dpi / 160f; + var admobX = (int)(screenPosition.x / dpi); + var admobY = (int)((Screen.height - (int)screenPosition.y) / dpi); + return (admobX, admobY); + } + + public void SetPosition(AdsPosition adsPosition) + { +#if VIRTUESKY_ADS && VIRTUESKY_ADMOB + _nativeOverlayAd.SetTemplatePosition(ConvertPosition(adsPosition)); +#endif + } + + public void SetPosition(int x, int y) + { +#if VIRTUESKY_ADS && VIRTUESKY_ADMOB + _nativeOverlayAd.SetTemplatePosition(x, y); +#endif + } + + public void SetPosition(RectTransform uiElement) + { +#if VIRTUESKY_ADS && VIRTUESKY_ADMOB + (int x, int y) = ConvertUiElementPosToNativeAdsPos(uiElement); + _nativeOverlayAd.SetTemplatePosition(x, y); +#endif + } + + public void SetPosition(RectTransform uiElement, Camera camera) + { +#if VIRTUESKY_ADS && VIRTUESKY_ADMOB + (int x, int y) = ConvertUiElementPosToNativeAdsPos(uiElement, camera); + _nativeOverlayAd.SetTemplatePosition(x, y); #endif } @@ -236,9 +279,9 @@ public NativeTemplateStyle Style() }; } - AdPosition ConvertPosition() + AdPosition ConvertPosition(AdsPosition _adsPosition) { - return adsPosition switch + return _adsPosition switch { AdsPosition.Top => AdPosition.Top, AdsPosition.Bottom => AdPosition.Bottom, From 71dffeee2de8ac834fdabe82c5842785a7572d53 Mon Sep 17 00:00:00 2001 From: DucNV Date: Mon, 9 Dec 2024 09:24:07 +0700 Subject: [PATCH 06/10] - update register adjust sdk 5.0.6 Co-Authored-By: VirtueSky <126542083+VirtueSky@users.noreply.github.com> --- VirtueSky/ControlPanel/ConstantPackage.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VirtueSky/ControlPanel/ConstantPackage.cs b/VirtueSky/ControlPanel/ConstantPackage.cs index a5bbd43c..ec87799d 100644 --- a/VirtueSky/ControlPanel/ConstantPackage.cs +++ b/VirtueSky/ControlPanel/ConstantPackage.cs @@ -77,7 +77,7 @@ public class ConstantPackage #endregion public const string PackageNameAdjust = "com.adjust.sdk"; - public const string MaxVersionAdjust = "https://github.com/adjust/unity_sdk.git?path=Assets/Adjust#v5.0.5"; + public const string MaxVersionAdjust = "https://github.com/adjust/unity_sdk.git?path=Assets/Adjust#v5.0.6"; public const string PackageNamePlayFab = "com.pancake.playfab"; public const string MaxVersionPlayFab = From 942350927af790b76c53788a9b9b4dd64b589619 Mon Sep 17 00:00:00 2001 From: DucNV Date: Tue, 10 Dec 2024 17:59:54 +0700 Subject: [PATCH 07/10] - update Iap - add properties SubscriptionInfo in IapDataVariable - internal field product add properties Product in IapDataVariable Co-Authored-By: VirtueSky <126542083+VirtueSky@users.noreply.github.com> --- VirtueSky/Iap/Runtime/IapDataVariable.cs | 7 +- VirtueSky/Iap/Runtime/IapManager.cs | 98 +++++++++++++----------- 2 files changed, 58 insertions(+), 47 deletions(-) diff --git a/VirtueSky/Iap/Runtime/IapDataVariable.cs b/VirtueSky/Iap/Runtime/IapDataVariable.cs index 9810d3b2..7154108c 100644 --- a/VirtueSky/Iap/Runtime/IapDataVariable.cs +++ b/VirtueSky/Iap/Runtime/IapDataVariable.cs @@ -17,15 +17,18 @@ public class IapDataVariable : ScriptableObject [Space] public float price; [SerializeField] private IapPurchaseSuccess onPurchaseSuccess; - [SerializeField] IapPurchaseFailed onPurchaseFailed; + [SerializeField] private IapPurchaseFailed onPurchaseFailed; - [ReadOnly] public Product product; + [ReadOnly] internal Product product; + [ReadOnly] internal SubscriptionInfo subscriptionInfo; internal IapPurchaseSuccess OnPurchaseSuccess => onPurchaseSuccess; internal IapPurchaseFailed OnPurchaseFailed => onPurchaseFailed; [NonSerialized] public Action purchaseSuccessCallback; [NonSerialized] public Action purchaseFailedCallback; + public Product Product => product; + public SubscriptionInfo SubscriptionInfo => subscriptionInfo; public void Purchase() { diff --git a/VirtueSky/Iap/Runtime/IapManager.cs b/VirtueSky/Iap/Runtime/IapManager.cs index 1a624233..3d62cab0 100644 --- a/VirtueSky/Iap/Runtime/IapManager.cs +++ b/VirtueSky/Iap/Runtime/IapManager.cs @@ -96,19 +96,25 @@ void InitImpl() IsInitialized = true; } + #region Internal Api + private bool IsPurchasedProduct(IapDataVariable product) { if (_controller == null) return false; - return product.productType == ProductType.NonConsumable && + return product.productType is ProductType.NonConsumable or ProductType.Subscription && _controller.products.WithID(product.id).hasReceipt; } - private string GetLocalizedPriceProduct(IapDataVariable product) + void PurchaseProduct(IapDataVariable product) { - if (_controller == null) return ""; - return _controller.products.WithID(product.id).metadata.localizedPriceString; + // call when IAPDataVariable raise event + if (changePreventDisplayAppOpenEvent != null) changePreventDisplayAppOpenEvent.Raise(true); + PurchaseProductInternal(product); } + #endregion + + #region Implement public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs purchaseEvent) { @@ -143,7 +149,6 @@ public PurchaseProcessingResult ProcessPurchase(PurchaseEventArgs purchaseEvent) return PurchaseProcessingResult.Complete; } - public void OnInitialized(IStoreController controller, IExtensionProvider extensions) { _controller = controller; @@ -159,11 +164,53 @@ public void OnInitialized(IStoreController controller, IExtensionProvider extens InitProductIapDataVariable(); } + public void OnInitializeFailed(InitializationFailureReason error, string message) + { + OnInitializeFailed(error); + } + + public void OnInitializeFailed(InitializationFailureReason error) + { + switch (error) + { + case InitializationFailureReason.AppNotKnown: + Debug.LogError("Is your App correctly uploaded on the relevant publisher console?"); + break; + case InitializationFailureReason.PurchasingUnavailable: + Debug.LogWarning("In App Purchases disabled in device settings!"); + break; + case InitializationFailureReason.NoProductsAvailable: + Debug.LogWarning("No products available for purchase!"); + break; + default: + throw new ArgumentOutOfRangeException(nameof(error), error, null); + } + } + + public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason) + { + InternalPurchaseFailed(product.definition.id, failureReason.ToString()); + } + + public void OnPurchaseFailed(Product product, PurchaseFailureDescription failureDescription) + { + InternalPurchaseFailed(product.definition.id, failureDescription.reason.ToString()); + } + + #endregion + + private void InitProductIapDataVariable() { foreach (var iapDataVariable in iapSetting.Products) { - iapDataVariable.product = _controller.products.WithID(iapDataVariable.id); + var product = _controller.products.WithID(iapDataVariable.id); + iapDataVariable.product = product; + if (iapDataVariable.productType == ProductType.Subscription) + { + var subManager = new SubscriptionManager(product, null); + iapDataVariable.subscriptionInfo = subManager.getSubscriptionInfo(); + } } } @@ -183,12 +230,6 @@ void PurchaseVerified(PurchaseEventArgs purchaseEvent) InternalPurchaseSuccess(purchaseEvent.purchasedProduct.definition.id); } - void PurchaseProduct(IapDataVariable product) - { - // call when IAPDataVariable raise event - if (changePreventDisplayAppOpenEvent != null) changePreventDisplayAppOpenEvent.Raise(true); - PurchaseProductInternal(product); - } #region Purchase Success @@ -207,39 +248,6 @@ void InternalPurchaseSuccess(string id) #region Purchase Failed - public void OnInitializeFailed(InitializationFailureReason error) - { - switch (error) - { - case InitializationFailureReason.AppNotKnown: - Debug.LogError("Is your App correctly uploaded on the relevant publisher console?"); - break; - case InitializationFailureReason.PurchasingUnavailable: - Debug.LogWarning("In App Purchases disabled in device settings!"); - break; - case InitializationFailureReason.NoProductsAvailable: - Debug.LogWarning("No products available for purchase!"); - break; - default: - throw new ArgumentOutOfRangeException(nameof(error), error, null); - } - } - - public void OnInitializeFailed(InitializationFailureReason error, string message) - { - OnInitializeFailed(error); - } - - public void OnPurchaseFailed(Product product, PurchaseFailureReason failureReason) - { - InternalPurchaseFailed(product.definition.id, failureReason.ToString()); - } - - public void OnPurchaseFailed(Product product, PurchaseFailureDescription failureDescription) - { - InternalPurchaseFailed(product.definition.id, failureDescription.reason.ToString()); - } - private void InternalPurchaseFailed(string id, string reason) { if (changePreventDisplayAppOpenEvent != null) changePreventDisplayAppOpenEvent.Raise(false); From 641ada1a6f038d911f5636f43f6474d2dbb159cb Mon Sep 17 00:00:00 2001 From: DucNV Date: Wed, 11 Dec 2024 09:35:44 +0700 Subject: [PATCH 08/10] - update prime tween 1.2.2 Co-Authored-By: VirtueSky <126542083+VirtueSky@users.noreply.github.com> --- VirtueSky/PrimeTween/Editor/AssemblyInfo.cs | 3 - .../PrimeTween/Editor/AssemblyInfo.cs.meta | 3 - .../PrimeTween/Editor/CodeGenerator.asset | 1077 ----------------- .../Editor/CodeGenerator.asset.meta | 8 - VirtueSky/PrimeTween/Editor/CodeGenerator.cs | 762 ------------ .../PrimeTween/Editor/CodeGenerator.cs.meta | 3 - VirtueSky/PrimeTween/Editor/CodeTemplates.cs | 150 --- .../PrimeTween/Editor/CodeTemplates.cs.meta | 3 - .../Editor/PrimeTweenManagerInspector.cs | 83 -- .../Editor/PrimeTweenManagerInspector.cs.meta | 3 - .../Editor/TweenSettingsPropDrawer.cs | 141 --- .../Editor/TweenSettingsPropDrawer.cs.meta | 3 - .../Editor/TweenSettingsTypesPropDrawer.cs | 85 -- .../TweenSettingsTypesPropDrawer.cs.meta | 3 - .../Editor/TweenShakeSettingsPropDrawer.cs | 117 -- .../TweenShakeSettingsPropDrawer.cs.meta | 3 - .../ValueContainerStartEndPropDrawer.cs | 143 --- .../ValueContainerStartEndPropDrawer.cs.meta | 3 - .../Runtime/Internal/AssemblyInfo.cs.meta | 2 +- .../Runtime/Internal/Assert.cs.meta | 2 +- .../Internal/AsyncAwaitSupport.cs.meta | 2 +- .../Runtime/Internal/Constants.cs.meta | 2 +- .../Internal/CoroutinesSupport.cs.meta | 2 +- .../Runtime/Internal/DOTweenAdapter.meta | 2 +- .../DOTweenAdapter/DOTweenAdapter.cs.meta | 2 +- .../DOTweenAdapter/DOTweenAdapterGenerated.cs | 2 +- .../DOTweenAdapterGenerated.cs.meta | 2 +- .../Runtime/Internal/Extensions.cs.meta | 2 +- .../Runtime/Internal/ITween.cs.meta | 2 +- .../Runtime/Internal/Obsolete.cs.meta | 2 +- .../Internal/PrimeTweenManager.cs.meta | 2 +- .../Runtime/Internal/PropType.cs.meta | 2 +- .../Runtime/Internal/ReusableTween.cs.meta | 2 +- .../Runtime/Internal/StackTraces.cs.meta | 2 +- .../Runtime/Internal/StandardEasing.cs.meta | 2 +- .../Runtime/Internal/TweenGenerated.cs | 2 +- .../Runtime/Internal/TweenGenerated.cs.meta | 2 +- .../Runtime/Internal/TweenMethods.cs | 2 +- .../Runtime/Internal/TweenMethods.cs.meta | 2 +- .../PrimeTween/Runtime/Internal/Utils.cs | 2 +- .../PrimeTween/Runtime/Internal/Utils.cs.meta | 2 +- .../Runtime/Internal/ValueContainer.cs.meta | 2 +- VirtueSky/PrimeTween/version.txt | 2 +- 43 files changed, 25 insertions(+), 2618 deletions(-) delete mode 100644 VirtueSky/PrimeTween/Editor/AssemblyInfo.cs delete mode 100644 VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta delete mode 100644 VirtueSky/PrimeTween/Editor/CodeGenerator.asset delete mode 100644 VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta delete mode 100644 VirtueSky/PrimeTween/Editor/CodeGenerator.cs delete mode 100644 VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta delete mode 100644 VirtueSky/PrimeTween/Editor/CodeTemplates.cs delete mode 100644 VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta delete mode 100644 VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs delete mode 100644 VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta delete mode 100644 VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs delete mode 100644 VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs.meta delete mode 100644 VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs delete mode 100644 VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta delete mode 100644 VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs delete mode 100644 VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs.meta delete mode 100644 VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs delete mode 100644 VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs.meta diff --git a/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs b/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs deleted file mode 100644 index 74b96d6b..00000000 --- a/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs +++ /dev/null @@ -1,3 +0,0 @@ -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("PrimeTween.Tests")] diff --git a/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta b/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta deleted file mode 100644 index 7ed2f240..00000000 --- a/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 77f31680944e5534e8ed7d89b9d6a99a -timeCreated: 1683538561 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/CodeGenerator.asset b/VirtueSky/PrimeTween/Editor/CodeGenerator.asset deleted file mode 100644 index 3cca848e..00000000 --- a/VirtueSky/PrimeTween/Editor/CodeGenerator.asset +++ /dev/null @@ -1,1077 +0,0 @@ -%YAML 1.1 -%TAG !u! tag:unity3d.com,2011: ---- !u!114 &11400000 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 0} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f81c141b47ab4aee9ea1454818ce73d3, type: 3} - m_Name: CodeGenerator - m_EditorClassIdentifier: - methodsScript: {fileID: 11500000, guid: 51610f0e9d8e4ccead49e9fcc96d54e3, type: 3} - dotweenMethodsScript: {fileID: 11500000, guid: 3c238e2b584a4987b714406da2cf9c56, type: 3} - tweenComponentScript: {fileID: 11500000, guid: f191f8e3fa31440d9f1217f1f80dba7d, type: 3} - editorUtilsScript: {fileID: 11500000, guid: 7f3bfd9524c14644bfbab698076886f3, type: 3} - methodsData: - - description: Range_Light - methodName: Range - targetType: UnityEngine.Light - propertyType: 1 - propertyName: range - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 7 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: ShadowStrength_Light - methodName: ShadowStrength - targetType: UnityEngine.Light - propertyType: 1 - propertyName: shadowStrength - propertyGetter: - propertySetter: - dotweenMethodName: DOShadowStrength - dependency: 7 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Intensity_Light - methodName: Intensity - targetType: UnityEngine.Light - propertyType: 1 - propertyName: intensity - propertyGetter: - propertySetter: - dotweenMethodName: DOIntensity - dependency: 7 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: OrthographicSize_Camera - methodName: OrthographicSize - targetType: UnityEngine.Camera - propertyType: 1 - propertyName: orthographicSize - propertyGetter: - propertySetter: - dotweenMethodName: DOOrthoSize - dependency: 5 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: BackgroundColor_Camera - methodName: BackgroundColor - targetType: UnityEngine.Camera - propertyType: 2 - propertyName: backgroundColor - propertyGetter: - propertySetter: - dotweenMethodName: DOColor - dependency: 5 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Aspect_Camera - methodName: Aspect - targetType: UnityEngine.Camera - propertyType: 1 - propertyName: aspect - propertyGetter: - propertySetter: - dotweenMethodName: DOAspect - dependency: 5 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: FarClipPlane_Camera - methodName: FarClipPlane - targetType: UnityEngine.Camera - propertyType: 1 - propertyName: farClipPlane - propertyGetter: - propertySetter: - dotweenMethodName: DOFarClipPlane - dependency: 5 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: FieldOfView_Camera - methodName: FieldOfView - targetType: UnityEngine.Camera - propertyType: 1 - propertyName: fieldOfView - propertyGetter: - propertySetter: - dotweenMethodName: DOFieldOfView - dependency: 5 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: NearClipPlane_Camera - methodName: NearClipPlane - targetType: UnityEngine.Camera - propertyType: 1 - propertyName: nearClipPlane - propertyGetter: - propertySetter: - dotweenMethodName: DONearClipPlane - dependency: 5 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: PixelRect_Camera - methodName: PixelRect - targetType: UnityEngine.Camera - propertyType: 7 - propertyName: pixelRect - propertyGetter: - propertySetter: - dotweenMethodName: DOPixelRect - dependency: 5 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Rect_Camera - methodName: Rect - targetType: UnityEngine.Camera - propertyType: 7 - propertyName: rect - propertyGetter: - propertySetter: - dotweenMethodName: DORect - dependency: 5 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: LocalRotation_Transform - methodName: LocalRotation - targetType: UnityEngine.Transform - propertyType: 4 - propertyName: - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 0 - placeInGlobalScope: 1 - generateOnlyOverloads: 1 - - description: Scale_Transform - methodName: Scale - targetType: UnityEngine.Transform - propertyType: 1 - propertyName: - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 0 - placeInGlobalScope: 1 - generateOnlyOverloads: 1 - - description: Rotation_Transform - methodName: Rotation - targetType: UnityEngine.Transform - propertyType: 4 - propertyName: - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 0 - placeInGlobalScope: 1 - generateOnlyOverloads: 1 - - description: SliderValue_Slider - methodName: SliderValue - targetType: UnityEngine.UI.Slider - propertyType: 1 - propertyName: value - propertyGetter: - propertySetter: - dotweenMethodName: DOValue - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: NormalizedPosition_ScrollRect - methodName: NormalizedPosition - targetType: UnityEngine.UI.ScrollRect - propertyType: 3 - propertyName: - propertyGetter: GetNormalizedPosition() - propertySetter: SetNormalizedPosition(val) - dotweenMethodName: DONormalizedPos - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: HorizontalNormalizedPosition_ScrollRect - methodName: HorizontalNormalizedPosition - targetType: UnityEngine.UI.ScrollRect - propertyType: 1 - propertyName: horizontalNormalizedPosition - propertyGetter: - propertySetter: - dotweenMethodName: DOHorizontalNormalizedPos - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: VerticalNormalizedPosition_ScrollRect - methodName: VerticalNormalizedPosition - targetType: UnityEngine.UI.ScrollRect - propertyType: 1 - propertyName: verticalNormalizedPosition - propertyGetter: - propertySetter: - dotweenMethodName: DOVerticalNormalizedPos - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: PivotX_RectTransform - methodName: PivotX - targetType: UnityEngine.RectTransform - propertyType: 1 - propertyName: - propertyGetter: pivot[0] - propertySetter: pivot = _target.pivot.WithComponent(0, val) - dotweenMethodName: DOPivotX - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: PivotY_RectTransform - methodName: PivotY - targetType: UnityEngine.RectTransform - propertyType: 1 - propertyName: - propertyGetter: pivot[1] - propertySetter: pivot = _target.pivot.WithComponent(1, val) - dotweenMethodName: DOPivotY - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Pivot_RectTransform - methodName: Pivot - targetType: UnityEngine.RectTransform - propertyType: 3 - propertyName: pivot - propertyGetter: - propertySetter: - dotweenMethodName: DOPivot - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: AnchorMax_RectTransform - methodName: AnchorMax - targetType: UnityEngine.RectTransform - propertyType: 3 - propertyName: anchorMax - propertyGetter: - propertySetter: - dotweenMethodName: DOAnchorMax - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: AnchorMin_RectTransform - methodName: AnchorMin - targetType: UnityEngine.RectTransform - propertyType: 3 - propertyName: anchorMin - propertyGetter: - propertySetter: - dotweenMethodName: DOAnchorMin - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: AnchoredPosition3D_RectTransform - methodName: AnchoredPosition3D - targetType: UnityEngine.RectTransform - propertyType: 4 - propertyName: anchoredPosition3D - propertyGetter: - propertySetter: - dotweenMethodName: DOAnchorPos3D - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: AnchoredPosition3DX_RectTransform - methodName: AnchoredPosition3DX - targetType: UnityEngine.RectTransform - propertyType: 1 - propertyName: - propertyGetter: anchoredPosition3D[0] - propertySetter: anchoredPosition3D = _target.anchoredPosition3D.WithComponent(0, - val) - dotweenMethodName: DOAnchorPos3DX - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: AnchoredPosition3DY_RectTransform - methodName: AnchoredPosition3DY - targetType: UnityEngine.RectTransform - propertyType: 1 - propertyName: - propertyGetter: anchoredPosition3D[1] - propertySetter: anchoredPosition3D = _target.anchoredPosition3D.WithComponent(1, - val) - dotweenMethodName: DOAnchorPos3DY - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: AnchoredPosition3DZ_RectTransform - methodName: AnchoredPosition3DZ - targetType: UnityEngine.RectTransform - propertyType: 1 - propertyName: - propertyGetter: anchoredPosition3D[2] - propertySetter: anchoredPosition3D = _target.anchoredPosition3D.WithComponent(2, - val) - dotweenMethodName: DOAnchorPos3DZ - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: EffectDistance_Shadow - methodName: EffectDistance - targetType: UnityEngine.UI.Shadow - propertyType: 3 - propertyName: effectDistance - propertyGetter: - propertySetter: - dotweenMethodName: DOScale - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Alpha_Shadow - methodName: Alpha - targetType: UnityEngine.UI.Shadow - propertyType: 1 - propertyName: - propertyGetter: effectColor.a - propertySetter: effectColor = _target.effectColor.WithAlpha(val) - dotweenMethodName: DOFade - dependency: 1 - placeInGlobalScope: 1 - generateOnlyOverloads: 0 - - description: Color_Shadow - methodName: Color - targetType: UnityEngine.UI.Shadow - propertyType: 2 - propertyName: effectColor - propertyGetter: - propertySetter: - dotweenMethodName: DOColor - dependency: 1 - placeInGlobalScope: 1 - generateOnlyOverloads: 0 - - description: PreferredSize_LayoutElement - methodName: PreferredSize - targetType: UnityEngine.UI.LayoutElement - propertyType: 3 - propertyName: - propertyGetter: GetPreferredSize() - propertySetter: SetPreferredSize(val) - dotweenMethodName: DOPreferredSize - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: PreferredWidth_LayoutElement - methodName: PreferredWidth - targetType: UnityEngine.UI.LayoutElement - propertyType: 1 - propertyName: preferredWidth - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: PreferredHeight_LayoutElement - methodName: PreferredHeight - targetType: UnityEngine.UI.LayoutElement - propertyType: 1 - propertyName: preferredHeight - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: MovePosition_Rigidbody - methodName: MovePosition - targetType: UnityEngine.Rigidbody - propertyType: 4 - propertyName: - propertyGetter: position - propertySetter: MovePosition(val) - dotweenMethodName: DOMove - dependency: 3 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: MoveRotation_Rigidbody - methodName: MoveRotation - targetType: UnityEngine.Rigidbody - propertyType: 6 - propertyName: - propertyGetter: rotation - propertySetter: MoveRotation(val) - dotweenMethodName: DORotate - dependency: 3 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: MovePosition_Rigidbody2D - methodName: MovePosition - targetType: UnityEngine.Rigidbody2D - propertyType: 3 - propertyName: - propertyGetter: position - propertySetter: MovePosition(val) - dotweenMethodName: DOMove - dependency: 4 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: MoveRotation_Rigidbody2D - methodName: MoveRotation - targetType: UnityEngine.Rigidbody2D - propertyType: 1 - propertyName: - propertyGetter: rotation - propertySetter: MoveRotation(val) - dotweenMethodName: DORotate - dependency: 4 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: FlexibleSize_LayoutElement - methodName: FlexibleSize - targetType: UnityEngine.UI.LayoutElement - propertyType: 3 - propertyName: - propertyGetter: GetFlexibleSize() - propertySetter: SetFlexibleSize(val) - dotweenMethodName: DOFlexibleSize - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: FlexibleWidth_LayoutElement - methodName: FlexibleWidth - targetType: UnityEngine.UI.LayoutElement - propertyType: 1 - propertyName: flexibleWidth - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: FlexibleHeight_LayoutElement - methodName: FlexibleHeight - targetType: UnityEngine.UI.LayoutElement - propertyType: 1 - propertyName: flexibleHeight - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: MinSize_LayoutElement - methodName: MinSize - targetType: UnityEngine.UI.LayoutElement - propertyType: 3 - propertyName: - propertyGetter: GetMinSize() - propertySetter: SetMinSize(val) - dotweenMethodName: DOMinSize - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: MinWidth_LayoutElement - methodName: MinWidth - targetType: UnityEngine.UI.LayoutElement - propertyType: 1 - propertyName: minWidth - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: MinHeight_LayoutElement - methodName: MinHeight - targetType: UnityEngine.UI.LayoutElement - propertyType: 1 - propertyName: minHeight - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Position_Transform - methodName: Position - targetType: UnityEngine.Transform - propertyType: 4 - propertyName: position - propertyGetter: - propertySetter: - dotweenMethodName: DOMove - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: PositionX_Transform - methodName: PositionX - targetType: UnityEngine.Transform - propertyType: 1 - propertyName: - propertyGetter: position.x - propertySetter: position = _target.position.WithComponent(0, val) - dotweenMethodName: DOMoveX - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: PositionY_Transform - methodName: PositionY - targetType: UnityEngine.Transform - propertyType: 1 - propertyName: - propertyGetter: position.y - propertySetter: position = _target.position.WithComponent(1, val) - dotweenMethodName: DOMoveY - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: PositionZ_Transform - methodName: PositionZ - targetType: UnityEngine.Transform - propertyType: 1 - propertyName: - propertyGetter: position.z - propertySetter: position = _target.position.WithComponent(2, val) - dotweenMethodName: DOMoveZ - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: LocalPosition_Transform - methodName: LocalPosition - targetType: UnityEngine.Transform - propertyType: 4 - propertyName: localPosition - propertyGetter: - propertySetter: - dotweenMethodName: DOLocalMove - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: LocalPositionX_Transform - methodName: LocalPositionX - targetType: UnityEngine.Transform - propertyType: 1 - propertyName: - propertyGetter: localPosition.x - propertySetter: localPosition = _target.localPosition.WithComponent(0, val) - dotweenMethodName: DOLocalMoveX - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: LocalPositionY_Transform - methodName: LocalPositionY - targetType: UnityEngine.Transform - propertyType: 1 - propertyName: - propertyGetter: localPosition.y - propertySetter: localPosition = _target.localPosition.WithComponent(1, val) - dotweenMethodName: DOLocalMoveY - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: LocalPositionZ_Transform - methodName: LocalPositionZ - targetType: UnityEngine.Transform - propertyType: 1 - propertyName: - propertyGetter: localPosition.z - propertySetter: localPosition = _target.localPosition.WithComponent(2, val) - dotweenMethodName: DOLocalMoveZ - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Rotation_Transform - methodName: Rotation - targetType: UnityEngine.Transform - propertyType: 6 - propertyName: rotation - propertyGetter: - propertySetter: - dotweenMethodName: DORotateQuaternion - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: LocalRotation_Transform - methodName: LocalRotation - targetType: UnityEngine.Transform - propertyType: 6 - propertyName: localRotation - propertyGetter: - propertySetter: - dotweenMethodName: DOLocalRotateQuaternion - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Scale_Transform - methodName: Scale - targetType: UnityEngine.Transform - propertyType: 4 - propertyName: localScale - propertyGetter: - propertySetter: - dotweenMethodName: DOScale - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: ScaleX_Transform - methodName: ScaleX - targetType: UnityEngine.Transform - propertyType: 1 - propertyName: - propertyGetter: localScale.x - propertySetter: localScale = _target.localScale.WithComponent(0, val) - dotweenMethodName: DOScaleX - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: ScaleY_Transform - methodName: ScaleY - targetType: UnityEngine.Transform - propertyType: 1 - propertyName: - propertyGetter: localScale.y - propertySetter: localScale = _target.localScale.WithComponent(1, val) - dotweenMethodName: DOScaleY - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: ScaleZ_Transform - methodName: ScaleZ - targetType: UnityEngine.Transform - propertyType: 1 - propertyName: - propertyGetter: localScale.z - propertySetter: localScale = _target.localScale.WithComponent(2, val) - dotweenMethodName: DOScaleZ - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Color_Graphic - methodName: Color - targetType: UnityEngine.UI.Graphic - propertyType: 2 - propertyName: color - propertyGetter: - propertySetter: - dotweenMethodName: DOColor - dependency: 1 - placeInGlobalScope: 1 - generateOnlyOverloads: 0 - - description: Color_SpriteRenderer - methodName: Color - targetType: UnityEngine.SpriteRenderer - propertyType: 2 - propertyName: color - propertyGetter: - propertySetter: - dotweenMethodName: DOColor - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Color_Material - methodName: Color - targetType: UnityEngine.Material - propertyType: 2 - propertyName: color - propertyGetter: - propertySetter: - dotweenMethodName: DOColor - dependency: 6 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Color_Light - methodName: Color - targetType: UnityEngine.Light - propertyType: 2 - propertyName: color - propertyGetter: - propertySetter: - dotweenMethodName: DOColor - dependency: 7 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: AnchoredPosition_RectTransform - methodName: AnchoredPosition - targetType: UnityEngine.RectTransform - propertyType: 3 - propertyName: anchoredPosition - propertyGetter: - propertySetter: - dotweenMethodName: DOAnchorPos - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: AnchoredPositionX_RectTransform - methodName: AnchoredPositionX - targetType: UnityEngine.RectTransform - propertyType: 1 - propertyName: - propertyGetter: anchoredPosition.x - propertySetter: anchoredPosition = _target.anchoredPosition.WithComponent(0, - val) - dotweenMethodName: DOAnchorPosX - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: AnchoredPositionY_RectTransform - methodName: AnchoredPositionY - targetType: UnityEngine.RectTransform - propertyType: 1 - propertyName: - propertyGetter: anchoredPosition.y - propertySetter: anchoredPosition = _target.anchoredPosition.WithComponent(1, - val) - dotweenMethodName: DOAnchorPosY - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: SizeDelta_RectTransform - methodName: SizeDelta - targetType: UnityEngine.RectTransform - propertyType: 3 - propertyName: sizeDelta - propertyGetter: - propertySetter: - dotweenMethodName: DOSizeDelta - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Alpha_CanvasGroup - methodName: Alpha - targetType: UnityEngine.CanvasGroup - propertyType: 1 - propertyName: alpha - propertyGetter: - propertySetter: - dotweenMethodName: DOFade - dependency: 1 - placeInGlobalScope: 1 - generateOnlyOverloads: 0 - - description: Alpha_Graphic - methodName: Alpha - targetType: UnityEngine.UI.Graphic - propertyType: 1 - propertyName: - propertyGetter: color.a - propertySetter: color = _target.color.WithAlpha(val) - dotweenMethodName: DOFade - dependency: 1 - placeInGlobalScope: 1 - generateOnlyOverloads: 0 - - description: Alpha_SpriteRenderer - methodName: Alpha - targetType: UnityEngine.SpriteRenderer - propertyType: 1 - propertyName: - propertyGetter: color.a - propertySetter: color = _target.color.WithAlpha(val) - dotweenMethodName: DOFade - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Alpha_Material - methodName: Alpha - targetType: UnityEngine.Material - propertyType: 1 - propertyName: - propertyGetter: color.a - propertySetter: color = _target.color.WithAlpha(val) - dotweenMethodName: DOFade - dependency: 6 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: MainTextureOffset_Material - methodName: MainTextureOffset - targetType: UnityEngine.Material - propertyType: 3 - propertyName: mainTextureOffset - propertyGetter: - propertySetter: - dotweenMethodName: DOOffset - dependency: 6 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: MainTextureScale_Material - methodName: MainTextureScale - targetType: UnityEngine.Material - propertyType: 3 - propertyName: mainTextureScale - propertyGetter: - propertySetter: - dotweenMethodName: DOTiling - dependency: 6 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: FillAmount_Image - methodName: FillAmount - targetType: UnityEngine.UI.Image - propertyType: 1 - propertyName: fillAmount - propertyGetter: - propertySetter: - dotweenMethodName: DOFillAmount - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Volume_AudioSource - methodName: Volume - targetType: UnityEngine.AudioSource - propertyType: 1 - propertyName: volume - propertyGetter: - propertySetter: - dotweenMethodName: DOFade - dependency: 2 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Pitch_AudioSource - methodName: Pitch - targetType: UnityEngine.AudioSource - propertyType: 1 - propertyName: pitch - propertyGetter: - propertySetter: - dotweenMethodName: DOPitch - dependency: 2 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: PanStereo_AudioSource - methodName: PanStereo - targetType: UnityEngine.AudioSource - propertyType: 1 - propertyName: panStereo - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 2 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: TweenTimeScale_Tween - methodName: TweenTimeScale - targetType: PrimeTween.Tween - propertyType: 1 - propertyName: - propertyGetter: - propertySetter: - dotweenMethodName: DOTimeScale - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 1 - - description: TweenTimeScale_Sequence - methodName: TweenTimeScale - targetType: PrimeTween.Sequence - propertyType: 1 - propertyName: - propertyGetter: - propertySetter: - dotweenMethodName: DOTimeScale - dependency: 0 - placeInGlobalScope: 0 - generateOnlyOverloads: 1 - - description: VisualElementLayout_VisualElement - methodName: VisualElementLayout - targetType: UnityEngine.UIElements.VisualElement - propertyType: 7 - propertyName: - propertyGetter: GetResolvedStyleRect() - propertySetter: SetStyleRect(val) - dotweenMethodName: - dependency: 9 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Position_ITransform - methodName: Position - targetType: UnityEngine.UIElements.ITransform - propertyType: 4 - propertyName: position - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 9 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Rotation_ITransform - methodName: Rotation - targetType: UnityEngine.UIElements.ITransform - propertyType: 6 - propertyName: rotation - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 9 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: Scale_ITransform - methodName: Scale - targetType: UnityEngine.UIElements.ITransform - propertyType: 4 - propertyName: scale - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 9 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: VisualElementSize_VisualElement - methodName: VisualElementSize - targetType: UnityEngine.UIElements.VisualElement - propertyType: 3 - propertyName: - propertyGetter: layout.size - propertySetter: style.width = val.x; _target.style.height = val.y - dotweenMethodName: - dependency: 9 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: VisualElementTopLeft_VisualElement - methodName: VisualElementTopLeft - targetType: UnityEngine.UIElements.VisualElement - propertyType: 3 - propertyName: - propertyGetter: GetTopLeft() - propertySetter: SetTopLeft(val) - dotweenMethodName: - dependency: 9 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: VisualElementColor_VisualElement - methodName: VisualElementColor - targetType: UnityEngine.UIElements.VisualElement - propertyType: 2 - propertyName: - propertyGetter: style.color.value - propertySetter: style.color = val - dotweenMethodName: - dependency: 9 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: VisualElementBackgroundColor_VisualElement - methodName: VisualElementBackgroundColor - targetType: UnityEngine.UIElements.VisualElement - propertyType: 2 - propertyName: - propertyGetter: style.backgroundColor.value - propertySetter: style.backgroundColor = val - dotweenMethodName: - dependency: 9 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: OffsetMin_RectTransform - methodName: OffsetMin - targetType: UnityEngine.RectTransform - propertyType: 3 - propertyName: offsetMin - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: OffsetMinX_RectTransform - methodName: OffsetMinX - targetType: UnityEngine.RectTransform - propertyType: 1 - propertyName: - propertyGetter: offsetMin[0] - propertySetter: offsetMin = _target.offsetMin.WithComponent(0, val) - dotweenMethodName: - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: OffsetMinY_RectTransform - methodName: OffsetMinY - targetType: UnityEngine.RectTransform - propertyType: 1 - propertyName: - propertyGetter: offsetMin[1] - propertySetter: offsetMin = _target.offsetMin.WithComponent(1, val) - dotweenMethodName: - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: OffsetMax_RectTransform - methodName: OffsetMax - targetType: UnityEngine.RectTransform - propertyType: 3 - propertyName: offsetMax - propertyGetter: - propertySetter: - dotweenMethodName: - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: OffsetMaxX_RectTransform - methodName: OffsetMaxX - targetType: UnityEngine.RectTransform - propertyType: 1 - propertyName: - propertyGetter: offsetMax[0] - propertySetter: offsetMax = _target.offsetMax.WithComponent(0, val) - dotweenMethodName: - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: OffsetMaxY_RectTransform - methodName: OffsetMaxY - targetType: UnityEngine.RectTransform - propertyType: 1 - propertyName: - propertyGetter: offsetMax[1] - propertySetter: offsetMax = _target.offsetMax.WithComponent(1, val) - dotweenMethodName: - dependency: 1 - placeInGlobalScope: 0 - generateOnlyOverloads: 0 - - description: TextMaxVisibleCharacters_TMP_Text - methodName: TextMaxVisibleCharacters - targetType: TMPro.TMP_Text - propertyType: 8 - propertyName: maxVisibleCharacters - propertyGetter: - propertySetter: - dotweenMethodName: DOMaxVisibleCharacters - dependency: 10 - placeInGlobalScope: 0 - generateOnlyOverloads: 1 - additiveMethodsGenerator: - additiveMethods: - - methodName: PositionAdditive - propertyType: 4 - setter: _target.position += delta - - methodName: LocalPositionAdditive - propertyType: 4 - setter: _target.localPosition += delta - - methodName: ScaleAdditive - propertyType: 4 - setter: _target.localScale += delta - - methodName: RotationAdditive - propertyType: 4 - setter: _target.rotation *= UnityEngine.Quaternion.Euler(delta) - - methodName: LocalRotationAdditive - propertyType: 4 - setter: _target.localRotation *= UnityEngine.Quaternion.Euler(delta) - - methodName: RotationAdditive - propertyType: 6 - setter: _target.rotation *= delta - - methodName: LocalRotationAdditive - propertyType: 6 - setter: _target.localRotation *= delta - speedBasedMethodsGenerator: - data: - - methodName: Position - propType: 4 - propName: position - speedParamName: averageSpeed - - methodName: LocalPosition - propType: 4 - propName: localPosition - speedParamName: averageSpeed - - methodName: Rotation - propType: 6 - propName: rotation - speedParamName: averageAngularSpeed - - methodName: LocalRotation - propType: 6 - propName: localRotation - speedParamName: averageAngularSpeed diff --git a/VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta b/VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta deleted file mode 100644 index 8b2d7c57..00000000 --- a/VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta +++ /dev/null @@ -1,8 +0,0 @@ -fileFormatVersion: 2 -guid: 5b5aaa5611b385541ab2b0cb1d8755e1 -NativeFormatImporter: - externalObjects: {} - mainObjectFileID: 11400000 - userData: - assetBundleName: - assetBundleVariant: diff --git a/VirtueSky/PrimeTween/Editor/CodeGenerator.cs b/VirtueSky/PrimeTween/Editor/CodeGenerator.cs deleted file mode 100644 index 0b16493d..00000000 --- a/VirtueSky/PrimeTween/Editor/CodeGenerator.cs +++ /dev/null @@ -1,762 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Reflection; -using JetBrains.Annotations; -using PrimeTween; -using UnityEditor; -using UnityEngine; -using Assert = UnityEngine.Assertions.Assert; - -// todo check all TweenType are covered in TweenTypeToTweenData() -internal class CodeGenerator : ScriptableObject { - [SerializeField] MonoScript methodsScript; - [SerializeField] MonoScript dotweenMethodsScript; - [SerializeField] MonoScript tweenComponentScript; - [SerializeField] MonoScript editorUtilsScript; - [SerializeField] MethodGenerationData[] methodsData; - [SerializeField] AdditiveMethodsGenerator additiveMethodsGenerator; - [SerializeField] SpeedBasedMethodsGenerator speedBasedMethodsGenerator; - - /*void OnEnable() { - #if PRIME_TWEEN_SAFETY_CHECKS - foreach (var data in methodsData) { - data.description = ""; - var methodPrefix = getMethodPrefix(data.dependency); - if (!string.IsNullOrEmpty(methodPrefix)) { - data.description += methodPrefix + "_"; - } - data.description = data.methodName + "_" + getTypeByName(data.targetType).Name; - } - #endif - }*/ - - [Serializable] - class AdditiveMethodsGenerator { - [SerializeField] AdditiveMethodsGeneratorData[] additiveMethods; - - [Serializable] - class AdditiveMethodsGeneratorData { - [SerializeField] internal string methodName; - [SerializeField] internal PropType propertyType; - [SerializeField] internal string setter; - } - - [NotNull] - internal string Generate() { - string result = @" -#if PRIME_TWEEN_EXPERIMENTAL"; - foreach (var data in additiveMethods) { - const string template = @" - public static Tween PositionAdditive([NotNull] UnityEngine.Transform target, Single deltaValue, float duration, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => PositionAdditive(target, deltaValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)); - public static Tween PositionAdditive([NotNull] UnityEngine.Transform target, Single deltaValue, float duration, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => PositionAdditive(target, deltaValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)); - public static Tween PositionAdditive([NotNull] UnityEngine.Transform target, Single deltaValue, TweenSettings settings) - => CustomAdditive(target, deltaValue, settings, (_target, delta) => additiveTweenSetter()); -"; - result += template.Replace("Single", data.propertyType.ToFullTypeName()) - .Replace("PositionAdditive", data.methodName) - .Replace("additiveTweenSetter()", data.setter); - } - result += "#endif"; - return result; - } - } - - [ContextMenu(nameof(generateAllMethods))] - internal void generateAllMethods() { - generateMethods(); - generateDotweenMethods(); - } - - 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() { - if (tweenComponentScript == null) { - Debug.LogError("Not generating TweenComponent script because this component is only available in PrimeTween PRO."); - return; - } - - var str = tweenComponentScript.text; - var searchIndex = str.IndexOf(generatorBeginLabel, StringComparison.Ordinal); - Assert.AreNotEqual(-1, searchIndex); - str = str.Substring(0, searchIndex + generatorBeginLabel.Length) + "\n"; - - var tweenTypes = (TweenType[]) Enum.GetValues(typeof(TweenType)); - tweenTypes = tweenTypes.SkipWhile(x => x != TweenType.LightRange).ToArray(); - var generationData = methodsData - .GroupBy(_ => _.dependency) - .SelectMany(x => x) - .SkipWhile(x => x.description != "Range_Light") - .ToArray(); - - Dependency dependency = Dependency.None; - for (var i = 0; i < generationData.Length; i++) { - var data = generationData[i]; - if (dependency != data.dependency) { - if (shouldWrapInDefine(dependency)) { - str += " #endif\n"; - } - dependency = data.dependency; - if (shouldWrapInDefine(dependency)) { - switch (dependency) { - case Dependency.PRIME_TWEEN_EXPERIMENTAL: - case Dependency.UI_ELEMENTS_MODULE_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; - } - } - } - var tweenType = tweenTypes[i]; - if (data.dependency == Dependency.UI_ELEMENTS_MODULE_INSTALLED || data.targetType.Contains("PrimeTween.")) { // skip both TweenTimeScale - continue; - } - Assert.IsTrue(tweenType.ToString().Contains(data.methodName), $"{i}, {tweenType}, {data.methodName}"); - // Debug.Log(data.methodName); - - var template = @" case TweenType.Position: - return target is Transform positionTarget ? Tween.Position(positionTarget, settingsVector3) : (Tween?)null;"; - template = template.Replace("TweenType.Position", $"TweenType.{tweenType}"); - template = template.Replace("Transform", getTypeByName(data.targetType).Name); - var varName = tweenType.ToString(); - varName = char.ToLower(varName[0]) + varName.Substring(1) + "Target"; - template = template.Replace("positionTarget", varName); - template = template.Replace("Tween.Position", $"Tween.{getPrefix()}{data.methodName}"); - template = template.Replace("settingsVector3", $"settings{data.propertyType}"); - str += template + "\n"; - - string getPrefix() => data.placeInGlobalScope ? null : getMethodPrefix(data.dependency); - } - if (shouldWrapInDefine(dependency)) { - str += " #endif\n"; - } - str += @" default: - throw new Exception(); - } - } - } - } -} -"; - SaveScript(tweenComponentScript, str); - } - - static void SaveScript(MonoScript script, string text) { - var path = AssetDatabase.GetAssetPath(script); - if (text == File.ReadAllText(path)) { - return; - } - File.WriteAllText(path, text); - EditorUtility.SetDirty(script); - AssetDatabase.Refresh(); - AssetDatabase.SaveAssets(); - } - - void generateDotweenMethods() { - // todo combine adapter files into one file - var str = @"#if PRIME_TWEEN_DOTWEEN_ADAPTER -// This file is generated by CodeGenerator.cs -using JetBrains.Annotations; -using System; - -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);"; - str += generateWithDefines(data => { - if (!data.dotweenMethodName.Any()) { - return string.Empty; - } - Assert.IsTrue(data.dotweenMethodName.Any()); - string result = ""; - result += "\n"; - result += populateTemplate(dotweenOverload.Replace("DOTWEEN_METHOD_NAME", data.dotweenMethodName), data); - return result; - }); - str += @" - } -} -#endif"; - SaveScript(dotweenMethodsScript, str); - } - - [CanBeNull] - static string getMethodPrefix(Dependency dep) { - switch (dep) { - case Dependency.UNITY_UGUI_INSTALLED: - return "UI"; - case Dependency.AUDIO_MODULE_INSTALLED: - return "Audio"; - case Dependency.PHYSICS_MODULE_INSTALLED: - case Dependency.PHYSICS2D_MODULE_INSTALLED: - return nameof(Rigidbody); - case Dependency.None: - case Dependency.PRIME_TWEEN_EXPERIMENTAL: - case Dependency.UI_ELEMENTS_MODULE_INSTALLED: - case Dependency.TEXT_MESH_PRO_INSTALLED: - return null; - } - return dep.ToString(); - } - - static bool shouldWrapInDefine(Dependency d) { - switch (d) { - case Dependency.UNITY_UGUI_INSTALLED: - case Dependency.AUDIO_MODULE_INSTALLED: - case Dependency.PHYSICS_MODULE_INSTALLED: - case Dependency.PHYSICS2D_MODULE_INSTALLED: - case Dependency.PRIME_TWEEN_EXPERIMENTAL: - case Dependency.UI_ELEMENTS_MODULE_INSTALLED: - case Dependency.TEXT_MESH_PRO_INSTALLED: - return true; - } - return false; - } - - const string overloadTemplateTo = @" public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single endValue, float duration, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => METHOD_NAME(target, new TweenSettings(endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single endValue, float duration, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => METHOD_NAME(target, new TweenSettings(endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single startValue, Single endValue, float duration, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => METHOD_NAME(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single startValue, Single endValue, float duration, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => METHOD_NAME(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single endValue, TweenSettings settings) => METHOD_NAME(target, new TweenSettings(endValue, settings)); - public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single startValue, Single endValue, TweenSettings settings) => METHOD_NAME(target, new TweenSettings(startValue, endValue, settings));"; - const string fullTemplate = @" public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, TweenSettings settings) { - return animate(target, ref settings, _tween => { - var _target = _tween.target as UnityEngine.Camera; - var val = _tween.FloatVal; - _target.orthographicSize = val; - }, t => (t.target as UnityEngine.Camera).orthographicSize.ToContainer(), TweenType.CameraOrthographicSize); - }"; - - void generateMethods() { - var text = methodsScript.text; - var searchIndex = text.IndexOf(generatorBeginLabel, StringComparison.Ordinal); - Assert.AreNotEqual(-1, searchIndex); - text = text.Substring(0, searchIndex + generatorBeginLabel.Length) + "\n"; - - var methodDataToEnumName = new Dictionary(); - { // generate enums - foreach (var group in methodsData.GroupBy(_ => _.dependency)) { - foreach (var data in group) { - text += " "; - var enumName = GetTweenTypeEnumName(data); - methodDataToEnumName.Add(data, enumName); - text += enumName; - text += ",\n"; - } - } - text += " }\n\n"; - } - { // generate TweenTypeToTweenData() - // todo combine Utils class with TweenGenerated or Extensions file - string utilsText = @"using System; -using PrimeTween; - -internal static class Utils { - internal static (PropType, Type) TweenTypeToTweenData(TweenType tweenType) { - switch (tweenType) { -"; - foreach (var group in methodsData.GroupBy(x => x.dependency)) { - var dependency = group.Key; - if (shouldWrapInDefine(dependency)) { - switch (dependency) { - case Dependency.PRIME_TWEEN_EXPERIMENTAL: - case Dependency.UI_ELEMENTS_MODULE_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; - } - } - foreach (var data in group) { - utilsText += $" case TweenType.{methodDataToEnumName[data]}:\n"; - utilsText += $" return (PropType.{data.propertyType}, typeof({getTypeByName(data.targetType).FullName}));\n"; - } - if (shouldWrapInDefine(dependency)) { - utilsText += " #endif\n"; - } - } - var tweenData = new List<(TweenType, PropType, Type)> { - (TweenType.None, PropType.None, null), - #if PRIME_TWEEN_PRO - (TweenType.TweenComponent, PropType.None, typeof(TweenComponent)), - #endif - (TweenType.Delay, PropType.Float, null), - (TweenType.Callback, PropType.Float, null), - (TweenType.ShakeLocalPosition, PropType.Vector3, typeof(Transform)), - (TweenType.ShakeLocalRotation, PropType.Quaternion, typeof(Transform)), - (TweenType.ShakeScale, PropType.Vector3, typeof(Transform)), - (TweenType.ShakeCustom, PropType.Vector3, typeof(Transform)), - (TweenType.ShakeCamera, PropType.Float, typeof(Camera)), - (TweenType.CustomFloat, PropType.Float, null), - (TweenType.CustomColor, PropType.Color, null), - (TweenType.CustomVector2, PropType.Vector2, null), - (TweenType.CustomVector3, PropType.Vector3, null), - (TweenType.CustomVector4, PropType.Vector4, null), - (TweenType.CustomQuaternion, PropType.Quaternion, null), - (TweenType.CustomRect, PropType.Rect, null), - (TweenType.CustomDouble, PropType.Double, null), - (TweenType.MaterialColorProperty, PropType.Color, typeof(Material)), - (TweenType.MaterialProperty, PropType.Float, typeof(Material)), - (TweenType.MaterialAlphaProperty, PropType.Float, typeof(Material)), - (TweenType.MaterialTextureOffset, PropType.Vector2, typeof(Material)), - (TweenType.MaterialTextureScale, PropType.Vector2, typeof(Material)), - (TweenType.MaterialPropertyVector4, PropType.Vector4, typeof(Material)), - (TweenType.EulerAngles, PropType.Vector3, typeof(Transform)), - (TweenType.LocalEulerAngles, PropType.Vector3, typeof(Transform)), - (TweenType.GlobalTimeScale, PropType.Float, null), - (TweenType.MainSequence, PropType.Float, null), - (TweenType.NestedSequence, PropType.Float, null) - }; - foreach (var tuple in tweenData) { - utilsText += $" case TweenType.{tuple.Item1}:\n"; - string typeStr = tuple.Item3 == null ? "null" : $"typeof({tuple.Item3})"; - utilsText += $" return (PropType.{tuple.Item2}, {typeStr});\n"; - } - utilsText += @" default: - throw new Exception(); - } - } -} -"; - SaveScript(editorUtilsScript, utilsText); - } - - text += " public partial struct Tween {"; - text += generateWithDefines(generate); - text = addCustomAnimationMethods(text); - text += additiveMethodsGenerator.Generate(); - text += speedBasedMethodsGenerator.Generate(); - text += @" - } -}"; - SaveScript(methodsScript, text); - } - - static string GetTweenTypeEnumName(MethodGenerationData data) { - string result = ""; - var dependency = data.dependency; - if (dependency != Dependency.None) { - result += getMethodPrefix(dependency); - } - if (dependency == Dependency.UI_ELEMENTS_MODULE_INSTALLED && !data.methodName.Contains("VisualElement")) { - result += "VisualElement"; - } - result += data.methodName; - if ((data.methodName == "Alpha" || data.methodName == "Color") && data.dependency == Dependency.UNITY_UGUI_INSTALLED) { - result += getTypeByName(data.targetType).Name; - } else if (data.methodName == "Scale" && data.propertyType == PropType.Float) { - result += "Uniform"; - } else if ((data.methodName == "Rotation" || data.methodName == "LocalRotation") && data.propertyType == PropType.Quaternion) { - result += "Quaternion"; - } else if (data.targetType == "PrimeTween.Sequence" ) { - result += "Sequence"; - } else if (data.targetType == "UnityEngine.Rigidbody2D") { - result += "2D"; - } - return result; - } - - [NotNull] - string generateWithDefines([NotNull] Func generator) { - string result = ""; - foreach (var group in methodsData.GroupBy(_ => _.dependency)) { - result += generateWithDefines(generator, group); - } - return result; - } - - [NotNull] - static string generateWithDefines([NotNull] Func generator, [NotNull] IGrouping group) { - var result = ""; - var dependency = group.Key; - if (shouldWrapInDefine(dependency)) { - switch (dependency) { - case Dependency.PRIME_TWEEN_EXPERIMENTAL: - case Dependency.UI_ELEMENTS_MODULE_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; - } - } - foreach (var method in group) { - var generated = generator(method); - if (!string.IsNullOrEmpty(generated)) { - result += generated; - result += "\n"; - } - } - if (shouldWrapInDefine(dependency)) { - result += "\n #endif"; - } - return result; - } - - [NotNull] - static Type getTypeByName(string targetType) { - var types = AppDomain.CurrentDomain - .GetAssemblies() - .Select(_ => _.GetType(targetType)) - .Where(_ => _ != null) - .Where(_ => _.FullName == targetType) - .Distinct() - .ToArray(); - switch (types.Length) { - case 0: - throw new Exception($"target type ({targetType}) not found in any of the assemblies.\n" + - "Please specify the full name of the type. For example, instead of 'Transform', use 'UnityEngine.Transform'.\n" + - "Or install the target package in Package Manager.\n"); - case 1: - break; - default: - throw new Exception($"More than one type found that match {targetType}. Found:\n" - + string.Join("\n", types.Select(_ => $"{_.AssemblyQualifiedName}\n{_.Assembly.GetName().FullName}"))); - } - var type = types.Single(); - Assert.IsNotNull(type, $"targetType ({targetType}) wasn't found in any assembly."); - return type; - } - - [NotNull] - static string generate([NotNull] MethodGenerationData data) { - var methodName = data.methodName; - Assert.IsTrue(System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(methodName), $"Method name is invalid: {methodName}."); - var propertyName = data.propertyName; - - var overload = populateTemplate(overloadTemplateTo, data); - var full = populateTemplate(fullTemplate, data); - const string templatePropName = "orthographicSize"; - string replaced = ""; - if (data.generateOnlyOverloads) { - replaced += "\n"; - replaced += overload; - } else if (propertyName.Any()) { - checkFieldOrProp(); - Assert.IsFalse(data.propertyGetter.Any()); - Assert.IsFalse(data.propertySetter.Any()); - replaced += "\n"; - replaced += overload; - replaced += "\n"; - replaced += full; - replaced = replaced.Replace(templatePropName, propertyName); - - void checkFieldOrProp() { - var type = getTypeByName(data.targetType); - Assert.IsNotNull(type); - const BindingFlags flags = BindingFlags.Instance | BindingFlags.Public; - var prop = type.GetProperty(propertyName, flags); - Type expectedPropType; - if (data.propertyType == PropType.Float) { - expectedPropType = typeof(float); - } else if (data.propertyType == PropType.Int) { - expectedPropType = typeof(int); - } else { - var typeName = $"{data.propertyType.ToFullTypeName()}, UnityEngine.CoreModule"; - expectedPropType = Type.GetType(typeName); - Assert.IsNotNull(expectedPropType, typeName); - } - if (prop != null) { - Assert.AreEqual(expectedPropType, prop.PropertyType); - return; - } - - var field = type.GetField(propertyName, flags); - if (field != null) { - Assert.AreEqual(expectedPropType, field.FieldType, "Field type is incorrect."); - return; - } - - throw new Exception($"Field or property with name ({propertyName}) not found for type {type.FullName}. Generation data name: {data.description}."); - } - } else { - Assert.IsTrue(data.propertySetter.Any()); - if (data.propertyGetter.Any()) { - replaced += "\n"; - replaced += replaceGetter(overload); - } - - replaced += "\n"; - full = replaceSetter(full); - replaced += replaceGetter(full); - - // ReSharper disable once AnnotateNotNullTypeMember - string replaceGetter(string str) { - while (true) { - var j = str.IndexOf(templatePropName, StringComparison.Ordinal); - if (j == -1) { - break; - } - Assert.AreNotEqual(-1, j); - str = str.Remove(j, templatePropName.Length); - str = str.Insert(j, data.propertyGetter); - } - return str; - } - - // ReSharper disable once AnnotateNotNullTypeMember - string replaceSetter(string str) { - while (true) { - var k = str.IndexOf("orthographicSize =", StringComparison.Ordinal); - if (k == -1) { - break; - } - Assert.AreNotEqual(-1, k); - var endIndex = str.IndexOf(";", k, StringComparison.Ordinal); - Assert.AreNotEqual(-1, endIndex); - str = str.Remove(k, endIndex - k); - str = str.Insert(k, data.propertySetter); - } - return str; - } - } - return replaced; - } - - [NotNull] - static string addCustomAnimationMethods(string text) { - const string template = @" public static Tween Custom_TEMPLATE(Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => Custom_TEMPLATE(new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); - public static Tween Custom_TEMPLATE(Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => Custom_TEMPLATE(new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); - public static Tween Custom_TEMPLATE(Single startValue, Single endValue, TweenSettings settings, [NotNull] Action onValueChange) => Custom_TEMPLATE(new TweenSettings(startValue, endValue, settings), onValueChange); - public static Tween Custom_TEMPLATE(TweenSettings settings, [NotNull] Action onValueChange) { - Assert.IsNotNull(onValueChange); - if (settings.startFromCurrent) { - UnityEngine.Debug.LogWarning(Constants.customTweensDontSupportStartFromCurrentWarning); - } - var tween = PrimeTweenManager.fetchTween(); - tween.startValue.CopyFrom(ref settings.startValue); - tween.endValue.CopyFrom(ref settings.endValue); - tween.setPropType(PropType.Float); - tween.customOnValueChange = onValueChange; - tween.Setup(PrimeTweenManager.dummyTarget, ref settings.settings, _tween => { - var _onValueChange = _tween.customOnValueChange as Action; - var val = _tween.FloatVal; - try { - _onValueChange(val); - } catch (Exception e) { - Assert.LogError($""Tween was stopped because of exception in {nameof(onValueChange)} callback, tween: {_tween.GetDescription()}, exception:\n{e}\n"", _tween.id, _tween.target as UnityEngine.Object); - _tween.EmergencyStop(); - } - }, null, false, TweenType.CustomFloat); - return PrimeTweenManager.Animate(tween); - } - public static Tween Custom_TEMPLATE([NotNull] T target, Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) where T : class - => Custom_internal(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); - public static Tween Custom_TEMPLATE([NotNull] T target, Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) where T : class - => Custom_internal(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); - public static Tween Custom_TEMPLATE([NotNull] T target, Single startValue, Single endValue, TweenSettings settings, [NotNull] Action onValueChange) where T : class - => Custom_internal(target, new TweenSettings(startValue, endValue, settings), onValueChange); - public static Tween Custom_TEMPLATE([NotNull] T target, TweenSettings settings, [NotNull] Action onValueChange) where T : class - => Custom_internal(target, settings, onValueChange); - #if PRIME_TWEEN_EXPERIMENTAL - public static Tween CustomAdditive([NotNull] T target, Single deltaValue, TweenSettings settings, [NotNull] Action onDeltaChange) where T : class - => Custom_internal(target, new TweenSettings(default, deltaValue, settings), onDeltaChange, true); - #endif - static Tween Custom_internal([NotNull] T target, TweenSettings settings, [NotNull] Action onValueChange, bool isAdditive = false) where T : class { - Assert.IsNotNull(onValueChange); - if (settings.startFromCurrent) { - UnityEngine.Debug.LogWarning(Constants.customTweensDontSupportStartFromCurrentWarning); - } - var tween = PrimeTweenManager.fetchTween(); - tween.startValue.CopyFrom(ref settings.startValue); - tween.endValue.CopyFrom(ref settings.endValue); - tween.setPropType(PropType.Float); - tween.customOnValueChange = onValueChange; - tween.isAdditive = isAdditive; - tween.Setup(target, ref settings.settings, _tween => { - var _onValueChange = _tween.customOnValueChange as Action; - var _target = _tween.target as T; - Single val; - if (_tween.isAdditive) { - var newVal = _tween.FloatVal; - val = newVal.calcDelta(_tween.prevVal); - _tween.prevVal.FloatVal = newVal; - } else { - val = _tween.FloatVal; - } - try { - _onValueChange(_target, val); - } catch (Exception e) { - Assert.LogError($""Tween was stopped because of exception in {nameof(onValueChange)} callback, tween: {_tween.GetDescription()}, exception:\n{e}\n"", _tween.id, _tween.target as UnityEngine.Object); - _tween.EmergencyStop(); - } - }, null, false, TweenType.CustomFloat); - return PrimeTweenManager.Animate(tween); - } - static Tween animate(object target, ref TweenSettings settings, [NotNull] Action setter, Func getter, TweenType _tweenType) { - var tween = PrimeTweenManager.fetchTween(); - tween.startValue.CopyFrom(ref settings.startValue); - tween.endValue.CopyFrom(ref settings.endValue); - tween.setPropType(PropType.Float); - tween.Setup(target, ref settings.settings, setter, getter, settings.startFromCurrent, _tweenType); - return PrimeTweenManager.Animate(tween); - } - static Tween animateWithIntParam([NotNull] object target, int intParam, ref TweenSettings settings, [NotNull] Action setter, [NotNull] Func getter, TweenType _tweenType) { - var tween = PrimeTweenManager.fetchTween(); - tween.intParam = intParam; - tween.startValue.CopyFrom(ref settings.startValue); - tween.endValue.CopyFrom(ref settings.endValue); - tween.setPropType(PropType.Float); - tween.Setup(target, ref settings.settings, setter, getter, settings.startFromCurrent, _tweenType); - return PrimeTweenManager.Animate(tween); - }"; - - var types = new[] { typeof(float), typeof(Color), typeof(Vector2), typeof(Vector3), typeof(Vector4), typeof(Quaternion), typeof(Rect) }; - foreach (var type in types) { - text += "\n\n"; - var isFloat = type == typeof(float); - var replaced = template; - replaced = replaced.Replace("Single", isFloat ? "float" : type.FullName); - if (!isFloat) { - replaced = replaced.Replace("TweenSettings", $"TweenSettings<{type.FullName}>"); - replaced = replaced.Replace(".FloatVal", $".{type.Name}Val"); - replaced = replaced.Replace("Single val;", $"{type.Name} val;"); - replaced = replaced.Replace("PropType.Float", $"PropType.{type.Name}"); - replaced = replaced.Replace("TweenType.CustomFloat", $"TweenType.Custom{type.Name}"); - } - replaced = replaced.Replace("Custom_TEMPLATE", "Custom"); - text += replaced; - } - return text; - } - - [NotNull] - static string populateTemplate([NotNull] string str, [NotNull] MethodGenerationData data) { - var methodName = data.methodName; - var prefix = getMethodPrefix(data.dependency); - if (prefix != null && !data.placeInGlobalScope) { - methodName = prefix + methodName; - } - var targetType = data.targetType; - if (string.IsNullOrEmpty(targetType)) { - str = str.Replace("[NotNull] UnityEngine.Camera target, ", "") - .Replace("METHOD_NAME(target, ", "METHOD_NAME("); - } else { - str = str.Replace("UnityEngine.Camera", targetType); - } - str = str.Replace("METHOD_NAME", methodName); - str = str.Replace("TweenType.CameraOrthographicSize", $"TweenType.{GetTweenTypeEnumName(data)}"); - if (data.propertyType != PropType.Float) { - str = str.Replace("Single", data.propertyType.ToFullTypeName()); - str = str.Replace("_tween.FloatVal", $"_tween.{data.propertyType.ToString()}Val"); - str = str.Replace("TweenSettings", $"TweenSettings<{data.propertyType.ToFullTypeName()}>"); - } - return str; - } - - [Serializable] - internal class SpeedBasedMethodsGenerator { - [SerializeField] Data[] data; - - [Serializable] - class Data { - [SerializeField] internal string methodName; - [SerializeField] internal PropType propType; - [SerializeField] internal string propName; - [SerializeField] internal string speedParamName; - } - - [NotNull] - internal string Generate() { - string result = ""; - foreach (var d in data) { - const string template = @" - public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 endValue, float averageSpeed, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => PositionAtSpeed(target, new TweenSettings(endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 endValue, float averageSpeed, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => PositionAtSpeed(target, new TweenSettings(endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 startValue, UnityEngine.Vector3 endValue, float averageSpeed, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => PositionAtSpeed(target, new TweenSettings(startValue, endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 startValue, UnityEngine.Vector3 endValue, float averageSpeed, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => PositionAtSpeed(target, new TweenSettings(startValue, endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, TweenSettings settings) { - var speed = settings.settings.duration; - if (speed <= 0) { - UnityEngine.Debug.LogError($""Invalid speed provided to the Tween.{nameof(PositionAtSpeed)}() method: {speed}.""); - return default; - } - if (settings.startFromCurrent) { - settings.startFromCurrent = false; - settings.startValue = target.position; - } - settings.settings.duration = Extensions.CalcDistance(settings.startValue, settings.endValue) / speed; - return Tween.Position(target, settings); - } -"; - result += template.Replace("PositionAtSpeed", $"{d.methodName}AtSpeed") - .Replace("UnityEngine.Vector3", d.propType.ToFullTypeName()) - .Replace("Tween.Position", $"{d.methodName}") - .Replace("target.position", $"target.{d.propName}") - .Replace("averageSpeed", $"{d.speedParamName}") - ; - } - return result; - } - } -} - -[Serializable] -class MethodGenerationData { - public string description; - public string methodName; - public string targetType; - public PropType propertyType; - - public string propertyName; - - public string propertyGetter; - public string propertySetter; - public string dotweenMethodName; - public Dependency dependency; - public bool placeInGlobalScope; - public bool generateOnlyOverloads; -} - -[PublicAPI] -enum Dependency { - None, - UNITY_UGUI_INSTALLED, - AUDIO_MODULE_INSTALLED, - PHYSICS_MODULE_INSTALLED, - PHYSICS2D_MODULE_INSTALLED, - Camera, - Material, - Light, - PRIME_TWEEN_EXPERIMENTAL, - UI_ELEMENTS_MODULE_INSTALLED, - TEXT_MESH_PRO_INSTALLED -} - -static class Ext { - [NotNull] - internal static string ToFullTypeName(this PropType type) { - Assert.AreNotEqual(PropType.Float, type); - if (type == PropType.Int) { - return "int"; - } - return $"UnityEngine.{type}"; - } -} diff --git a/VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta b/VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta deleted file mode 100644 index adc33218..00000000 --- a/VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 91062890830ba3f44ae278f19424d5ad -timeCreated: 1673348438 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/CodeTemplates.cs b/VirtueSky/PrimeTween/Editor/CodeTemplates.cs deleted file mode 100644 index b8c5e1fa..00000000 --- a/VirtueSky/PrimeTween/Editor/CodeTemplates.cs +++ /dev/null @@ -1,150 +0,0 @@ -/* -// ReSharper disable PossibleNullReferenceException -// ReSharper disable UnusedMember.Global -// ReSharper disable MemberCanBePrivate.Global -// ReSharper disable UnusedMember.Local -using System; -using JetBrains.Annotations; - -namespace PrimeTween { - internal static class CodeTemplates { - public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 endValue, float averageSpeed, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => PositionAtSpeed(target, new TweenSettings(endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 endValue, float averageSpeed, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => PositionAtSpeed(target, new TweenSettings(endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 startValue, UnityEngine.Vector3 endValue, float averageSpeed, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => PositionAtSpeed(target, new TweenSettings(startValue, endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 startValue, UnityEngine.Vector3 endValue, float averageSpeed, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => PositionAtSpeed(target, new TweenSettings(startValue, endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, TweenSettings settings) { - var speed = settings.settings.duration; - if (speed <= 0) { - UnityEngine.Debug.LogError($"Invalid speed provided to the Tween.{nameof(PositionAtSpeed)}() method: {speed}."); - return default; - } - if (settings.startFromCurrent) { - settings.startFromCurrent = false; - settings.startValue = target.position; - } - settings.settings.duration = Extensions.CalcDistance(settings.startValue, settings.endValue) / speed; - return Tween.Position(target, settings); - } - - public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single endValue, float duration, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => METHOD_NAME(target, new TweenSettings(endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single endValue, float duration, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => METHOD_NAME(target, new TweenSettings(endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single startValue, Single endValue, float duration, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => METHOD_NAME(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single startValue, Single endValue, float duration, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => METHOD_NAME(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); - public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single endValue, TweenSettings settings) => METHOD_NAME(target, new TweenSettings(endValue, settings)); - public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single startValue, Single endValue, TweenSettings settings) => METHOD_NAME(target, new TweenSettings(startValue, endValue, settings)); - - public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, TweenSettings settings) { - return animate(target, ref settings, _tween => { - var _target = _tween.target as UnityEngine.Camera; - var val = _tween.FloatVal; - _target.orthographicSize = val; - }, t => (t.target as UnityEngine.Camera).orthographicSize.ToContainer(), TweenType.CameraOrthographicSize); - } - - public static Tween Custom_TEMPLATE(Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => Custom_TEMPLATE(new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); - public static Tween Custom_TEMPLATE(Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => Custom_TEMPLATE(new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); - public static Tween Custom_TEMPLATE(Single startValue, Single endValue, TweenSettings settings, [NotNull] Action onValueChange) => Custom_TEMPLATE(new TweenSettings(startValue, endValue, settings), onValueChange); - public static Tween Custom_TEMPLATE(TweenSettings settings, [NotNull] Action onValueChange) { - Assert.IsNotNull(onValueChange); - if (settings.startFromCurrent) { - UnityEngine.Debug.LogWarning(Constants.customTweensDontSupportStartFromCurrentWarning); - } - var tween = PrimeTweenManager.fetchTween(); - tween.startValue.CopyFrom(ref settings.startValue); - tween.endValue.CopyFrom(ref settings.endValue); - tween.propType = PropType.Float; - tween.customOnValueChange = onValueChange; - tween.Setup(PrimeTweenManager.dummyTarget, ref settings.settings, _tween => { - var _onValueChange = _tween.customOnValueChange as Action; - var val = _tween.FloatVal; - try { - _onValueChange(val); - } catch (Exception e) { - Assert.LogError($"Tween was stopped because of exception in {nameof(onValueChange)} callback, tween: {_tween.GetDescription()}, exception:\n{e}\n", _tween.id, _tween.target as UnityEngine.Object); - _tween.EmergencyStop(); - } - }, null, false, TweenType.CustomFloat); - return PrimeTweenManager.Animate(tween); - } - public static Tween Custom_TEMPLATE([NotNull] T target, Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) where T : class - => Custom_internal(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); - public static Tween Custom_TEMPLATE([NotNull] T target, Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) where T : class - => Custom_internal(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); - public static Tween Custom_TEMPLATE([NotNull] T target, Single startValue, Single endValue, TweenSettings settings, [NotNull] Action onValueChange) where T : class - => Custom_internal(target, new TweenSettings(startValue, endValue, settings), onValueChange); - public static Tween Custom_TEMPLATE([NotNull] T target, TweenSettings settings, [NotNull] Action onValueChange) where T : class - => Custom_internal(target, settings, onValueChange); - #if PRIME_TWEEN_EXPERIMENTAL - public static Tween CustomAdditive([NotNull] T target, Single deltaValue, TweenSettings settings, [NotNull] Action onDeltaChange) where T : class - => Custom_internal(target, new TweenSettings(default, deltaValue, settings), onDeltaChange, true); - #endif - static Tween Custom_internal([NotNull] T target, TweenSettings settings, [NotNull] Action onValueChange, bool isAdditive = false) where T : class { - Assert.IsNotNull(onValueChange); - if (settings.startFromCurrent) { - UnityEngine.Debug.LogWarning(Constants.customTweensDontSupportStartFromCurrentWarning); - } - var tween = PrimeTweenManager.fetchTween(); - tween.startValue.CopyFrom(ref settings.startValue); - tween.endValue.CopyFrom(ref settings.endValue); - tween.propType = PropType.Float; - tween.customOnValueChange = onValueChange; - tween.isAdditive = isAdditive; - tween.Setup(target, ref settings.settings, _tween => { - var _onValueChange = _tween.customOnValueChange as Action; - var _target = _tween.target as T; - Single val; - if (_tween.isAdditive) { - var newVal = _tween.FloatVal; - val = newVal.calcDelta(_tween.prevVal); - _tween.prevVal.FloatVal = newVal; - } else { - val = _tween.FloatVal; - } - try { - _onValueChange(_target, val); - } catch (Exception e) { - Assert.LogError($"Tween was stopped because of exception in {nameof(onValueChange)} callback, tween: {_tween.GetDescription()}, exception:\n{e}\n", _tween.id, _tween.target as UnityEngine.Object); - _tween.EmergencyStop(); - } - }, null, false, TweenType.CustomFloat); - return PrimeTweenManager.Animate(tween); - } - static Tween animate(object target, ref TweenSettings settings, [NotNull] Action setter, Func getter, TweenType _tweenType) { - var tween = PrimeTweenManager.fetchTween(); - tween.startValue.CopyFrom(ref settings.startValue); - tween.endValue.CopyFrom(ref settings.endValue); - tween.propType = PropType.Float; - tween.Setup(target, ref settings.settings, setter, getter, settings.startFromCurrent, _tweenType); - return PrimeTweenManager.Animate(tween); - } - static Tween animateWithIntParam([NotNull] object target, int intParam, ref TweenSettings settings, [NotNull] Action setter, [NotNull] Func getter, TweenType _tweenType) { - var tween = PrimeTweenManager.fetchTween(); - tween.intParam = intParam; - tween.startValue.CopyFrom(ref settings.startValue); - tween.endValue.CopyFrom(ref settings.endValue); - tween.propType = PropType.Float; - tween.Setup(target, ref settings.settings, setter, getter, settings.startFromCurrent, _tweenType); - return PrimeTweenManager.Animate(tween); - } - - public static Tween PositionAdditive([NotNull] UnityEngine.Transform target, Single deltaValue, float duration, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => PositionAdditive(target, deltaValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)); - public static Tween PositionAdditive([NotNull] UnityEngine.Transform target, Single deltaValue, float duration, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) - => PositionAdditive(target, deltaValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)); - public static Tween PositionAdditive([NotNull] UnityEngine.Transform target, Single deltaValue, TweenSettings settings) - => CustomAdditive(target, deltaValue, settings, (_, _) => additiveTweenSetter()); - - static void additiveTweenSetter() {} - } -} -*/ diff --git a/VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta b/VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta deleted file mode 100644 index beaef6e5..00000000 --- a/VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 13ce4156fb592254ab2f13dd0ab0bf52 -timeCreated: 1677166276 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs b/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs deleted file mode 100644 index aded167e..00000000 --- a/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System.Collections.Generic; -using JetBrains.Annotations; -using PrimeTween; -using UnityEditor; -using UnityEngine; - -[CustomEditor(typeof(PrimeTweenManager))] -internal class PrimeTweenManagerInspector : Editor { - SerializedProperty tweensProp; - SerializedProperty fixedUpdateTweensProp; - GUIContent aliveTweenGuiContent; - GUIContent fixedUpdateTweenGuiContent; - StringCache tweensCountCache; - StringCache maxSimultaneousTweensCountCache; - StringCache currentPoolCapacityCache; - - void OnEnable() { - tweensProp = serializedObject.FindProperty(nameof(PrimeTweenManager.tweens)); - fixedUpdateTweensProp = serializedObject.FindProperty(nameof(PrimeTweenManager.fixedUpdateTweens)); - Assert.IsNotNull(tweensProp); - Assert.IsNotNull(fixedUpdateTweensProp); - aliveTweenGuiContent = new GUIContent("Tweens"); - fixedUpdateTweenGuiContent = new GUIContent("Fixed update tweens"); - } - - public override void OnInspectorGUI() { - using (new EditorGUI.DisabledScope(true)) { - EditorGUILayout.ObjectField("Script", MonoScript.FromMonoBehaviour((MonoBehaviour)target), typeof(MonoBehaviour), false); - } - - var manager = target as PrimeTweenManager; - Assert.IsNotNull(manager); - - GUILayout.BeginHorizontal(); - GUILayout.Label("Alive tweens", EditorStyles.label); - GUILayout.Label(tweensCountCache.GetCachedString(manager.tweensCount), EditorStyles.boldLabel); - GUILayout.FlexibleSpace(); - GUILayout.EndHorizontal(); - - GUILayout.BeginHorizontal(); - GUILayout.Label( Constants.maxAliveTweens, EditorStyles.label); - GUILayout.Label(maxSimultaneousTweensCountCache.GetCachedString(manager.maxSimultaneousTweensCount), EditorStyles.boldLabel); - GUILayout.FlexibleSpace(); - GUILayout.EndHorizontal(); - - GUILayout.BeginHorizontal(); - GUILayout.Label("Tweens capacity", EditorStyles.label); - GUILayout.Label(currentPoolCapacityCache.GetCachedString(manager.currentPoolCapacity), EditorStyles.boldLabel); - GUILayout.FlexibleSpace(); - GUILayout.EndHorizontal(); - EditorGUILayout.HelpBox("Use " + Constants.setTweensCapacityMethod + " to set tweens capacity.\n" + - "To prevent memory allocations during runtime, choose the value that is greater than the maximum number of simultaneous tweens in your game.", MessageType.None); - - drawList(tweensProp, manager.tweens, aliveTweenGuiContent); - drawList(fixedUpdateTweensProp, manager.fixedUpdateTweens, fixedUpdateTweenGuiContent); - void drawList(SerializedProperty tweensProp, List list, GUIContent guiContent) { - if (tweensProp.isExpanded) { - foreach (var tween in list) { - if (tween != null && string.IsNullOrEmpty(tween.debugDescription)) { - tween.debugDescription = tween.GetDescription(); - } - } - } - using (new EditorGUI.DisabledScope(true)) { - EditorGUILayout.PropertyField(tweensProp, guiContent); - } - } - } - - struct StringCache { - int currentValue; - string str; - - [NotNull] - internal string GetCachedString(int value) { - if (currentValue != value || str == null) { - currentValue = value; - str = value.ToString(); - } - return str; - } - } -} \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta b/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta deleted file mode 100644 index 46c8d37c..00000000 --- a/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: 7c9dce2090ecb50459c38684398a3adb -timeCreated: 1683813842 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs b/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs deleted file mode 100644 index 84e12752..00000000 --- a/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System; -using JetBrains.Annotations; -using PrimeTween; -using UnityEditor; -using UnityEngine; -using static UnityEditor.EditorGUI; -using static UnityEditor.EditorGUIUtility; - -/// todo clear the custom ease curve when ease != Ease.Custom -[CustomPropertyDrawer(typeof(TweenSettings))] -internal class TweenSettingsPropDrawer : PropertyDrawer { - public override float GetPropertyHeight([NotNull] SerializedProperty property, GUIContent label) { - if (!property.isExpanded) { - return singleLineHeight; - } - return getPropHeight(property); - } - - internal static float getPropHeight([NotNull] SerializedProperty property) { - var count = 1; - count++; // duration - count++; // ease - var easeIndex = property.FindPropertyRelative(nameof(TweenSettings.ease)).intValue; - if (easeIndex == (int)Ease.Custom) { - count++; // customEase - } - count++; // cycles - var cycles = property.FindPropertyRelative(nameof(TweenSettings.cycles)).intValue; - if (cycles != 0 && cycles != 1) { - count++; // cycleMode - } - count++; // startDelay - count++; // endDelay - count++; // useUnscaledTime - count++; // useFixedUpdate - var result = singleLineHeight * count + standardVerticalSpacing * (count - 1); - result += standardVerticalSpacing * 2; // extra spacing - return result; - } - - public override void OnGUI(Rect position, [NotNull] SerializedProperty property, GUIContent label) { - var rect = new Rect(position) { height = singleLineHeight }; - PropertyField(rect, property, label); - if (!property.isExpanded) { - return; - } - moveToNextLine(ref rect); - indentLevel++; - { // duration - property.NextVisible(true); - DrawDuration(rect, property); - moveToNextLine(ref rect); - } - drawEaseTillEnd(property, ref rect); - indentLevel--; - } - - internal static void DrawDuration(Rect rect, [NotNull] SerializedProperty property) { - if (GUI.enabled) { - ClampProperty(property, 1f); - } - PropertyField(rect, property); - } - - internal static void ClampProperty(SerializedProperty prop, float defaultValue, float min = 0.01f, float max = float.MaxValue) { - prop.floatValue = prop.floatValue == 0f ? defaultValue : Mathf.Clamp(prop.floatValue, min, max); - } - - internal static void drawEaseTillEnd([NotNull] SerializedProperty property, ref Rect rect) { - DrawEaseAndCycles(property, ref rect); - drawStartDelayTillEnd(ref rect, property); - } - - internal static void DrawEaseAndCycles(SerializedProperty property, ref Rect rect, bool addSpace = true, bool draw = true) { - { // ease - property.NextVisible(true); - if (draw) PropertyField(rect, property); - moveToNextLine(ref rect); - // customEase - bool isCustom = property.intValue == (int) Ease.Custom; - property.NextVisible(true); - if (isCustom) { - if (draw) PropertyField(rect, property); - moveToNextLine(ref rect); - } - } - if (addSpace) { - rect.y += standardVerticalSpacing * 2; - } - { // cycles - var cycles = drawCycles(rect, property, draw); - moveToNextLine(ref rect); - { - // cycleMode - property.NextVisible(true); - if (cycles != 0 && cycles != 1) { - if (draw) PropertyField(rect, property); - moveToNextLine(ref rect); - } - } - } - } - - internal static void drawStartDelayTillEnd(ref Rect rect, [NotNull] SerializedProperty property) { - { // startDelay, endDelay - for (int _ = 0; _ < 2; _++) { - property.NextVisible(true); - if (property.floatValue < 0f) { - property.floatValue = 0f; - } - PropertyField(rect, property); - moveToNextLine(ref rect); - } - } - { // useUnscaledTime - property.NextVisible(true); - PropertyField(rect, property); - moveToNextLine(ref rect); - } - { // useFixedUpdate - property.NextVisible(true); - PropertyField(rect, property); - moveToNextLine(ref rect); - } - } - - internal static int drawCycles(Rect rect, [NotNull] SerializedProperty property, bool draw = true) { - property.NextVisible(false); - if (property.intValue == 0) { - property.intValue = 1; - } else if (property.intValue < -1) { - property.intValue = -1; - } - if (draw) PropertyField(rect, property); - return property.intValue; - } - - static void moveToNextLine(ref Rect rect) { - rect.y += singleLineHeight + standardVerticalSpacing; - } -} diff --git a/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs.meta b/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs.meta deleted file mode 100644 index a179809d..00000000 --- a/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f8f4d614305226a4abf7d56ed174e508 -timeCreated: 1677570253 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs b/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs deleted file mode 100644 index bf90a8ad..00000000 --- a/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs +++ /dev/null @@ -1,85 +0,0 @@ -#pragma warning disable CS0162 -using JetBrains.Annotations; -using PrimeTween; -using UnityEditor; -using UnityEngine; -using static UnityEditor.EditorGUI; -using static UnityEditor.EditorGUIUtility; - -[CustomPropertyDrawer(typeof(TweenSettings)), - CustomPropertyDrawer(typeof(TweenSettings)), - CustomPropertyDrawer(typeof(TweenSettings)), - CustomPropertyDrawer(typeof(TweenSettings)), - CustomPropertyDrawer(typeof(TweenSettings)), - CustomPropertyDrawer(typeof(TweenSettings)), - CustomPropertyDrawer(typeof(TweenSettings)), - CustomPropertyDrawer(typeof(TweenSettings)) -] -internal class TweenSettingsTypesPropDrawer : PropertyDrawer { - const bool drawStartFromCurrent = false; - - public override float GetPropertyHeight([NotNull] SerializedProperty property, GUIContent label) { - if (!property.isExpanded) { - return singleLineHeight; - } - var count = 0; - float height = 0f; - property.NextVisible(true); // startFromCurrent - incrementHeight(); // startValue - incrementHeight(); // endValue - property.NextVisible(false); - var result = height + 0 * (count - 1) + TweenSettingsPropDrawer.getPropHeight(property); - result += standardVerticalSpacing * 2; // extra space - return result; - - void incrementHeight() { - property.NextVisible(false); - count++; // startFromCurrent - height += EditorGUI.GetPropertyHeight(property, true); - } - } - - public override void OnGUI(Rect position, [NotNull] SerializedProperty property, GUIContent label) { - var rect = new Rect(position) { height = singleLineHeight }; - PropertyField(rect, property, label); - if (!property.isExpanded) { - return; - } - rect.y += singleLineHeight + standardVerticalSpacing; - indentLevel++; - - // startFromCurrent - property.NextVisible(true); - - // startValue - { - var startFromCurrent = property.boolValue; - property.NextVisible(false); - if (!startFromCurrent || !drawStartFromCurrent) { - PropertyField(rect, property, true); - moveToNextLine(true); - } - } - - // endValue - property.NextVisible(false); - PropertyField(rect, property, true); - moveToNextLine(true); - - // duration - { - property.NextVisible(false); // settings - property.NextVisible(true); // duration - TweenSettingsPropDrawer.DrawDuration(rect, property); - moveToNextLine(false); - } - - TweenSettingsPropDrawer.drawEaseTillEnd(property, ref rect); - - indentLevel--; - - void moveToNextLine(bool includeChildren) { - rect.y += EditorGUI.GetPropertyHeight(property, includeChildren) + standardVerticalSpacing; - } - } -} diff --git a/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta b/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta deleted file mode 100644 index e4c7e094..00000000 --- a/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f5dfc251024fd904d945310438915610 -timeCreated: 1677747774 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs b/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs deleted file mode 100644 index e868d843..00000000 --- a/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs +++ /dev/null @@ -1,117 +0,0 @@ -using JetBrains.Annotations; -using PrimeTween; -using UnityEditor; -using UnityEngine; -using static UnityEditor.EditorGUI; -using static UnityEditor.EditorGUIUtility; - -[CustomPropertyDrawer(typeof(ShakeSettings))] -internal class TweenShakeSettingsPropDrawer : PropertyDrawer { // todo rename to ShakeSettingsPropDrawer - public override float GetPropertyHeight([NotNull] SerializedProperty property, GUIContent label) { - if (!property.isExpanded) { - return singleLineHeight; - } - property.NextVisible(true); - float result = EditorGUI.GetPropertyHeight(property, true); // strength - var count = 1; - count++; // frequency - count++; // duration - count++; // enableFalloff - property.NextVisible(false); - property.NextVisible(false); - property.NextVisible(false); // enableFalloff - if (property.boolValue) { - count++; // falloffEase - property.NextVisible(false); - if (property.intValue == -1) { - count++; // strengthOverTime - } - } - count++; // asymmetry - count++; // easeBetweenShakes - count++; // cycles - count++; // startDelay - count++; // endDelay - count++; // useUnscaledTime - count++; // useFixedUpdate - result += singleLineHeight * count + standardVerticalSpacing * (count - 1); - result += standardVerticalSpacing * 2; // extra space - return result; - } - - public override void OnGUI(Rect position, [NotNull] SerializedProperty property, GUIContent label) { - var rect = new Rect(position) { height = singleLineHeight }; - PropertyField(rect, property, label); - if (!property.isExpanded) { - return; - } - moveToNextLine(); - indentLevel++; - property.NextVisible(true); - { // strength - PropertyField(rect, property); - rect.y += EditorGUI.GetPropertyHeight(property, true); - } - { // duration - property.NextVisible(false); - TweenSettingsPropDrawer.DrawDuration(rect, property); - moveToNextLine(); - } - { // frequency - property.NextVisible(false); - var floatValue = property.floatValue; - if (floatValue == 0f) { - property.floatValue = ShakeSettings.defaultFrequency; - } else if (floatValue < 0.1f) { - property.floatValue = 0.1f; - } - propertyField(); - } - { // enableFalloff - property.NextVisible(false); - propertyField(); - var enableFalloff = property.boolValue; - property.NextVisible(false); - if (enableFalloff) { - // falloffEase - propertyField(); - // strengthOverTime - var customFalloffEase = property.intValue == (int)Ease.Custom; - property.NextVisible(false); - if (customFalloffEase) { - propertyField(); - } - } else { - // skipped strengthOverTime - property.NextVisible(false); - } - } - // extra space - rect.y += standardVerticalSpacing * 2; - { // asymmetry - property.NextVisible(false); - propertyField(); - } - { // easeBetweenShakes - property.NextVisible(false); - if (property.intValue == (int)Ease.Custom) { - Debug.LogWarning($"Ease.Custom is not supported for {nameof(ShakeSettings.easeBetweenShakes)}."); - property.intValue = (int)Ease.Default; - } - propertyField(); - } - TweenSettingsPropDrawer.drawCycles(rect, property); - moveToNextLine(); - TweenSettingsPropDrawer.drawStartDelayTillEnd(ref rect, property); - indentLevel--; - - void propertyField() { - PropertyField(rect, property); - moveToNextLine(); - } - - void moveToNextLine() { - rect.y += singleLineHeight + standardVerticalSpacing; - } - } -} diff --git a/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs.meta b/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs.meta deleted file mode 100644 index 6f042fb0..00000000 --- a/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: c4cf2c2465d1a5940b94c9560c2a879f -timeCreated: 1677573071 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs b/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs deleted file mode 100644 index fcc40300..00000000 --- a/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs +++ /dev/null @@ -1,143 +0,0 @@ -using System; -using PrimeTween; -using UnityEditor; -using UnityEngine; - -[CustomPropertyDrawer(typeof(ValueContainerStartEnd))] -public class ValueContainerStartEndPropDrawer : PropertyDrawer { - public override float GetPropertyHeight(SerializedProperty prop, GUIContent label) { - prop.Next(true); - var tweenType = (TweenType)prop.enumValueIndex; - prop.Next(false); - return GetHeight(prop, label, tweenType); - } - - internal static float GetHeight(SerializedProperty prop, GUIContent label, TweenType tweenType) { - var propType = Utils.TweenTypeToTweenData(tweenType).Item1; - Assert.AreNotEqual(PropType.None, propType); - bool startFromCurrent = prop.boolValue; - bool hasStartValue = !startFromCurrent; - if (hasStartValue) { - return GetSingleItemHeight(propType, label) * 2f + EditorGUIUtility.standardVerticalSpacing; - } - return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing + GetSingleItemHeight(propType, label); - } - - static float GetSingleItemHeight(PropType propType, GUIContent label) { - return EditorGUI.GetPropertyHeight(ToSerializedPropType(), label); - SerializedPropertyType ToSerializedPropType() { - switch (propType) { - case PropType.Float: - return SerializedPropertyType.Float; - case PropType.Color: - return SerializedPropertyType.Color; - case PropType.Vector2: - return SerializedPropertyType.Vector2; - case PropType.Vector3: - return SerializedPropertyType.Vector3; - case PropType.Vector4: - case PropType.Quaternion: - return SerializedPropertyType.Vector4; - case PropType.Rect: - return SerializedPropertyType.Rect; - case PropType.Int: - return SerializedPropertyType.Integer; - case PropType.Double: - case PropType.None: - default: - throw new Exception(); - } - } - } - - public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { - prop.Next(true); - var tweenType = (TweenType)prop.enumValueIndex; - prop.Next(false); - Draw(ref pos, prop, tweenType); - } - - internal static void Draw(ref Rect pos, SerializedProperty prop, TweenType tweenType) { - var propType = Utils.TweenTypeToTweenData(tweenType).Item1; - Assert.AreNotEqual(PropType.None, propType); - const float toggleWidth = 18f; - EditorGUIUtility.labelWidth -= toggleWidth; - var togglePos = new Rect(pos.x + 2, pos.y, toggleWidth - 2, EditorGUIUtility.singleLineHeight); - var guiContent = EditorGUI.BeginProperty(togglePos, new GUIContent(), prop); // todo is it possible to display tooltip? tooltip is only displayed over the label, but I need to display it over the ToggleLeft - EditorGUI.BeginChangeCheck(); - bool newStartFromCurrent = !EditorGUI.ToggleLeft(togglePos, guiContent, !prop.boolValue); - if (EditorGUI.EndChangeCheck()) { - prop.boolValue = newStartFromCurrent; - } - EditorGUI.EndProperty(); - - pos.x += toggleWidth; - pos.width -= toggleWidth; - - prop.Next(false); - if (newStartFromCurrent) { - pos.height = EditorGUIUtility.singleLineHeight; - EditorGUI.LabelField(pos, new GUIContent(prop.displayName, prop.tooltip)); - prop.Next(false); - } else { - DrawValueContainer(ref pos, prop, propType); - } - - pos.y += pos.height + EditorGUIUtility.standardVerticalSpacing; - DrawValueContainer(ref pos, prop, propType); - pos.y += pos.height + EditorGUIUtility.standardVerticalSpacing; - - pos.x -= toggleWidth; - pos.width += toggleWidth; - } - - static void DrawValueContainer(ref Rect pos, SerializedProperty prop, PropType propType) { - var root = prop.Copy(); - prop.Next(true); - ValueContainer valueContainer = default; - for (int i = 0; i < 4; i++) { - valueContainer[i] = prop.floatValue; - prop.Next(false); - } - var guiContent = new GUIContent(root.displayName, root.tooltip); - pos.height = GetSingleItemHeight(propType, guiContent); - guiContent = EditorGUI.BeginProperty(pos, guiContent, root); - EditorGUI.BeginChangeCheck(); - ValueContainer newVal = DrawField(pos); - ValueContainer DrawField(Rect position) { - switch (propType) { - case PropType.Float: - return EditorGUI.FloatField(position, guiContent, valueContainer.FloatVal).ToContainer(); - case PropType.Color: - return EditorGUI.ColorField(position, guiContent, valueContainer.ColorVal).ToContainer(); - case PropType.Vector2: - return EditorGUI.Vector2Field(position, guiContent, valueContainer.Vector2Val).ToContainer(); - case PropType.Vector3: - return EditorGUI.Vector3Field(position, guiContent, valueContainer.Vector3Val).ToContainer(); - case PropType.Vector4: - case PropType.Quaternion: // todo don't draw quaternion - return EditorGUI.Vector4Field(position, guiContent, valueContainer.Vector4Val).ToContainer(); - case PropType.Rect: - return EditorGUI.RectField(position, guiContent, valueContainer.RectVal).ToContainer(); - case PropType.Int: - var newIntVal = EditorGUI.IntField(position, guiContent, Mathf.RoundToInt(valueContainer.FloatVal)); - return ((float)newIntVal).ToContainer(); - case PropType.Double: - case PropType.None: - default: - throw new Exception(); - } - } - if (EditorGUI.EndChangeCheck()) { - root.Next(true); - for (int i = 0; i < 4; i++) { - // ReSharper disable once CompareOfFloatsByEqualityOperator - if (root.floatValue != newVal[i]) { - root.floatValue = newVal[i]; - } - root.Next(false); - } - } - EditorGUI.EndProperty(); - } -} diff --git a/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs.meta b/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs.meta deleted file mode 100644 index 51e748d1..00000000 --- a/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs.meta +++ /dev/null @@ -1,3 +0,0 @@ -fileFormatVersion: 2 -guid: f165141ebcaf41e4ea0f7b0b044542b3 -timeCreated: 1710625562 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/AssemblyInfo.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/AssemblyInfo.cs.meta index 1c6e8385..c20bb3e7 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/AssemblyInfo.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/AssemblyInfo.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 58f810eb1f699af42b88d44af5580099 +guid: 62b50c30f9f358540b7f58d941a04d73 timeCreated: 1674163732 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/Assert.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/Assert.cs.meta index 008f0b75..d76eb772 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/Assert.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/Assert.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: ae72793d7d769434fb6654f624e0d743 +guid: 9cb2ac150b3465e47a7ee02457fbbdd5 timeCreated: 1686059830 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/AsyncAwaitSupport.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/AsyncAwaitSupport.cs.meta index 2e2c7161..880e2b99 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/AsyncAwaitSupport.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/AsyncAwaitSupport.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: bb010708e48fbe340bff3f70eebffdcf +guid: 1ad3334f326beb4409bf9798eae2b76e timeCreated: 1678262334 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/Constants.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/Constants.cs.meta index 8876661c..07ae67b4 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/Constants.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/Constants.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 7d2ab94679b58654cbfc1b98c24eb89c +guid: d7b9ffda2c654774bbbd24367d83f6e5 timeCreated: 1677010307 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/CoroutinesSupport.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/CoroutinesSupport.cs.meta index 3d8cb4fb..5c11ce0c 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/CoroutinesSupport.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/CoroutinesSupport.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 0c3310f69bd0ea548af51ff19b127d27 +guid: bed6a0f3303ed3c48948ccda6df2084b timeCreated: 1678282601 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter.meta b/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter.meta index 31bcee4d..76eb7852 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: b316fd2e021e99848ba03d579f441b4b +guid: ab0aebc8db3b75943918b5bcaeeee09b timeCreated: 1675753203 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapter.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapter.cs.meta index 7bed85b9..3982333d 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapter.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapter.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 5fce049859d454043842bf904db8d698 +guid: 13b2688eaa0705f4ab20916f160d4f3e timeCreated: 1675686833 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapterGenerated.cs b/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapterGenerated.cs index 1102e94e..285cbd7d 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapterGenerated.cs +++ b/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapterGenerated.cs @@ -148,7 +148,7 @@ public static partial class DOTweenAdapter { #endif #if UI_ELEMENTS_MODULE_INSTALLED #endif - #if TEXT_MESH_PRO_INSTALLED || (UNITY_6000_0_OR_NEWER && UNITY_UGUI_INSTALLED) + #if TEXT_MESH_PRO_INSTALLED public static Tween DOMaxVisibleCharacters([NotNull] this TMPro.TMP_Text target, int endValue, float duration) => Tween.TextMaxVisibleCharacters(target, endValue, duration); #endif diff --git a/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapterGenerated.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapterGenerated.cs.meta index 9ac88e42..d4f98501 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapterGenerated.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter/DOTweenAdapterGenerated.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 69fc3e1f971153441ae050fc68b9220c +guid: ccf5bc8ff1ead0d4891f3e65b2de23ca timeCreated: 1675754085 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/Extensions.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/Extensions.cs.meta index 50480fa4..08961a3d 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/Extensions.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/Extensions.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: d9e2e1d7a00c85642a00f247c7e80d17 +guid: 287e24c358cbd484fa28e507138d974d timeCreated: 1677165403 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/ITween.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/ITween.cs.meta index 6b408921..ce91d61d 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/ITween.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/ITween.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 98f6c14cc912d5a4daa4050d4b593ce3 +guid: 6010eb3ebbe9d804e8707f06e85543eb timeCreated: 1701681398 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/Obsolete.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/Obsolete.cs.meta index 37e1126c..6130a3b4 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/Obsolete.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/Obsolete.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 4af956d8a2ea39541902ec77a7f84714 +guid: fe1d141e780e4ab428e2277acef0c371 timeCreated: 1693407269 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/PrimeTweenManager.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/PrimeTweenManager.cs.meta index bae4f181..1489fdca 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/PrimeTweenManager.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/PrimeTweenManager.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: 5ad66649102498443a587bf23ba0e252 +guid: 9afe3738e1b55704ca3a791f2e1ae134 MonoImporter: externalObjects: {} serializedVersion: 2 diff --git a/VirtueSky/PrimeTween/Runtime/Internal/PropType.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/PropType.cs.meta index 87ee424a..5d866c56 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/PropType.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/PropType.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 1d4f1f1cb8407c94fb68028614c5b25d +guid: ee424d24dd289664e9e86a0118628805 timeCreated: 1674162838 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/ReusableTween.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/ReusableTween.cs.meta index 45d1b23e..d11521a5 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/ReusableTween.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/ReusableTween.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: f3e8c1c374b78c8468173c1c377165ed +guid: de9e9c67bc30af64bae60fbc71f6d2bd timeCreated: 1676595389 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/StackTraces.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/StackTraces.cs.meta index fadf2c69..b022f97e 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/StackTraces.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/StackTraces.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 731d618fd47d4d84687095e4dd58a867 +guid: b733e085cd208394c8cd01fef15a3d0d timeCreated: 1703321204 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/StandardEasing.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/StandardEasing.cs.meta index b033bf3d..1ae5f2b8 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/StandardEasing.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/StandardEasing.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: ac5ad1796b7ea7e4fbfae7197ed609f1 +guid: 0ad5c844dc61cde4b882bfea52732c86 timeCreated: 1673270662 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs b/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs index fd376a9e..841ec7e3 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs +++ b/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs @@ -1752,7 +1752,7 @@ public static Tween VisualElementBackgroundColor([NotNull] UnityEngine.UIElement } #endif - #if TEXT_MESH_PRO_INSTALLED || (UNITY_6000_0_OR_NEWER && UNITY_UGUI_INSTALLED) + #if TEXT_MESH_PRO_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(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) diff --git a/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs.meta index 503eedb9..5432e5fe 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/TweenGenerated.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 4ac7b9d16652abb43a56e1131365ea37 +guid: 5438e4dad248fe04382272867be17b10 timeCreated: 1673617985 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs b/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs index 5ae122d2..3aa6bec0 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs +++ b/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs @@ -362,7 +362,7 @@ public static Tween Scale([NotNull] Transform target, TweenSettings unifo public static Tween Rotation([NotNull] Transform target, TweenSettings eulerAnglesSettings) => Rotation(target, toQuaternion(eulerAnglesSettings)); public static Tween LocalRotation([NotNull] Transform target, TweenSettings localEulerAnglesSettings) => LocalRotation(target, toQuaternion(localEulerAnglesSettings)); static TweenSettings toQuaternion(TweenSettings s) => new TweenSettings(Quaternion.Euler(s.startValue), Quaternion.Euler(s.endValue), s.settings) { startFromCurrent = s.startFromCurrent }; - #if TEXT_MESH_PRO_INSTALLED || (UNITY_6000_0_OR_NEWER && UNITY_UGUI_INSTALLED) + #if TEXT_MESH_PRO_INSTALLED public static Tween TextMaxVisibleCharacters([NotNull] TMPro.TMP_Text target, TweenSettings settings) { int oldCount = target.textInfo.characterCount; target.ForceMeshUpdate(); diff --git a/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs.meta index 138b14f6..a950ecc5 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/TweenMethods.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 4b92226f9bf37474abfc8e8761a5a405 +guid: 47a60d0f85631f64d860e3f5ae75b789 timeCreated: 1672225881 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs b/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs index 5e01698c..b726b961 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs +++ b/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs @@ -196,7 +196,7 @@ internal static (PropType, Type) TweenTypeToTweenData(TweenType tweenType) { case TweenType.VisualElementBackgroundColor: return (PropType.Color, typeof(UnityEngine.UIElements.VisualElement)); #endif - #if TEXT_MESH_PRO_INSTALLED || (UNITY_6000_0_OR_NEWER && UNITY_UGUI_INSTALLED) + #if TEXT_MESH_PRO_INSTALLED case TweenType.TextMaxVisibleCharacters: return (PropType.Int, typeof(TMPro.TMP_Text)); #endif diff --git a/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs.meta index 10812489..b5bd69a6 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/Utils.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 70d8fab0e50ec67439b58a6c9948545d +guid: e383e104c7147224a8b766862c1b61a7 timeCreated: 1711272020 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Runtime/Internal/ValueContainer.cs.meta b/VirtueSky/PrimeTween/Runtime/Internal/ValueContainer.cs.meta index 25444cc1..e73b4b53 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/ValueContainer.cs.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/ValueContainer.cs.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: e7b35fe033748b642889264ad634c8fc +guid: b69dbd177a6f0b7418e4c93180841d5a timeCreated: 1676455173 \ No newline at end of file diff --git a/VirtueSky/PrimeTween/version.txt b/VirtueSky/PrimeTween/version.txt index 24e56e03..06043b8e 100644 --- a/VirtueSky/PrimeTween/version.txt +++ b/VirtueSky/PrimeTween/version.txt @@ -1 +1 @@ -v1.2.1 \ No newline at end of file +v1.2.2 \ No newline at end of file From 01c4caf42ddde1f9c814bb099fa5dca5a3302c48 Mon Sep 17 00:00:00 2001 From: DucNV Date: Wed, 11 Dec 2024 09:47:56 +0700 Subject: [PATCH 09/10] - update tween Co-Authored-By: VirtueSky <126542083+VirtueSky@users.noreply.github.com> --- VirtueSky/PrimeTween/Editor/AssemblyInfo.cs | 3 + .../PrimeTween/Editor/AssemblyInfo.cs.meta | 11 + .../PrimeTween/Editor/CodeGenerator.asset | 1077 +++++++++++++++++ .../Editor/CodeGenerator.asset.meta | 8 + VirtueSky/PrimeTween/Editor/CodeGenerator.cs | 755 ++++++++++++ .../PrimeTween/Editor/CodeGenerator.cs.meta | 11 + VirtueSky/PrimeTween/Editor/CodeTemplates.cs | 150 +++ .../PrimeTween/Editor/CodeTemplates.cs.meta | 11 + .../Editor/PrimeTweenManagerInspector.cs | 83 ++ .../Editor/PrimeTweenManagerInspector.cs.meta | 11 + .../Editor/TweenSettingsPropDrawer.cs | 141 +++ .../Editor/TweenSettingsPropDrawer.cs.meta | 11 + .../Editor/TweenSettingsTypesPropDrawer.cs | 85 ++ .../TweenSettingsTypesPropDrawer.cs.meta | 11 + .../Editor/TweenShakeSettingsPropDrawer.cs | 117 ++ .../TweenShakeSettingsPropDrawer.cs.meta | 11 + .../ValueContainerStartEndPropDrawer.cs | 143 +++ .../ValueContainerStartEndPropDrawer.cs.meta | 11 + 18 files changed, 2650 insertions(+) create mode 100644 VirtueSky/PrimeTween/Editor/AssemblyInfo.cs create mode 100644 VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta create mode 100644 VirtueSky/PrimeTween/Editor/CodeGenerator.asset create mode 100644 VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta create mode 100644 VirtueSky/PrimeTween/Editor/CodeGenerator.cs create mode 100644 VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta create mode 100644 VirtueSky/PrimeTween/Editor/CodeTemplates.cs create mode 100644 VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta create mode 100644 VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs create mode 100644 VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta create mode 100644 VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs create mode 100644 VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs.meta create mode 100644 VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs create mode 100644 VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta create mode 100644 VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs create mode 100644 VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs.meta create mode 100644 VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs create mode 100644 VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs.meta diff --git a/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs b/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs new file mode 100644 index 00000000..74b96d6b --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("PrimeTween.Tests")] diff --git a/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta b/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta new file mode 100644 index 00000000..5dbbabfc --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 77f31680944e5534e8ed7d89b9d6a99a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VirtueSky/PrimeTween/Editor/CodeGenerator.asset b/VirtueSky/PrimeTween/Editor/CodeGenerator.asset new file mode 100644 index 00000000..3cca848e --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/CodeGenerator.asset @@ -0,0 +1,1077 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f81c141b47ab4aee9ea1454818ce73d3, type: 3} + m_Name: CodeGenerator + m_EditorClassIdentifier: + methodsScript: {fileID: 11500000, guid: 51610f0e9d8e4ccead49e9fcc96d54e3, type: 3} + dotweenMethodsScript: {fileID: 11500000, guid: 3c238e2b584a4987b714406da2cf9c56, type: 3} + tweenComponentScript: {fileID: 11500000, guid: f191f8e3fa31440d9f1217f1f80dba7d, type: 3} + editorUtilsScript: {fileID: 11500000, guid: 7f3bfd9524c14644bfbab698076886f3, type: 3} + methodsData: + - description: Range_Light + methodName: Range + targetType: UnityEngine.Light + propertyType: 1 + propertyName: range + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 7 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: ShadowStrength_Light + methodName: ShadowStrength + targetType: UnityEngine.Light + propertyType: 1 + propertyName: shadowStrength + propertyGetter: + propertySetter: + dotweenMethodName: DOShadowStrength + dependency: 7 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Intensity_Light + methodName: Intensity + targetType: UnityEngine.Light + propertyType: 1 + propertyName: intensity + propertyGetter: + propertySetter: + dotweenMethodName: DOIntensity + dependency: 7 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: OrthographicSize_Camera + methodName: OrthographicSize + targetType: UnityEngine.Camera + propertyType: 1 + propertyName: orthographicSize + propertyGetter: + propertySetter: + dotweenMethodName: DOOrthoSize + dependency: 5 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: BackgroundColor_Camera + methodName: BackgroundColor + targetType: UnityEngine.Camera + propertyType: 2 + propertyName: backgroundColor + propertyGetter: + propertySetter: + dotweenMethodName: DOColor + dependency: 5 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Aspect_Camera + methodName: Aspect + targetType: UnityEngine.Camera + propertyType: 1 + propertyName: aspect + propertyGetter: + propertySetter: + dotweenMethodName: DOAspect + dependency: 5 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: FarClipPlane_Camera + methodName: FarClipPlane + targetType: UnityEngine.Camera + propertyType: 1 + propertyName: farClipPlane + propertyGetter: + propertySetter: + dotweenMethodName: DOFarClipPlane + dependency: 5 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: FieldOfView_Camera + methodName: FieldOfView + targetType: UnityEngine.Camera + propertyType: 1 + propertyName: fieldOfView + propertyGetter: + propertySetter: + dotweenMethodName: DOFieldOfView + dependency: 5 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: NearClipPlane_Camera + methodName: NearClipPlane + targetType: UnityEngine.Camera + propertyType: 1 + propertyName: nearClipPlane + propertyGetter: + propertySetter: + dotweenMethodName: DONearClipPlane + dependency: 5 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: PixelRect_Camera + methodName: PixelRect + targetType: UnityEngine.Camera + propertyType: 7 + propertyName: pixelRect + propertyGetter: + propertySetter: + dotweenMethodName: DOPixelRect + dependency: 5 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Rect_Camera + methodName: Rect + targetType: UnityEngine.Camera + propertyType: 7 + propertyName: rect + propertyGetter: + propertySetter: + dotweenMethodName: DORect + dependency: 5 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: LocalRotation_Transform + methodName: LocalRotation + targetType: UnityEngine.Transform + propertyType: 4 + propertyName: + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 0 + placeInGlobalScope: 1 + generateOnlyOverloads: 1 + - description: Scale_Transform + methodName: Scale + targetType: UnityEngine.Transform + propertyType: 1 + propertyName: + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 0 + placeInGlobalScope: 1 + generateOnlyOverloads: 1 + - description: Rotation_Transform + methodName: Rotation + targetType: UnityEngine.Transform + propertyType: 4 + propertyName: + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 0 + placeInGlobalScope: 1 + generateOnlyOverloads: 1 + - description: SliderValue_Slider + methodName: SliderValue + targetType: UnityEngine.UI.Slider + propertyType: 1 + propertyName: value + propertyGetter: + propertySetter: + dotweenMethodName: DOValue + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: NormalizedPosition_ScrollRect + methodName: NormalizedPosition + targetType: UnityEngine.UI.ScrollRect + propertyType: 3 + propertyName: + propertyGetter: GetNormalizedPosition() + propertySetter: SetNormalizedPosition(val) + dotweenMethodName: DONormalizedPos + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: HorizontalNormalizedPosition_ScrollRect + methodName: HorizontalNormalizedPosition + targetType: UnityEngine.UI.ScrollRect + propertyType: 1 + propertyName: horizontalNormalizedPosition + propertyGetter: + propertySetter: + dotweenMethodName: DOHorizontalNormalizedPos + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: VerticalNormalizedPosition_ScrollRect + methodName: VerticalNormalizedPosition + targetType: UnityEngine.UI.ScrollRect + propertyType: 1 + propertyName: verticalNormalizedPosition + propertyGetter: + propertySetter: + dotweenMethodName: DOVerticalNormalizedPos + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: PivotX_RectTransform + methodName: PivotX + targetType: UnityEngine.RectTransform + propertyType: 1 + propertyName: + propertyGetter: pivot[0] + propertySetter: pivot = _target.pivot.WithComponent(0, val) + dotweenMethodName: DOPivotX + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: PivotY_RectTransform + methodName: PivotY + targetType: UnityEngine.RectTransform + propertyType: 1 + propertyName: + propertyGetter: pivot[1] + propertySetter: pivot = _target.pivot.WithComponent(1, val) + dotweenMethodName: DOPivotY + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Pivot_RectTransform + methodName: Pivot + targetType: UnityEngine.RectTransform + propertyType: 3 + propertyName: pivot + propertyGetter: + propertySetter: + dotweenMethodName: DOPivot + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: AnchorMax_RectTransform + methodName: AnchorMax + targetType: UnityEngine.RectTransform + propertyType: 3 + propertyName: anchorMax + propertyGetter: + propertySetter: + dotweenMethodName: DOAnchorMax + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: AnchorMin_RectTransform + methodName: AnchorMin + targetType: UnityEngine.RectTransform + propertyType: 3 + propertyName: anchorMin + propertyGetter: + propertySetter: + dotweenMethodName: DOAnchorMin + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: AnchoredPosition3D_RectTransform + methodName: AnchoredPosition3D + targetType: UnityEngine.RectTransform + propertyType: 4 + propertyName: anchoredPosition3D + propertyGetter: + propertySetter: + dotweenMethodName: DOAnchorPos3D + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: AnchoredPosition3DX_RectTransform + methodName: AnchoredPosition3DX + targetType: UnityEngine.RectTransform + propertyType: 1 + propertyName: + propertyGetter: anchoredPosition3D[0] + propertySetter: anchoredPosition3D = _target.anchoredPosition3D.WithComponent(0, + val) + dotweenMethodName: DOAnchorPos3DX + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: AnchoredPosition3DY_RectTransform + methodName: AnchoredPosition3DY + targetType: UnityEngine.RectTransform + propertyType: 1 + propertyName: + propertyGetter: anchoredPosition3D[1] + propertySetter: anchoredPosition3D = _target.anchoredPosition3D.WithComponent(1, + val) + dotweenMethodName: DOAnchorPos3DY + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: AnchoredPosition3DZ_RectTransform + methodName: AnchoredPosition3DZ + targetType: UnityEngine.RectTransform + propertyType: 1 + propertyName: + propertyGetter: anchoredPosition3D[2] + propertySetter: anchoredPosition3D = _target.anchoredPosition3D.WithComponent(2, + val) + dotweenMethodName: DOAnchorPos3DZ + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: EffectDistance_Shadow + methodName: EffectDistance + targetType: UnityEngine.UI.Shadow + propertyType: 3 + propertyName: effectDistance + propertyGetter: + propertySetter: + dotweenMethodName: DOScale + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Alpha_Shadow + methodName: Alpha + targetType: UnityEngine.UI.Shadow + propertyType: 1 + propertyName: + propertyGetter: effectColor.a + propertySetter: effectColor = _target.effectColor.WithAlpha(val) + dotweenMethodName: DOFade + dependency: 1 + placeInGlobalScope: 1 + generateOnlyOverloads: 0 + - description: Color_Shadow + methodName: Color + targetType: UnityEngine.UI.Shadow + propertyType: 2 + propertyName: effectColor + propertyGetter: + propertySetter: + dotweenMethodName: DOColor + dependency: 1 + placeInGlobalScope: 1 + generateOnlyOverloads: 0 + - description: PreferredSize_LayoutElement + methodName: PreferredSize + targetType: UnityEngine.UI.LayoutElement + propertyType: 3 + propertyName: + propertyGetter: GetPreferredSize() + propertySetter: SetPreferredSize(val) + dotweenMethodName: DOPreferredSize + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: PreferredWidth_LayoutElement + methodName: PreferredWidth + targetType: UnityEngine.UI.LayoutElement + propertyType: 1 + propertyName: preferredWidth + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: PreferredHeight_LayoutElement + methodName: PreferredHeight + targetType: UnityEngine.UI.LayoutElement + propertyType: 1 + propertyName: preferredHeight + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: MovePosition_Rigidbody + methodName: MovePosition + targetType: UnityEngine.Rigidbody + propertyType: 4 + propertyName: + propertyGetter: position + propertySetter: MovePosition(val) + dotweenMethodName: DOMove + dependency: 3 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: MoveRotation_Rigidbody + methodName: MoveRotation + targetType: UnityEngine.Rigidbody + propertyType: 6 + propertyName: + propertyGetter: rotation + propertySetter: MoveRotation(val) + dotweenMethodName: DORotate + dependency: 3 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: MovePosition_Rigidbody2D + methodName: MovePosition + targetType: UnityEngine.Rigidbody2D + propertyType: 3 + propertyName: + propertyGetter: position + propertySetter: MovePosition(val) + dotweenMethodName: DOMove + dependency: 4 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: MoveRotation_Rigidbody2D + methodName: MoveRotation + targetType: UnityEngine.Rigidbody2D + propertyType: 1 + propertyName: + propertyGetter: rotation + propertySetter: MoveRotation(val) + dotweenMethodName: DORotate + dependency: 4 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: FlexibleSize_LayoutElement + methodName: FlexibleSize + targetType: UnityEngine.UI.LayoutElement + propertyType: 3 + propertyName: + propertyGetter: GetFlexibleSize() + propertySetter: SetFlexibleSize(val) + dotweenMethodName: DOFlexibleSize + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: FlexibleWidth_LayoutElement + methodName: FlexibleWidth + targetType: UnityEngine.UI.LayoutElement + propertyType: 1 + propertyName: flexibleWidth + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: FlexibleHeight_LayoutElement + methodName: FlexibleHeight + targetType: UnityEngine.UI.LayoutElement + propertyType: 1 + propertyName: flexibleHeight + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: MinSize_LayoutElement + methodName: MinSize + targetType: UnityEngine.UI.LayoutElement + propertyType: 3 + propertyName: + propertyGetter: GetMinSize() + propertySetter: SetMinSize(val) + dotweenMethodName: DOMinSize + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: MinWidth_LayoutElement + methodName: MinWidth + targetType: UnityEngine.UI.LayoutElement + propertyType: 1 + propertyName: minWidth + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: MinHeight_LayoutElement + methodName: MinHeight + targetType: UnityEngine.UI.LayoutElement + propertyType: 1 + propertyName: minHeight + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Position_Transform + methodName: Position + targetType: UnityEngine.Transform + propertyType: 4 + propertyName: position + propertyGetter: + propertySetter: + dotweenMethodName: DOMove + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: PositionX_Transform + methodName: PositionX + targetType: UnityEngine.Transform + propertyType: 1 + propertyName: + propertyGetter: position.x + propertySetter: position = _target.position.WithComponent(0, val) + dotweenMethodName: DOMoveX + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: PositionY_Transform + methodName: PositionY + targetType: UnityEngine.Transform + propertyType: 1 + propertyName: + propertyGetter: position.y + propertySetter: position = _target.position.WithComponent(1, val) + dotweenMethodName: DOMoveY + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: PositionZ_Transform + methodName: PositionZ + targetType: UnityEngine.Transform + propertyType: 1 + propertyName: + propertyGetter: position.z + propertySetter: position = _target.position.WithComponent(2, val) + dotweenMethodName: DOMoveZ + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: LocalPosition_Transform + methodName: LocalPosition + targetType: UnityEngine.Transform + propertyType: 4 + propertyName: localPosition + propertyGetter: + propertySetter: + dotweenMethodName: DOLocalMove + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: LocalPositionX_Transform + methodName: LocalPositionX + targetType: UnityEngine.Transform + propertyType: 1 + propertyName: + propertyGetter: localPosition.x + propertySetter: localPosition = _target.localPosition.WithComponent(0, val) + dotweenMethodName: DOLocalMoveX + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: LocalPositionY_Transform + methodName: LocalPositionY + targetType: UnityEngine.Transform + propertyType: 1 + propertyName: + propertyGetter: localPosition.y + propertySetter: localPosition = _target.localPosition.WithComponent(1, val) + dotweenMethodName: DOLocalMoveY + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: LocalPositionZ_Transform + methodName: LocalPositionZ + targetType: UnityEngine.Transform + propertyType: 1 + propertyName: + propertyGetter: localPosition.z + propertySetter: localPosition = _target.localPosition.WithComponent(2, val) + dotweenMethodName: DOLocalMoveZ + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Rotation_Transform + methodName: Rotation + targetType: UnityEngine.Transform + propertyType: 6 + propertyName: rotation + propertyGetter: + propertySetter: + dotweenMethodName: DORotateQuaternion + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: LocalRotation_Transform + methodName: LocalRotation + targetType: UnityEngine.Transform + propertyType: 6 + propertyName: localRotation + propertyGetter: + propertySetter: + dotweenMethodName: DOLocalRotateQuaternion + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Scale_Transform + methodName: Scale + targetType: UnityEngine.Transform + propertyType: 4 + propertyName: localScale + propertyGetter: + propertySetter: + dotweenMethodName: DOScale + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: ScaleX_Transform + methodName: ScaleX + targetType: UnityEngine.Transform + propertyType: 1 + propertyName: + propertyGetter: localScale.x + propertySetter: localScale = _target.localScale.WithComponent(0, val) + dotweenMethodName: DOScaleX + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: ScaleY_Transform + methodName: ScaleY + targetType: UnityEngine.Transform + propertyType: 1 + propertyName: + propertyGetter: localScale.y + propertySetter: localScale = _target.localScale.WithComponent(1, val) + dotweenMethodName: DOScaleY + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: ScaleZ_Transform + methodName: ScaleZ + targetType: UnityEngine.Transform + propertyType: 1 + propertyName: + propertyGetter: localScale.z + propertySetter: localScale = _target.localScale.WithComponent(2, val) + dotweenMethodName: DOScaleZ + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Color_Graphic + methodName: Color + targetType: UnityEngine.UI.Graphic + propertyType: 2 + propertyName: color + propertyGetter: + propertySetter: + dotweenMethodName: DOColor + dependency: 1 + placeInGlobalScope: 1 + generateOnlyOverloads: 0 + - description: Color_SpriteRenderer + methodName: Color + targetType: UnityEngine.SpriteRenderer + propertyType: 2 + propertyName: color + propertyGetter: + propertySetter: + dotweenMethodName: DOColor + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Color_Material + methodName: Color + targetType: UnityEngine.Material + propertyType: 2 + propertyName: color + propertyGetter: + propertySetter: + dotweenMethodName: DOColor + dependency: 6 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Color_Light + methodName: Color + targetType: UnityEngine.Light + propertyType: 2 + propertyName: color + propertyGetter: + propertySetter: + dotweenMethodName: DOColor + dependency: 7 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: AnchoredPosition_RectTransform + methodName: AnchoredPosition + targetType: UnityEngine.RectTransform + propertyType: 3 + propertyName: anchoredPosition + propertyGetter: + propertySetter: + dotweenMethodName: DOAnchorPos + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: AnchoredPositionX_RectTransform + methodName: AnchoredPositionX + targetType: UnityEngine.RectTransform + propertyType: 1 + propertyName: + propertyGetter: anchoredPosition.x + propertySetter: anchoredPosition = _target.anchoredPosition.WithComponent(0, + val) + dotweenMethodName: DOAnchorPosX + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: AnchoredPositionY_RectTransform + methodName: AnchoredPositionY + targetType: UnityEngine.RectTransform + propertyType: 1 + propertyName: + propertyGetter: anchoredPosition.y + propertySetter: anchoredPosition = _target.anchoredPosition.WithComponent(1, + val) + dotweenMethodName: DOAnchorPosY + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: SizeDelta_RectTransform + methodName: SizeDelta + targetType: UnityEngine.RectTransform + propertyType: 3 + propertyName: sizeDelta + propertyGetter: + propertySetter: + dotweenMethodName: DOSizeDelta + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Alpha_CanvasGroup + methodName: Alpha + targetType: UnityEngine.CanvasGroup + propertyType: 1 + propertyName: alpha + propertyGetter: + propertySetter: + dotweenMethodName: DOFade + dependency: 1 + placeInGlobalScope: 1 + generateOnlyOverloads: 0 + - description: Alpha_Graphic + methodName: Alpha + targetType: UnityEngine.UI.Graphic + propertyType: 1 + propertyName: + propertyGetter: color.a + propertySetter: color = _target.color.WithAlpha(val) + dotweenMethodName: DOFade + dependency: 1 + placeInGlobalScope: 1 + generateOnlyOverloads: 0 + - description: Alpha_SpriteRenderer + methodName: Alpha + targetType: UnityEngine.SpriteRenderer + propertyType: 1 + propertyName: + propertyGetter: color.a + propertySetter: color = _target.color.WithAlpha(val) + dotweenMethodName: DOFade + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Alpha_Material + methodName: Alpha + targetType: UnityEngine.Material + propertyType: 1 + propertyName: + propertyGetter: color.a + propertySetter: color = _target.color.WithAlpha(val) + dotweenMethodName: DOFade + dependency: 6 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: MainTextureOffset_Material + methodName: MainTextureOffset + targetType: UnityEngine.Material + propertyType: 3 + propertyName: mainTextureOffset + propertyGetter: + propertySetter: + dotweenMethodName: DOOffset + dependency: 6 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: MainTextureScale_Material + methodName: MainTextureScale + targetType: UnityEngine.Material + propertyType: 3 + propertyName: mainTextureScale + propertyGetter: + propertySetter: + dotweenMethodName: DOTiling + dependency: 6 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: FillAmount_Image + methodName: FillAmount + targetType: UnityEngine.UI.Image + propertyType: 1 + propertyName: fillAmount + propertyGetter: + propertySetter: + dotweenMethodName: DOFillAmount + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Volume_AudioSource + methodName: Volume + targetType: UnityEngine.AudioSource + propertyType: 1 + propertyName: volume + propertyGetter: + propertySetter: + dotweenMethodName: DOFade + dependency: 2 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Pitch_AudioSource + methodName: Pitch + targetType: UnityEngine.AudioSource + propertyType: 1 + propertyName: pitch + propertyGetter: + propertySetter: + dotweenMethodName: DOPitch + dependency: 2 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: PanStereo_AudioSource + methodName: PanStereo + targetType: UnityEngine.AudioSource + propertyType: 1 + propertyName: panStereo + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 2 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: TweenTimeScale_Tween + methodName: TweenTimeScale + targetType: PrimeTween.Tween + propertyType: 1 + propertyName: + propertyGetter: + propertySetter: + dotweenMethodName: DOTimeScale + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 1 + - description: TweenTimeScale_Sequence + methodName: TweenTimeScale + targetType: PrimeTween.Sequence + propertyType: 1 + propertyName: + propertyGetter: + propertySetter: + dotweenMethodName: DOTimeScale + dependency: 0 + placeInGlobalScope: 0 + generateOnlyOverloads: 1 + - description: VisualElementLayout_VisualElement + methodName: VisualElementLayout + targetType: UnityEngine.UIElements.VisualElement + propertyType: 7 + propertyName: + propertyGetter: GetResolvedStyleRect() + propertySetter: SetStyleRect(val) + dotweenMethodName: + dependency: 9 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Position_ITransform + methodName: Position + targetType: UnityEngine.UIElements.ITransform + propertyType: 4 + propertyName: position + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 9 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Rotation_ITransform + methodName: Rotation + targetType: UnityEngine.UIElements.ITransform + propertyType: 6 + propertyName: rotation + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 9 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: Scale_ITransform + methodName: Scale + targetType: UnityEngine.UIElements.ITransform + propertyType: 4 + propertyName: scale + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 9 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: VisualElementSize_VisualElement + methodName: VisualElementSize + targetType: UnityEngine.UIElements.VisualElement + propertyType: 3 + propertyName: + propertyGetter: layout.size + propertySetter: style.width = val.x; _target.style.height = val.y + dotweenMethodName: + dependency: 9 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: VisualElementTopLeft_VisualElement + methodName: VisualElementTopLeft + targetType: UnityEngine.UIElements.VisualElement + propertyType: 3 + propertyName: + propertyGetter: GetTopLeft() + propertySetter: SetTopLeft(val) + dotweenMethodName: + dependency: 9 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: VisualElementColor_VisualElement + methodName: VisualElementColor + targetType: UnityEngine.UIElements.VisualElement + propertyType: 2 + propertyName: + propertyGetter: style.color.value + propertySetter: style.color = val + dotweenMethodName: + dependency: 9 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: VisualElementBackgroundColor_VisualElement + methodName: VisualElementBackgroundColor + targetType: UnityEngine.UIElements.VisualElement + propertyType: 2 + propertyName: + propertyGetter: style.backgroundColor.value + propertySetter: style.backgroundColor = val + dotweenMethodName: + dependency: 9 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: OffsetMin_RectTransform + methodName: OffsetMin + targetType: UnityEngine.RectTransform + propertyType: 3 + propertyName: offsetMin + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: OffsetMinX_RectTransform + methodName: OffsetMinX + targetType: UnityEngine.RectTransform + propertyType: 1 + propertyName: + propertyGetter: offsetMin[0] + propertySetter: offsetMin = _target.offsetMin.WithComponent(0, val) + dotweenMethodName: + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: OffsetMinY_RectTransform + methodName: OffsetMinY + targetType: UnityEngine.RectTransform + propertyType: 1 + propertyName: + propertyGetter: offsetMin[1] + propertySetter: offsetMin = _target.offsetMin.WithComponent(1, val) + dotweenMethodName: + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: OffsetMax_RectTransform + methodName: OffsetMax + targetType: UnityEngine.RectTransform + propertyType: 3 + propertyName: offsetMax + propertyGetter: + propertySetter: + dotweenMethodName: + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: OffsetMaxX_RectTransform + methodName: OffsetMaxX + targetType: UnityEngine.RectTransform + propertyType: 1 + propertyName: + propertyGetter: offsetMax[0] + propertySetter: offsetMax = _target.offsetMax.WithComponent(0, val) + dotweenMethodName: + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: OffsetMaxY_RectTransform + methodName: OffsetMaxY + targetType: UnityEngine.RectTransform + propertyType: 1 + propertyName: + propertyGetter: offsetMax[1] + propertySetter: offsetMax = _target.offsetMax.WithComponent(1, val) + dotweenMethodName: + dependency: 1 + placeInGlobalScope: 0 + generateOnlyOverloads: 0 + - description: TextMaxVisibleCharacters_TMP_Text + methodName: TextMaxVisibleCharacters + targetType: TMPro.TMP_Text + propertyType: 8 + propertyName: maxVisibleCharacters + propertyGetter: + propertySetter: + dotweenMethodName: DOMaxVisibleCharacters + dependency: 10 + placeInGlobalScope: 0 + generateOnlyOverloads: 1 + additiveMethodsGenerator: + additiveMethods: + - methodName: PositionAdditive + propertyType: 4 + setter: _target.position += delta + - methodName: LocalPositionAdditive + propertyType: 4 + setter: _target.localPosition += delta + - methodName: ScaleAdditive + propertyType: 4 + setter: _target.localScale += delta + - methodName: RotationAdditive + propertyType: 4 + setter: _target.rotation *= UnityEngine.Quaternion.Euler(delta) + - methodName: LocalRotationAdditive + propertyType: 4 + setter: _target.localRotation *= UnityEngine.Quaternion.Euler(delta) + - methodName: RotationAdditive + propertyType: 6 + setter: _target.rotation *= delta + - methodName: LocalRotationAdditive + propertyType: 6 + setter: _target.localRotation *= delta + speedBasedMethodsGenerator: + data: + - methodName: Position + propType: 4 + propName: position + speedParamName: averageSpeed + - methodName: LocalPosition + propType: 4 + propName: localPosition + speedParamName: averageSpeed + - methodName: Rotation + propType: 6 + propName: rotation + speedParamName: averageAngularSpeed + - methodName: LocalRotation + propType: 6 + propName: localRotation + speedParamName: averageAngularSpeed diff --git a/VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta b/VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta new file mode 100644 index 00000000..647d0e2d --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5b5aaa5611b385541ab2b0cb1d8755e1 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/VirtueSky/PrimeTween/Editor/CodeGenerator.cs b/VirtueSky/PrimeTween/Editor/CodeGenerator.cs new file mode 100644 index 00000000..5d82eec2 --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/CodeGenerator.cs @@ -0,0 +1,755 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using JetBrains.Annotations; +using PrimeTween; +using UnityEditor; +using UnityEngine; +using Assert = UnityEngine.Assertions.Assert; + +// todo check all TweenType are covered in TweenTypeToTweenData() +internal class CodeGenerator : ScriptableObject { + [SerializeField] MonoScript methodsScript; + [SerializeField] MonoScript dotweenMethodsScript; + [SerializeField] MonoScript tweenComponentScript; + [SerializeField] MonoScript editorUtilsScript; + [SerializeField] MethodGenerationData[] methodsData; + [SerializeField] AdditiveMethodsGenerator additiveMethodsGenerator; + [SerializeField] SpeedBasedMethodsGenerator speedBasedMethodsGenerator; + + /*void OnEnable() { + #if PRIME_TWEEN_SAFETY_CHECKS + foreach (var data in methodsData) { + data.description = ""; + var methodPrefix = getMethodPrefix(data.dependency); + if (!string.IsNullOrEmpty(methodPrefix)) { + data.description += methodPrefix + "_"; + } + data.description = data.methodName + "_" + getTypeByName(data.targetType).Name; + } + #endif + }*/ + + [Serializable] + class AdditiveMethodsGenerator { + [SerializeField] AdditiveMethodsGeneratorData[] additiveMethods; + + [Serializable] + class AdditiveMethodsGeneratorData { + [SerializeField] internal string methodName; + [SerializeField] internal PropType propertyType; + [SerializeField] internal string setter; + } + + [NotNull] + internal string Generate() { + string result = @" +#if PRIME_TWEEN_EXPERIMENTAL"; + foreach (var data in additiveMethods) { + const string template = @" + public static Tween PositionAdditive([NotNull] UnityEngine.Transform target, Single deltaValue, float duration, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => PositionAdditive(target, deltaValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)); + public static Tween PositionAdditive([NotNull] UnityEngine.Transform target, Single deltaValue, float duration, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => PositionAdditive(target, deltaValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)); + public static Tween PositionAdditive([NotNull] UnityEngine.Transform target, Single deltaValue, TweenSettings settings) + => CustomAdditive(target, deltaValue, settings, (_target, delta) => additiveTweenSetter()); +"; + result += template.Replace("Single", data.propertyType.ToFullTypeName()) + .Replace("PositionAdditive", data.methodName) + .Replace("additiveTweenSetter()", data.setter); + } + result += "#endif"; + return result; + } + } + + [ContextMenu(nameof(generateAllMethods))] + internal void generateAllMethods() { + generateMethods(); + generateDotweenMethods(); + } + + const string generatorBeginLabel = "// CODE GENERATOR BEGIN"; + + [ContextMenu(nameof(generateTweenComponent))] + void generateTweenComponent() { + if (tweenComponentScript == null) { + Debug.LogError("Not generating TweenComponent script because this component is only available in PrimeTween PRO."); + return; + } + + var str = tweenComponentScript.text; + var searchIndex = str.IndexOf(generatorBeginLabel, StringComparison.Ordinal); + Assert.AreNotEqual(-1, searchIndex); + str = str.Substring(0, searchIndex + generatorBeginLabel.Length) + "\n"; + + var tweenTypes = (TweenType[]) Enum.GetValues(typeof(TweenType)); + tweenTypes = tweenTypes.SkipWhile(x => x != TweenType.LightRange).ToArray(); + var generationData = methodsData + .GroupBy(_ => _.dependency) + .SelectMany(x => x) + .SkipWhile(x => x.description != "Range_Light") + .ToArray(); + + Dependency dependency = Dependency.None; + for (var i = 0; i < generationData.Length; i++) { + var data = generationData[i]; + if (dependency != data.dependency) { + if (shouldWrapInDefine(dependency)) { + str += " #endif\n"; + } + dependency = data.dependency; + if (shouldWrapInDefine(dependency)) { + switch (dependency) { + case Dependency.PRIME_TWEEN_EXPERIMENTAL: + case Dependency.UI_ELEMENTS_MODULE_INSTALLED: + case Dependency.TEXT_MESH_PRO_INSTALLED: + str += $" #if {dependency}\n"; + break; + default: + str += $" #if !UNITY_2019_1_OR_NEWER || {dependency}\n"; + break; + } + } + } + var tweenType = tweenTypes[i]; + if (data.dependency == Dependency.UI_ELEMENTS_MODULE_INSTALLED || data.targetType.Contains("PrimeTween.")) { // skip both TweenTimeScale + continue; + } + Assert.IsTrue(tweenType.ToString().Contains(data.methodName), $"{i}, {tweenType}, {data.methodName}"); + // Debug.Log(data.methodName); + + var template = @" case TweenType.Position: + return target is Transform positionTarget ? Tween.Position(positionTarget, settingsVector3) : (Tween?)null;"; + template = template.Replace("TweenType.Position", $"TweenType.{tweenType}"); + template = template.Replace("Transform", getTypeByName(data.targetType).Name); + var varName = tweenType.ToString(); + varName = char.ToLower(varName[0]) + varName.Substring(1) + "Target"; + template = template.Replace("positionTarget", varName); + template = template.Replace("Tween.Position", $"Tween.{getPrefix()}{data.methodName}"); + template = template.Replace("settingsVector3", $"settings{data.propertyType}"); + str += template + "\n"; + + string getPrefix() => data.placeInGlobalScope ? null : getMethodPrefix(data.dependency); + } + if (shouldWrapInDefine(dependency)) { + str += " #endif\n"; + } + str += @" default: + throw new Exception(); + } + } + } + } +} +"; + SaveScript(tweenComponentScript, str); + } + + static void SaveScript(MonoScript script, string text) { + var path = AssetDatabase.GetAssetPath(script); + if (text == File.ReadAllText(path)) { + return; + } + File.WriteAllText(path, text); + EditorUtility.SetDirty(script); + AssetDatabase.Refresh(); + AssetDatabase.SaveAssets(); + } + + void generateDotweenMethods() { + // todo combine adapter files into one file + var str = @"#if PRIME_TWEEN_DOTWEEN_ADAPTER +// This file is generated by CodeGenerator.cs +using JetBrains.Annotations; +using System; + +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);"; + str += generateWithDefines(data => { + if (!data.dotweenMethodName.Any()) { + return string.Empty; + } + Assert.IsTrue(data.dotweenMethodName.Any()); + string result = ""; + result += "\n"; + result += populateTemplate(dotweenOverload.Replace("DOTWEEN_METHOD_NAME", data.dotweenMethodName), data); + return result; + }); + str += @" + } +} +#endif"; + SaveScript(dotweenMethodsScript, str); + } + + [CanBeNull] + static string getMethodPrefix(Dependency dep) { + switch (dep) { + case Dependency.UNITY_UGUI_INSTALLED: + return "UI"; + case Dependency.AUDIO_MODULE_INSTALLED: + return "Audio"; + case Dependency.PHYSICS_MODULE_INSTALLED: + case Dependency.PHYSICS2D_MODULE_INSTALLED: + return nameof(Rigidbody); + case Dependency.None: + case Dependency.PRIME_TWEEN_EXPERIMENTAL: + case Dependency.UI_ELEMENTS_MODULE_INSTALLED: + case Dependency.TEXT_MESH_PRO_INSTALLED: + return null; + } + return dep.ToString(); + } + + static bool shouldWrapInDefine(Dependency d) { + switch (d) { + case Dependency.UNITY_UGUI_INSTALLED: + case Dependency.AUDIO_MODULE_INSTALLED: + case Dependency.PHYSICS_MODULE_INSTALLED: + case Dependency.PHYSICS2D_MODULE_INSTALLED: + case Dependency.PRIME_TWEEN_EXPERIMENTAL: + case Dependency.UI_ELEMENTS_MODULE_INSTALLED: + case Dependency.TEXT_MESH_PRO_INSTALLED: + return true; + } + return false; + } + + const string overloadTemplateTo = @" public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single endValue, float duration, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => METHOD_NAME(target, new TweenSettings(endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single endValue, float duration, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => METHOD_NAME(target, new TweenSettings(endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single startValue, Single endValue, float duration, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => METHOD_NAME(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single startValue, Single endValue, float duration, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => METHOD_NAME(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single endValue, TweenSettings settings) => METHOD_NAME(target, new TweenSettings(endValue, settings)); + public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single startValue, Single endValue, TweenSettings settings) => METHOD_NAME(target, new TweenSettings(startValue, endValue, settings));"; + const string fullTemplate = @" public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, TweenSettings settings) { + return animate(target, ref settings, _tween => { + var _target = _tween.target as UnityEngine.Camera; + var val = _tween.FloatVal; + _target.orthographicSize = val; + }, t => (t.target as UnityEngine.Camera).orthographicSize.ToContainer(), TweenType.CameraOrthographicSize); + }"; + + void generateMethods() { + var text = methodsScript.text; + var searchIndex = text.IndexOf(generatorBeginLabel, StringComparison.Ordinal); + Assert.AreNotEqual(-1, searchIndex); + text = text.Substring(0, searchIndex + generatorBeginLabel.Length) + "\n"; + + var methodDataToEnumName = new Dictionary(); + { // generate enums + foreach (var group in methodsData.GroupBy(_ => _.dependency)) { + foreach (var data in group) { + text += " "; + var enumName = GetTweenTypeEnumName(data); + methodDataToEnumName.Add(data, enumName); + text += enumName; + text += ",\n"; + } + } + text += " }\n\n"; + } + { // generate TweenTypeToTweenData() + // todo combine Utils class with TweenGenerated or Extensions file + string utilsText = @"using System; +using PrimeTween; + +internal static class Utils { + internal static (PropType, Type) TweenTypeToTweenData(TweenType tweenType) { + switch (tweenType) { +"; + foreach (var group in methodsData.GroupBy(x => x.dependency)) { + var dependency = group.Key; + if (shouldWrapInDefine(dependency)) { + switch (dependency) { + case Dependency.PRIME_TWEEN_EXPERIMENTAL: + case Dependency.UI_ELEMENTS_MODULE_INSTALLED: + case Dependency.TEXT_MESH_PRO_INSTALLED: + utilsText += $" #if {dependency}\n"; + break; + default: + utilsText += $" #if !UNITY_2019_1_OR_NEWER || {dependency}\n"; + break; + } + } + foreach (var data in group) { + utilsText += $" case TweenType.{methodDataToEnumName[data]}:\n"; + utilsText += $" return (PropType.{data.propertyType}, typeof({getTypeByName(data.targetType).FullName}));\n"; + } + if (shouldWrapInDefine(dependency)) { + utilsText += " #endif\n"; + } + } + var tweenData = new List<(TweenType, PropType, Type)> { + (TweenType.None, PropType.None, null), + #if PRIME_TWEEN_PRO + (TweenType.TweenComponent, PropType.None, typeof(TweenComponent)), + #endif + (TweenType.Delay, PropType.Float, null), + (TweenType.Callback, PropType.Float, null), + (TweenType.ShakeLocalPosition, PropType.Vector3, typeof(Transform)), + (TweenType.ShakeLocalRotation, PropType.Quaternion, typeof(Transform)), + (TweenType.ShakeScale, PropType.Vector3, typeof(Transform)), + (TweenType.ShakeCustom, PropType.Vector3, typeof(Transform)), + (TweenType.ShakeCamera, PropType.Float, typeof(Camera)), + (TweenType.CustomFloat, PropType.Float, null), + (TweenType.CustomColor, PropType.Color, null), + (TweenType.CustomVector2, PropType.Vector2, null), + (TweenType.CustomVector3, PropType.Vector3, null), + (TweenType.CustomVector4, PropType.Vector4, null), + (TweenType.CustomQuaternion, PropType.Quaternion, null), + (TweenType.CustomRect, PropType.Rect, null), + (TweenType.CustomDouble, PropType.Double, null), + (TweenType.MaterialColorProperty, PropType.Color, typeof(Material)), + (TweenType.MaterialProperty, PropType.Float, typeof(Material)), + (TweenType.MaterialAlphaProperty, PropType.Float, typeof(Material)), + (TweenType.MaterialTextureOffset, PropType.Vector2, typeof(Material)), + (TweenType.MaterialTextureScale, PropType.Vector2, typeof(Material)), + (TweenType.MaterialPropertyVector4, PropType.Vector4, typeof(Material)), + (TweenType.EulerAngles, PropType.Vector3, typeof(Transform)), + (TweenType.LocalEulerAngles, PropType.Vector3, typeof(Transform)), + (TweenType.GlobalTimeScale, PropType.Float, null), + (TweenType.MainSequence, PropType.Float, null), + (TweenType.NestedSequence, PropType.Float, null) + }; + foreach (var tuple in tweenData) { + utilsText += $" case TweenType.{tuple.Item1}:\n"; + string typeStr = tuple.Item3 == null ? "null" : $"typeof({tuple.Item3})"; + utilsText += $" return (PropType.{tuple.Item2}, {typeStr});\n"; + } + utilsText += @" default: + throw new Exception(); + } + } +} +"; + SaveScript(editorUtilsScript, utilsText); + } + + text += " public partial struct Tween {"; + text += generateWithDefines(generate); + text = addCustomAnimationMethods(text); + text += additiveMethodsGenerator.Generate(); + text += speedBasedMethodsGenerator.Generate(); + text += @" + } +}"; + SaveScript(methodsScript, text); + } + + static string GetTweenTypeEnumName(MethodGenerationData data) { + string result = ""; + var dependency = data.dependency; + if (dependency != Dependency.None) { + result += getMethodPrefix(dependency); + } + if (dependency == Dependency.UI_ELEMENTS_MODULE_INSTALLED && !data.methodName.Contains("VisualElement")) { + result += "VisualElement"; + } + result += data.methodName; + if ((data.methodName == "Alpha" || data.methodName == "Color") && data.dependency == Dependency.UNITY_UGUI_INSTALLED) { + result += getTypeByName(data.targetType).Name; + } else if (data.methodName == "Scale" && data.propertyType == PropType.Float) { + result += "Uniform"; + } else if ((data.methodName == "Rotation" || data.methodName == "LocalRotation") && data.propertyType == PropType.Quaternion) { + result += "Quaternion"; + } else if (data.targetType == "PrimeTween.Sequence" ) { + result += "Sequence"; + } else if (data.targetType == "UnityEngine.Rigidbody2D") { + result += "2D"; + } + return result; + } + + [NotNull] + string generateWithDefines([NotNull] Func generator) { + string result = ""; + foreach (var group in methodsData.GroupBy(_ => _.dependency)) { + result += generateWithDefines(generator, group); + } + return result; + } + + [NotNull] + static string generateWithDefines([NotNull] Func generator, [NotNull] IGrouping group) { + var result = ""; + var dependency = group.Key; + if (shouldWrapInDefine(dependency)) { + switch (dependency) { + case Dependency.PRIME_TWEEN_EXPERIMENTAL: + case Dependency.UI_ELEMENTS_MODULE_INSTALLED: + case Dependency.TEXT_MESH_PRO_INSTALLED: + result += $"\n #if {dependency}"; + break; + default: + result += $"\n #if !UNITY_2019_1_OR_NEWER || {dependency}"; + break; + } + } + foreach (var method in group) { + var generated = generator(method); + if (!string.IsNullOrEmpty(generated)) { + result += generated; + result += "\n"; + } + } + if (shouldWrapInDefine(dependency)) { + result += "\n #endif"; + } + return result; + } + + [NotNull] + static Type getTypeByName(string targetType) { + var types = AppDomain.CurrentDomain + .GetAssemblies() + .Select(_ => _.GetType(targetType)) + .Where(_ => _ != null) + .Where(_ => _.FullName == targetType) + .Distinct() + .ToArray(); + switch (types.Length) { + case 0: + throw new Exception($"target type ({targetType}) not found in any of the assemblies.\n" + + "Please specify the full name of the type. For example, instead of 'Transform', use 'UnityEngine.Transform'.\n" + + "Or install the target package in Package Manager.\n"); + case 1: + break; + default: + throw new Exception($"More than one type found that match {targetType}. Found:\n" + + string.Join("\n", types.Select(_ => $"{_.AssemblyQualifiedName}\n{_.Assembly.GetName().FullName}"))); + } + var type = types.Single(); + Assert.IsNotNull(type, $"targetType ({targetType}) wasn't found in any assembly."); + return type; + } + + [NotNull] + static string generate([NotNull] MethodGenerationData data) { + var methodName = data.methodName; + Assert.IsTrue(System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(methodName), $"Method name is invalid: {methodName}."); + var propertyName = data.propertyName; + + var overload = populateTemplate(overloadTemplateTo, data); + var full = populateTemplate(fullTemplate, data); + const string templatePropName = "orthographicSize"; + string replaced = ""; + if (data.generateOnlyOverloads) { + replaced += "\n"; + replaced += overload; + } else if (propertyName.Any()) { + checkFieldOrProp(); + Assert.IsFalse(data.propertyGetter.Any()); + Assert.IsFalse(data.propertySetter.Any()); + replaced += "\n"; + replaced += overload; + replaced += "\n"; + replaced += full; + replaced = replaced.Replace(templatePropName, propertyName); + + void checkFieldOrProp() { + var type = getTypeByName(data.targetType); + Assert.IsNotNull(type); + const BindingFlags flags = BindingFlags.Instance | BindingFlags.Public; + var prop = type.GetProperty(propertyName, flags); + Type expectedPropType; + if (data.propertyType == PropType.Float) { + expectedPropType = typeof(float); + } else if (data.propertyType == PropType.Int) { + expectedPropType = typeof(int); + } else { + var typeName = $"{data.propertyType.ToFullTypeName()}, UnityEngine.CoreModule"; + expectedPropType = Type.GetType(typeName); + Assert.IsNotNull(expectedPropType, typeName); + } + if (prop != null) { + Assert.AreEqual(expectedPropType, prop.PropertyType); + return; + } + + var field = type.GetField(propertyName, flags); + if (field != null) { + Assert.AreEqual(expectedPropType, field.FieldType, "Field type is incorrect."); + return; + } + + throw new Exception($"Field or property with name ({propertyName}) not found for type {type.FullName}. Generation data name: {data.description}."); + } + } else { + Assert.IsTrue(data.propertySetter.Any()); + if (data.propertyGetter.Any()) { + replaced += "\n"; + replaced += replaceGetter(overload); + } + + replaced += "\n"; + full = replaceSetter(full); + replaced += replaceGetter(full); + + // ReSharper disable once AnnotateNotNullTypeMember + string replaceGetter(string str) { + while (true) { + var j = str.IndexOf(templatePropName, StringComparison.Ordinal); + if (j == -1) { + break; + } + Assert.AreNotEqual(-1, j); + str = str.Remove(j, templatePropName.Length); + str = str.Insert(j, data.propertyGetter); + } + return str; + } + + // ReSharper disable once AnnotateNotNullTypeMember + string replaceSetter(string str) { + while (true) { + var k = str.IndexOf("orthographicSize =", StringComparison.Ordinal); + if (k == -1) { + break; + } + Assert.AreNotEqual(-1, k); + var endIndex = str.IndexOf(";", k, StringComparison.Ordinal); + Assert.AreNotEqual(-1, endIndex); + str = str.Remove(k, endIndex - k); + str = str.Insert(k, data.propertySetter); + } + return str; + } + } + return replaced; + } + + [NotNull] + static string addCustomAnimationMethods(string text) { + const string template = @" public static Tween Custom_TEMPLATE(Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => Custom_TEMPLATE(new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); + public static Tween Custom_TEMPLATE(Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => Custom_TEMPLATE(new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); + public static Tween Custom_TEMPLATE(Single startValue, Single endValue, TweenSettings settings, [NotNull] Action onValueChange) => Custom_TEMPLATE(new TweenSettings(startValue, endValue, settings), onValueChange); + public static Tween Custom_TEMPLATE(TweenSettings settings, [NotNull] Action onValueChange) { + Assert.IsNotNull(onValueChange); + if (settings.startFromCurrent) { + UnityEngine.Debug.LogWarning(Constants.customTweensDontSupportStartFromCurrentWarning); + } + var tween = PrimeTweenManager.fetchTween(); + tween.startValue.CopyFrom(ref settings.startValue); + tween.endValue.CopyFrom(ref settings.endValue); + tween.setPropType(PropType.Float); + tween.customOnValueChange = onValueChange; + tween.Setup(PrimeTweenManager.dummyTarget, ref settings.settings, _tween => { + var _onValueChange = _tween.customOnValueChange as Action; + var val = _tween.FloatVal; + try { + _onValueChange(val); + } catch (Exception e) { + Assert.LogError($""Tween was stopped because of exception in {nameof(onValueChange)} callback, tween: {_tween.GetDescription()}, exception:\n{e}\n"", _tween.id, _tween.target as UnityEngine.Object); + _tween.EmergencyStop(); + } + }, null, false, TweenType.CustomFloat); + return PrimeTweenManager.Animate(tween); + } + public static Tween Custom_TEMPLATE([NotNull] T target, Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) where T : class + => Custom_internal(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); + public static Tween Custom_TEMPLATE([NotNull] T target, Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) where T : class + => Custom_internal(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); + public static Tween Custom_TEMPLATE([NotNull] T target, Single startValue, Single endValue, TweenSettings settings, [NotNull] Action onValueChange) where T : class + => Custom_internal(target, new TweenSettings(startValue, endValue, settings), onValueChange); + public static Tween Custom_TEMPLATE([NotNull] T target, TweenSettings settings, [NotNull] Action onValueChange) where T : class + => Custom_internal(target, settings, onValueChange); + #if PRIME_TWEEN_EXPERIMENTAL + public static Tween CustomAdditive([NotNull] T target, Single deltaValue, TweenSettings settings, [NotNull] Action onDeltaChange) where T : class + => Custom_internal(target, new TweenSettings(default, deltaValue, settings), onDeltaChange, true); + #endif + static Tween Custom_internal([NotNull] T target, TweenSettings settings, [NotNull] Action onValueChange, bool isAdditive = false) where T : class { + Assert.IsNotNull(onValueChange); + if (settings.startFromCurrent) { + UnityEngine.Debug.LogWarning(Constants.customTweensDontSupportStartFromCurrentWarning); + } + var tween = PrimeTweenManager.fetchTween(); + tween.startValue.CopyFrom(ref settings.startValue); + tween.endValue.CopyFrom(ref settings.endValue); + tween.setPropType(PropType.Float); + tween.customOnValueChange = onValueChange; + tween.isAdditive = isAdditive; + tween.Setup(target, ref settings.settings, _tween => { + var _onValueChange = _tween.customOnValueChange as Action; + var _target = _tween.target as T; + Single val; + if (_tween.isAdditive) { + var newVal = _tween.FloatVal; + val = newVal.calcDelta(_tween.prevVal); + _tween.prevVal.FloatVal = newVal; + } else { + val = _tween.FloatVal; + } + try { + _onValueChange(_target, val); + } catch (Exception e) { + Assert.LogError($""Tween was stopped because of exception in {nameof(onValueChange)} callback, tween: {_tween.GetDescription()}, exception:\n{e}\n"", _tween.id, _tween.target as UnityEngine.Object); + _tween.EmergencyStop(); + } + }, null, false, TweenType.CustomFloat); + return PrimeTweenManager.Animate(tween); + } + static Tween animate(object target, ref TweenSettings settings, [NotNull] Action setter, Func getter, TweenType _tweenType) { + var tween = PrimeTweenManager.fetchTween(); + tween.startValue.CopyFrom(ref settings.startValue); + tween.endValue.CopyFrom(ref settings.endValue); + tween.setPropType(PropType.Float); + tween.Setup(target, ref settings.settings, setter, getter, settings.startFromCurrent, _tweenType); + return PrimeTweenManager.Animate(tween); + } + static Tween animateWithIntParam([NotNull] object target, int intParam, ref TweenSettings settings, [NotNull] Action setter, [NotNull] Func getter, TweenType _tweenType) { + var tween = PrimeTweenManager.fetchTween(); + tween.intParam = intParam; + tween.startValue.CopyFrom(ref settings.startValue); + tween.endValue.CopyFrom(ref settings.endValue); + tween.setPropType(PropType.Float); + tween.Setup(target, ref settings.settings, setter, getter, settings.startFromCurrent, _tweenType); + return PrimeTweenManager.Animate(tween); + }"; + + var types = new[] { typeof(float), typeof(Color), typeof(Vector2), typeof(Vector3), typeof(Vector4), typeof(Quaternion), typeof(Rect) }; + foreach (var type in types) { + text += "\n\n"; + var isFloat = type == typeof(float); + var replaced = template; + replaced = replaced.Replace("Single", isFloat ? "float" : type.FullName); + if (!isFloat) { + replaced = replaced.Replace("TweenSettings", $"TweenSettings<{type.FullName}>"); + replaced = replaced.Replace(".FloatVal", $".{type.Name}Val"); + replaced = replaced.Replace("Single val;", $"{type.Name} val;"); + replaced = replaced.Replace("PropType.Float", $"PropType.{type.Name}"); + replaced = replaced.Replace("TweenType.CustomFloat", $"TweenType.Custom{type.Name}"); + } + replaced = replaced.Replace("Custom_TEMPLATE", "Custom"); + text += replaced; + } + return text; + } + + [NotNull] + static string populateTemplate([NotNull] string str, [NotNull] MethodGenerationData data) { + var methodName = data.methodName; + var prefix = getMethodPrefix(data.dependency); + if (prefix != null && !data.placeInGlobalScope) { + methodName = prefix + methodName; + } + var targetType = data.targetType; + if (string.IsNullOrEmpty(targetType)) { + str = str.Replace("[NotNull] UnityEngine.Camera target, ", "") + .Replace("METHOD_NAME(target, ", "METHOD_NAME("); + } else { + str = str.Replace("UnityEngine.Camera", targetType); + } + str = str.Replace("METHOD_NAME", methodName); + str = str.Replace("TweenType.CameraOrthographicSize", $"TweenType.{GetTweenTypeEnumName(data)}"); + if (data.propertyType != PropType.Float) { + str = str.Replace("Single", data.propertyType.ToFullTypeName()); + str = str.Replace("_tween.FloatVal", $"_tween.{data.propertyType.ToString()}Val"); + str = str.Replace("TweenSettings", $"TweenSettings<{data.propertyType.ToFullTypeName()}>"); + } + return str; + } + + [Serializable] + internal class SpeedBasedMethodsGenerator { + [SerializeField] Data[] data; + + [Serializable] + class Data { + [SerializeField] internal string methodName; + [SerializeField] internal PropType propType; + [SerializeField] internal string propName; + [SerializeField] internal string speedParamName; + } + + [NotNull] + internal string Generate() { + string result = ""; + foreach (var d in data) { + const string template = @" + public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 endValue, float averageSpeed, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => PositionAtSpeed(target, new TweenSettings(endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 endValue, float averageSpeed, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => PositionAtSpeed(target, new TweenSettings(endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 startValue, UnityEngine.Vector3 endValue, float averageSpeed, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => PositionAtSpeed(target, new TweenSettings(startValue, endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 startValue, UnityEngine.Vector3 endValue, float averageSpeed, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => PositionAtSpeed(target, new TweenSettings(startValue, endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, TweenSettings settings) { + var speed = settings.settings.duration; + if (speed <= 0) { + UnityEngine.Debug.LogError($""Invalid speed provided to the Tween.{nameof(PositionAtSpeed)}() method: {speed}.""); + return default; + } + if (settings.startFromCurrent) { + settings.startFromCurrent = false; + settings.startValue = target.position; + } + settings.settings.duration = Extensions.CalcDistance(settings.startValue, settings.endValue) / speed; + return Tween.Position(target, settings); + } +"; + result += template.Replace("PositionAtSpeed", $"{d.methodName}AtSpeed") + .Replace("UnityEngine.Vector3", d.propType.ToFullTypeName()) + .Replace("Tween.Position", $"{d.methodName}") + .Replace("target.position", $"target.{d.propName}") + .Replace("averageSpeed", $"{d.speedParamName}") + ; + } + return result; + } + } +} + +[Serializable] +class MethodGenerationData { + public string description; + public string methodName; + public string targetType; + public PropType propertyType; + + public string propertyName; + + public string propertyGetter; + public string propertySetter; + public string dotweenMethodName; + public Dependency dependency; + public bool placeInGlobalScope; + public bool generateOnlyOverloads; +} + +[PublicAPI] +enum Dependency { + None, + UNITY_UGUI_INSTALLED, + AUDIO_MODULE_INSTALLED, + PHYSICS_MODULE_INSTALLED, + PHYSICS2D_MODULE_INSTALLED, + Camera, + Material, + Light, + PRIME_TWEEN_EXPERIMENTAL, + UI_ELEMENTS_MODULE_INSTALLED, + TEXT_MESH_PRO_INSTALLED +} + +static class Ext { + [NotNull] + internal static string ToFullTypeName(this PropType type) { + Assert.AreNotEqual(PropType.Float, type); + if (type == PropType.Int) { + return "int"; + } + return $"UnityEngine.{type}"; + } +} diff --git a/VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta b/VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta new file mode 100644 index 00000000..43aca8b9 --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 91062890830ba3f44ae278f19424d5ad +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VirtueSky/PrimeTween/Editor/CodeTemplates.cs b/VirtueSky/PrimeTween/Editor/CodeTemplates.cs new file mode 100644 index 00000000..b8c5e1fa --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/CodeTemplates.cs @@ -0,0 +1,150 @@ +/* +// ReSharper disable PossibleNullReferenceException +// ReSharper disable UnusedMember.Global +// ReSharper disable MemberCanBePrivate.Global +// ReSharper disable UnusedMember.Local +using System; +using JetBrains.Annotations; + +namespace PrimeTween { + internal static class CodeTemplates { + public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 endValue, float averageSpeed, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => PositionAtSpeed(target, new TweenSettings(endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 endValue, float averageSpeed, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => PositionAtSpeed(target, new TweenSettings(endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 startValue, UnityEngine.Vector3 endValue, float averageSpeed, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => PositionAtSpeed(target, new TweenSettings(startValue, endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + public static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, UnityEngine.Vector3 startValue, UnityEngine.Vector3 endValue, float averageSpeed, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => PositionAtSpeed(target, new TweenSettings(startValue, endValue, new TweenSettings(averageSpeed, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + static Tween PositionAtSpeed([NotNull] UnityEngine.Transform target, TweenSettings settings) { + var speed = settings.settings.duration; + if (speed <= 0) { + UnityEngine.Debug.LogError($"Invalid speed provided to the Tween.{nameof(PositionAtSpeed)}() method: {speed}."); + return default; + } + if (settings.startFromCurrent) { + settings.startFromCurrent = false; + settings.startValue = target.position; + } + settings.settings.duration = Extensions.CalcDistance(settings.startValue, settings.endValue) / speed; + return Tween.Position(target, settings); + } + + public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single endValue, float duration, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => METHOD_NAME(target, new TweenSettings(endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single endValue, float duration, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => METHOD_NAME(target, new TweenSettings(endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single startValue, Single endValue, float duration, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => METHOD_NAME(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single startValue, Single endValue, float duration, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => METHOD_NAME(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime))); + public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single endValue, TweenSettings settings) => METHOD_NAME(target, new TweenSettings(endValue, settings)); + public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, Single startValue, Single endValue, TweenSettings settings) => METHOD_NAME(target, new TweenSettings(startValue, endValue, settings)); + + public static Tween METHOD_NAME([NotNull] UnityEngine.Camera target, TweenSettings settings) { + return animate(target, ref settings, _tween => { + var _target = _tween.target as UnityEngine.Camera; + var val = _tween.FloatVal; + _target.orthographicSize = val; + }, t => (t.target as UnityEngine.Camera).orthographicSize.ToContainer(), TweenType.CameraOrthographicSize); + } + + public static Tween Custom_TEMPLATE(Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => Custom_TEMPLATE(new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); + public static Tween Custom_TEMPLATE(Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => Custom_TEMPLATE(new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); + public static Tween Custom_TEMPLATE(Single startValue, Single endValue, TweenSettings settings, [NotNull] Action onValueChange) => Custom_TEMPLATE(new TweenSettings(startValue, endValue, settings), onValueChange); + public static Tween Custom_TEMPLATE(TweenSettings settings, [NotNull] Action onValueChange) { + Assert.IsNotNull(onValueChange); + if (settings.startFromCurrent) { + UnityEngine.Debug.LogWarning(Constants.customTweensDontSupportStartFromCurrentWarning); + } + var tween = PrimeTweenManager.fetchTween(); + tween.startValue.CopyFrom(ref settings.startValue); + tween.endValue.CopyFrom(ref settings.endValue); + tween.propType = PropType.Float; + tween.customOnValueChange = onValueChange; + tween.Setup(PrimeTweenManager.dummyTarget, ref settings.settings, _tween => { + var _onValueChange = _tween.customOnValueChange as Action; + var val = _tween.FloatVal; + try { + _onValueChange(val); + } catch (Exception e) { + Assert.LogError($"Tween was stopped because of exception in {nameof(onValueChange)} callback, tween: {_tween.GetDescription()}, exception:\n{e}\n", _tween.id, _tween.target as UnityEngine.Object); + _tween.EmergencyStop(); + } + }, null, false, TweenType.CustomFloat); + return PrimeTweenManager.Animate(tween); + } + public static Tween Custom_TEMPLATE([NotNull] T target, Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) where T : class + => Custom_internal(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); + public static Tween Custom_TEMPLATE([NotNull] T target, Single startValue, Single endValue, float duration, [NotNull] Action onValueChange, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) where T : class + => Custom_internal(target, new TweenSettings(startValue, endValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)), onValueChange); + public static Tween Custom_TEMPLATE([NotNull] T target, Single startValue, Single endValue, TweenSettings settings, [NotNull] Action onValueChange) where T : class + => Custom_internal(target, new TweenSettings(startValue, endValue, settings), onValueChange); + public static Tween Custom_TEMPLATE([NotNull] T target, TweenSettings settings, [NotNull] Action onValueChange) where T : class + => Custom_internal(target, settings, onValueChange); + #if PRIME_TWEEN_EXPERIMENTAL + public static Tween CustomAdditive([NotNull] T target, Single deltaValue, TweenSettings settings, [NotNull] Action onDeltaChange) where T : class + => Custom_internal(target, new TweenSettings(default, deltaValue, settings), onDeltaChange, true); + #endif + static Tween Custom_internal([NotNull] T target, TweenSettings settings, [NotNull] Action onValueChange, bool isAdditive = false) where T : class { + Assert.IsNotNull(onValueChange); + if (settings.startFromCurrent) { + UnityEngine.Debug.LogWarning(Constants.customTweensDontSupportStartFromCurrentWarning); + } + var tween = PrimeTweenManager.fetchTween(); + tween.startValue.CopyFrom(ref settings.startValue); + tween.endValue.CopyFrom(ref settings.endValue); + tween.propType = PropType.Float; + tween.customOnValueChange = onValueChange; + tween.isAdditive = isAdditive; + tween.Setup(target, ref settings.settings, _tween => { + var _onValueChange = _tween.customOnValueChange as Action; + var _target = _tween.target as T; + Single val; + if (_tween.isAdditive) { + var newVal = _tween.FloatVal; + val = newVal.calcDelta(_tween.prevVal); + _tween.prevVal.FloatVal = newVal; + } else { + val = _tween.FloatVal; + } + try { + _onValueChange(_target, val); + } catch (Exception e) { + Assert.LogError($"Tween was stopped because of exception in {nameof(onValueChange)} callback, tween: {_tween.GetDescription()}, exception:\n{e}\n", _tween.id, _tween.target as UnityEngine.Object); + _tween.EmergencyStop(); + } + }, null, false, TweenType.CustomFloat); + return PrimeTweenManager.Animate(tween); + } + static Tween animate(object target, ref TweenSettings settings, [NotNull] Action setter, Func getter, TweenType _tweenType) { + var tween = PrimeTweenManager.fetchTween(); + tween.startValue.CopyFrom(ref settings.startValue); + tween.endValue.CopyFrom(ref settings.endValue); + tween.propType = PropType.Float; + tween.Setup(target, ref settings.settings, setter, getter, settings.startFromCurrent, _tweenType); + return PrimeTweenManager.Animate(tween); + } + static Tween animateWithIntParam([NotNull] object target, int intParam, ref TweenSettings settings, [NotNull] Action setter, [NotNull] Func getter, TweenType _tweenType) { + var tween = PrimeTweenManager.fetchTween(); + tween.intParam = intParam; + tween.startValue.CopyFrom(ref settings.startValue); + tween.endValue.CopyFrom(ref settings.endValue); + tween.propType = PropType.Float; + tween.Setup(target, ref settings.settings, setter, getter, settings.startFromCurrent, _tweenType); + return PrimeTweenManager.Animate(tween); + } + + public static Tween PositionAdditive([NotNull] UnityEngine.Transform target, Single deltaValue, float duration, Ease ease = Ease.Default, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => PositionAdditive(target, deltaValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)); + public static Tween PositionAdditive([NotNull] UnityEngine.Transform target, Single deltaValue, float duration, Easing ease, int cycles = 1, CycleMode cycleMode = CycleMode.Restart, float startDelay = 0, float endDelay = 0, bool useUnscaledTime = false) + => PositionAdditive(target, deltaValue, new TweenSettings(duration, ease, cycles, cycleMode, startDelay, endDelay, useUnscaledTime)); + public static Tween PositionAdditive([NotNull] UnityEngine.Transform target, Single deltaValue, TweenSettings settings) + => CustomAdditive(target, deltaValue, settings, (_, _) => additiveTweenSetter()); + + static void additiveTweenSetter() {} + } +} +*/ diff --git a/VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta b/VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta new file mode 100644 index 00000000..1d59094b --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 13ce4156fb592254ab2f13dd0ab0bf52 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs b/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs new file mode 100644 index 00000000..aded167e --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs @@ -0,0 +1,83 @@ +using System.Collections.Generic; +using JetBrains.Annotations; +using PrimeTween; +using UnityEditor; +using UnityEngine; + +[CustomEditor(typeof(PrimeTweenManager))] +internal class PrimeTweenManagerInspector : Editor { + SerializedProperty tweensProp; + SerializedProperty fixedUpdateTweensProp; + GUIContent aliveTweenGuiContent; + GUIContent fixedUpdateTweenGuiContent; + StringCache tweensCountCache; + StringCache maxSimultaneousTweensCountCache; + StringCache currentPoolCapacityCache; + + void OnEnable() { + tweensProp = serializedObject.FindProperty(nameof(PrimeTweenManager.tweens)); + fixedUpdateTweensProp = serializedObject.FindProperty(nameof(PrimeTweenManager.fixedUpdateTweens)); + Assert.IsNotNull(tweensProp); + Assert.IsNotNull(fixedUpdateTweensProp); + aliveTweenGuiContent = new GUIContent("Tweens"); + fixedUpdateTweenGuiContent = new GUIContent("Fixed update tweens"); + } + + public override void OnInspectorGUI() { + using (new EditorGUI.DisabledScope(true)) { + EditorGUILayout.ObjectField("Script", MonoScript.FromMonoBehaviour((MonoBehaviour)target), typeof(MonoBehaviour), false); + } + + var manager = target as PrimeTweenManager; + Assert.IsNotNull(manager); + + GUILayout.BeginHorizontal(); + GUILayout.Label("Alive tweens", EditorStyles.label); + GUILayout.Label(tweensCountCache.GetCachedString(manager.tweensCount), EditorStyles.boldLabel); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + GUILayout.Label( Constants.maxAliveTweens, EditorStyles.label); + GUILayout.Label(maxSimultaneousTweensCountCache.GetCachedString(manager.maxSimultaneousTweensCount), EditorStyles.boldLabel); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + + GUILayout.BeginHorizontal(); + GUILayout.Label("Tweens capacity", EditorStyles.label); + GUILayout.Label(currentPoolCapacityCache.GetCachedString(manager.currentPoolCapacity), EditorStyles.boldLabel); + GUILayout.FlexibleSpace(); + GUILayout.EndHorizontal(); + EditorGUILayout.HelpBox("Use " + Constants.setTweensCapacityMethod + " to set tweens capacity.\n" + + "To prevent memory allocations during runtime, choose the value that is greater than the maximum number of simultaneous tweens in your game.", MessageType.None); + + drawList(tweensProp, manager.tweens, aliveTweenGuiContent); + drawList(fixedUpdateTweensProp, manager.fixedUpdateTweens, fixedUpdateTweenGuiContent); + void drawList(SerializedProperty tweensProp, List list, GUIContent guiContent) { + if (tweensProp.isExpanded) { + foreach (var tween in list) { + if (tween != null && string.IsNullOrEmpty(tween.debugDescription)) { + tween.debugDescription = tween.GetDescription(); + } + } + } + using (new EditorGUI.DisabledScope(true)) { + EditorGUILayout.PropertyField(tweensProp, guiContent); + } + } + } + + struct StringCache { + int currentValue; + string str; + + [NotNull] + internal string GetCachedString(int value) { + if (currentValue != value || str == null) { + currentValue = value; + str = value.ToString(); + } + return str; + } + } +} \ No newline at end of file diff --git a/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta b/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta new file mode 100644 index 00000000..86f03123 --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7c9dce2090ecb50459c38684398a3adb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs b/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs new file mode 100644 index 00000000..84e12752 --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs @@ -0,0 +1,141 @@ +using System; +using JetBrains.Annotations; +using PrimeTween; +using UnityEditor; +using UnityEngine; +using static UnityEditor.EditorGUI; +using static UnityEditor.EditorGUIUtility; + +/// todo clear the custom ease curve when ease != Ease.Custom +[CustomPropertyDrawer(typeof(TweenSettings))] +internal class TweenSettingsPropDrawer : PropertyDrawer { + public override float GetPropertyHeight([NotNull] SerializedProperty property, GUIContent label) { + if (!property.isExpanded) { + return singleLineHeight; + } + return getPropHeight(property); + } + + internal static float getPropHeight([NotNull] SerializedProperty property) { + var count = 1; + count++; // duration + count++; // ease + var easeIndex = property.FindPropertyRelative(nameof(TweenSettings.ease)).intValue; + if (easeIndex == (int)Ease.Custom) { + count++; // customEase + } + count++; // cycles + var cycles = property.FindPropertyRelative(nameof(TweenSettings.cycles)).intValue; + if (cycles != 0 && cycles != 1) { + count++; // cycleMode + } + count++; // startDelay + count++; // endDelay + count++; // useUnscaledTime + count++; // useFixedUpdate + var result = singleLineHeight * count + standardVerticalSpacing * (count - 1); + result += standardVerticalSpacing * 2; // extra spacing + return result; + } + + public override void OnGUI(Rect position, [NotNull] SerializedProperty property, GUIContent label) { + var rect = new Rect(position) { height = singleLineHeight }; + PropertyField(rect, property, label); + if (!property.isExpanded) { + return; + } + moveToNextLine(ref rect); + indentLevel++; + { // duration + property.NextVisible(true); + DrawDuration(rect, property); + moveToNextLine(ref rect); + } + drawEaseTillEnd(property, ref rect); + indentLevel--; + } + + internal static void DrawDuration(Rect rect, [NotNull] SerializedProperty property) { + if (GUI.enabled) { + ClampProperty(property, 1f); + } + PropertyField(rect, property); + } + + internal static void ClampProperty(SerializedProperty prop, float defaultValue, float min = 0.01f, float max = float.MaxValue) { + prop.floatValue = prop.floatValue == 0f ? defaultValue : Mathf.Clamp(prop.floatValue, min, max); + } + + internal static void drawEaseTillEnd([NotNull] SerializedProperty property, ref Rect rect) { + DrawEaseAndCycles(property, ref rect); + drawStartDelayTillEnd(ref rect, property); + } + + internal static void DrawEaseAndCycles(SerializedProperty property, ref Rect rect, bool addSpace = true, bool draw = true) { + { // ease + property.NextVisible(true); + if (draw) PropertyField(rect, property); + moveToNextLine(ref rect); + // customEase + bool isCustom = property.intValue == (int) Ease.Custom; + property.NextVisible(true); + if (isCustom) { + if (draw) PropertyField(rect, property); + moveToNextLine(ref rect); + } + } + if (addSpace) { + rect.y += standardVerticalSpacing * 2; + } + { // cycles + var cycles = drawCycles(rect, property, draw); + moveToNextLine(ref rect); + { + // cycleMode + property.NextVisible(true); + if (cycles != 0 && cycles != 1) { + if (draw) PropertyField(rect, property); + moveToNextLine(ref rect); + } + } + } + } + + internal static void drawStartDelayTillEnd(ref Rect rect, [NotNull] SerializedProperty property) { + { // startDelay, endDelay + for (int _ = 0; _ < 2; _++) { + property.NextVisible(true); + if (property.floatValue < 0f) { + property.floatValue = 0f; + } + PropertyField(rect, property); + moveToNextLine(ref rect); + } + } + { // useUnscaledTime + property.NextVisible(true); + PropertyField(rect, property); + moveToNextLine(ref rect); + } + { // useFixedUpdate + property.NextVisible(true); + PropertyField(rect, property); + moveToNextLine(ref rect); + } + } + + internal static int drawCycles(Rect rect, [NotNull] SerializedProperty property, bool draw = true) { + property.NextVisible(false); + if (property.intValue == 0) { + property.intValue = 1; + } else if (property.intValue < -1) { + property.intValue = -1; + } + if (draw) PropertyField(rect, property); + return property.intValue; + } + + static void moveToNextLine(ref Rect rect) { + rect.y += singleLineHeight + standardVerticalSpacing; + } +} diff --git a/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs.meta b/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs.meta new file mode 100644 index 00000000..7dd1c130 --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f8f4d614305226a4abf7d56ed174e508 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs b/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs new file mode 100644 index 00000000..bf90a8ad --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs @@ -0,0 +1,85 @@ +#pragma warning disable CS0162 +using JetBrains.Annotations; +using PrimeTween; +using UnityEditor; +using UnityEngine; +using static UnityEditor.EditorGUI; +using static UnityEditor.EditorGUIUtility; + +[CustomPropertyDrawer(typeof(TweenSettings)), + CustomPropertyDrawer(typeof(TweenSettings)), + CustomPropertyDrawer(typeof(TweenSettings)), + CustomPropertyDrawer(typeof(TweenSettings)), + CustomPropertyDrawer(typeof(TweenSettings)), + CustomPropertyDrawer(typeof(TweenSettings)), + CustomPropertyDrawer(typeof(TweenSettings)), + CustomPropertyDrawer(typeof(TweenSettings)) +] +internal class TweenSettingsTypesPropDrawer : PropertyDrawer { + const bool drawStartFromCurrent = false; + + public override float GetPropertyHeight([NotNull] SerializedProperty property, GUIContent label) { + if (!property.isExpanded) { + return singleLineHeight; + } + var count = 0; + float height = 0f; + property.NextVisible(true); // startFromCurrent + incrementHeight(); // startValue + incrementHeight(); // endValue + property.NextVisible(false); + var result = height + 0 * (count - 1) + TweenSettingsPropDrawer.getPropHeight(property); + result += standardVerticalSpacing * 2; // extra space + return result; + + void incrementHeight() { + property.NextVisible(false); + count++; // startFromCurrent + height += EditorGUI.GetPropertyHeight(property, true); + } + } + + public override void OnGUI(Rect position, [NotNull] SerializedProperty property, GUIContent label) { + var rect = new Rect(position) { height = singleLineHeight }; + PropertyField(rect, property, label); + if (!property.isExpanded) { + return; + } + rect.y += singleLineHeight + standardVerticalSpacing; + indentLevel++; + + // startFromCurrent + property.NextVisible(true); + + // startValue + { + var startFromCurrent = property.boolValue; + property.NextVisible(false); + if (!startFromCurrent || !drawStartFromCurrent) { + PropertyField(rect, property, true); + moveToNextLine(true); + } + } + + // endValue + property.NextVisible(false); + PropertyField(rect, property, true); + moveToNextLine(true); + + // duration + { + property.NextVisible(false); // settings + property.NextVisible(true); // duration + TweenSettingsPropDrawer.DrawDuration(rect, property); + moveToNextLine(false); + } + + TweenSettingsPropDrawer.drawEaseTillEnd(property, ref rect); + + indentLevel--; + + void moveToNextLine(bool includeChildren) { + rect.y += EditorGUI.GetPropertyHeight(property, includeChildren) + standardVerticalSpacing; + } + } +} diff --git a/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta b/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta new file mode 100644 index 00000000..ace83409 --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f5dfc251024fd904d945310438915610 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs b/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs new file mode 100644 index 00000000..e868d843 --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs @@ -0,0 +1,117 @@ +using JetBrains.Annotations; +using PrimeTween; +using UnityEditor; +using UnityEngine; +using static UnityEditor.EditorGUI; +using static UnityEditor.EditorGUIUtility; + +[CustomPropertyDrawer(typeof(ShakeSettings))] +internal class TweenShakeSettingsPropDrawer : PropertyDrawer { // todo rename to ShakeSettingsPropDrawer + public override float GetPropertyHeight([NotNull] SerializedProperty property, GUIContent label) { + if (!property.isExpanded) { + return singleLineHeight; + } + property.NextVisible(true); + float result = EditorGUI.GetPropertyHeight(property, true); // strength + var count = 1; + count++; // frequency + count++; // duration + count++; // enableFalloff + property.NextVisible(false); + property.NextVisible(false); + property.NextVisible(false); // enableFalloff + if (property.boolValue) { + count++; // falloffEase + property.NextVisible(false); + if (property.intValue == -1) { + count++; // strengthOverTime + } + } + count++; // asymmetry + count++; // easeBetweenShakes + count++; // cycles + count++; // startDelay + count++; // endDelay + count++; // useUnscaledTime + count++; // useFixedUpdate + result += singleLineHeight * count + standardVerticalSpacing * (count - 1); + result += standardVerticalSpacing * 2; // extra space + return result; + } + + public override void OnGUI(Rect position, [NotNull] SerializedProperty property, GUIContent label) { + var rect = new Rect(position) { height = singleLineHeight }; + PropertyField(rect, property, label); + if (!property.isExpanded) { + return; + } + moveToNextLine(); + indentLevel++; + property.NextVisible(true); + { // strength + PropertyField(rect, property); + rect.y += EditorGUI.GetPropertyHeight(property, true); + } + { // duration + property.NextVisible(false); + TweenSettingsPropDrawer.DrawDuration(rect, property); + moveToNextLine(); + } + { // frequency + property.NextVisible(false); + var floatValue = property.floatValue; + if (floatValue == 0f) { + property.floatValue = ShakeSettings.defaultFrequency; + } else if (floatValue < 0.1f) { + property.floatValue = 0.1f; + } + propertyField(); + } + { // enableFalloff + property.NextVisible(false); + propertyField(); + var enableFalloff = property.boolValue; + property.NextVisible(false); + if (enableFalloff) { + // falloffEase + propertyField(); + // strengthOverTime + var customFalloffEase = property.intValue == (int)Ease.Custom; + property.NextVisible(false); + if (customFalloffEase) { + propertyField(); + } + } else { + // skipped strengthOverTime + property.NextVisible(false); + } + } + // extra space + rect.y += standardVerticalSpacing * 2; + { // asymmetry + property.NextVisible(false); + propertyField(); + } + { // easeBetweenShakes + property.NextVisible(false); + if (property.intValue == (int)Ease.Custom) { + Debug.LogWarning($"Ease.Custom is not supported for {nameof(ShakeSettings.easeBetweenShakes)}."); + property.intValue = (int)Ease.Default; + } + propertyField(); + } + TweenSettingsPropDrawer.drawCycles(rect, property); + moveToNextLine(); + TweenSettingsPropDrawer.drawStartDelayTillEnd(ref rect, property); + indentLevel--; + + void propertyField() { + PropertyField(rect, property); + moveToNextLine(); + } + + void moveToNextLine() { + rect.y += singleLineHeight + standardVerticalSpacing; + } + } +} diff --git a/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs.meta b/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs.meta new file mode 100644 index 00000000..5c2b5e72 --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c4cf2c2465d1a5940b94c9560c2a879f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs b/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs new file mode 100644 index 00000000..fcc40300 --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs @@ -0,0 +1,143 @@ +using System; +using PrimeTween; +using UnityEditor; +using UnityEngine; + +[CustomPropertyDrawer(typeof(ValueContainerStartEnd))] +public class ValueContainerStartEndPropDrawer : PropertyDrawer { + public override float GetPropertyHeight(SerializedProperty prop, GUIContent label) { + prop.Next(true); + var tweenType = (TweenType)prop.enumValueIndex; + prop.Next(false); + return GetHeight(prop, label, tweenType); + } + + internal static float GetHeight(SerializedProperty prop, GUIContent label, TweenType tweenType) { + var propType = Utils.TweenTypeToTweenData(tweenType).Item1; + Assert.AreNotEqual(PropType.None, propType); + bool startFromCurrent = prop.boolValue; + bool hasStartValue = !startFromCurrent; + if (hasStartValue) { + return GetSingleItemHeight(propType, label) * 2f + EditorGUIUtility.standardVerticalSpacing; + } + return EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing + GetSingleItemHeight(propType, label); + } + + static float GetSingleItemHeight(PropType propType, GUIContent label) { + return EditorGUI.GetPropertyHeight(ToSerializedPropType(), label); + SerializedPropertyType ToSerializedPropType() { + switch (propType) { + case PropType.Float: + return SerializedPropertyType.Float; + case PropType.Color: + return SerializedPropertyType.Color; + case PropType.Vector2: + return SerializedPropertyType.Vector2; + case PropType.Vector3: + return SerializedPropertyType.Vector3; + case PropType.Vector4: + case PropType.Quaternion: + return SerializedPropertyType.Vector4; + case PropType.Rect: + return SerializedPropertyType.Rect; + case PropType.Int: + return SerializedPropertyType.Integer; + case PropType.Double: + case PropType.None: + default: + throw new Exception(); + } + } + } + + public override void OnGUI(Rect pos, SerializedProperty prop, GUIContent label) { + prop.Next(true); + var tweenType = (TweenType)prop.enumValueIndex; + prop.Next(false); + Draw(ref pos, prop, tweenType); + } + + internal static void Draw(ref Rect pos, SerializedProperty prop, TweenType tweenType) { + var propType = Utils.TweenTypeToTweenData(tweenType).Item1; + Assert.AreNotEqual(PropType.None, propType); + const float toggleWidth = 18f; + EditorGUIUtility.labelWidth -= toggleWidth; + var togglePos = new Rect(pos.x + 2, pos.y, toggleWidth - 2, EditorGUIUtility.singleLineHeight); + var guiContent = EditorGUI.BeginProperty(togglePos, new GUIContent(), prop); // todo is it possible to display tooltip? tooltip is only displayed over the label, but I need to display it over the ToggleLeft + EditorGUI.BeginChangeCheck(); + bool newStartFromCurrent = !EditorGUI.ToggleLeft(togglePos, guiContent, !prop.boolValue); + if (EditorGUI.EndChangeCheck()) { + prop.boolValue = newStartFromCurrent; + } + EditorGUI.EndProperty(); + + pos.x += toggleWidth; + pos.width -= toggleWidth; + + prop.Next(false); + if (newStartFromCurrent) { + pos.height = EditorGUIUtility.singleLineHeight; + EditorGUI.LabelField(pos, new GUIContent(prop.displayName, prop.tooltip)); + prop.Next(false); + } else { + DrawValueContainer(ref pos, prop, propType); + } + + pos.y += pos.height + EditorGUIUtility.standardVerticalSpacing; + DrawValueContainer(ref pos, prop, propType); + pos.y += pos.height + EditorGUIUtility.standardVerticalSpacing; + + pos.x -= toggleWidth; + pos.width += toggleWidth; + } + + static void DrawValueContainer(ref Rect pos, SerializedProperty prop, PropType propType) { + var root = prop.Copy(); + prop.Next(true); + ValueContainer valueContainer = default; + for (int i = 0; i < 4; i++) { + valueContainer[i] = prop.floatValue; + prop.Next(false); + } + var guiContent = new GUIContent(root.displayName, root.tooltip); + pos.height = GetSingleItemHeight(propType, guiContent); + guiContent = EditorGUI.BeginProperty(pos, guiContent, root); + EditorGUI.BeginChangeCheck(); + ValueContainer newVal = DrawField(pos); + ValueContainer DrawField(Rect position) { + switch (propType) { + case PropType.Float: + return EditorGUI.FloatField(position, guiContent, valueContainer.FloatVal).ToContainer(); + case PropType.Color: + return EditorGUI.ColorField(position, guiContent, valueContainer.ColorVal).ToContainer(); + case PropType.Vector2: + return EditorGUI.Vector2Field(position, guiContent, valueContainer.Vector2Val).ToContainer(); + case PropType.Vector3: + return EditorGUI.Vector3Field(position, guiContent, valueContainer.Vector3Val).ToContainer(); + case PropType.Vector4: + case PropType.Quaternion: // todo don't draw quaternion + return EditorGUI.Vector4Field(position, guiContent, valueContainer.Vector4Val).ToContainer(); + case PropType.Rect: + return EditorGUI.RectField(position, guiContent, valueContainer.RectVal).ToContainer(); + case PropType.Int: + var newIntVal = EditorGUI.IntField(position, guiContent, Mathf.RoundToInt(valueContainer.FloatVal)); + return ((float)newIntVal).ToContainer(); + case PropType.Double: + case PropType.None: + default: + throw new Exception(); + } + } + if (EditorGUI.EndChangeCheck()) { + root.Next(true); + for (int i = 0; i < 4; i++) { + // ReSharper disable once CompareOfFloatsByEqualityOperator + if (root.floatValue != newVal[i]) { + root.floatValue = newVal[i]; + } + root.Next(false); + } + } + EditorGUI.EndProperty(); + } +} diff --git a/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs.meta b/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs.meta new file mode 100644 index 00000000..b8293b15 --- /dev/null +++ b/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f165141ebcaf41e4ea0f7b0b044542b3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: From a77f8ec46cdacb3747b6ff61fff9ed12391e1beb Mon Sep 17 00:00:00 2001 From: DucNV Date: Wed, 11 Dec 2024 09:52:14 +0700 Subject: [PATCH 10/10] - update version Co-Authored-By: VirtueSky <126542083+VirtueSky@users.noreply.github.com> --- README.md | 4 ++-- VirtueSky/ControlPanel/ConstantPackage.cs | 2 +- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e489ae63..92961726 100644 --- a/README.md +++ b/README.md @@ -23,9 +23,9 @@ ### 1: Download the repo and drop it into folder `Assets` ### 2: Add the line below to `Packages/manifest.json` -for version `3.2.0` +for version `3.2.1` ```csharp -"com.virtuesky.sunflower":"https://github.com/VirtueSky/sunflower.git#3.2.0", +"com.virtuesky.sunflower":"https://github.com/VirtueSky/sunflower.git#3.2.1", ``` ## Includes modules diff --git a/VirtueSky/ControlPanel/ConstantPackage.cs b/VirtueSky/ControlPanel/ConstantPackage.cs index ec87799d..29d67e2f 100644 --- a/VirtueSky/ControlPanel/ConstantPackage.cs +++ b/VirtueSky/ControlPanel/ConstantPackage.cs @@ -2,7 +2,7 @@ { public class ConstantPackage { - public const string VersionSunflower = "3.2.0"; + public const string VersionSunflower = "3.2.1"; public const string PackageNameInAppPurchase = "com.unity.purchasing"; public const string MaxVersionInAppPurchase = "4.12.2"; public const string PackageNameNewtonsoftJson = "com.unity.nuget.newtonsoft-json"; diff --git a/package.json b/package.json index ae7f7e66..f3c013ac 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "com.virtuesky.sunflower", "displayName": "Sunflower", "description": "Core ScriptableObject Architecture for building Unity games", - "version": "3.2.0", + "version": "3.2.1", "unity": "2022.3", "category": "virtuesky", "license": "MIT",