From 7e7739a6ad985d7f6158a295d6d3d4d38d6788d8 Mon Sep 17 00:00:00 2001 From: DucNV Date: Fri, 20 Dec 2024 13:51:35 +0700 Subject: [PATCH 1/7] Update package.json Co-Authored-By: VirtueSky <126542083+VirtueSky@users.noreply.github.com> --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 980f58f..bc5edab 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "com.unity.serialization": "3.1.1", "com.unity.collections": "2.1.4", "com.unity.textmeshpro": "3.0.8", - "com.unity.addressables": "1.21.21" + "com.unity.addressables": "1.21.21", + "com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask#2.5.10" } } \ No newline at end of file From 940a0339ec07d4bf4d203c18a1dc9281fff0393b Mon Sep 17 00:00:00 2001 From: DucNV Date: Fri, 20 Dec 2024 15:22:48 +0700 Subject: [PATCH 2/7] - update register package UIParticle 4.10.4 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 cc02191..106131b 100644 --- a/VirtueSky/ControlPanel/ConstantPackage.cs +++ b/VirtueSky/ControlPanel/ConstantPackage.cs @@ -102,7 +102,7 @@ public class ConstantPackage public const string PackageNameCoffeeUIParticle = "com.coffee.ui-particle"; public const string MaxVersionCoffeeUIParticle = - "https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.10.3"; + "https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.10.4"; public const string PackageNameAppleSignIn = "com.lupidan.apple-signin-unity"; From 8e36175551fda373394af5f8a0652f6ac2e4c007 Mon Sep 17 00:00:00 2001 From: DucNV Date: Tue, 24 Dec 2024 14:47:12 +0700 Subject: [PATCH 3/7] - update register package - UI Particle 4.10.5 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 106131b..1d4526f 100644 --- a/VirtueSky/ControlPanel/ConstantPackage.cs +++ b/VirtueSky/ControlPanel/ConstantPackage.cs @@ -102,7 +102,7 @@ public class ConstantPackage public const string PackageNameCoffeeUIParticle = "com.coffee.ui-particle"; public const string MaxVersionCoffeeUIParticle = - "https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.10.4"; + "https://github.com/mob-sakai/ParticleEffectForUGUI.git#4.10.5"; public const string PackageNameAppleSignIn = "com.lupidan.apple-signin-unity"; From ccc91969abbbd84be94038f71da58d992f3d0c2e Mon Sep 17 00:00:00 2001 From: DucNV Date: Tue, 24 Dec 2024 15:32:46 +0700 Subject: [PATCH 4/7] - Fix ads - preload banner Co-Authored-By: VirtueSky <126542083+VirtueSky@users.noreply.github.com> --- .../Runtime/Admob/AdmobAdClient.cs | 37 ++++++ .../Advertising/Runtime/General/AdClient.cs | 117 ++---------------- .../Runtime/IronSource/IronSourceAdClient.cs | 34 ++++- .../Advertising/Runtime/Max/MaxAdClient.cs | 39 +++++- 4 files changed, 115 insertions(+), 112 deletions(-) diff --git a/VirtueSky/Advertising/Runtime/Admob/AdmobAdClient.cs b/VirtueSky/Advertising/Runtime/Admob/AdmobAdClient.cs index 6d9f5e9..8cdd245 100644 --- a/VirtueSky/Advertising/Runtime/Admob/AdmobAdClient.cs +++ b/VirtueSky/Advertising/Runtime/Admob/AdmobAdClient.cs @@ -42,9 +42,11 @@ public override void Initialize() LoadRewarded(); LoadRewardedInterstitial(); LoadAppOpen(); + LoadBanner(); #endif } + #if VIRTUESKY_ADS && VIRTUESKY_ADMOB void RegisterAppStateChange() { @@ -60,5 +62,40 @@ void OnAppStateChanged(GoogleMobileAds.Common.AppState state) } } #endif + public override void LoadBanner() + { + if (adSetting.AdmobBannerVariable == null) return; + adSetting.AdmobBannerVariable.Load(); + } + + public override void LoadInterstitial() + { + if (adSetting.AdmobInterVariable == null) return; + if (!adSetting.AdmobInterVariable.IsReady()) adSetting.AdmobInterVariable.Load(); + } + + public override void LoadRewarded() + { + if (adSetting.AdmobRewardVariable == null) return; + if (!adSetting.AdmobRewardVariable.IsReady()) adSetting.AdmobRewardVariable.Load(); + } + + public override void LoadRewardedInterstitial() + { + if (adSetting.AdmobRewardInterVariable == null) return; + if (!adSetting.AdmobRewardInterVariable.IsReady()) adSetting.AdmobRewardInterVariable.Load(); + } + + public override void LoadAppOpen() + { + if (adSetting.AdmobAppOpenVariable == null) return; + if (!adSetting.AdmobAppOpenVariable.IsReady()) adSetting.AdmobAppOpenVariable.Load(); + } + + public override void ShowAppOpen() + { + if (statusAppOpenFirstIgnore) adSetting.AdmobAppOpenVariable.Show(); + statusAppOpenFirstIgnore = true; + } } } \ No newline at end of file diff --git a/VirtueSky/Advertising/Runtime/General/AdClient.cs b/VirtueSky/Advertising/Runtime/General/AdClient.cs index 82a158a..42109ed 100644 --- a/VirtueSky/Advertising/Runtime/General/AdClient.cs +++ b/VirtueSky/Advertising/Runtime/General/AdClient.cs @@ -1,12 +1,9 @@ -using UnityEngine; -using VirtueSky.Inspector; - namespace VirtueSky.Ads { public abstract class AdClient { protected AdSetting adSetting; - private bool _statusAppOpenFirstIgnore; + protected bool statusAppOpenFirstIgnore; public void SetupAdSetting(AdSetting _adSetting) { @@ -14,111 +11,11 @@ public void SetupAdSetting(AdSetting _adSetting) } public abstract void Initialize(); - - #region Inter Ad - - private AdUnitVariable InterstitialAdUnit() - { - return adSetting.CurrentAdNetwork switch - { - AdNetwork.Max => adSetting.MaxInterVariable, - AdNetwork.Admob => adSetting.AdmobInterVariable, - _ => adSetting.IronSourceInterVariable, - }; - } - - protected virtual bool IsInterstitialReady() - { - return InterstitialAdUnit().IsReady(); - } - - public virtual void LoadInterstitial() - { - if (InterstitialAdUnit() == null) return; - if (!IsInterstitialReady()) InterstitialAdUnit().Load(); - } - - #endregion - - #region Reward Ad - - private AdUnitVariable RewardAdUnit() - { - return adSetting.CurrentAdNetwork switch - { - AdNetwork.Max => adSetting.MaxRewardVariable, - AdNetwork.Admob => adSetting.AdmobRewardVariable, - _ => adSetting.IronSourceRewardVariable, - }; - } - - protected virtual bool IsRewardedReady() - { - return RewardAdUnit().IsReady(); - } - - public virtual void LoadRewarded() - { - if (RewardAdUnit() == null) return; - if (!IsRewardedReady()) RewardAdUnit().Load(); - } - - #endregion - - #region Reward Inter Ad - - private AdUnitVariable RewardedInterstitialAdUnit() - { - return adSetting.CurrentAdNetwork switch - { - AdNetwork.Max => adSetting.MaxRewardInterVariable, - AdNetwork.Admob => adSetting.AdmobRewardInterVariable, - _ => null, - }; - } - - protected virtual bool IsRewardedInterstitialReady() - { - return RewardedInterstitialAdUnit().IsReady(); - } - - public virtual void LoadRewardedInterstitial() - { - if (RewardedInterstitialAdUnit() == null) return; - if (!IsRewardedInterstitialReady()) RewardedInterstitialAdUnit().Load(); - } - - #endregion - - #region AppOpen Ad - - private AdUnitVariable AppOpenAdUnit() - { - return adSetting.CurrentAdNetwork switch - { - AdNetwork.Max => adSetting.MaxAppOpenVariable, - AdNetwork.Admob => adSetting.AdmobAppOpenVariable, - _ => null - }; - } - - protected virtual bool IsAppOpenReady() - { - return AppOpenAdUnit().IsReady(); - } - - public virtual void LoadAppOpen() - { - if (AppOpenAdUnit() == null) return; - if (!IsAppOpenReady()) AppOpenAdUnit().Load(); - } - - public virtual void ShowAppOpen() - { - if (_statusAppOpenFirstIgnore) AppOpenAdUnit().Show(); - _statusAppOpenFirstIgnore = true; - } - - #endregion + public abstract void LoadBanner(); + public abstract void LoadInterstitial(); + public abstract void LoadRewarded(); + public abstract void LoadRewardedInterstitial(); + public abstract void LoadAppOpen(); + public abstract void ShowAppOpen(); } } \ No newline at end of file diff --git a/VirtueSky/Advertising/Runtime/IronSource/IronSourceAdClient.cs b/VirtueSky/Advertising/Runtime/IronSource/IronSourceAdClient.cs index c4e1f46..8db8aa2 100644 --- a/VirtueSky/Advertising/Runtime/IronSource/IronSourceAdClient.cs +++ b/VirtueSky/Advertising/Runtime/IronSource/IronSourceAdClient.cs @@ -1,4 +1,3 @@ -using UnityEngine; using VirtueSky.Core; using VirtueSky.Tracking; @@ -7,6 +6,7 @@ namespace VirtueSky.Ads public class IronSourceAdClient : AdClient { public bool SdkInitializationCompleted { get; private set; } + public override void Initialize() { SdkInitializationCompleted = false; @@ -27,7 +27,9 @@ public override void Initialize() #endif LoadInterstitial(); LoadRewarded(); + LoadBanner(); } + #if VIRTUESKY_ADS && VIRTUESKY_IRONSOURCE private void ImpressionDataReadyEvent(IronSourceImpressionData impressionData) { @@ -48,5 +50,35 @@ void SdkInitializationCompletedEvent() { SdkInitializationCompleted = true; } + + public override void LoadBanner() + { + if (adSetting.IronSourceBannerVariable == null) return; + adSetting.IronSourceBannerVariable.Load(); + } + + public override void LoadInterstitial() + { + if (adSetting.IronSourceInterVariable == null) return; + if (!adSetting.IronSourceInterVariable.IsReady()) adSetting.IronSourceInterVariable.Load(); + } + + public override void LoadRewarded() + { + if (adSetting.IronSourceRewardVariable == null) return; + if (!adSetting.IronSourceRewardVariable.IsReady()) adSetting.IronSourceRewardVariable.Load(); + } + + public override void LoadRewardedInterstitial() + { + } + + public override void LoadAppOpen() + { + } + + public override void ShowAppOpen() + { + } } } \ No newline at end of file diff --git a/VirtueSky/Advertising/Runtime/Max/MaxAdClient.cs b/VirtueSky/Advertising/Runtime/Max/MaxAdClient.cs index 9468c13..02c46e0 100644 --- a/VirtueSky/Advertising/Runtime/Max/MaxAdClient.cs +++ b/VirtueSky/Advertising/Runtime/Max/MaxAdClient.cs @@ -1,4 +1,3 @@ -using UnityEngine; using VirtueSky.Core; namespace VirtueSky.Ads @@ -20,9 +19,11 @@ public override void Initialize() LoadRewarded(); LoadRewardedInterstitial(); LoadAppOpen(); + LoadBanner(); #endif } + #if VIRTUESKY_ADS && VIRTUESKY_APPLOVIN private void OnAppStateChange(bool pauseStatus) { @@ -32,5 +33,41 @@ private void OnAppStateChange(bool pauseStatus) } } #endif + + public override void LoadBanner() + { + if (adSetting.MaxBannerVariable == null) return; + adSetting.MaxBannerVariable.Load(); + } + + public override void LoadInterstitial() + { + if (adSetting.MaxInterVariable == null) return; + if (!adSetting.MaxInterVariable.IsReady()) adSetting.MaxInterVariable.Load(); + } + + public override void LoadRewarded() + { + if (adSetting.MaxRewardVariable == null) return; + if (!adSetting.MaxRewardVariable.IsReady()) adSetting.MaxRewardVariable.Load(); + } + + public override void LoadRewardedInterstitial() + { + if (adSetting.MaxRewardInterVariable == null) return; + if (!adSetting.MaxRewardInterVariable.IsReady()) adSetting.MaxRewardInterVariable.Load(); + } + + public override void LoadAppOpen() + { + if (adSetting.MaxAppOpenVariable == null) return; + if (!adSetting.MaxAppOpenVariable.IsReady()) adSetting.MaxAppOpenVariable.Load(); + } + + public override void ShowAppOpen() + { + if (statusAppOpenFirstIgnore) adSetting.MaxAppOpenVariable.Show(); + statusAppOpenFirstIgnore = true; + } } } \ No newline at end of file From adc6ec8fefc1342eef9c1321f5d32b40c10fe86f Mon Sep 17 00:00:00 2001 From: DucNV Date: Tue, 24 Dec 2024 15:46:40 +0700 Subject: [PATCH 5/7] - add more method get info iap product Co-Authored-By: VirtueSky <126542083+VirtueSky@users.noreply.github.com> --- VirtueSky/Iap/Runtime/IapDataVariable.cs | 34 +++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/VirtueSky/Iap/Runtime/IapDataVariable.cs b/VirtueSky/Iap/Runtime/IapDataVariable.cs index ea0e6f7..8ae6a96 100644 --- a/VirtueSky/Iap/Runtime/IapDataVariable.cs +++ b/VirtueSky/Iap/Runtime/IapDataVariable.cs @@ -15,7 +15,9 @@ public class IapDataVariable : ScriptableObject [ReadOnly] public string id; [ReadOnly] public ProductType productType; - [Space] public float price; + [Tooltip("Price config used for UI"), Space] + public float priceConfig; + [SerializeField] private IapPurchaseSuccess onPurchaseSuccess; [SerializeField] private IapPurchaseFailed onPurchaseFailed; internal IapPurchaseSuccess OnPurchaseSuccess => onPurchaseSuccess; @@ -54,6 +56,36 @@ public bool IsPurchased() if (iapManager == null) return false; return iapManager.IsPurchasedProduct(this); } + + public string GetLocalizedPriceString() + { + if (GetProduct() == null) return String.Empty; + return GetProduct().metadata.localizedPriceString; + } + + public string GetIsoCurrencyCode() + { + if (GetProduct() == null) return String.Empty; + return GetProduct().metadata.isoCurrencyCode; + } + + public string GetLocalizedDescription() + { + if (GetProduct() == null) return String.Empty; + return GetProduct().metadata.localizedDescription; + } + + public string GetLocalizedTitle() + { + if (GetProduct() == null) return String.Empty; + return GetProduct().metadata.localizedTitle; + } + + public decimal GetLocalizedPrice() + { + if (GetProduct() == null) return 0; + return GetProduct().metadata.localizedPrice; + } } } #endif \ No newline at end of file From 521c51994e2ca4fbdb10c76258116d796246c5a2 Mon Sep 17 00:00:00 2001 From: DucNV Date: Tue, 24 Dec 2024 15:55:14 +0700 Subject: [PATCH 6/7] Update ConstantPackage.cs 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 1d4526f..b08f2b8 100644 --- a/VirtueSky/ControlPanel/ConstantPackage.cs +++ b/VirtueSky/ControlPanel/ConstantPackage.cs @@ -97,7 +97,7 @@ public class ConstantPackage public const string PackageNameCoffeeUIEffect = "com.coffee.ui-effect"; public const string MaxVersionCoffeeUIEffect = - "https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.0.1"; + "https://github.com/mob-sakai/UIEffect.git?path=Packages/src#5.0.2"; public const string PackageNameCoffeeUIParticle = "com.coffee.ui-particle"; From 14e62f8776c0a4eec4e8046fc2510818aa7eb12c Mon Sep 17 00:00:00 2001 From: DucNV Date: Tue, 24 Dec 2024 15:56:51 +0700 Subject: [PATCH 7/7] - update package Co-Authored-By: VirtueSky <126542083+VirtueSky@users.noreply.github.com> --- README.md | 4 ++-- VirtueSky/ControlPanel/ConstantPackage.cs | 4 +--- package.json | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cb00411..f8e4230 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.4` +for version `3.2.5` ```csharp -"com.virtuesky.sunflower":"https://github.com/VirtueSky/sunflower.git#3.2.4", +"com.virtuesky.sunflower":"https://github.com/VirtueSky/sunflower.git#3.2.5", ``` ## Includes modules diff --git a/VirtueSky/ControlPanel/ConstantPackage.cs b/VirtueSky/ControlPanel/ConstantPackage.cs index b08f2b8..97776dd 100644 --- a/VirtueSky/ControlPanel/ConstantPackage.cs +++ b/VirtueSky/ControlPanel/ConstantPackage.cs @@ -2,7 +2,7 @@ { public class ConstantPackage { - public const string VersionSunflower = "3.2.4"; + public const string VersionSunflower = "3.2.5"; public const string PackageNameInAppPurchase = "com.unity.purchasing"; public const string MaxVersionInAppPurchase = "4.12.2"; public const string PackageNameNewtonsoftJson = "com.unity.nuget.newtonsoft-json"; @@ -107,8 +107,6 @@ public class ConstantPackage public const string PackageNameAppleSignIn = "com.lupidan.apple-signin-unity"; public const string MaxVersionAppleSignIn = "https://github.com/lupidan/apple-signin-unity.git#v1.4.3"; - //public const string PackageNameAnimancer = "com.virtuesky.animancer"; - //public const string MaxVersionAnimancer = "https://github.com/VirtueSky/animancer-unity.git#7.0.0"; #region Spine diff --git a/package.json b/package.json index bc5edab..b18933f 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.4", + "version": "3.2.5", "unity": "2022.3", "category": "virtuesky", "license": "MIT",