update: 调整支付接口, 记录成功后的属性
parent
23a2616b95
commit
852853629e
|
|
@ -13,7 +13,7 @@ namespace Guru
|
|||
{
|
||||
if (success)
|
||||
{
|
||||
GuruSDKModel.Instance.PurchasedCount++; // 记录成功购买次数
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<PurchasedProduct> 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<int> _successLevel;
|
||||
|
|
@ -160,7 +148,6 @@ namespace Guru
|
|||
_totalPlayed = new BindableProperty<int>(b_play, OnPlayedChanged);
|
||||
_purchasedCount = new BindableProperty<int>(buy_count, OnPurchasedNumChanged);
|
||||
_uid = new BindableProperty<string>(uid, OnUidChanged);
|
||||
_isIapUser = new BindableProperty<bool>(is_iap_user, OnIsIapUserChanged);
|
||||
|
||||
purchased = new List<PurchasedProduct>(20);
|
||||
}
|
||||
|
|
@ -206,11 +193,6 @@ namespace Guru
|
|||
Save();
|
||||
}
|
||||
|
||||
private void OnIsIapUserChanged(bool value)
|
||||
{
|
||||
is_iap_user = value;
|
||||
Save();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 启动配置
|
||||
|
|
|
|||
|
|
@ -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
|
|||
/// <param name="success"></param>
|
||||
private static void OnBuyEnd(string productName, bool success)
|
||||
{
|
||||
if (success) Model.PurchasedCount++;
|
||||
_onPurchaseCallback?.Invoke(productName, success);
|
||||
Callbacks.IAP._onPurchaseEnd?.Invoke(productName, success);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue