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/Advertising/Runtime/Admob/AdmodUnitVariable/AdmobNativeOverlayVariable.cs b/VirtueSky/Advertising/Runtime/Admob/AdmodUnitVariable/AdmobNativeOverlayVariable.cs index 360fedf4..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 popups with cameras attached - 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,21 +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 popups with cameras attached + /// 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); + return (admobX, admobY); + } - _nativeOverlayAd?.RenderTemplate(Style(), new AdSize(width, height), 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 } @@ -237,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, 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() { diff --git a/VirtueSky/ControlPanel/ConstantPackage.cs b/VirtueSky/ControlPanel/ConstantPackage.cs index a5bbd43c..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"; @@ -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 = 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); diff --git a/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta b/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta index b825c589..5dbbabfc 100644 --- a/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta +++ b/VirtueSky/PrimeTween/Editor/AssemblyInfo.cs.meta @@ -1,3 +1,11 @@ fileFormatVersion: 2 -guid: a3c27f8cb2a846f589acacc063d08498 -timeCreated: 1683538561 \ No newline at end of file +guid: 77f31680944e5534e8ed7d89b9d6a99a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta b/VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta index 0702eb76..647d0e2d 100644 --- a/VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta +++ b/VirtueSky/PrimeTween/Editor/CodeGenerator.asset.meta @@ -1,8 +1,8 @@ fileFormatVersion: 2 -guid: b7964af3ed0024db49a5758e8a4de1c6 +guid: 5b5aaa5611b385541ab2b0cb1d8755e1 NativeFormatImporter: externalObjects: {} - mainObjectFileID: 11400000 + mainObjectFileID: 0 userData: assetBundleName: assetBundleVariant: diff --git a/VirtueSky/PrimeTween/Editor/CodeGenerator.cs b/VirtueSky/PrimeTween/Editor/CodeGenerator.cs index d44d57c5..5d82eec2 100644 --- a/VirtueSky/PrimeTween/Editor/CodeGenerator.cs +++ b/VirtueSky/PrimeTween/Editor/CodeGenerator.cs @@ -72,7 +72,6 @@ internal void generateAllMethods() { } const string generatorBeginLabel = "// CODE GENERATOR BEGIN"; - const string textMeshProScriptingDefine = "#if TEXT_MESH_PRO_INSTALLED || (UNITY_6000_0_OR_NEWER && UNITY_UGUI_INSTALLED)"; [ContextMenu(nameof(generateTweenComponent))] void generateTweenComponent() { @@ -106,10 +105,8 @@ void generateTweenComponent() { 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"; + str += $" #if {dependency}\n"; break; default: str += $" #if !UNITY_2019_1_OR_NEWER || {dependency}\n"; @@ -275,10 +272,8 @@ internal static (PropType, Type) TweenTypeToTweenData(TweenType tweenType) { 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"; + utilsText += $" #if {dependency}\n"; break; default: utilsText += $" #if !UNITY_2019_1_OR_NEWER || {dependency}\n"; @@ -304,6 +299,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), @@ -390,10 +386,8 @@ static string generateWithDefines([NotNull] Func g 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}"; + result += $"\n #if {dependency}"; break; default: result += $"\n #if !UNITY_2019_1_OR_NEWER || {dependency}"; diff --git a/VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta b/VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta index 38d5027b..43aca8b9 100644 --- a/VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta +++ b/VirtueSky/PrimeTween/Editor/CodeGenerator.cs.meta @@ -1,3 +1,11 @@ fileFormatVersion: 2 -guid: f81c141b47ab4aee9ea1454818ce73d3 -timeCreated: 1673348438 \ No newline at end of file +guid: 91062890830ba3f44ae278f19424d5ad +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta b/VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta index f01230aa..1d59094b 100644 --- a/VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta +++ b/VirtueSky/PrimeTween/Editor/CodeTemplates.cs.meta @@ -1,3 +1,11 @@ fileFormatVersion: 2 -guid: 566b3920ae914b24909cd26d64c86e77 -timeCreated: 1677166276 \ No newline at end of file +guid: 13ce4156fb592254ab2f13dd0ab0bf52 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta b/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta index fb4ed9fe..86f03123 100644 --- a/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta +++ b/VirtueSky/PrimeTween/Editor/PrimeTweenManagerInspector.cs.meta @@ -1,3 +1,11 @@ fileFormatVersion: 2 -guid: 98b4466711c04e95b1d84f31e10116ba -timeCreated: 1683813842 \ No newline at end of file +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 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..7dd1c130 100644 --- a/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs.meta +++ b/VirtueSky/PrimeTween/Editor/TweenSettingsPropDrawer.cs.meta @@ -1,3 +1,11 @@ fileFormatVersion: 2 -guid: 142499da0ff44fac99f2ac376bbce331 -timeCreated: 1677570253 \ No newline at end of file +guid: f8f4d614305226a4abf7d56ed174e508 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta b/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta index 21bad296..ace83409 100644 --- a/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta +++ b/VirtueSky/PrimeTween/Editor/TweenSettingsTypesPropDrawer.cs.meta @@ -1,3 +1,11 @@ fileFormatVersion: 2 -guid: 9e0988c54c7744db9aa91eae79ed7e5e -timeCreated: 1677747774 \ No newline at end of file +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 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..5c2b5e72 100644 --- a/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs.meta +++ b/VirtueSky/PrimeTween/Editor/TweenShakeSettingsPropDrawer.cs.meta @@ -1,3 +1,11 @@ fileFormatVersion: 2 -guid: ccef20e0855347cdae977a49716d656f -timeCreated: 1677573071 \ No newline at end of file +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 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..b8293b15 100644 --- a/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs.meta +++ b/VirtueSky/PrimeTween/Editor/ValueContainerStartEndPropDrawer.cs.meta @@ -1,3 +1,11 @@ fileFormatVersion: 2 -guid: 6c08ff7f819145b987090598c6a13397 -timeCreated: 1710625562 \ No newline at end of file +guid: f165141ebcaf41e4ea0f7b0b044542b3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: 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..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: 61f306d3fcd147d6819d3c8d1ec82489 +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 cb671b48..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: c593ca227a744d37b174fc677404e1a9 +guid: 9cb2ac150b3465e47a7ee02457fbbdd5 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..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: 3aad1100da5540a191e769695ce94322 +guid: 1ad3334f326beb4409bf9798eae2b76e 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..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: 60bd878528e14f21ae03c089de19f253 +guid: d7b9ffda2c654774bbbd24367d83f6e5 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..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: 6b4374d6f2544e95a115ca74b92bec0c +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 f8110487..76eb7852 100644 --- a/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter.meta +++ b/VirtueSky/PrimeTween/Runtime/Internal/DOTweenAdapter.meta @@ -1,3 +1,3 @@ fileFormatVersion: 2 -guid: 7e46be11dbfe47849bc893876e4b3011 +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 331ff4df..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: f2642faa77224669a504c829da9b8d90 +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 d1ca182e..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: 3c238e2b584a4987b714406da2cf9c56 +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 1653550f..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: af006e099ef04f6aa7cecc43e8cb6097 +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 3b1f60a0..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: 3cd334e55fa448c3a55e6c14ebaf6638 +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 721bb9d6..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: e6abe1297f08438d974455dc4b2f5396 +guid: fe1d141e780e4ab428e2277acef0c371 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..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: f3f57bce977c474ba249eb63545eff3c +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 766fda29..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: 4eb6f75d186a4c3e88cdf4a5b2b36332 +guid: ee424d24dd289664e9e86a0118628805 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..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: 257a3dcfeff44807bbedf9be546b410d +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 b73aca43..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: 7a28f74456ca46d08fc316235384c5ee +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 ded7f935..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: e7f65c344edd417ebef88555406178af +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 cffa87a9..841ec7e3 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, @@ -1751,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 0e433cfd..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: 51610f0e9d8e4ccead49e9fcc96d54e3 +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 51a6e9c3..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(); @@ -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..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: 964bf290d93964b8b9ab9ba1b3e231c7 +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 6010a432..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 @@ -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..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: 7f3bfd9524c14644bfbab698076886f3 +guid: e383e104c7147224a8b766862c1b61a7 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..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: 483fe305105a484489884630559c0d62 +guid: b69dbd177a6f0b7418e4c93180841d5a 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 diff --git a/VirtueSky/PrimeTween/version.txt b/VirtueSky/PrimeTween/version.txt index 0408c30b..06043b8e 100644 --- a/VirtueSky/PrimeTween/version.txt +++ b/VirtueSky/PrimeTween/version.txt @@ -1 +1 @@ -v1.2.0 \ No newline at end of file +v1.2.2 \ No newline at end of file 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",