diff --git a/Runtime/Code/SDK/GuruSDK.Analytics.cs b/Runtime/Code/SDK/GuruSDK.Analytics.cs index f676b00..779e896 100644 --- a/Runtime/Code/SDK/GuruSDK.Analytics.cs +++ b/Runtime/Code/SDK/GuruSDK.Analytics.cs @@ -201,16 +201,16 @@ namespace Guru /// 玩家(角色)升级事件 /// /// - /// + /// /// 扩展数据 - public static void LogLevelUp(int playerLevel, string playerName, Dictionary extra = null) + public static void LogLevelUp(int playerLevel, string characterName, Dictionary extra = null) { if (!IsInitialSuccess) { UnityEngine.Debug.LogError($"{Tag} :: LogLevelUp {playerLevel} :: Please call first, before you call ."); return; } - Analytics.LevelUp(playerLevel, playerName, extra); + Analytics.LevelUp(playerLevel, characterName, extra); } /// @@ -358,6 +358,27 @@ namespace Guru #region IAP 打点 + private static string TryGetFirstProductId() + { + if (GuruSettings.Instance != null && (GuruSettings.Instance.Products?.Length ?? 0) > 0) + { + return GuruSettings.Instance.Products[0]?.ProductId ?? ""; + } + + return ""; + } + + private static string TryGetCurrentProductId() + { + if (GuruIAP.Instance != null && IsIAPReady) + { + return GuruIAP.Instance.CurrentBuyingProductId; + } + return ""; + } + + + /// /// 当付费页面打开时调用 /// @@ -367,10 +388,7 @@ namespace Guru { if (string.IsNullOrEmpty(productId)) { - if (GuruSettings.Instance != null && (GuruSettings.Instance.Products?.Length ?? 0) > 0) - { - productId = GuruSettings.Instance.Products[0].ProductId; - } + productId = TryGetFirstProductId(); } Analytics.IAPImp(scene, productId); } @@ -384,12 +402,22 @@ namespace Guru { if (string.IsNullOrEmpty(productId)) { - productId = GuruIAP.Instance.CurrentBuyingProductId; + productId = TryGetCurrentProductId(); } Analytics.IAPClose(scene, productId); } + /// + /// 当点击 IAP 商品按钮的时候调用 + /// + /// + /// + public static void OnIAPClick(string scene = "", string productId = "") + { + Analytics.IAPClick(scene, productId); + } + #endregion #region 经济打点 diff --git a/Runtime/Code/SDK/GuruSDK.Debug.cs b/Runtime/Code/SDK/GuruSDK.Debug.cs index c7b29a7..dd76f57 100644 --- a/Runtime/Code/SDK/GuruSDK.Debug.cs +++ b/Runtime/Code/SDK/GuruSDK.Debug.cs @@ -3,9 +3,9 @@ namespace Guru { public partial class GuruSDK { - private const string K_CMD_NAME_DEBUGGER = "debug.guru.dbg"; - private const string K_CMD_NAME_WATERMARK = "debug.guru.wm"; - private const string K_CMD_NAME_CONSOLE = "debug.guru.con"; + private const string K_CMD_NAME_DEBUGGER = "gurusdk.unity.dbg"; + private const string K_CMD_NAME_WATERMARK = "gurusdk.unity.wm"; + private const string K_CMD_NAME_CONSOLE = "gurusdk.unity.con";