From de467e891254f9f80ed83a3ee1c0aea69fd0fb31 Mon Sep 17 00:00:00 2001
From: allez <305670599@qq.com>
Date: 星期二, 08 九月 2020 11:10:30 +0800
Subject: [PATCH] 0312 quick对接
---
ChannelDiff/iOS/xmyjgame/The2thWorldSDK/UniversalSDK.mm | 99 +++++++++++++++++++++++++++++++++++++------------
1 files changed, 75 insertions(+), 24 deletions(-)
diff --git a/ChannelDiff/iOS/xmyjgame/The2thWorldSDK/UniversalSDK.mm b/ChannelDiff/iOS/xmyjgame/The2thWorldSDK/UniversalSDK.mm
index 2590d01..d2bc10d 100644
--- a/ChannelDiff/iOS/xmyjgame/The2thWorldSDK/UniversalSDK.mm
+++ b/ChannelDiff/iOS/xmyjgame/The2thWorldSDK/UniversalSDK.mm
@@ -213,9 +213,16 @@
case SMPC_QUICK_SDK_ERROR_NONE:
{
NSLog(@"鍒濆鍖栨垚鍔�");
+ NSString *_appid = [[SMPCQuickSDK defaultInstance] getConfigValue:@"zfappid"];
+ if ([_appid isEqualToString:@""])
+ {
+ _appid = sAppID;
+ }
+
NSMutableDictionary *_dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:S2U_SdkInitComplete], @"code",
- @"quick", @"channelPlatform",nil];
+ @"quick", @"channelPlatform",
+ @"yj_appid", _appid, @"yj_spid", _appid, nil];
[self SendMessageToUnity:_dict];
}
break;
@@ -236,14 +243,15 @@
NSDictionary *userInfo = [notify userInfo];
if (error == 0) {
NSString *uid = [[SMPCQuickSDK defaultInstance] userId];
- sUserName= [[SMPCQuickSDK defaultInstance] userNick];
+ NSString *gameUID = [NSString stringWithFormat:@"%@@%d", uid, [SMPCQuickSDK defaultInstance].channelType];
+ NSString *UserName = [[SMPCQuickSDK defaultInstance] userNick];
//鑾峰彇user_token锛岀敤浜庝粠鏈嶅姟鍣ㄥ幓楠岃瘉鐢ㄦ埛淇℃伅
NSString *user_token = userInfo[kSmpcQuickSDKKeyUserToken];
NSDictionary *_dict = [NSDictionary dictionaryWithObjectsAndKeys:
[NSDictionary dictionaryWithObjectsAndKeys:user_token, @"token",
- user_token, @"token_expire",
- sUserName, @"account", nil],@"info",
+ UserName, @"userName",
+ gameUID, @"account", nil],@"info",
[NSNumber numberWithInt:S2U_FreePlatformLoginOk], @"code", nil];
[self SendMessageToUnity:_dict];
}
@@ -368,6 +376,23 @@
[[SMPCQuickSDK defaultInstance] logout];
}
break;
+ case U2S_CreateRole:
+ {
+ // 鏇存柊瑙掕壊淇℃伅
+ SMPCQuickSDKGameRoleInfo *gameRoleInfo = [SMPCQuickSDKGameRoleInfo new];
+ gameRoleInfo.serverName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"serverName"]];
+ gameRoleInfo.gameRoleName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleName"]];
+ gameRoleInfo.serverId = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"sid"]]; //闇�瑕佹槸鏁板瓧瀛楃涓�
+ gameRoleInfo.gameRoleID = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleID"]];
+ gameRoleInfo.gameUserBalance = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"money"]];
+ gameRoleInfo.vipLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"vipLevel"]];
+ gameRoleInfo.gameUserLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"level"]];
+ gameRoleInfo.partyName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"familyName"]];
+ gameRoleInfo.creatTime = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"createTime"]];
+
+ [[SMPCQuickSDK defaultInstance] updateRoleInfoWith:gameRoleInfo isCreate:YES];//濡傛灉杩欎釜瑙掕壊鏄垰鍒氬垱寤虹殑锛岃繖閲宨sCreate鍙互浼燳ES
+ break;
+ }
case U2S_RoleLogin:
{
// 鏇存柊瑙掕壊淇℃伅
@@ -376,12 +401,30 @@
gameRoleInfo.gameRoleName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleName"]];
gameRoleInfo.serverId = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"sid"]]; //闇�瑕佹槸鏁板瓧瀛楃涓�
gameRoleInfo.gameRoleID = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleID"]];
- gameRoleInfo.gameUserBalance = @"0";
+ gameRoleInfo.gameUserBalance = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"money"]];
gameRoleInfo.vipLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"vipLevel"]];
gameRoleInfo.gameUserLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"level"]];
gameRoleInfo.partyName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"familyName"]];
gameRoleInfo.creatTime = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"createTime"]];
- gameRoleInfo.fightPower = @"12345";
+
+ [[SMPCQuickSDK defaultInstance] updateRoleInfoWith:gameRoleInfo isCreate:NO];//濡傛灉杩欎釜瑙掕壊鏄垰鍒氬垱寤虹殑锛岃繖閲宨sCreate鍙互浼燳ES
+ break;
+ }
+
+ case U2S_RoleLevelUp:
+ {
+ // 鏇存柊瑙掕壊淇℃伅
+ SMPCQuickSDKGameRoleInfo *gameRoleInfo = [SMPCQuickSDKGameRoleInfo new];
+ gameRoleInfo.serverName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"serverName"]];
+ gameRoleInfo.gameRoleName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleName"]];
+ gameRoleInfo.serverId = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"sid"]]; //闇�瑕佹槸鏁板瓧瀛楃涓�
+ gameRoleInfo.gameRoleID = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleID"]];
+ gameRoleInfo.gameUserBalance = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"money"]];
+ gameRoleInfo.vipLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"vipLevel"]];
+ gameRoleInfo.gameUserLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"level"]];
+ gameRoleInfo.partyName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"familyName"]];
+ gameRoleInfo.creatTime = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"createTime"]];
+
[[SMPCQuickSDK defaultInstance] updateRoleInfoWith:gameRoleInfo isCreate:NO];//濡傛灉杩欎釜瑙掕壊鏄垰鍒氬垱寤虹殑锛岃繖閲宨sCreate鍙互浼燳ES
break;
}
@@ -389,30 +432,38 @@
{
SMPCQuickSDKGameRoleInfo *role = [[SMPCQuickSDKGameRoleInfo alloc] init];
SMPCQuickSDKPayOrderInfo *order = [[SMPCQuickSDKPayOrderInfo alloc] init];
- role.serverName = [NSString stringWithFormat:@"%@", [_dict objectForKey:@"serverName"]]; //蹇呭~
- role.gameRoleName = [NSString stringWithFormat:@"%@", [_dict objectForKey:@"roleName"]];//@""
- role.serverId = [NSString stringWithFormat:@"%@", [_dict objectForKey:@"sid"]]; //闇�瑕佹槸鏁板瓧瀛楃涓�
- role.gameRoleID = [NSString stringWithFormat:@"%@", [_dict objectForKey:@"roleID"]];//
- role.gameUserBalance = @"0";//
- role.vipLevel = [NSString stringWithFormat:@"%@", [_dict objectForKey:@"vipLevel"]];//
- role.gameUserLevel = [NSString stringWithFormat:@"%@", [_dict objectForKey:@"level"]];
- role.partyName = [NSString stringWithFormat:@"%@", [_dict objectForKey:@"familyName"]];//
+
+ role.serverName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"serverName"]];
+ role.gameRoleName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleName"]];
+ role.serverId = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"sid"]]; //闇�瑕佹槸鏁板瓧瀛楃涓�
+ role.gameRoleID = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"roleID"]];
+ role.gameUserBalance = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"money"]];
+ role.vipLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"vipLevel"]];
+ role.gameUserLevel = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"level"]];
+ role.partyName = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"familyName"]];
+ role.creatTime = [NSString stringWithFormat:@"%@",[_dict objectForKey:@"createTime"]];
+
order.goodsID = [NSString stringWithFormat:@"%@", [_dict objectForKey:@"cpInfo"]]; //蹇呭~ iap鏃舵敞鎰忓拰鑻规灉寮�鍙戣�呭悗鍙颁竴鑷达紝鎴栬�呮笭閬撴槧灏勭殑
order.productName = [NSString stringWithFormat:@"%@", [_dict objectForKey:@"title"]];//蹇呭~
order.cpOrderID = [NSString stringWithFormat:@"%@", [_dict objectForKey:@"orderId"]]; //蹇呭~ 娓告垙璁㈠崟鍙�
order.count = 1; //蹇呭~ 鏁伴噺
order.amount = [[_dict objectForKey:@"mount"] floatValue]; //蹇呭~ 鎬讳环
- order.callbackUrl = @"";
- order.extrasParams = [NSString stringWithFormat:@"{\"appid\":\"%@\",\"cpinfo\":\"%@\",\"cporderid\":\"%@\",\"productid\":\"%@\"}",
- sAppID,
- [_dict objectForKey:@"cpInfo"],
- [_dict objectForKey:@"orderId"],
- sGameID];
- //涓埆娓犻亾瑕佹眰鍗曚环*鏁伴噺==鎬讳环
- if([SMPCQuickSDK defaultInstance].channelType == 9999){
- //閫氳繃鍒ゆ柇娓犻亾鍙峰鐞嗙壒瀹氭笭閬撶殑鍙傛暟
- order.goodsID = @"productlist.name";
+
+ NSString *_appid = [[SMPCQuickSDK defaultInstance] getConfigValue:@"zfappid"];
+ if ([_appid isEqualToString:@""])
+ {
+ _appid = sAppID;
}
+ order.extrasParams = [NSString stringWithFormat:@"{\"appid\":\"%@\",\"cpinfo\":\"%@\",\"cporderid\":\"%@\"}",
+ _appid,
+ [_dict objectForKey:@"cpInfo"],
+ [_dict objectForKey:@"orderId"]
+ ];
+// //涓埆娓犻亾瑕佹眰鍗曚环*鏁伴噺==鎬讳环
+// if([SMPCQuickSDK defaultInstance].channelType == 9999){
+// //閫氳繃鍒ゆ柇娓犻亾鍙峰鐞嗙壒瀹氭笭閬撶殑鍙傛暟
+// order.goodsID = @"productlist.name";
+// }
int error = [[SMPCQuickSDK defaultInstance] payOrderInfo:order
roleInfo:role];
if (error!=0)
--
Gitblit v1.8.0