diff --git a/Runtime/Code/IAP/GuruIAP.cs b/Runtime/Code/IAP/GuruIAP.cs index 7e5ec52..b7f2d27 100644 --- a/Runtime/Code/IAP/GuruIAP.cs +++ b/Runtime/Code/IAP/GuruIAP.cs @@ -3,8 +3,6 @@ namespace Guru internal class GuruIAP: IAPServiceBase { - - /// /// 获取BLevel /// diff --git a/Runtime/Code/SDK/GuruSDK.Analytics.cs b/Runtime/Code/SDK/GuruSDK.Analytics.cs index db38204..00f62cb 100644 --- a/Runtime/Code/SDK/GuruSDK.Analytics.cs +++ b/Runtime/Code/SDK/GuruSDK.Analytics.cs @@ -27,13 +27,25 @@ namespace Guru /// /// public static void LogEvent(string eventName, Dictionary data = null) - => Analytics.Track(eventName, data); + { + if (!IsInitialSuccess) + { + Debug.LogError($"{Tag} Please call first, before you call ."); + return; + } + Analytics.Track(eventName, data); + } + + public static void SetScreen(string screen, string extra = "") + { + if (!IsInitialSuccess) + { + Debug.LogError($"{Tag} Please call first, before you call ."); + return; + } + Analytics.SetCurrentScreen(screen, extra); + } - public static void SetScreen(string screen, string extra = "") - => Analytics.SetCurrentScreen(screen, extra); - - - #endregion #region 游戏打点 @@ -53,7 +65,7 @@ namespace Guru { if (!IsInitialSuccess) { - Debug.LogError($"{Tag} Please call first, before you call the log event api."); + Debug.LogError($"{Tag} Please call first, before you call ."); return; } @@ -93,6 +105,13 @@ namespace Guru string levelCategory = "main", string levelName = "", string levelID = "", int? duration = null, int? step = null, int? score = null ) { + if (!IsInitialSuccess) + { + Debug.LogError($"{Tag} Please call first, before you call ."); + return; + } + + if (InitConfig.AutoRecordFinishedLevels) { if(result == EventLevelEndSuccess) Model.SuccessLevelCount++; // 自动记录关卡完成次数 @@ -147,6 +166,11 @@ namespace Guru /// public static void LogLevelUp(int playerLevel, string playerName) { + if (!IsInitialSuccess) + { + Debug.LogError($"{Tag} Please call first, before you call ."); + return; + } Analytics.LevelUp(playerLevel, playerName); } @@ -156,6 +180,11 @@ namespace Guru /// public static void LogAchievement(string achievementName) { + if (!IsInitialSuccess) + { + Debug.LogError($"{Tag} Please call first, before you call ."); + return; + } Analytics.UnlockAchievement(achievementName); } @@ -169,7 +198,14 @@ namespace Guru /// /// public static void SetUserProperty(string key, string value) - => Analytics.SetUserProperty(key, value); + { + if (!IsInitialSuccess) + { + Debug.LogError($"{Tag} Please call first, before you call ."); + return; + } + Analytics.SetUserProperty(key, value); + } public static void SetUID(string uid) { diff --git a/Runtime/Code/SDK/GuruSDK.cs b/Runtime/Code/SDK/GuruSDK.cs index 59cb04d..c7a6d54 100644 --- a/Runtime/Code/SDK/GuruSDK.cs +++ b/Runtime/Code/SDK/GuruSDK.cs @@ -254,28 +254,28 @@ namespace Guru #region Logging - public static void LogI(object message) + internal static void LogI(object message) { Debug.Log($"{Tag} {message}"); } - public static void LogW(object message) + internal static void LogW(object message) { Debug.LogWarning($"{Tag} {message}"); } - public static void LogE(object message) + internal static void LogE(object message) { Debug.LogError($"{Tag} {message}"); } - public static void LogException(string message) + internal static void LogException(string message) { LogException( new Exception($"{Tag} {message}")); } - public static void LogException(Exception e) + internal static void LogException(Exception e) { Debug.LogException(e); }