此文档主要是用于在游戏需要接入龙图海外SDK各地区特殊功能时的补充文档。
使用此文档接口需要iOS BaseSDK 和 全球地区SDK同时接入。
请各位根据接入的地区查看需要的接口使用。
功能说明:
调用此接口不会触发注销事件,SDK会拉起登录界面.由用户自行选择账号登录.
登录成功后会通过切换账号回调返回用户信息
接口定义:
C++版本==============================================================
void SwitchAccount();
接口示例:
//设置切换账号回调
LTGameSDK::GetInstance().SwitchAccountCallBack(SwitchAccountCallBack);
void SwitchAccountCallBack(bool result, const char* jsonStr)
{
NSLog(@"********* SwitchAccountCallBack ******** = %@",[NSString stringWithUTF8String:jsonStr]);
if(result){
Json::Reader json_reader;
Json::Value json_object;
if (!json_reader.parse(jsonStr, json_object)){
return;
}
//json格式和内容同登录
}else{
NSLog(@" 切换账号失败 ");
}
}
OC版本==============================================================
设置代理后实现下面回调
- (void)ltSwitchAccountCallBackWhitResult:(BOOL)result dict:(NSDictionary *)dict{
NSLog(@"*********OC ltSwitchAccountCallBackWhitResult ******** = %@",dict);
if(result)
{
//进入登录页面
NSLog(@" 切换账号成功,进入登录页面 ");
NSString *userid = [dict objectForKey:@"userId"];
NSString *tokenId = [dict objectForKey:@"tokenId"];
NSString *currentUserType = [dict objectForKey:@"currentUserType"];
NSString *userName = [dict objectForKey:@"userName"];
NSLog(@"userid = %@,tokenid = %@,currentusertype = %@,username = %@",userid,tokenId,currentUserType,userName);
//用户登录成功,进入创建角色界面
// 模拟游戏进入选择服务器页面
[[LTGameOCSDK shareInstance] LTSDKBaseSendGameProcessEventType:GAMEOC_PROCESS_EVENT_TYPE_IN_SELECT_SERVERLIST];
}
else
{
NSLog(@" 切换账号失败 ");
}
}
功能说明:
此接口会返回用户中心绑定结果,仅限调用用户中心的账号绑定返回.
C++版本==============================================================
//设置绑定回调
LTGameSDK::GetInstance().BindAccountCallBack(bindAccountCallBack);
void bindAccountCallBack(bool result,const char * jsonStr,const char* type){
cout<<"*********bindAccountCallBack********"<<endl;
cout<<jsonStr<<endl;
cout<<type<<endl;
/*
type:三方类型(国内+海外)
"GoogleLogin"
"FBLogin"
"appleLogin"
"TwitterLogin"
"Weibo"
"Wechat"
"QQ"
"GameCenterLogin"
*/
Json::Reader json_reader;
Json::Value json_object;
if (!json_reader.parse(jsonStr, json_object)){
return;
}
/*
{"data":{"accessToken":"EF0EE605E80E8648A6BCBDC3311B245A5FB2DAEA5E51841C4AAAC61D8EE29154","bindChannelIds":["0231"],"bindThirdUserFlag":1,"currentUserName":"52dd8be8-294a-45b7-8110-c987af58588f","currentUserType":"thirdHidden","email":"","loginType":"thirdHiddenRegister","nickName":"1202283850219599","originalUserType":"thirdHidden","thirdProductUserId":"","thirdUserId":"0102310000000000000000001202283850219599","userId":"0800010000000000000000000000000029732602","userIdV1":"0102310000000000000000001202283850219599","userName":"52dd8be8-294a-45b7-8110-c987af58588f","userPlatformId":"0231"},"errorCode":"01020001","errorDesc":"成功","status":"1"}
*/
if (result) {
NSLog(@"绑定成功");
Json::Value dataJson = json_object["data"];
string userId = dataJson["userId"].asString();
}
else{
NSLog(@" 绑定失败 ");
string erroeDes = json_object["errorDesc"].asString();
}
}
OC版本===============================================================
/// 绑定回调
/// @param result 绑定结果
/// @param type 绑定三方类型
/// @param dict 返回内容
- (void)ltBindAccountCallBackWithResult:(BOOL)result thirdType:(NSString *)type dict:(NSDictionary *)dict{
/*
type:三方类型(国内+海外)
"GoogleLogin"
"FBLogin"
"appleLogin"
"TwitterLogin"
"Weibo"
"Wechat"
"QQ"
"GameCenterLogin"
*/
/*
{"data":{"accessToken":"EF0EE605E80E8648A6BCBDC3311B245A5FB2DAEA5E51841C4AAAC61D8EE29154","bindChannelIds":["0231"],"bindThirdUserFlag":1,"currentUserName":"52dd8be8-294a-45b7-8110-c987af58588f","currentUserType":"thirdHidden","email":"","loginType":"thirdHiddenRegister","nickName":"1202283850219599","originalUserType":"thirdHidden","thirdProductUserId":"","thirdUserId":"0102310000000000000000001202283850219599","userId":"0800010000000000000000000000000029732602","userIdV1":"0102310000000000000000001202283850219599","userName":"52dd8be8-294a-45b7-8110-c987af58588f","userPlatformId":"0231"},"errorCode":"01020001","errorDesc":"成功","status":"1"}
*/
}
```
上海中清龙图软件有限公司