From 0bcda4f915ba7f53222192379f72e6ff12f5f61d Mon Sep 17 00:00:00 2001 From: huyfei Date: Tue, 23 Jan 2024 13:57:09 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=B7=BB=E5=8A=A0Restore=20=E5=9B=9E?= =?UTF-8?q?=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Code/SDK/GuruSDK.Callback.cs | 15 ++++++++------- Runtime/Code/SDK/GuruSDK.IAP.cs | 9 ++++----- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Runtime/Code/SDK/GuruSDK.Callback.cs b/Runtime/Code/SDK/GuruSDK.Callback.cs index 213a93c..5c352e6 100644 --- a/Runtime/Code/SDK/GuruSDK.Callback.cs +++ b/Runtime/Code/SDK/GuruSDK.Callback.cs @@ -114,13 +114,6 @@ namespace Guru /// public static class Remote { - internal static Action _onRemoteInitComplete; - public static event Action OnRemoteInitComplete - { - add => _onRemoteInitComplete += value; - remove => _onRemoteInitComplete -= value; - } - internal static Action _onRemoteFetchComplete; public static event Action OnRemoteFetchComplete { @@ -154,6 +147,14 @@ namespace Guru add => _onPurchaseFailed += value; remove => _onPurchaseFailed -= value; } + + internal static Action _onIAPRestored; + public static event Action OnIAPRestored + { + add => _onIAPRestored += value; + remove => _onIAPRestored -= value; + } + } diff --git a/Runtime/Code/SDK/GuruSDK.IAP.cs b/Runtime/Code/SDK/GuruSDK.IAP.cs index caf6709..9955d8f 100644 --- a/Runtime/Code/SDK/GuruSDK.IAP.cs +++ b/Runtime/Code/SDK/GuruSDK.IAP.cs @@ -162,22 +162,21 @@ namespace Guru #region Restore Purchase - private static Action _onRestored; /// /// 恢复购买 /// /// - public static void Restore(Action restoreCallback) + public static void Restore(Action restoreCallback = null) { + if( restoreCallback != null) Callbacks.IAP.OnIAPRestored += restoreCallback; if (CheckIAPReady()) { - _onRestored = restoreCallback; GuruIAP.Instance.Restore(); } } - private static void OnRestored(bool success) + private static void OnRestored(bool success, string msg) { - _onRestored?.Invoke(success); + Callbacks.IAP._onIAPRestored?.Invoke(success, msg); // 更新回复购买回调 } #endregion