2021-04-07 16:20:41 +08:00
|
|
|
|
# 使用 TapTap.Bootstrap
|
2021-04-12 11:24:42 +08:00
|
|
|
|
## 使用前提
|
|
|
|
|
|
|
|
|
|
使用 TapTap.Bootstrap 前提是必须依赖以下库:
|
|
|
|
|
* [TapTap.Common](https://github.com/TapTap/TapCommon-Unity.git)
|
|
|
|
|
|
|
|
|
|
## 命名空间
|
2021-04-07 16:20:41 +08:00
|
|
|
|
|
|
|
|
|
```c#
|
2021-04-12 11:24:42 +08:00
|
|
|
|
using TapTap.Bootstrap;
|
2021-04-07 16:20:41 +08:00
|
|
|
|
```
|
|
|
|
|
|
2021-04-12 11:24:42 +08:00
|
|
|
|
## 接口描述
|
2021-04-07 16:20:41 +08:00
|
|
|
|
|
2021-05-07 16:57:54 +08:00
|
|
|
|
### 1.初始化
|
2021-04-07 16:20:41 +08:00
|
|
|
|
|
2021-05-07 16:57:54 +08:00
|
|
|
|
> TapBootstrap 会根据 TapConfig 中的 TapDBConfig 配置来进行 TapDB 的自动初始化。
|
|
|
|
|
|
|
|
|
|
开启 TapDB
|
2021-04-07 16:20:41 +08:00
|
|
|
|
```c#
|
2021-04-25 15:45:36 +08:00
|
|
|
|
var config = new TapConfig.TapConfigBuilder()
|
|
|
|
|
.ClientID("client_id")
|
|
|
|
|
.ClientSecret("client_secret")
|
|
|
|
|
.RegionType(RegionType.CN)
|
2021-05-08 16:39:46 +08:00
|
|
|
|
.TapDBConfig(true,"channel","gameVersion",true)
|
2021-04-25 15:45:36 +08:00
|
|
|
|
.Builder();
|
2021-05-07 16:57:54 +08:00
|
|
|
|
```
|
|
|
|
|
关闭 TapDB
|
|
|
|
|
```c#
|
|
|
|
|
var config = new TapConfig.TapConfigBuilder()
|
|
|
|
|
.ClientID("client_id")
|
|
|
|
|
.ClientSecret("client_secret")
|
|
|
|
|
.RegionType(RegionType.CN)
|
2021-05-08 16:39:46 +08:00
|
|
|
|
//# .TapDBConfig(false,null,null,false)
|
2021-05-07 16:57:54 +08:00
|
|
|
|
.EnableTapDB(false)
|
|
|
|
|
.Builder();
|
|
|
|
|
```
|
|
|
|
|
初始化 TapSDK
|
|
|
|
|
```c#
|
2021-04-07 16:20:41 +08:00
|
|
|
|
TapBootstrap.Init(config);
|
|
|
|
|
```
|
|
|
|
|
|
2021-05-07 16:57:54 +08:00
|
|
|
|
### 2.登陆
|
2021-04-07 16:20:41 +08:00
|
|
|
|
|
|
|
|
|
```c#
|
|
|
|
|
TapBootstrap.Login(LoginType loginType, string[] permissions);
|
|
|
|
|
```
|
|
|
|
|
|
2021-05-07 16:57:54 +08:00
|
|
|
|
### 3.设置语言
|
2021-04-07 16:20:41 +08:00
|
|
|
|
```c#
|
|
|
|
|
TapBootstrap.SetPreferLanguage(TapLanguage tapLanguage);
|
|
|
|
|
```
|
|
|
|
|
|
2021-05-07 16:57:54 +08:00
|
|
|
|
### 4.绑定TapTap账号(已废弃)
|
2021-04-07 16:20:41 +08:00
|
|
|
|
```c#
|
|
|
|
|
TapBootstrap.Bind(LoginType loginType, string[] permissions);
|
|
|
|
|
```
|
|
|
|
|
|
2021-05-07 16:57:54 +08:00
|
|
|
|
### 5.注册用户状态回调
|
2021-04-07 16:20:41 +08:00
|
|
|
|
|
|
|
|
|
```c#
|
|
|
|
|
TapBootstrap.RegisterUserStatusChangedListener(ITapUserStatusChangedListener listener);
|
|
|
|
|
```
|
|
|
|
|
|
2021-05-07 16:57:54 +08:00
|
|
|
|
### 6.注册登陆回调
|
2021-04-07 16:20:41 +08:00
|
|
|
|
```c#
|
|
|
|
|
TapBootstrap.RegisterLoginResultListener(ITapLoginResultListener listener);
|
|
|
|
|
```
|
|
|
|
|
|
2021-05-07 16:57:54 +08:00
|
|
|
|
### 7.获取用户信息
|
2021-04-07 16:20:41 +08:00
|
|
|
|
```c#
|
|
|
|
|
TapBootstrap.GetUser(Action<TapUser,TapError> action);
|
|
|
|
|
```
|
|
|
|
|
|
2021-05-07 16:57:54 +08:00
|
|
|
|
### 8.获取详细用户信息
|
2021-04-07 16:20:41 +08:00
|
|
|
|
```c#
|
|
|
|
|
TapBootstrap.GetDetailUser(Action<TapUserDetail, TapError> action);
|
|
|
|
|
```
|
|
|
|
|
|
2021-05-07 16:57:54 +08:00
|
|
|
|
### 9.篝火测试资格
|
|
|
|
|
```c#
|
|
|
|
|
TapBootstrap.GetTestQualification(Action<bool,TapError> action);
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### 10.获取AccessToken
|
2021-04-07 16:20:41 +08:00
|
|
|
|
```c#
|
|
|
|
|
TapBootstrap.GetDetailUser(Action<TapUserDetail, TapError> action);
|
|
|
|
|
```
|
|
|
|
|
|
2021-05-07 16:57:54 +08:00
|
|
|
|
### 11.登出
|
2021-04-07 16:20:41 +08:00
|
|
|
|
```c#
|
|
|
|
|
TapBootstrap.Logout();
|
|
|
|
|
```
|
|
|
|
|
|
2021-05-07 16:57:54 +08:00
|
|
|
|
### 12.打开用户中心
|
2021-04-07 16:20:41 +08:00
|
|
|
|
```c#
|
|
|
|
|
TapBootstrap.OpenUserCenter();
|
|
|
|
|
```
|