update:支付调整
This commit is contained in:
Binary file not shown.
@@ -52,10 +52,16 @@ namespace tysdk
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return result;
|
||||
#elif UNITY_ANDROID
|
||||
|
||||
var pType = "googleiab.global.app";
|
||||
// var pType = "googleiab.global.app";
|
||||
var pType = tysdk.AccountInfo.googlePayType;
|
||||
if (_accountInfo.channel == EAccoutType.hwVkid)
|
||||
pType = tysdk.AccountInfo.hwPayType;
|
||||
|
||||
var task = TYSDKCallbackManager.Instance.RegisterCallback<PaymentInfo>(TimeSpan.FromMinutes(1));
|
||||
|
||||
@@ -130,7 +136,7 @@ namespace tysdk
|
||||
//商品列表的回调
|
||||
public void SKUListResult(string json)
|
||||
{
|
||||
Debug.Log("[TYSdkFacade] GetSKUList callback");
|
||||
Debug.Log($"[TYSdkFacade] GetSKUList callback -> accountChannel: {_accountInfo.channel}");
|
||||
var jresult = JObject.Parse(json);
|
||||
int code = int.Parse(jresult["code"].ToString());
|
||||
var result = new ProductListInfo();
|
||||
@@ -139,8 +145,19 @@ namespace tysdk
|
||||
string productStr = jresult["respObj"].ToString();
|
||||
result.code = code;
|
||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||
var jsonObjList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SKUDetail>>(productStr);
|
||||
result.products = jsonObjList;
|
||||
// var jsonObjList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SKUDetail>>(productStr);
|
||||
// result.products = jsonObjList;
|
||||
var accountChannel = _accountInfo.channel;
|
||||
if (accountChannel == EAccoutType.hwVkid)
|
||||
{
|
||||
result.ReadSkuFromData(productStr, accountChannel);
|
||||
}
|
||||
else
|
||||
{
|
||||
// var jsonObjList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SKUDetail>>(productStr);
|
||||
// result.products = jsonObjList;
|
||||
result.BaseReadSkuFromData(productStr);
|
||||
}
|
||||
#elif UNITY_IOS && !UNITY_EDITOR
|
||||
result.ReadSKUFromJson(productStr);
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
namespace tysdk
|
||||
{
|
||||
@@ -16,6 +18,8 @@ namespace tysdk
|
||||
public static class AccountInfo
|
||||
{
|
||||
public static string hwVkid = "vk.global.app";
|
||||
public static string hwPayType = "rustore.global.app";
|
||||
public static string googlePayType = "googleiab.global.app";
|
||||
}
|
||||
|
||||
|
||||
@@ -96,6 +100,18 @@ namespace tysdk
|
||||
}
|
||||
#endif
|
||||
|
||||
public List<SKUDetail> BaseReadSkuFromData(string productData)
|
||||
{
|
||||
var jsonObjList = JsonConvert.DeserializeObject<List<SKUDetail>>(productData);
|
||||
products = jsonObjList;
|
||||
return jsonObjList;
|
||||
}
|
||||
public List<SKUDetail> ReadSkuFromData(string productData, EAccoutType accountChannel)
|
||||
{
|
||||
var jsonObjList = JsonConvert.DeserializeObject<List<SKUDetail>>(productData);
|
||||
products = jsonObjList;
|
||||
return jsonObjList;
|
||||
}
|
||||
}
|
||||
|
||||
#if UNITY_IOS
|
||||
@@ -125,7 +141,9 @@ namespace tysdk
|
||||
public string description;
|
||||
public string ourProductId;
|
||||
public string price;
|
||||
public string price_amount_micros;
|
||||
|
||||
[JsonProperty("price_amount_micros")]
|
||||
public string price_amount_micros { get; set; }
|
||||
public string price_currency_code;
|
||||
public string productId;
|
||||
public string title;
|
||||
@@ -137,7 +155,16 @@ namespace tysdk
|
||||
}
|
||||
|
||||
public string ProdPriceStr => price;
|
||||
public float ProdPrice => float.Parse(price_amount_micros) / 1000000;
|
||||
//public float ProdPrice => float.Parse(price_amount_micros) / 1000000;
|
||||
public float ProdPrice
|
||||
{
|
||||
get
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(price_amount_micros) || !long.TryParse(price_amount_micros, out var micros))
|
||||
return 0f;
|
||||
return micros / 1_000_000f;
|
||||
}
|
||||
}
|
||||
public string ProdID => ourProductId;
|
||||
public string ProdKey => productId;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user