PlatformTapManager.cs 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. using ET;
  2. using TapTap.Bootstrap;
  3. using TapTap.Common;
  4. using TapTap.TapDB;
  5. namespace GFGGame
  6. {
  7. public class PlatformTapManager
  8. {
  9. public static void InitSDK()
  10. {
  11. if (!PlatformManager.IsTaptap)
  12. {
  13. return;
  14. }
  15. var config = new TapConfig.Builder()
  16. .ClientID("K7bDyPGYlVx2AAtk6q")
  17. .ClientToken("fjwWBtibB4Dj3UjyRQxK2tZ3f8fGNgg14tcRW38D")
  18. .ServerURL("https://k7bdypgy.cloud.tds1.tapapis.cn")
  19. .RegionType(RegionType.CN)
  20. .TapDBConfig(true, "tap", null, true)
  21. .ConfigBuilder();
  22. TapBootstrap.Init(config);
  23. }
  24. public static void OnEnterGame()
  25. {
  26. if(!PlatformManager.IsTaptap)
  27. {
  28. return;
  29. }
  30. var serverInfosComponent = GameGlobal.zoneScene.GetComponent<ServerInfosComponent>();
  31. var accountInfoComponent = GameGlobal.zoneScene.GetComponent<AccountInfoComponent>();
  32. var roleInfosComponent = GameGlobal.zoneScene.GetComponent<RoleInfosComponent>();
  33. var currentRole = roleInfosComponent.GetCurrentRole();
  34. TapDB.SetUser(accountInfoComponent.Account);
  35. TapDB.SetName(currentRole.Name);
  36. TapDB.SetLevel(RoleDataManager.lvl);
  37. TapDB.SetServer(serverInfosComponent.GetCurrentServerInfo().ServerName);
  38. }
  39. public static void OnQuitGame()
  40. {
  41. if (!PlatformManager.IsTaptap)
  42. {
  43. return;
  44. }
  45. TapDB.ClearUser();
  46. }
  47. }
  48. }