TapTapEvent.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. using System;
  2. using System.Threading.Tasks;
  3. using TapSDK.Core.Internal;
  4. using UnityEngine;
  5. using System.Reflection;
  6. using TapSDK.Core.Internal.Log;
  7. namespace TapSDK.Core {
  8. public class TapTapEvent {
  9. private static ITapEventPlatform platformWrapper;
  10. static TapTapEvent() {
  11. platformWrapper = PlatformTypeUtils.CreatePlatformImplementationObject(typeof(ITapEventPlatform),
  12. "TapSDK.Core") as ITapEventPlatform;
  13. if(platformWrapper == null) {
  14. TapLog.Error("PlatformWrapper is null");
  15. }
  16. }
  17. internal static void Init(TapTapEventOptions eventOptions)
  18. {
  19. platformWrapper.Init(eventOptions);
  20. }
  21. public static void SetUserID(string userID)
  22. {
  23. platformWrapper?.SetUserID(userID);
  24. }
  25. public static void SetUserID(string userID, string properties){
  26. platformWrapper?.SetUserID(userID,properties);
  27. }
  28. public static void ClearUser(){
  29. platformWrapper?.ClearUser();
  30. }
  31. public static string GetDeviceId(){
  32. if(platformWrapper != null) {
  33. return platformWrapper?.GetDeviceId();
  34. }
  35. return "";
  36. }
  37. public static void LogEvent(string name, string properties){
  38. platformWrapper?.LogEvent(name, properties);
  39. }
  40. public static void DeviceInitialize(string properties){
  41. platformWrapper?.DeviceInitialize(properties);
  42. }
  43. public static void DeviceUpdate(string properties){
  44. platformWrapper?.DeviceUpdate(properties);
  45. }
  46. public static void DeviceAdd(string properties){
  47. platformWrapper?.DeviceAdd(properties);
  48. }
  49. public static void UserInitialize(string properties){
  50. platformWrapper?.UserInitialize(properties);
  51. }
  52. public static void UserUpdate(string properties){
  53. platformWrapper?.UserUpdate(properties);
  54. }
  55. public static void UserAdd(string properties){
  56. platformWrapper?.UserAdd(properties);
  57. }
  58. public static void AddCommonProperty(string key, string value){
  59. platformWrapper?.AddCommonProperty(key, value);
  60. }
  61. public static void AddCommon(string properties){
  62. platformWrapper?.AddCommon(properties);
  63. }
  64. public static void ClearCommonProperty(string key){
  65. platformWrapper?.ClearCommonProperty(key);
  66. }
  67. public static void ClearCommonProperties(string[] keys){
  68. platformWrapper?.ClearCommonProperties(keys);
  69. }
  70. public static void ClearAllCommonProperties(){
  71. platformWrapper?.ClearAllCommonProperties();
  72. }
  73. public static void LogPurchasedEvent(string orderID, string productName, long amount, string currencyType, string paymentMethod, string properties){
  74. platformWrapper?.LogChargeEvent(orderID, productName, amount, currencyType, paymentMethod, properties);
  75. }
  76. public static void RegisterDynamicProperties(Func<string> callback){
  77. platformWrapper?.RegisterDynamicProperties(callback);
  78. }
  79. public static void SetOAID(string value){
  80. platformWrapper?.SetOAID(value);
  81. }
  82. public static void LogDeviceLoginEvent(){
  83. platformWrapper?.LogDeviceLoginEvent();
  84. }
  85. }
  86. }