From f099a99c95d44eba62e9a85d3eea8812bcae56e2 Mon Sep 17 00:00:00 2001 From: huyufei Date: Wed, 7 Aug 2024 23:14:15 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=B7=BB=E5=8A=A0GuruSDK=20=E6=B8=85?= =?UTF-8?q?=E7=A9=BA=E6=95=B0=E6=8D=AE=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Code/IAP/GuruIAP.cs | 13 ++++++++----- Runtime/Code/Model/GuruSDKModel.cs | 16 ++++++++++++++++ Runtime/Code/SDK/GuruSDK.System.cs | 18 ++++++++++++++++++ Runtime/Code/SDK/GuruSDK.cs | 3 +++ 4 files changed, 45 insertions(+), 5 deletions(-) diff --git a/Runtime/Code/IAP/GuruIAP.cs b/Runtime/Code/IAP/GuruIAP.cs index 68d7a22..a10952a 100644 --- a/Runtime/Code/IAP/GuruIAP.cs +++ b/Runtime/Code/IAP/GuruIAP.cs @@ -7,14 +7,17 @@ namespace Guru /// 获取BLevel /// /// - protected override int GetBLevel() => GuruSDKModel.Instance.SuccessLevelId; // BLevel + protected override int GetBLevel() => Model.SuccessLevelId; // BLevel + private GuruSDKModel Model => GuruSDKModel.Instance; + protected override void OnPurchaseOver(bool success, string productName) { - if (success) - { - - } + } + + public void ClearData() + { + _model.ClearData(); } } } \ No newline at end of file diff --git a/Runtime/Code/Model/GuruSDKModel.cs b/Runtime/Code/Model/GuruSDKModel.cs index be9c302..d33f7b3 100644 --- a/Runtime/Code/Model/GuruSDKModel.cs +++ b/Runtime/Code/Model/GuruSDKModel.cs @@ -299,6 +299,22 @@ namespace Guru #endregion + + #region 清除数据 + + public void ClearData() + { + uid = ""; + b_level = 0; + b_play = 0; + buy_count = 0; + no_ads = false; + first_open_time = ""; + purchased?.Clear(); + event_priorities?.Clear(); + } + + #endregion } [Serializable] diff --git a/Runtime/Code/SDK/GuruSDK.System.cs b/Runtime/Code/SDK/GuruSDK.System.cs index 9c1ba28..e12a2dc 100644 --- a/Runtime/Code/SDK/GuruSDK.System.cs +++ b/Runtime/Code/SDK/GuruSDK.System.cs @@ -77,5 +77,23 @@ namespace Guru #endif #endregion + + #region Data Cache + + /// + /// 清除数据缓存 + /// + public static void CleanData() + { + Model.ClearData(); + GuruIAP.Instance.ClearData(); + PlayerPrefs.DeleteAll(); + PlayerPrefs.Save(); + } + + + + #endregion + } } \ No newline at end of file diff --git a/Runtime/Code/SDK/GuruSDK.cs b/Runtime/Code/SDK/GuruSDK.cs index 7dc24ba..ddfe430 100644 --- a/Runtime/Code/SDK/GuruSDK.cs +++ b/Runtime/Code/SDK/GuruSDK.cs @@ -425,6 +425,9 @@ namespace Guru Analytics.SetBPlay(bPlay); } + + + #endregion #region Logging