[M] all functional

This commit is contained in:
2024-08-16 00:56:24 +08:00
parent c355784122
commit 1a0af9d725
14 changed files with 1278 additions and 171 deletions

View File

@@ -18,18 +18,26 @@ namespace tysdk
|___/
=================================================*/
public async Task<PaymentInfo> Pay(string prodId, string prodPrice, string prodName, int count, string pType)
//public async Task<PaymentInfo> Pay(string prodId, string prodPrice, string prodName, int count, string pType, string price_amount_micros =null)
public async Task<PaymentInfo> Pay(SKUDetail prod, int count)
{
if (!IsLoggedIn) return new PaymentInfo() { code = "-1", msg = "未登录" };
var orderId = System.Guid.NewGuid().ToString();
var extraDic = new Dictionary<string, object>() {
Dictionary<string, object> extraDic = new Dictionary<string, object>() {
{"paytime" , System.DateTime.UtcNow.Ticks},
{"sum" , float.Parse(prodPrice) * count},
{"sum" , prod.ProdPrice * count},
};
string extraInfo = Newtonsoft.Json.JsonConvert.SerializeObject(extraDic);
//to base64
extraInfo = System.Convert.ToBase64String(System.Text.Encoding.UTF8.GetBytes(extraInfo));
var prodId = prod.ProdID;
var prodPrice = prod.price;
var prodName = prod.title;
var pType = "googleiab.global.app";
#if UNITY_EDITOR
@@ -44,6 +52,7 @@ namespace tysdk
price = prodPrice
};
return result;
#elif UNITY_ANDROID
@@ -52,7 +61,10 @@ namespace tysdk
{
taskSource.SetResult((PaymentInfo)callback);
});
//UnityBridgeFunc.UnityKnow(prodId, prodName, count.ToString(), orderId, extraInfo);
UnityBridgeFunc.UnityKnowNew(prodId, prodPrice, prodName, count.ToString(), orderId, extraInfo,pType);
var result = await taskSource.Task;
result.count = count;
result.orderId = orderId;