2021-04-12 11:24:42 +08:00
|
|
|
# [使用 TapTap.Bootstrap ](./Documentation/README.md)
|
2021-04-07 16:20:41 +08:00
|
|
|
|
2021-04-12 11:24:42 +08:00
|
|
|
## 使用前提
|
|
|
|
|
|
|
|
使用 TapTap.Bootstrap 前提是必须依赖以下库:
|
|
|
|
* [TapTap.Common](https://github.com/TapTap/TapCommon-Unity.git)
|
2021-07-15 13:51:32 +08:00
|
|
|
* [TapTap.Login](https://github.com/TapTap/TapLogin-Unity.git)
|
|
|
|
* [LeanCloud.Storage](https://github.com/leancloud/csharp-sdk)
|
2021-04-12 11:24:42 +08:00
|
|
|
|
|
|
|
## 命名空间
|
2021-04-07 16:20:41 +08:00
|
|
|
|
|
|
|
```c#
|
|
|
|
using TapTap.Bootstrap;
|
|
|
|
```
|
|
|
|
|
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-07-15 13:51:32 +08:00
|
|
|
#### TapBootstrap 会根据 TapConfig 中的 TapDBConfig 配置来进行 TapDB 的自动初始化。
|
2021-05-07 16:57:54 +08:00
|
|
|
|
2021-07-15 13:51:32 +08:00
|
|
|
##### 开启 TapDB
|
2021-05-07 16:57:54 +08:00
|
|
|
```c#
|
|
|
|
var config = new TapConfig.TapConfigBuilder()
|
|
|
|
.ClientID("client_id")
|
|
|
|
.ClientSecret("client_secret")
|
2021-07-15 13:51:32 +08:00
|
|
|
.ServerURL("https://ikggdre2.lc-cn-n1-shared.com")
|
2021-05-07 16:57:54 +08:00
|
|
|
.RegionType(RegionType.CN)
|
2021-05-08 16:39:46 +08:00
|
|
|
.TapDBConfig(true,"channel","gameVersion",true)
|
2021-05-07 16:57:54 +08:00
|
|
|
.Builder();
|
|
|
|
```
|
2021-07-15 13:51:32 +08:00
|
|
|
##### 关闭 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")
|
2021-07-15 13:51:32 +08:00
|
|
|
.ServerURL("https://ikggdre2.lc-cn-n1-shared.com")
|
2021-04-25 15:45:36 +08:00
|
|
|
.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)
|
2021-04-25 15:45:36 +08:00
|
|
|
.Builder();
|
2021-05-07 16:57:54 +08:00
|
|
|
```
|
2021-07-15 13:51:32 +08:00
|
|
|
##### 初始化
|
2021-05-07 16:57:54 +08:00
|
|
|
```c#
|
2021-04-07 16:20:41 +08:00
|
|
|
TapBootstrap.Init(config);
|
|
|
|
```
|
|
|
|
|
2021-07-15 13:51:32 +08:00
|
|
|
### 2.账户系统
|
2021-04-07 16:20:41 +08:00
|
|
|
|
2021-07-15 13:51:32 +08:00
|
|
|
> 登陆成功之后,都会得到一个 `TDSUser` 实例
|
2021-04-07 16:20:41 +08:00
|
|
|
|
2021-07-15 13:51:32 +08:00
|
|
|
#### 使用 TapTap OAuth 授权结果直接登陆账户系统
|
2021-04-07 16:20:41 +08:00
|
|
|
|
|
|
|
```c#
|
2021-07-15 13:51:32 +08:00
|
|
|
var tdsUser = await TDSUser.LoginWithTapTap();
|
2021-04-07 16:20:41 +08:00
|
|
|
```
|
|
|
|
|
2021-07-15 13:51:32 +08:00
|
|
|
#### 游客登陆
|
2021-04-07 16:20:41 +08:00
|
|
|
```c#
|
2021-07-15 13:51:32 +08:00
|
|
|
var tdsUser = await TDSUser.LoginAnonymously();
|
2021-04-07 16:20:41 +08:00
|
|
|
```
|
|
|
|
|
2021-07-15 13:51:32 +08:00
|
|
|
#### 绑定第三方平台账号
|
2021-04-07 16:20:41 +08:00
|
|
|
```c#
|
2021-07-15 13:51:32 +08:00
|
|
|
var tdsUser = await TDSUser.LoginWithAuthData(Dictionary<string, object> authData, string platform,
|
|
|
|
LCUserAuthDataLoginOption option = null);
|
2021-04-07 16:20:41 +08:00
|
|
|
```
|
|
|
|
|
2021-07-15 13:51:32 +08:00
|
|
|
#### 退出登陆
|
2021-04-07 16:20:41 +08:00
|
|
|
```c#
|
2021-07-15 13:51:32 +08:00
|
|
|
TDSUser.Logout();
|
2021-04-07 16:20:41 +08:00
|
|
|
```
|
|
|
|
|
|
|
|
|