update:支付调整
This commit is contained in:
@@ -6,7 +6,9 @@
|
|||||||
<uses-permission android:name="android.permission.VIBRATE" />
|
<uses-permission android:name="android.permission.VIBRATE" />
|
||||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
<uses-permission android:name="android.permission.POST_NOTIFICATIONS"/>
|
||||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
<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"
|
<activity android:name="com.unity3d.player.TYUnityActivity"
|
||||||
android:theme="@style/UnityThemeSelector">
|
android:theme="@style/UnityThemeSelector">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
|
|||||||
@@ -60,6 +60,8 @@ dependencies {
|
|||||||
implementation "com.google.android.libraries.identity.googleid:googleid:1.1.1"
|
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 "ru.rustore.sdk:review:10.0.0"
|
||||||
implementation "com.vk.id:vkid:2.5.1"
|
implementation "com.vk.id:vkid:2.5.1"
|
||||||
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.2"
|
coreLibraryDesugaring "com.android.tools:desugar_jdk_libs:2.1.2"
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ public class SDKTest : MonoBehaviour
|
|||||||
_messageTxt.text = "products count:::" + result.products.Count;
|
_messageTxt.text = "products count:::" + result.products.Count;
|
||||||
_messageTxt.text += "\n" + result.products[0].ToString();
|
_messageTxt.text += "\n" + result.products[0].ToString();
|
||||||
sku = result.products[0];
|
sku = result.products[0];
|
||||||
|
Debug.Log($"sku = {sku}");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
@@ -52,10 +52,16 @@ namespace tysdk
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
#elif UNITY_ANDROID
|
#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));
|
var task = TYSDKCallbackManager.Instance.RegisterCallback<PaymentInfo>(TimeSpan.FromMinutes(1));
|
||||||
|
|
||||||
@@ -130,7 +136,7 @@ namespace tysdk
|
|||||||
//商品列表的回调
|
//商品列表的回调
|
||||||
public void SKUListResult(string json)
|
public void SKUListResult(string json)
|
||||||
{
|
{
|
||||||
Debug.Log("[TYSdkFacade] GetSKUList callback");
|
Debug.Log($"[TYSdkFacade] GetSKUList callback -> accountChannel: {_accountInfo.channel}");
|
||||||
var jresult = JObject.Parse(json);
|
var jresult = JObject.Parse(json);
|
||||||
int code = int.Parse(jresult["code"].ToString());
|
int code = int.Parse(jresult["code"].ToString());
|
||||||
var result = new ProductListInfo();
|
var result = new ProductListInfo();
|
||||||
@@ -139,8 +145,19 @@ namespace tysdk
|
|||||||
string productStr = jresult["respObj"].ToString();
|
string productStr = jresult["respObj"].ToString();
|
||||||
result.code = code;
|
result.code = code;
|
||||||
#if UNITY_ANDROID && !UNITY_EDITOR
|
#if UNITY_ANDROID && !UNITY_EDITOR
|
||||||
var jsonObjList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SKUDetail>>(productStr);
|
// var jsonObjList = Newtonsoft.Json.JsonConvert.DeserializeObject<List<SKUDetail>>(productStr);
|
||||||
result.products = jsonObjList;
|
// 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
|
#elif UNITY_IOS && !UNITY_EDITOR
|
||||||
result.ReadSKUFromJson(productStr);
|
result.ReadSKUFromJson(productStr);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
namespace tysdk
|
namespace tysdk
|
||||||
{
|
{
|
||||||
@@ -16,6 +18,8 @@ namespace tysdk
|
|||||||
public static class AccountInfo
|
public static class AccountInfo
|
||||||
{
|
{
|
||||||
public static string hwVkid = "vk.global.app";
|
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
|
#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
|
#if UNITY_IOS
|
||||||
@@ -125,7 +141,9 @@ namespace tysdk
|
|||||||
public string description;
|
public string description;
|
||||||
public string ourProductId;
|
public string ourProductId;
|
||||||
public string price;
|
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 price_currency_code;
|
||||||
public string productId;
|
public string productId;
|
||||||
public string title;
|
public string title;
|
||||||
@@ -137,7 +155,16 @@ namespace tysdk
|
|||||||
}
|
}
|
||||||
|
|
||||||
public string ProdPriceStr => price;
|
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 ProdID => ourProductId;
|
||||||
public string ProdKey => productId;
|
public string ProdKey => productId;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user