update:支付调整

This commit is contained in:
2026-01-29 10:22:25 +08:00
parent 333d8fa6f7
commit 9f1379c465
6 changed files with 56 additions and 7 deletions

View File

@@ -6,7 +6,9 @@
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<application android:extractNativeLibs="true" android:name="com.unity3d.player.TYApp" android:usesCleartextTraffic="true">
<application android:extractNativeLibs="true" android:name="com.unity3d.player.TYApp"
tools:replace="android:usesCleartextTraffic"
android:usesCleartextTraffic="true">
<activity android:name="com.unity3d.player.TYUnityActivity"
android:theme="@style/UnityThemeSelector">
<intent-filter>

View File

@@ -60,6 +60,8 @@ dependencies {
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
implementation(platform("ru.rustore.sdk:bom:2025.11.01"))
implementation("ru.rustore.sdk:pay")
implementation "ru.rustore.sdk:review:10.0.0"
implementation "com.vk.id:vkid:2.5.1"
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.2"

View File

@@ -209,6 +209,7 @@ public class SDKTest : MonoBehaviour
_messageTxt.text = "products count:::" + result.products.Count;
_messageTxt.text += "\n" + result.products[0].ToString();
sku = result.products[0];
Debug.Log($"sku = {sku}");
}
else
{

View File

@@ -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

View File

@@ -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;
}