[F] iOS Payment param, remote UnityKnown thirdExtend

This commit is contained in:
2024-08-07 01:26:49 +08:00
parent 90d63db9e6
commit 4b0a85efea
4 changed files with 25 additions and 19 deletions

View File

@@ -28,7 +28,7 @@ public class SDKTest : MonoBehaviour
void Start()
{
TYSdkFacade.Instance.Init();
//UnityBridgeFunc.UnityResetServerUrl("http://128-hwsfsdk-sdk-test01.qijihdhk.com ");
_InitBtn.onClick.AddListener(TYSdkFacade.Instance.Init);
_loginGuestBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGuest));
_loginGoogleBtn.onClick.AddListener(() => OnLogin(EAccoutType.hwGoogle));

View File

@@ -119,17 +119,29 @@ extern "C" {
}
//支付
void UnityKnow(const char* userId, const char* productId, const char* productPrice, const char* productName,
const char* productCount, const char* prodorderId, const char* appInfo)
void UnityKnow(const char* userId,const char* productId,const char* productPrice,const char* productName,const char* productCount,const char* orderid,const char* appinfo)
{
}
//支付 new
void UnityKnowNew(const char* productId, const char* productPrice, const char* productName,
const char* productCount, const char* prodorderId, const char* appInfo, const char* pType)
{
NSLog(@"TYSdkInterface UnityKnow ");
NSString* pUserId = [[NSString alloc] initWithCString:userId encoding:NSUTF8StringEncoding];
NSString* porderid = [[NSString alloc] initWithCString:orderid encoding:NSUTF8StringEncoding];
NSString* pProductId = [[NSString alloc] initWithCString:productId encoding:NSUTF8StringEncoding];
NSString* pProductPrice = [[NSString alloc] initWithCString:productPrice encoding:NSUTF8StringEncoding];
NSString* pProductName = [[NSString alloc] initWithCString:productName encoding:NSUTF8StringEncoding];
NSString* pProductCount = [[NSString alloc] initWithCString:productCount encoding:NSUTF8StringEncoding];
NSString* pAppInfo = [[NSString alloc] initWithCString:appinfo encoding:NSUTF8StringEncoding];
XYProduct* product = [XYProduct createShoppingDataWith:XYOnlyConsume];
if (porderid != NULL && porderid.length > 0) {
product.productOrderId = porderid;
}
[product XYProductWithAppInfo:pAppInfo productId:pProductId productName:pProductName productPrice:[pProductPrice floatValue] gameId:-1 productCount:[pProductCount integerValue] userId:[pUserId integerValue]];
[XYApi XYCharge:product completionHandler:^(XYResp * _Nonnull resp) {
NSMutableDictionary *resultDict = [@{} mutableCopy];
[resultDict setValue:[NSString stringWithFormat:@"%ld", (long)resp.errCode] forKey:@"code"];
[resultDict setValue:resp.errStr ? resp.errStr : @"" forKey:@"errStr"];
NSString *result = DicTojsonString(resultDict);
const char* param = AllocCString(result);
UnitySendMessage("TYSdkFacade","PayResult", param);
}];
}
//打点

View File

@@ -65,7 +65,8 @@ namespace tysdk
{
taskSource.SetResult((PaymentInfo)callback);
});
UnityBridgeFunc.UnityKnowNew(prodId, prodPrice, prodName, count.ToString(), orderId, extraInfo,pType);
UnityBridgeFunc.UnityKnow(_accountInfo.strUserId, prodId, prodPrice, prodName, count.ToString(), orderId, extraInfo);
var result = await taskSource.Task;
result.count = count;
result.orderId = orderId;

View File

@@ -243,13 +243,6 @@ namespace tysdk
public static extern void UnityKnow(string userId, string productId, string productPrice, string productName,
string productCount, string prodorderId, string appInfo);
//支付new
[DllImport("__Internal")]
public static extern void UnityKnowNew(string productId, string productPrice, string productName,
string productCount, string prodorderId, string appInfo, string pType);
//获取商品列表
[DllImport("__Internal")]
public static extern void ThirdExtend();
//打点
[DllImport("__Internal")]
public static extern void SetGaUserInfo(string userId);