From bd27ea089ce35e698bfad8ffe741241ae6665851 Mon Sep 17 00:00:00 2001 From: zhangaotian <8474238@qq.com> Date: Tue, 30 Jul 2024 14:48:40 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90Bug=E3=80=91IAP=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=81=A2=E5=A4=8D=E8=B4=AD=E4=B9=B0=E3=80=81=E5=8E=BB=E6=8E=89?= =?UTF-8?q?UI=E7=9B=B8=E6=9C=BA=E9=80=82=E9=85=8D=E8=84=9A=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Forest/Assets/Scenes/StartScene.unity | 13 ----------- .../Scripts/Framework/Guide/GuideStep.cs | 2 +- .../Assets/Scripts/Gameplay/IAP/IAPHandle.cs | 22 +++++++++++++++---- .../Assets/Scripts/Gameplay/IAP/IAPManager.cs | 4 ++-- .../GameStartLoadingExecutor.cs | 4 ++-- 5 files changed, 23 insertions(+), 22 deletions(-) diff --git a/Forest/Assets/Scenes/StartScene.unity b/Forest/Assets/Scenes/StartScene.unity index 0cbcd1c..20c56f1 100644 --- a/Forest/Assets/Scenes/StartScene.unity +++ b/Forest/Assets/Scenes/StartScene.unity @@ -134,7 +134,6 @@ GameObject: - component: {fileID: 123179489} - component: {fileID: 123179488} - component: {fileID: 123179486} - - component: {fileID: 123179490} m_Layer: 0 m_Name: UICamera m_TagString: Untagged @@ -252,18 +251,6 @@ Transform: m_Children: [] m_Father: {fileID: 2081420527} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} ---- !u!114 &123179490 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 123179485} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: fff49514adc6448d0a4cbea3ff37308b, type: 3} - m_Name: - m_EditorClassIdentifier: --- !u!1 &158007422 GameObject: m_ObjectHideFlags: 0 diff --git a/Forest/Assets/Scripts/Framework/Guide/GuideStep.cs b/Forest/Assets/Scripts/Framework/Guide/GuideStep.cs index 021e482..fa4609b 100644 --- a/Forest/Assets/Scripts/Framework/Guide/GuideStep.cs +++ b/Forest/Assets/Scripts/Framework/Guide/GuideStep.cs @@ -45,6 +45,7 @@ public abstract class GuideStepBase /// public async void StartGuide() { + GuideMananger.Instance.IsGuiding = true; await UniTask.Delay(500); // 延迟时间开始 DoBeforeGuide(); SubStartGuide(); @@ -116,6 +117,5 @@ internal sealed class WinLevel : GuideStepBase protected override void SubStartGuide() { - GuideMananger.Instance.IsGuiding = true; } } \ No newline at end of file diff --git a/Forest/Assets/Scripts/Gameplay/IAP/IAPHandle.cs b/Forest/Assets/Scripts/Gameplay/IAP/IAPHandle.cs index d5eb539..b6da128 100644 --- a/Forest/Assets/Scripts/Gameplay/IAP/IAPHandle.cs +++ b/Forest/Assets/Scripts/Gameplay/IAP/IAPHandle.cs @@ -12,7 +12,6 @@ public class IAPHandle : IStoreListener private const string Environment = "production"; public Action SendReceiptAction; public Action SetApplicationUseId; - public Action OnBreakPurchase; public bool ClientVerify; public List ConsumableGoods; public List NonConsumableGoods; @@ -24,6 +23,7 @@ public class IAPHandle : IStoreListener private IGooglePlayStoreExtensions _googlePlayStoreExtensions; private Action _onPurchaseSuccess; private Action _onPurchaseFail; + public Action OnRestorePurchase; private bool _isInitialized; /// @@ -150,7 +150,7 @@ public class IAPHandle : IStoreListener } #endregion - + #region 购买 /// @@ -198,7 +198,14 @@ public class IAPHandle : IStoreListener } else { - _onPurchaseSuccess?.Invoke(_curProduct); + if (_onPurchaseSuccess != null) + { + _onPurchaseSuccess.Invoke(_curProduct); + } + else + { + OnRestorePurchase?.Invoke(_curProduct); + } } } @@ -220,7 +227,14 @@ public class IAPHandle : IStoreListener } else { - _onPurchaseSuccess?.Invoke(_curProduct); + if (_onPurchaseSuccess != null) + { + _onPurchaseSuccess.Invoke(_curProduct); + } + else + { + OnRestorePurchase?.Invoke(_curProduct); + } } } } diff --git a/Forest/Assets/Scripts/Gameplay/IAP/IAPManager.cs b/Forest/Assets/Scripts/Gameplay/IAP/IAPManager.cs index 12f9ae6..891977d 100644 --- a/Forest/Assets/Scripts/Gameplay/IAP/IAPManager.cs +++ b/Forest/Assets/Scripts/Gameplay/IAP/IAPManager.cs @@ -15,11 +15,11 @@ public class IAPManager : Singlenton /// 添加商品并初始化IAP /// public void AddGoods(List consumableGoods, List nonConsumableGoods, - Action onBreakPurchase = null) + Action onRestorePurchase = null) { _helper.ConsumableGoods = consumableGoods; _helper.NonConsumableGoods = nonConsumableGoods; - _helper.OnBreakPurchase = onBreakPurchase; + _helper.OnRestorePurchase = onRestorePurchase; try { diff --git a/Forest/Assets/Scripts/Gameplay/LoadingExecutor/GameStartLoadingExecutor.cs b/Forest/Assets/Scripts/Gameplay/LoadingExecutor/GameStartLoadingExecutor.cs index fc1afd7..e2705a9 100644 --- a/Forest/Assets/Scripts/Gameplay/LoadingExecutor/GameStartLoadingExecutor.cs +++ b/Forest/Assets/Scripts/Gameplay/LoadingExecutor/GameStartLoadingExecutor.cs @@ -103,10 +103,10 @@ namespace Gameplay.LoadingExecutor await UIManager.Instance.OpenWindow(UIConstants.UIStartMain); //用户协议 -> 登录 -> 数据同步 - if (AppInfoManager.Instance.UpdateConfirm) + if (AppInfoManager.Instance.UpdateConfirm && !GuideMananger.Instance.IsGuiding) await UIManager.Instance.OpenWindow(UIConstants.UISyncTip); - if (!AppInfoManager.Instance.CheckIfLogin() && !LoginManager.Instance.ShowLogin) + if (!AppInfoManager.Instance.CheckIfLogin() && !LoginManager.Instance.ShowLogin && !GuideMananger.Instance.IsGuiding) await UIManager.Instance.OpenWindow(UIConstants.UILogin); if (!PlayerPrefs.HasKey(LevelConstants.FirstLaunch))