update: 添加初始化保护逻辑, 未初始化时加入错误信息
parent
8881b2f442
commit
a2b296423f
|
|
@ -3,8 +3,6 @@ namespace Guru
|
|||
internal class GuruIAP: IAPServiceBase<GuruIAP>
|
||||
{
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 获取BLevel
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -27,12 +27,24 @@ namespace Guru
|
|||
/// <param name="eventName"></param>
|
||||
/// <param name="data"></param>
|
||||
public static void LogEvent(string eventName, Dictionary<string, dynamic> data = null)
|
||||
=> Analytics.Track(eventName, data);
|
||||
{
|
||||
if (!IsInitialSuccess)
|
||||
{
|
||||
Debug.LogError($"{Tag} Please call <GuruSDK.Init()> first, before you call <LogEvent>.");
|
||||
return;
|
||||
}
|
||||
Analytics.Track(eventName, data);
|
||||
}
|
||||
|
||||
public static void SetScreen(string screen, string extra = "")
|
||||
=> Analytics.SetCurrentScreen(screen, extra);
|
||||
|
||||
|
||||
{
|
||||
if (!IsInitialSuccess)
|
||||
{
|
||||
Debug.LogError($"{Tag} Please call <GuruSDK.Init()> first, before you call <SetScreen>.");
|
||||
return;
|
||||
}
|
||||
Analytics.SetCurrentScreen(screen, extra);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -53,7 +65,7 @@ namespace Guru
|
|||
{
|
||||
if (!IsInitialSuccess)
|
||||
{
|
||||
Debug.LogError($"{Tag} Please call <GuruSDK.Init()> first, before you call the log event api.");
|
||||
Debug.LogError($"{Tag} Please call <GuruSDK.Init()> first, before you call <LogLevelStart>.");
|
||||
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 <GuruSDK.Init()> first, before you call <LogLevelEnd>.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (InitConfig.AutoRecordFinishedLevels)
|
||||
{
|
||||
if(result == EventLevelEndSuccess) Model.SuccessLevelCount++; // 自动记录关卡完成次数
|
||||
|
|
@ -147,6 +166,11 @@ namespace Guru
|
|||
/// <param name="playerName"></param>
|
||||
public static void LogLevelUp(int playerLevel, string playerName)
|
||||
{
|
||||
if (!IsInitialSuccess)
|
||||
{
|
||||
Debug.LogError($"{Tag} Please call <GuruSDK.Init()> first, before you call <LogLevelUp>.");
|
||||
return;
|
||||
}
|
||||
Analytics.LevelUp(playerLevel, playerName);
|
||||
}
|
||||
|
||||
|
|
@ -156,6 +180,11 @@ namespace Guru
|
|||
/// <param name="achievementName"></param>
|
||||
public static void LogAchievement(string achievementName)
|
||||
{
|
||||
if (!IsInitialSuccess)
|
||||
{
|
||||
Debug.LogError($"{Tag} Please call <GuruSDK.Init()> first, before you call <LogAchievement>.");
|
||||
return;
|
||||
}
|
||||
Analytics.UnlockAchievement(achievementName);
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +198,14 @@ namespace Guru
|
|||
/// <param name="key"></param>
|
||||
/// <param name="value"></param>
|
||||
public static void SetUserProperty(string key, string value)
|
||||
=> Analytics.SetUserProperty(key, value);
|
||||
{
|
||||
if (!IsInitialSuccess)
|
||||
{
|
||||
Debug.LogError($"{Tag} Please call <GuruSDK.Init()> first, before you call <SetUserProperty>.");
|
||||
return;
|
||||
}
|
||||
Analytics.SetUserProperty(key, value);
|
||||
}
|
||||
|
||||
public static void SetUID(string uid)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue