TapBootstrap-Unity/Documentation/README.md

1.9 KiB

使用 TapTap.Bootstrap

使用前提

使用 TapTap.Bootstrap 前提是必须依赖以下库:

命名空间

using TapTap.Bootstrap;

接口描述

1.初始化

TapBootstrap 会根据 TapConfig 中的 TapDBConfig 配置来进行 TapDB 的自动初始化。

开启 TapDB
var config = new TapConfig.Builder()
                .ClientID("client_id")
                .ClientSecret("client_secret")
                .ServerURL("https://ikggdre2.lc-cn-n1-shared.com")
                .RegionType(RegionType.CN)
                .TapDBConfig(true,"channel","gameVersion",true)
                .Builder();
关闭 TapDB
var config = new TapConfig.Builder()
                .ClientID("client_id")
                .ClientSecret("client_secret")
                .ServerURL("https://ikggdre2.lc-cn-n1-shared.com")
                .RegionType(RegionType.CN)
//#             .TapDBConfig(false,null,null,false)
                .EnableTapDB(false)
                .Builder();
初始化
TapBootstrap.Init(config);

2.账户系统

登陆成功之后,都会得到一个 TDSUser 实例

使用 TapTap OAuth 授权结果直接登陆/注册账户系统

var tdsUser = await TDSUser.LoginWithTapTap();

游客登陆

var tdsUser = await TDSUser.LoginAnonymously();

使用第三方平台授权登录/注册账户

var tdsUser = await TDSUser.LoginWithAuthData(Dictionary<string, object> authData, string platform,
            LCUserAuthDataLoginOption option = null);

绑定第三方平台授权

await TDSUser.AssociateAuthData(Dictionary<string, object> authData, string platform);

退出登陆

TDSUser.Logout();