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