123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- using ET;
- using TapTap.Bootstrap;
- using TapTap.Common;
- using TapTap.TapDB;
- //using Plugins.AntiAddictionUIKit;
- namespace GFGGame
- {
- public class PlatformTapManager
- {
- public static void InitSDK()
- {
- if (!PlatformManager.IsTaptap)
- {
- return;
- }
- var config = new TapConfig.Builder()
- .ClientID("K7bDyPGYlVx2AAtk6q")
- .ClientToken("fjwWBtibB4Dj3UjyRQxK2tZ3f8fGNgg14tcRW38D")
- .ServerURL("https://k7bdypgy.cloud.tds1.tapapis.cn")
- .RegionType(RegionType.CN)
- .TapDBConfig(true, "tap", null, true)
- .ConfigBuilder();
- TapBootstrap.Init(config);
- string gameIdentifier = "游戏的 Client ID";
- // 是否启用时长限制功能
- bool useTimeLimit = true;
- // 是否启用消费限制功能
- bool usePaymentLimit = true;
- // 是否显示切换账号按钮
- bool showSwitchAccount = false;
- //AntiAddictionUIKit.Init(gameIdentifier, useTimeLimit, usePaymentLimit, showSwitchAccount,
- // (antiAddictionCallbackData) => {
- // int code = antiAddictionCallbackData.code;
- // MsgExtraParams extras = antiAddictionCallbackData.extras;
- // // 根据 code 不同提示玩家不同信息,详见下面的说明
- // if (code == 500)
- // {
- // // 开始计时
- // AntiAddictionUIKit.EnterGame();
- // Debug.Log("玩家登录后判断当前玩家可以进行游戏");
- // }
- // },
- // (exception) => {
- // // 处理异常
- //}
- //);
- }
- public static void OnEnterGame()
- {
- if(!PlatformManager.IsTaptap)
- {
- return;
- }
- var serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
- var accountInfoComponent = GameGlobal.zoneScene.GetComponent<AccountInfoComponent>();
- var roleInfosComponent = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>();
- var currentRole = roleInfosComponent.GetCurrentRole();
- TapDB.SetUser(accountInfoComponent.Account);
- TapDB.SetName(currentRole.Name);
- TapDB.SetLevel(RoleDataManager.lvl);
- TapDB.SetServer(serverInfosComponent.GetCurrentServerInfo().ServerName);
- }
- public static void OnQuitGame()
- {
- if (!PlatformManager.IsTaptap)
- {
- return;
- }
- TapDB.ClearUser();
- }
- }
- }
|