fix: 修复 b_level 累加的问题, 目前完成关卡只会计算最高的 LevelId 作为 b_level 的数据
parent
311b53ea5f
commit
93935f87c4
|
|
@ -7,7 +7,7 @@ namespace Guru
|
||||||
/// 获取BLevel
|
/// 获取BLevel
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
protected override int GetBLevel() => GuruSDKModel.Instance.SuccessLevelCount; // BLevel
|
protected override int GetBLevel() => GuruSDKModel.Instance.SuccessLevelId; // BLevel
|
||||||
|
|
||||||
protected override void OnPurchaseOver(bool success, string productName)
|
protected override void OnPurchaseOver(bool success, string productName)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ namespace Guru
|
||||||
|
|
||||||
private float _lastSavedTime = 0;
|
private float _lastSavedTime = 0;
|
||||||
|
|
||||||
public int SuccessLevelCount
|
public int SuccessLevelId
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -62,78 +62,80 @@ namespace Guru
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 游戏启动打点
|
/// 游戏启动打点
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level"></param>
|
/// <param name="levelId"></param>
|
||||||
/// <param name="levelName"></param>
|
/// <param name="levelName"></param>
|
||||||
/// <param name="levelCategory"></param>
|
/// <param name="levelCategory"></param>
|
||||||
/// <param name="levelID"></param>
|
/// <param name="levelID"></param>
|
||||||
/// <param name="startType"></param>
|
/// <param name="startType"></param>
|
||||||
/// <param name="isReplay"></param>
|
/// <param name="isReplay"></param>
|
||||||
public static void LogLevelStart(int level, string startType = EventLevelStartModePlay,
|
public static void LogLevelStart(int levelId, string startType = EventLevelStartModePlay,
|
||||||
string levelCategory = LevelCategoryMain, string levelName = "", string levelID = "",
|
string levelCategory = LevelCategoryMain, string levelName = "", string levelID = "",
|
||||||
bool isReplay = false)
|
bool isReplay = false)
|
||||||
{
|
{
|
||||||
if (!IsInitialSuccess)
|
if (!IsInitialSuccess)
|
||||||
{
|
{
|
||||||
Debug.LogError($"{Tag} :: LogLevelStart {level} :: Please call <GuruSDK.Init()> first, before you call <LogLevelStart>.");
|
Debug.LogError($"{Tag} :: LogLevelStart {levelId} :: Please call <GuruSDK.Init()> first, before you call <LogLevelStart>.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Analytics.LogLevelStart(level, levelName, levelCategory, levelID, startType, isReplay);
|
Analytics.LogLevelStart(levelId, levelName, levelCategory, levelID, startType, isReplay);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 游戏点击 Continue 重开始游戏
|
/// 游戏点击 Continue 重开始游戏
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level"></param>
|
/// <param name="levelId"></param>
|
||||||
/// <param name="levelCategory"></param>
|
/// <param name="levelCategory"></param>
|
||||||
/// <param name="levelName"></param>
|
/// <param name="levelName"></param>
|
||||||
/// <param name="levelID"></param>
|
/// <param name="levelID"></param>
|
||||||
public static void LogLevelContinue(int level, string levelCategory = LevelCategoryMain,
|
public static void LogLevelContinue(int levelId, string levelCategory = LevelCategoryMain,
|
||||||
string levelName = "", string levelID = "")
|
string levelName = "", string levelID = "")
|
||||||
{
|
{
|
||||||
LogLevelStart(level, EventLevelStartModeContinue, levelCategory, levelName, levelID, true);
|
LogLevelStart(levelId, EventLevelStartModeContinue, levelCategory, levelName, levelID, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 游戏点击 Continue 重开始游戏
|
/// 游戏点击 Continue 重开始游戏
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="level"></param>
|
/// <param name="levelId"></param>
|
||||||
/// <param name="levelCategory"></param>
|
/// <param name="levelCategory"></param>
|
||||||
/// <param name="levelName"></param>
|
/// <param name="levelName"></param>
|
||||||
/// <param name="levelID"></param>
|
/// <param name="levelID"></param>
|
||||||
public static void LogLevelReplay(int level, string levelCategory = LevelCategoryMain,
|
public static void LogLevelReplay(int levelId, string levelCategory = LevelCategoryMain,
|
||||||
string levelName = "", string levelID = "")
|
string levelName = "", string levelID = "")
|
||||||
{
|
{
|
||||||
LogLevelStart(level, EventLevelStartModeReplay,levelCategory, levelName, levelID, true);
|
LogLevelStart(levelId, EventLevelStartModeReplay,levelCategory, levelName, levelID, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 游戏胜利打点
|
/// 游戏胜利打点
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void LogLevelEnd(int level, string result = EventLevelEndSuccess,
|
public static void LogLevelEnd(int levelId, string result = EventLevelEndSuccess,
|
||||||
string levelCategory = LevelCategoryMain, string levelName = "", string levelID = "",
|
string levelCategory = LevelCategoryMain, string levelName = "", string levelID = "",
|
||||||
int? duration = null, int? step = null, int? score = null )
|
int? duration = null, int? step = null, int? score = null )
|
||||||
{
|
{
|
||||||
if (!IsInitialSuccess)
|
if (!IsInitialSuccess)
|
||||||
{
|
{
|
||||||
Debug.LogError($"{Tag} :: LogLevelEnd {level} :: Please call <GuruSDK.Init()> first, before you call <LogLevelEnd>.");
|
Debug.LogError($"{Tag} :: LogLevelEnd {levelId} :: Please call <GuruSDK.Init()> first, before you call <LogLevelEnd>.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (InitConfig.AutoRecordFinishedLevels)
|
if (InitConfig.AutoRecordFinishedLevels)
|
||||||
{
|
{
|
||||||
if(result == EventLevelEndSuccess){
|
if(result == EventLevelEndSuccess){
|
||||||
if(levelCategory == LevelCategoryMain) Model.SuccessLevelCount++; // 自动记录关卡完成次数
|
if(levelCategory == LevelCategoryMain)
|
||||||
|
{
|
||||||
|
if (levelId > Model.SuccessLevelId) Model.SuccessLevelId = levelId; // 自动记录关卡完成次数
|
||||||
|
}
|
||||||
Model.TotalPlayedCount++; // 自动记录关卡总次数
|
Model.TotalPlayedCount++; // 自动记录关卡总次数
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Analytics.BLevel = Model.SuccessLevelCount; // 记录 BLevel
|
Analytics.BLevel = Model.SuccessLevelId; // 记录 BLevel
|
||||||
Analytics.BPlay = Model.TotalPlayedCount; // 记录 BPlay
|
Analytics.BPlay = Model.TotalPlayedCount; // 记录 BPlay
|
||||||
}
|
}
|
||||||
|
|
||||||
Analytics.LogLevelEnd(level, result,
|
Analytics.LogLevelEnd(levelId, result,
|
||||||
levelName, levelCategory, levelCategory,
|
levelName, levelCategory, levelCategory,
|
||||||
duration, step, score);
|
duration, step, score);
|
||||||
}
|
}
|
||||||
|
|
@ -143,31 +145,31 @@ namespace Guru
|
||||||
/// 游戏失败打点
|
/// 游戏失败打点
|
||||||
/// 需要为游戏记录详细的失败原因
|
/// 需要为游戏记录详细的失败原因
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void LogLevelFail(int level,
|
public static void LogLevelFail(int levelId,
|
||||||
string levelCategory = LevelCategoryMain, string levelName = "", string levelID = "",
|
string levelCategory = LevelCategoryMain, string levelName = "", string levelID = "",
|
||||||
int? duration = null, int? step = null, int? score = null )
|
int? duration = null, int? step = null, int? score = null )
|
||||||
{
|
{
|
||||||
LogLevelEnd(level, EventLevelEndFail, levelCategory, levelName, levelID, duration, step, score);
|
LogLevelEnd(levelId, EventLevelEndFail, levelCategory, levelName, levelID, duration, step, score);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 因退出关卡导致游戏失败
|
/// 因退出关卡导致游戏失败
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void LogLevelFailExit(int level,
|
public static void LogLevelFailExit(int levelId,
|
||||||
string levelCategory = LevelCategoryMain, string levelName = "", string levelID = "",
|
string levelCategory = LevelCategoryMain, string levelName = "", string levelID = "",
|
||||||
int? duration = null, int? step = null, int? score = null)
|
int? duration = null, int? step = null, int? score = null)
|
||||||
{
|
{
|
||||||
LogLevelEnd(level, EventLevelEndExit, levelCategory, levelName, levelID, duration, step, score);
|
LogLevelEnd(levelId, EventLevelEndExit, levelCategory, levelName, levelID, duration, step, score);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 因关卡超时导致游戏失败
|
/// 因关卡超时导致游戏失败
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void LogLevelFailTimeout(int level,
|
public static void LogLevelFailTimeout(int levelId,
|
||||||
string levelCategory = LevelCategoryMain, string levelName = "", string levelID = "",
|
string levelCategory = LevelCategoryMain, string levelName = "", string levelID = "",
|
||||||
int? duration = null, int? step = null, int? score = null)
|
int? duration = null, int? step = null, int? score = null)
|
||||||
{
|
{
|
||||||
LogLevelEnd(level, EventLevelEndTimeout, levelCategory, levelName, levelID, duration, step, score);
|
LogLevelEnd(levelId, EventLevelEndTimeout, levelCategory, levelName, levelID, duration, step, score);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,8 +64,8 @@ namespace Guru
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static int SuccessLevelCount
|
public static int SuccessLevelCount
|
||||||
{
|
{
|
||||||
get => GuruSDKModel.Instance.SuccessLevelCount;
|
get => GuruSDKModel.Instance.SuccessLevelId;
|
||||||
set => GuruSDKModel.Instance.SuccessLevelCount = value;
|
set => GuruSDKModel.Instance.SuccessLevelId = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
|
|
@ -318,11 +318,11 @@ namespace Guru
|
||||||
|
|
||||||
if (useKeywords)
|
if (useKeywords)
|
||||||
{
|
{
|
||||||
// KeywordsManager.Install(Model.IsIAPUser, Model.SuccessLevelCount); // 启动Keyword管理器
|
// KeywordsManager.Install(Model.IsIAPUser, Model.SuccessLevelId); // 启动Keyword管理器
|
||||||
Try(() =>
|
Try(() =>
|
||||||
{
|
{
|
||||||
LogI($"#4.4 --- Init Keywords ---");
|
LogI($"#4.4 --- Init Keywords ---");
|
||||||
KeywordsManager.Install(Model.IsIAPUser, Model.SuccessLevelCount); // 启动Keyword管理器
|
KeywordsManager.Install(Model.IsIAPUser, Model.SuccessLevelId); // 启动Keyword管理器
|
||||||
}, ex =>
|
}, ex =>
|
||||||
{
|
{
|
||||||
Debug.LogError($"--- ERROR on Keywords: {ex.Message}");
|
Debug.LogError($"--- ERROR on Keywords: {ex.Message}");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue