update: 更新BeLevel 打点判定

feature/item_system
胡宇飞 2024-01-23 17:15:40 +08:00
parent 0bcda4f915
commit 5b3f2844a6
1 changed files with 18 additions and 9 deletions

View File

@ -9,6 +9,12 @@ namespace Guru
/// </summary> /// </summary>
public partial class GuruSDK public partial class GuruSDK
{ {
/// <summary>
/// 主线关卡类型
/// 只有传入此类型时才会进行 Blevel 的累加
/// </summary>
public const string LevelCategoryMain = "main";
//----------------- 关卡开始类型 --------------------- //----------------- 关卡开始类型 ---------------------
public const string EventLevelStartModePlay = "play"; public const string EventLevelStartModePlay = "play";
public const string EventLevelStartModeReplay = "replay"; public const string EventLevelStartModeReplay = "replay";
@ -60,7 +66,7 @@ namespace Guru
/// <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 level, string startType = EventLevelStartModePlay,
string levelCategory = "main", string levelName = "", string levelID = "", string levelCategory = LevelCategoryMain, string levelName = "", string levelID = "",
bool isReplay = false) bool isReplay = false)
{ {
if (!IsInitialSuccess) if (!IsInitialSuccess)
@ -79,7 +85,7 @@ namespace Guru
/// <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 = "main", public static void LogLevelContinue(int level, string levelCategory = LevelCategoryMain,
string levelName = "", string levelID = "") string levelName = "", string levelID = "")
{ {
LogLevelStart(level, EventLevelStartModeContinue, levelCategory, levelName, levelID, true); LogLevelStart(level, EventLevelStartModeContinue, levelCategory, levelName, levelID, true);
@ -92,7 +98,7 @@ namespace Guru
/// <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 = "main", public static void LogLevelReplay(int level, string levelCategory = LevelCategoryMain,
string levelName = "", string levelID = "") string levelName = "", string levelID = "")
{ {
LogLevelStart(level, EventLevelStartModeReplay,levelCategory, levelName, levelID, true); LogLevelStart(level, EventLevelStartModeReplay,levelCategory, levelName, levelID, true);
@ -102,7 +108,7 @@ namespace Guru
/// 游戏胜利打点 /// 游戏胜利打点
/// </summary> /// </summary>
public static void LogLevelEnd(int level, string result = EventLevelEndSuccess, public static void LogLevelEnd(int level, string result = EventLevelEndSuccess,
string levelCategory = "main", 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)
@ -114,8 +120,11 @@ namespace Guru
if (InitConfig.AutoRecordFinishedLevels) if (InitConfig.AutoRecordFinishedLevels)
{ {
if(result == EventLevelEndSuccess) Model.SuccessLevelCount++; // 自动记录关卡完成次数 if(result == EventLevelEndSuccess){
Model.TotalPlayedCount++; // 自动记录关卡总次数 if(levelCategory == LevelCategoryMain) Model.SuccessLevelCount++; // 自动记录关卡完成次数
Model.TotalPlayedCount++; // 自动记录关卡总次数
}
Analytics.BLevel = Model.SuccessLevelCount; // 记录 BLevel Analytics.BLevel = Model.SuccessLevelCount; // 记录 BLevel
Analytics.BPlay = Model.TotalPlayedCount; // 记录 BPlay Analytics.BPlay = Model.TotalPlayedCount; // 记录 BPlay
@ -132,7 +141,7 @@ namespace Guru
/// 需要为游戏记录详细的失败原因 /// 需要为游戏记录详细的失败原因
/// </summary> /// </summary>
public static void LogLevelFail(int level, public static void LogLevelFail(int level,
string levelCategory = "main",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(level, EventLevelEndFail, levelCategory, levelName, levelID, duration, step, score);
@ -142,7 +151,7 @@ namespace Guru
/// 因退出关卡导致游戏失败 /// 因退出关卡导致游戏失败
/// </summary> /// </summary>
public static void LogLevelFailExit(int level, public static void LogLevelFailExit(int level,
string levelCategory = "main", 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(level, EventLevelEndExit, levelCategory, levelName, levelID, duration, step, score);
@ -152,7 +161,7 @@ namespace Guru
/// 因关卡超时导致游戏失败 /// 因关卡超时导致游戏失败
/// </summary> /// </summary>
public static void LogLevelFailTimeout(int level, public static void LogLevelFailTimeout(int level,
string levelCategory = "main", 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(level, EventLevelEndTimeout, levelCategory, levelName, levelID, duration, step, score);