From 852853629e5457b9c6f0c5753a02607f467c6b6f Mon Sep 17 00:00:00 2001 From: huyufei Date: Fri, 17 May 2024 19:40:42 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E8=B0=83=E6=95=B4=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3,=20=E8=AE=B0=E5=BD=95=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Code/IAP/GuruIAP.cs | 2 +- Runtime/Code/Model/GuruSDKModel.cs | 22 ++-------------------- Runtime/Code/SDK/GuruSDK.IAP.cs | 2 +- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/Runtime/Code/IAP/GuruIAP.cs b/Runtime/Code/IAP/GuruIAP.cs index 5937ba1..68d7a22 100644 --- a/Runtime/Code/IAP/GuruIAP.cs +++ b/Runtime/Code/IAP/GuruIAP.cs @@ -13,7 +13,7 @@ namespace Guru { if (success) { - GuruSDKModel.Instance.PurchasedCount++; // 记录成功购买次数 + } } } diff --git a/Runtime/Code/Model/GuruSDKModel.cs b/Runtime/Code/Model/GuruSDKModel.cs index 91d1a1c..5695d1c 100644 --- a/Runtime/Code/Model/GuruSDKModel.cs +++ b/Runtime/Code/Model/GuruSDKModel.cs @@ -30,7 +30,6 @@ namespace Guru public int b_level = 0; public int b_play = 0; public int buy_count = 0; - public bool is_iap_user = false; public List purchased; //-------------- data --------------- @@ -92,20 +91,9 @@ namespace Guru _uid.Value = value; } } + + public bool IsIapUser => PurchasedCount > 0; - public bool IsIapUser - { - get - { - if(_isIapUser == null) InitProperties(); - return _isIapUser.Value; - } - set - { - if(_isIapUser == null) InitProperties(); - _isIapUser.Value = value; - } - } private BindableProperty _successLevel; @@ -160,7 +148,6 @@ namespace Guru _totalPlayed = new BindableProperty(b_play, OnPlayedChanged); _purchasedCount = new BindableProperty(buy_count, OnPurchasedNumChanged); _uid = new BindableProperty(uid, OnUidChanged); - _isIapUser = new BindableProperty(is_iap_user, OnIsIapUserChanged); purchased = new List(20); } @@ -206,11 +193,6 @@ namespace Guru Save(); } - private void OnIsIapUserChanged(bool value) - { - is_iap_user = value; - Save(); - } #endregion #region 启动配置 diff --git a/Runtime/Code/SDK/GuruSDK.IAP.cs b/Runtime/Code/SDK/GuruSDK.IAP.cs index 101a491..f280097 100644 --- a/Runtime/Code/SDK/GuruSDK.IAP.cs +++ b/Runtime/Code/SDK/GuruSDK.IAP.cs @@ -44,7 +44,6 @@ namespace Guru private static void OnIAPInitResult(bool success) { LogI($"IAP init result: {success}"); - IsIAPReady = success; Callbacks.IAP._onIAPInitComplete?.Invoke(success); } @@ -182,6 +181,7 @@ namespace Guru /// private static void OnBuyEnd(string productName, bool success) { + if (success) Model.PurchasedCount++; _onPurchaseCallback?.Invoke(productName, success); Callbacks.IAP._onPurchaseEnd?.Invoke(productName, success); }