基于IOS海外接入文档做出日本专用接口说明

文档说明

此文档主要是用于在游戏需要接入龙图海外SDK各地区特殊功能时的补充文档。
使用此文档接口需要iOS BaseSDK 和 日本地区SDK同时接入。

请各位根据接入的地区查看需要的接口使用。

1.切换账号

功能说明:
调用此接口不会触发注销事件,SDK会拉起登录界面.由用户自行选择账号登录.
登录成功后会通过切换账号回调返回用户信息

接口定义:
C++版本==============================================================

  1. void SwitchAccount();

接口示例:

  1. void SwitchAccountCallBack(bool result, const char* jsonStr)
  2. {
  3. NSLog(@"********* SwitchAccountCallBack ******** = %@",[NSString stringWithUTF8String:jsonStr]);
  4. if(result){
  5. Json::Reader json_reader;
  6. Json::Value json_object;
  7. if (!json_reader.parse(jsonStr, json_object)){
  8. return;
  9. }
  10. //json格式和内容同登录
  11. }else{
  12. NSLog(@" 切换账号失败 ");
  13. }
  14. }

OC版本===============================================================

  1. 设置代理后实现下面代理方法
  2. - (void)ltSwitchAccountCallBackWhitResult:(BOOL)result dict:(NSDictionary *)dict{
  3. if(result)
  4. {
  5. //进入登录页面
  6. NSLog(@" 切换账号成功,进入登录页面 ");
  7. NSString *userid = [dict objectForKey:@"userId"];
  8. NSString *tokenId = [dict objectForKey:@"tokenId"];
  9. NSString *currentUserType = [dict objectForKey:@"currentUserType"];
  10. NSString *userName = [dict objectForKey:@"userName"];
  11. NSLog(@"userid = %@,tokenid = %@,currentusertype = %@,username = %@",userid,tokenId,currentUserType,userName);
  12. //用户登录成功,进入创建角色界面
  13. // 模拟游戏进入选择服务器页面
  14. [[LTGameOCSDK shareInstance] LTSDKBaseSendGameProcessEventType:GAMEOC_PROCESS_EVENT_TYPE_IN_SELECT_SERVERLIST];
  15. }
  16. else
  17. {
  18. NSLog(@" 切换账号失败 ");
  19. }
  20. }

2.绑定账号

功能说明:
此接口会返回用户中心绑定结果,仅限调用用户中心的账号绑定返回.

C++版本==============================================================

  1. //设置绑定回调
  2. LTGameSDK::GetInstance().BindAccountCallBack(bindAccountCallBack);
  3. void bindAccountCallBack(bool result,const char * jsonStr,const char* type){
  4. cout<<"*********bindAccountCallBack********"<<endl;
  5. cout<<jsonStr<<endl;
  6. cout<<type<<endl;
  7. /*
  8. type:三方类型(国内+海外)
  9. "GoogleLogin"
  10. "FBLogin"
  11. "appleLogin"
  12. "TwitterLogin"
  13. "Weibo"
  14. "Wechat"
  15. "QQ"
  16. "GameCenterLogin"
  17. */
  18. Json::Reader json_reader;
  19. Json::Value json_object;
  20. if (!json_reader.parse(jsonStr, json_object)){
  21. return;
  22. }
  23. /*
  24. {"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"}
  25. */
  26. if (result) {
  27. NSLog(@"绑定成功");
  28. Json::Value dataJson = json_object["data"];
  29. string userId = dataJson["userId"].asString();
  30. }
  31. else{
  32. NSLog(@" 绑定失败 ");
  33. string erroeDes = json_object["errorDesc"].asString();
  34. }
  35. }

OC版本===============================================================

  1. /// 绑定回调
  2. /// @param result 绑定结果
  3. /// @param type 绑定三方类型
  4. /// @param dict 返回内容
  5. - (void)ltBindAccountCallBackWithResult:(BOOL)result thirdType:(NSString *)type dict:(NSDictionary *)dict{
  6. /*
  7. type:三方类型(国内+海外)
  8. "GoogleLogin"
  9. "FBLogin"
  10. "appleLogin"
  11. "TwitterLogin"
  12. "Weibo"
  13. "Wechat"
  14. "QQ"
  15. "GameCenterLogin"
  16. */
  17. /*
  18. {"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"}
  19. */
  20. }