From a2b296423fb1831b1d2ef565022b6120d7cf246c Mon Sep 17 00:00:00 2001 From: HuYufei Date: Mon, 8 Jan 2024 11:31:58 +0800 Subject: [PATCH] =?UTF-8?q?update:=20=E6=B7=BB=E5=8A=A0=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=E4=BF=9D=E6=8A=A4=E9=80=BB=E8=BE=91=EF=BC=8C=20?= =?UTF-8?q?=E6=9C=AA=E5=88=9D=E5=A7=8B=E5=8C=96=E6=97=B6=E5=8A=A0=E5=85=A5?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Runtime/Code/IAP/GuruIAP.cs | 2 -- Runtime/Code/SDK/GuruSDK.Analytics.cs | 52 ++++++++++++++++++++++----- Runtime/Code/SDK/GuruSDK.cs | 10 +++--- 3 files changed, 49 insertions(+), 15 deletions(-) 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); }