| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | namespace Guru | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2024-03-20 07:40:22 +00:00
										 |  |  |  |     using System; | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |     using System.Collections.Generic; | 
					
						
							| 
									
										
										
										
											2024-01-08 02:22:56 +00:00
										 |  |  |  |     using UnityEngine; | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |      | 
					
						
							|  |  |  |  |     /// <summary> | 
					
						
							|  |  |  |  |     /// 打点管理 | 
					
						
							|  |  |  |  |     /// </summary> | 
					
						
							|  |  |  |  |     public partial class GuruSDK | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         #region 通用接口 | 
					
						
							| 
									
										
										
										
											2024-06-18 02:14:33 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 自定义事件打点 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="eventName"></param> | 
					
						
							|  |  |  |  |         /// <param name="data"></param> | 
					
						
							| 
									
										
										
										
											2024-06-18 02:14:33 +00:00
										 |  |  |  |         /// <param name="priority"></param> | 
					
						
							|  |  |  |  |         public static void LogEvent(string eventName, Dictionary<string, dynamic> data = null, int priority = -1) | 
					
						
							| 
									
										
										
										
											2024-01-08 03:31:58 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-06-18 02:14:33 +00:00
										 |  |  |  |             if(priority < 0) priority = GetEventPriorityInt(eventName); | 
					
						
							|  |  |  |  |             Analytics.Track(eventName, data, null, priority); | 
					
						
							| 
									
										
										
										
											2024-01-08 03:31:58 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static void SetScreen(string screen, string extra = "") | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsInitialSuccess) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-07-26 11:18:00 +00:00
										 |  |  |  |                 UnityEngine.Debug.LogWarning($"{Tag} :: SetScreen {screen} can not be set before SDK init!"); | 
					
						
							| 
									
										
										
										
											2024-01-08 03:31:58 +00:00
										 |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             Analytics.SetCurrentScreen(screen, extra); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  |          | 
					
						
							| 
									
										
										
										
											2024-08-07 14:10:22 +00:00
										 |  |  |  |         #region 设置用户属性 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 设置用户属性 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="key"></param> | 
					
						
							|  |  |  |  |         /// <param name="value"></param> | 
					
						
							|  |  |  |  |         public static void SetUserProperty(string key, string value) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Analytics.SetUserProperty(key, value); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-08-07 14:17:53 +00:00
										 |  |  |  |         public static void SetUID(string uid) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Analytics.SetUid(uid); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static void SetUserBLevel(int bLevel) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!InitConfig.AutoRecordFinishedLevels) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Model.SetBLevelValue(bLevel); | 
					
						
							|  |  |  |  |                 Analytics.BLevel = bLevel; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             Analytics.SetBLevel(bLevel); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         public static void SetUserBPlay(int bPlay) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!InitConfig.AutoRecordFinishedLevels) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Model.SetBPlayValue(bPlay); | 
					
						
							|  |  |  |  |                 Analytics.BPlay = bPlay; | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2024-08-07 14:36:07 +00:00
										 |  |  |  |             Analytics.SetBPlay(bPlay); | 
					
						
							| 
									
										
										
										
											2024-08-07 14:17:53 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 上报用户全部的 Coin (当前值) | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="coins"></param> | 
					
						
							|  |  |  |  |         public static void SetUserCoin(int coins) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             SetUserProperty(Consts.PropertyCoin, $"{coins}");         | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 上报用户免费金币的 数量 (累加值) | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="freeCoins"></param> | 
					
						
							|  |  |  |  |         public static void SetUserNonIapCoin(int freeCoins) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             SetUserProperty(Consts.PropertyNonIAPCoin, $"{freeCoins}");         | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 上报用户付费金币的 数量 (累加值) | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="paidCoins"></param> | 
					
						
							|  |  |  |  |         public static void SetUserIapCoin(int paidCoins) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             SetUserProperty(Consts.PropertyIAPCoin, $"{paidCoins}");         | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         public static void SetUserExp(int exp) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             SetUserProperty(Consts.PropertyExp, $"{exp}");         | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         public static void SetUserHp(int hp) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             SetUserProperty(Consts.PropertyHp, $"{hp}");         | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static void SetUserGrade(int grade) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             SetUserProperty(Consts.PropertyGrade, $"{grade}");         | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static void SetUserIsIAP(bool isIapUser) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Analytics.SetIsIapUser(isIapUser); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static void SetATTStatus(string status) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             Analytics.SetAttStatus(status); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |          | 
					
						
							| 
									
										
										
										
											2024-08-07 14:10:22 +00:00
										 |  |  |  |         #endregion | 
					
						
							|  |  |  |  |          | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         #region 游戏打点 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 游戏启动打点 (level_start) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							| 
									
										
										
										
											2024-05-15 01:58:22 +00:00
										 |  |  |  |         /// <param name="levelId">关卡Id</param> | 
					
						
							|  |  |  |  |         /// <param name="levelName">关卡名称: main_01_9001,  daily_challenge_81011</param> | 
					
						
							|  |  |  |  |         /// <param name="levelType">关卡类型: 主线:main</param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// <param name="itemId">配置/谜题/图片/自定义Id: 101120</param> | 
					
						
							| 
									
										
										
										
											2024-05-15 01:58:22 +00:00
										 |  |  |  |         /// <param name="startType">关卡开始类型: play:开始游戏;replay:重玩;continue:继续游戏</param> | 
					
						
							|  |  |  |  |         /// <param name="isReplay">是否重新开始: true/false</param> | 
					
						
							|  |  |  |  |         /// <param name="extra">扩展数据</param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         public static void LogLevelStart(int levelId, string startType = Consts.EventLevelStartModePlay,  | 
					
						
							|  |  |  |  |             string levelType = Consts.LevelTypeMain, string levelName = "", string itemId = "", | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             bool isReplay = false, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-01-08 02:22:56 +00:00
										 |  |  |  |             if (!IsInitialSuccess) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |                 Debug.LogError($"{Tag} :: LogLevelStart {levelId} :: Please call <GuruSDK.Start()> first, before you call <LogLevelStart>."); | 
					
						
							| 
									
										
										
										
											2024-01-08 02:22:56 +00:00
										 |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             Analytics.LogLevelStart(levelId, levelName, levelType, itemId, startType, isReplay, extra); | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 游戏点击 Continue 继续游戏 (level_start) (continue) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							| 
									
										
										
										
											2024-04-02 07:27:34 +00:00
										 |  |  |  |         /// <param name="levelId"></param> | 
					
						
							| 
									
										
										
										
											2024-05-13 09:20:45 +00:00
										 |  |  |  |         /// <param name="levelType"></param> | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         /// <param name="levelName"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// <param name="itemId"></param> | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         public static void LogLevelContinue(int levelId, string levelType = Consts.LevelTypeMain, | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             string levelName = "", string itemId = "", Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |             LogLevelStart(levelId, Consts.EventLevelStartModeContinue, levelType, levelName, itemId,  true, extra:extra); | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 游戏点击 Replay 重玩关卡 (level_start) (replay) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							| 
									
										
										
										
											2024-04-02 07:27:34 +00:00
										 |  |  |  |         /// <param name="levelId"></param> | 
					
						
							| 
									
										
										
										
											2024-05-13 09:20:45 +00:00
										 |  |  |  |         /// <param name="levelType"></param> | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         /// <param name="levelName"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// <param name="itemId"></param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         public static void LogLevelReplay(int levelId, string levelType = Consts.LevelTypeMain, | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             string levelName = "", string itemId = "", Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |             LogLevelStart(levelId, Consts.EventLevelStartModeReplay,levelType, levelName, itemId,  true, extra:extra); | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 关卡结束打点 (level_end) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							| 
									
										
										
										
											2024-05-15 01:58:22 +00:00
										 |  |  |  |         /// <param name="levelId">关卡Id</param> | 
					
						
							|  |  |  |  |         /// <param name="result">success:成功;fail:失败;exit:退出;timeout:超时;replay:重玩...</param> | 
					
						
							|  |  |  |  |         /// <param name="levelType">关卡类型: 主线:main</param> | 
					
						
							|  |  |  |  |         /// <param name="levelName">关卡名称: main_01_9001,  daily_challenge_81011</param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// <param name="itemId">配置/谜题/图片/自定义Id: 101120</param> | 
					
						
							| 
									
										
										
										
											2024-05-15 01:58:22 +00:00
										 |  |  |  |         /// <param name="duration">关卡完成时长(单位:毫秒)</param> | 
					
						
							|  |  |  |  |         /// <param name="step">步数(有则上报)</param> | 
					
						
							|  |  |  |  |         /// <param name="score">分数(有则上报)</param> | 
					
						
							|  |  |  |  |         /// <param name="extra">扩展数据</param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         public static void LogLevelEnd(int levelId, string result = Consts.EventLevelEndSuccess, | 
					
						
							|  |  |  |  |             string levelType = Consts.LevelTypeMain, string levelName = "", string itemId = "", | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             int duration = 0, int? step = null, int? score = null, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-01-08 03:31:58 +00:00
										 |  |  |  |             if (!IsInitialSuccess) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |                 Debug.LogError( | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |                     $"{Tag} :: LogLevelEnd {levelId} :: Please call <GuruSDK.Start()> first, before you call <LogLevelEnd>."); | 
					
						
							| 
									
										
										
										
											2024-01-08 03:31:58 +00:00
										 |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             // 优先打 level_end 事件 | 
					
						
							|  |  |  |  |             Analytics.LogLevelEnd(levelId, result, levelName, levelType, itemId, duration, step, score, extra); | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             // 自动记录关卡属性 | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |             if (InitConfig.AutoRecordFinishedLevels) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |                 if (result == Consts.EventLevelEndSuccess) | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2024-08-07 11:47:51 +00:00
										 |  |  |  |                     if (levelType.ToLower() == Consts.LevelTypeMain) | 
					
						
							| 
									
										
										
										
											2024-04-02 07:27:34 +00:00
										 |  |  |  |                     { | 
					
						
							| 
									
										
										
										
											2024-08-07 11:47:51 +00:00
										 |  |  |  |                         if (levelId >= Model.SuccessLevelId) Model.SuccessLevelId = levelId; // 自动记录关卡完成次数 | 
					
						
							| 
									
										
										
										
											2024-04-02 07:27:34 +00:00
										 |  |  |  |                     } | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-01-23 09:15:40 +00:00
										 |  |  |  |                     Model.TotalPlayedCount++; // 自动记录关卡总次数 | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |                     Analytics.LevelEndSuccess(Model.TotalPlayedCount); // 自动 level_end_success | 
					
						
							| 
									
										
										
										
											2024-01-23 09:15:40 +00:00
										 |  |  |  |                 } | 
					
						
							|  |  |  |  |                  | 
					
						
							| 
									
										
										
										
											2024-04-02 07:27:34 +00:00
										 |  |  |  |                 Analytics.BLevel = Model.SuccessLevelId; // 记录 BLevel | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |                 Analytics.BPlay = Model.TotalPlayedCount; // 记录 BPlay | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-05-13 09:20:45 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 关卡首次通关 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="levelType"></param> | 
					
						
							|  |  |  |  |         /// <param name="levelName"></param> | 
					
						
							|  |  |  |  |         /// <param name="level"></param> | 
					
						
							|  |  |  |  |         /// <param name="result"></param> | 
					
						
							|  |  |  |  |         /// <param name="duration"></param> | 
					
						
							|  |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogLevelFirstEnd(string levelType, string levelName, int level, | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |             string result = Consts.EventLevelEndSuccess, int duration = 0, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-05-13 09:20:45 +00:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             Analytics.LevelFirstEnd(levelType, levelName, level, result, duration, extra); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 关卡总胜利次数打点 (level_end_success_{num}) | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="bPlay">完成总关数累计值</param> | 
					
						
							|  |  |  |  |         /// /// <param name="extra">扩展参数</param> | 
					
						
							|  |  |  |  |         public static void LogLevelEndSuccess(int bPlay, Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (InitConfig.AutoRecordFinishedLevels) return; | 
					
						
							|  |  |  |  |             Analytics.LevelEndSuccess(bPlay, extra); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-05-13 09:20:45 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 游戏失败打点 (level_end) (fail) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// <param name="levelId"></param> | 
					
						
							|  |  |  |  |         /// <param name="levelType"></param> | 
					
						
							|  |  |  |  |         /// <param name="levelName"></param> | 
					
						
							|  |  |  |  |         /// <param name="itemId"></param> | 
					
						
							|  |  |  |  |         /// <param name="duration"></param> | 
					
						
							|  |  |  |  |         /// <param name="step"></param> | 
					
						
							|  |  |  |  |         /// <param name="score"></param> | 
					
						
							|  |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-04-02 07:27:34 +00:00
										 |  |  |  |         public static void LogLevelFail(int levelId, | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |             string levelType = Consts.LevelTypeMain, string levelName = "", string itemId = "", | 
					
						
							| 
									
										
										
										
											2024-05-29 13:00:43 +00:00
										 |  |  |  |             int duration = 0, int? step = null, int? score = null , Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |             LogLevelEnd(levelId, Consts.EventLevelEndFail, levelType, levelName, itemId, duration, step, score, extra); | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 游戏失败退出 (level_end) (exit)  | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// <param name="levelId"></param> | 
					
						
							|  |  |  |  |         /// <param name="levelType"></param> | 
					
						
							|  |  |  |  |         /// <param name="levelName"></param> | 
					
						
							|  |  |  |  |         /// <param name="itemId"></param> | 
					
						
							|  |  |  |  |         /// <param name="duration"></param> | 
					
						
							|  |  |  |  |         /// <param name="step"></param> | 
					
						
							|  |  |  |  |         /// <param name="score"></param> | 
					
						
							|  |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-04-02 07:27:34 +00:00
										 |  |  |  |         public static void LogLevelFailExit(int levelId, | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |             string levelType = Consts.LevelTypeMain, string levelName = "", string itemId = "", | 
					
						
							| 
									
										
										
										
											2024-05-29 13:00:43 +00:00
										 |  |  |  |             int duration = 0, int? step = null, int? score = null, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |             LogLevelEnd(levelId, Consts.EventLevelEndExit, levelType, levelName, itemId, duration, step, score, extra); | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 关卡超时失败 (level_end) (timeout)  | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// <param name="levelId"></param> | 
					
						
							|  |  |  |  |         /// <param name="levelType"></param> | 
					
						
							|  |  |  |  |         /// <param name="levelName"></param> | 
					
						
							|  |  |  |  |         /// <param name="itemId"></param> | 
					
						
							|  |  |  |  |         /// <param name="duration"></param> | 
					
						
							|  |  |  |  |         /// <param name="step"></param> | 
					
						
							|  |  |  |  |         /// <param name="score"></param> | 
					
						
							|  |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-04-02 07:27:34 +00:00
										 |  |  |  |         public static void LogLevelFailTimeout(int levelId, | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |             string levelType = Consts.LevelTypeMain, string levelName = "", string itemId = "", | 
					
						
							| 
									
										
										
										
											2024-05-29 13:00:43 +00:00
										 |  |  |  |             int duration = 0, int? step = null, int? score = null, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |             LogLevelEnd(levelId, Consts.EventLevelEndTimeout, levelType, levelName, itemId, duration, step, score, extra); | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 玩家(角色)升级事件 (level_up) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="playerLevel"></param> | 
					
						
							| 
									
										
										
										
											2024-05-22 10:09:17 +00:00
										 |  |  |  |         /// <param name="characterName"></param> | 
					
						
							| 
									
										
										
										
											2024-05-15 01:58:22 +00:00
										 |  |  |  |         /// <param name="extra">扩展数据</param> | 
					
						
							| 
									
										
										
										
											2024-05-22 10:09:17 +00:00
										 |  |  |  |         public static void LogLevelUp(int playerLevel, string characterName, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-01-08 03:31:58 +00:00
										 |  |  |  |             if (!IsInitialSuccess) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |                 Debug.LogError($"{Tag} :: LogLevelUp {playerLevel} :: Please call <GuruSDK.Start()> first, before you call <LogLevelUp>."); | 
					
						
							| 
									
										
										
										
											2024-01-08 03:31:58 +00:00
										 |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2024-05-22 10:09:17 +00:00
										 |  |  |  |             Analytics.LevelUp(playerLevel, characterName, extra); | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 玩家解锁成就 (unlock_achievement) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// <param name="achievementId"></param> | 
					
						
							| 
									
										
										
										
											2024-05-15 01:58:22 +00:00
										 |  |  |  |         /// <param name="extra">扩展数据</param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogAchievement(string achievementId, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-01-08 03:31:58 +00:00
										 |  |  |  |             if (!IsInitialSuccess) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |                 Debug.LogError($"{Tag} :: LogAchievement {achievementId} :: Please call <GuruSDK.Start()> first, before you call <LogAchievement>."); | 
					
						
							| 
									
										
										
										
											2024-01-08 03:31:58 +00:00
										 |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             Analytics.UnlockAchievement(achievementId, extra); | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 玩家体力变化 (hp_points) | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="scene">场景</param> | 
					
						
							|  |  |  |  |         /// <param name="hp">HP 增量值</param> | 
					
						
							|  |  |  |  |         /// <param name="hpBefore">HP 初始值</param> | 
					
						
							|  |  |  |  |         /// <param name="hpAfter">HP 结算值</param> | 
					
						
							|  |  |  |  |         /// <param name="extra">额外数据</param> | 
					
						
							|  |  |  |  |         public static void LogHpPoints(string scene, int hp, int hpBefore, int hpAfter, | 
					
						
							|  |  |  |  |             Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsInitialSuccess) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 UnityEngine.Debug.LogError( | 
					
						
							|  |  |  |  |                     $"{Tag} :: LogHpPoints {hp} :: Please call <GuruSDK.Start()> first, before you call <LogHpChanged>."); | 
					
						
							|  |  |  |  |                 return; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             var dict = new Dictionary<string, object>() | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 [Consts.ParameterItemCategory] = scene, | 
					
						
							|  |  |  |  |                 ["hp"] = hp, | 
					
						
							|  |  |  |  |                 ["hp_before"] = hpBefore, | 
					
						
							|  |  |  |  |                 ["hp_after"] = hpAfter, | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (extra != null) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 foreach (var k in extra.Keys) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     dict[k] = extra[k]; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             LogEvent(Consts.EventHpPoints, dict); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         #endregion | 
					
						
							|  |  |  |  |          | 
					
						
							| 
									
										
										
										
											2024-03-06 04:36:41 +00:00
										 |  |  |  |         #region SDK 打点 | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// Log SDK boost time | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="time"></param> | 
					
						
							|  |  |  |  |         private static void LogSDKInitTime(double time) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-04-09 10:54:37 +00:00
										 |  |  |  |             Analytics.Track(Consts.EventSDKInfo, new Dictionary<string, dynamic>() | 
					
						
							| 
									
										
										
										
											2024-03-06 04:36:41 +00:00
										 |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-05-11 03:34:51 +00:00
										 |  |  |  |                 { "boost_time", time.ToString("F6") }, | 
					
						
							| 
									
										
										
										
											2024-03-15 04:59:20 +00:00
										 |  |  |  |                 { Consts.PropertyDeviceID, DeviceId }, | 
					
						
							| 
									
										
										
										
											2024-07-26 06:38:55 +00:00
										 |  |  |  |                 { "version", Version}, | 
					
						
							|  |  |  |  |                 { "network", Instance.GetNetworkStatus()}, | 
					
						
							| 
									
										
										
										
											2024-03-15 04:59:20 +00:00
										 |  |  |  |             }, new Analytics.EventSetting() | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 EnableFirebaseAnalytics = true, | 
					
						
							|  |  |  |  |             }); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-08-07 03:08:17 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 获取 GuruSDK 实验分组 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public static string GetGuruExperimentGroupId() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!GuruAnalytics.IsReady) return "not_set"; | 
					
						
							|  |  |  |  |             return GuruAnalytics.Instance.ExperimentGroupId; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-13 09:20:45 +00:00
										 |  |  |  |         #region IAP 打点 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-22 10:09:17 +00:00
										 |  |  |  |         private static string TryGetFirstProductId() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (GuruSettings.Instance != null && (GuruSettings.Instance.Products?.Length ?? 0) > 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return GuruSettings.Instance.Products[0]?.ProductId ?? ""; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return ""; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         private static string TryGetCurrentProductId() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (GuruIAP.Instance != null && IsIAPReady) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return GuruIAP.Instance.CurrentBuyingProductId; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return ""; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-13 09:20:45 +00:00
										 |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 当付费页面打开时调用 (iap_imp) | 
					
						
							| 
									
										
										
										
											2024-05-13 09:20:45 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							| 
									
										
										
										
											2024-05-29 13:00:43 +00:00
										 |  |  |  |         /// <param name="scene">付费页场景名称</param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogIAPImp(string scene, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-05-13 09:20:45 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             Analytics.IAPImp(scene, extra); | 
					
						
							| 
									
										
										
										
											2024-05-13 09:20:45 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 当付费页面关闭时调用 (iap_close) | 
					
						
							| 
									
										
										
										
											2024-05-13 09:20:45 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="scene"></param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogIAPClose(string scene, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-05-13 09:20:45 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             Analytics.IAPClose(scene, extra); | 
					
						
							| 
									
										
										
										
											2024-05-13 09:20:45 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-22 10:09:17 +00:00
										 |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 当点击 IAP 商品按钮的时候调用 (iap_clk) | 
					
						
							| 
									
										
										
										
											2024-05-22 10:09:17 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="scene"></param> | 
					
						
							|  |  |  |  |         /// <param name="productId"></param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="basePlan"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// <param name="offerId"></param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogIAPClick(string scene, string productId, string basePlan = "", string offerId = "", Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-05-22 10:09:17 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             Analytics.IAPClick(scene, productId, basePlan, offerId, extra); | 
					
						
							| 
									
										
										
										
											2024-05-22 10:09:17 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							| 
									
										
										
										
											2024-05-13 09:20:45 +00:00
										 |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         #region 经济打点 | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         // ************************************************************************************************ | 
					
						
							|  |  |  |  |         // * | 
					
						
							|  |  |  |  |         // *                                        经济打点 | 
					
						
							|  |  |  |  |         // * 内容详参: https://docs.google.com/spreadsheets/d/1xYSsAjbrwqeJm7panoVzHO0PeGRQVDCR4e2CU9OPEzk/edit#gid=0 | 
					
						
							|  |  |  |  |         // * | 
					
						
							|  |  |  |  |         // ************************************************************************************************ | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         //---------------------------------------- EARN ----------------------------------------  | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 基础收入接口 (earn_virtual_currency) | 
					
						
							|  |  |  |  |         /// 可直接调用此接口上报相关参数 | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// 获取虚拟货币/道具.  | 
					
						
							|  |  |  |  |         /// 基础接口, 不推荐项目组直接调用 | 
					
						
							|  |  |  |  |         /// 请直接调用其他对应场景的统计接口 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							| 
									
										
										
										
											2024-05-15 01:58:22 +00:00
										 |  |  |  |         /// <param name="currencyName">货币名称</param> | 
					
						
							|  |  |  |  |         /// <param name="value">货币增加值 10</param> | 
					
						
							|  |  |  |  |         /// <param name="balance">结算后货币总量 20 -> 30</param> | 
					
						
							|  |  |  |  |         /// <param name="category">消耗类型, 默认值请赋 reward</param> | 
					
						
							|  |  |  |  |         /// <param name="levelName">当前关卡或者人物等级名称</param> | 
					
						
							|  |  |  |  |         /// <param name="itemName">购买道具名称</param> | 
					
						
							|  |  |  |  |         /// <param name="scene">购买场景如 Store, Workbench, Sign, Ads....</param> | 
					
						
							| 
									
										
										
										
											2024-06-24 02:17:26 +00:00
										 |  |  |  |         /// <param name="extra">自定义数据</param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogEarnVirtualCurrency(string currencyName,  | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |             int value, int balance,  | 
					
						
							|  |  |  |  |             string category = "", string itemName = "", | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             Analytics.EarnVirtualCurrency(currencyName, value, balance, category, itemName,levelName, scene, extra); | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							| 
									
										
										
										
											2024-06-24 02:17:26 +00:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 游戏初次启动/用户获得初始道具 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="currencyName">货币名称</param> | 
					
						
							|  |  |  |  |         /// <param name="value">货币增加值 10</param> | 
					
						
							|  |  |  |  |         /// <param name="balance">结算后货币总量 20 -> 30</param> | 
					
						
							|  |  |  |  |         /// <param name="levelName">购入道具 ID / 道具名称</param> | 
					
						
							|  |  |  |  |         /// <param name="scene">购买场景如 Store, Workbench, Sign, Ads....</param> | 
					
						
							|  |  |  |  |         /// <param name="extra">自定义数据</param> | 
					
						
							|  |  |  |  |         public static void LogEarnVirtualCurrencyByFirstOpen(string currencyName,  | 
					
						
							|  |  |  |  |             int value, int balance,  | 
					
						
							|  |  |  |  |             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string item_category = Consts.CurrencyCategoryReward; | 
					
						
							|  |  |  |  |             string item_name = "first_open"; | 
					
						
							|  |  |  |  |             Analytics.EarnVirtualCurrency(currencyName, value, balance, item_category, item_name,levelName, scene, extra); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 出售道具后获取货币 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="currencyName">货币名称</param> | 
					
						
							|  |  |  |  |         /// <param name="value">货币增加值 10</param> | 
					
						
							|  |  |  |  |         /// <param name="balance">结算后货币总量 20 -> 30</param> | 
					
						
							|  |  |  |  |         /// <param name="itemName">购买道具名称</param> | 
					
						
							|  |  |  |  |         /// <param name="levelName">当前关卡或者人物等级名称</param> | 
					
						
							|  |  |  |  |         /// <param name="scene">购买场景如 Store, Workbench, Sign, Ads....</param> | 
					
						
							|  |  |  |  |         /// <param name="extra">自定义数据</param> | 
					
						
							|  |  |  |  |         public static void LogEarnVirtualCurrencyBySellItem(string currencyName,  | 
					
						
							|  |  |  |  |             int value, int balance, string itemName, | 
					
						
							|  |  |  |  |             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string item_category = Consts.CurrencyCategoryIGC; | 
					
						
							|  |  |  |  |             Analytics.EarnVirtualCurrency(currencyName, value, balance, item_category, itemName,levelName, scene, extra); | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |          | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 赚取组合: 货币+道具 (earn_virtual_currency) (props) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							| 
									
										
										
										
											2024-06-24 02:17:26 +00:00
										 |  |  |  |         /// <param name="currencyName">货币名称</param> | 
					
						
							|  |  |  |  |         /// <param name="value">货币增加值 10</param> | 
					
						
							|  |  |  |  |         /// <param name="balance">结算后货币总量 20 -> 30</param> | 
					
						
							|  |  |  |  |         /// <param name="category">消耗类型, 默认值请赋 reward</param> | 
					
						
							|  |  |  |  |         /// <param name="itemName">购买道具名称</param> | 
					
						
							|  |  |  |  |         /// <param name="props">获取的道具组合</param> | 
					
						
							|  |  |  |  |         /// <param name="levelName">当前关卡或者人物等级名称</param> | 
					
						
							|  |  |  |  |         /// <param name="scene">购买场景如 Store, Workbench, Sign, Ads....</param> | 
					
						
							|  |  |  |  |         /// <param name="extra">自定义数据</param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         private static void LogEarnVirtualCurrencyAndProps(string currencyName,  | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |             int value = 0, int balance = 0, | 
					
						
							|  |  |  |  |             string category = "", string itemName = "", | 
					
						
							|  |  |  |  |             string levelName = "", string scene = Consts.ParameterDefaultScene,   | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             string[] props = null, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             //---- Currency ----- | 
					
						
							|  |  |  |  |             if (value > 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |                 LogEarnVirtualCurrency(currencyName, value, balance, category, itemName, levelName, scene, extra); | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |             } | 
					
						
							|  |  |  |  |             //---- Props -------- | 
					
						
							|  |  |  |  |             if (null != props) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 int i = 0; | 
					
						
							|  |  |  |  |                 while (i < props.Length) | 
					
						
							|  |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |                     LogEarnVirtualCurrency(props[i], 1, 0, category, itemName, levelName, scene, extra); | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |                     i++; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 签到奖励. 获得货币/道具 (earn_virtual_currency) (reward:sign) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// <li>通常类型: Coin 收入 </li> | 
					
						
							|  |  |  |  |         /// <li>特殊类型: Coin + Props (道具列表) </li> | 
					
						
							|  |  |  |  |         /// <li>特殊类型: Props (道具列表) </li> | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="currencyName">货币名称</param> | 
					
						
							|  |  |  |  |         /// <param name="value">赚取金额</param> | 
					
						
							|  |  |  |  |         /// <param name="balance">货币总量(累加后)</param> | 
					
						
							|  |  |  |  |         /// <param name="levelName">当前关卡名称</param> | 
					
						
							|  |  |  |  |         /// <param name="scene">应用场景</param> | 
					
						
							|  |  |  |  |         /// <param name="props">获取的道具名称列表</param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogEarnVirtualCurrencyBySign(string currencyName,  | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |             int value = 0, int balance = 0, string levelName = "",  | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             string scene = "home_page", string[] props = null, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             string category = Consts.CurrencyCategoryReward; | 
					
						
							|  |  |  |  |             string itemName = "sign"; | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             LogEarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// IAP 付费购买. 获得货币/道具 (earn_virtual_currency) (iap_buy:sku) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// <li>通常类型: Coin 收入 </li> | 
					
						
							|  |  |  |  |         /// <li>特殊类型: Coin + Props (道具列表) </li> | 
					
						
							|  |  |  |  |         /// <li>特殊类型: Props (道具列表) </li>  | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							| 
									
										
										
										
											2024-04-10 08:01:00 +00:00
										 |  |  |  |         /// <param name="currencyName">IAP 道具名称</param> | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// <param name="value">赚取金额</param> | 
					
						
							|  |  |  |  |         /// <param name="balance">货币总量(累加后)</param> | 
					
						
							|  |  |  |  |         /// <param name="levelName">当前关卡名称</param> | 
					
						
							|  |  |  |  |         /// <param name="scene">应用场景</param> | 
					
						
							|  |  |  |  |         /// <param name="props">获取的道具名称列表</param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-06-05 09:46:11 +00:00
										 |  |  |  |         public static void LogEarnVirtualCurrencyByIAP(string currencyName, | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |             int value = 0, int balance = 0, string levelName = "",  | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             string scene = "store", string[] props = null, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             string category = Consts.CurrencyCategoryIAP; | 
					
						
							| 
									
										
										
										
											2024-05-27 06:33:38 +00:00
										 |  |  |  |             // string itemName = productId; | 
					
						
							|  |  |  |  |             string itemName = "sku"; | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             LogEarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 看广告获取到货币/道具 (earn_virtual_currency) (reward:ads) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// <li>通常类型: Coin 收入 </li> | 
					
						
							|  |  |  |  |         /// <li>特殊类型: Coin + Props (道具列表) </li> | 
					
						
							|  |  |  |  |         /// <li>特殊类型: Props (道具列表) </li>  | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="currencyName">货币名称</param> | 
					
						
							|  |  |  |  |         /// <param name="value">赚取金额</param> | 
					
						
							|  |  |  |  |         /// <param name="balance">货币总量(累加后)</param> | 
					
						
							|  |  |  |  |         /// <param name="levelName">当前关卡名称</param> | 
					
						
							|  |  |  |  |         /// <param name="scene">应用场景</param> | 
					
						
							|  |  |  |  |         /// <param name="props">获取的道具名称列表</param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogEarnVirtualCurrencyByAds(string currencyName,  | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |             int value = 0, int balance = 0, string levelName = "",  | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             string scene = "store", string[] props = null, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             string category = Consts.CurrencyCategoryReward; | 
					
						
							|  |  |  |  |             string itemName = "ads"; | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             LogEarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 使用了金币半价 + 看广告获取到货币/道具 (earn_virtual_currency) (bonus:ads) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// <li>通常类型: Coin 收入 </li> | 
					
						
							|  |  |  |  |         /// <li>特殊类型: Coin + Props (道具列表) </li> | 
					
						
							|  |  |  |  |         /// <li>特殊类型: Props (道具列表) </li>  | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="currencyName">货币名称</param> | 
					
						
							|  |  |  |  |         /// <param name="value">赚取金额</param> | 
					
						
							|  |  |  |  |         /// <param name="balance">货币总量(累加后)</param> | 
					
						
							|  |  |  |  |         /// <param name="levelName">当前关卡名称</param> | 
					
						
							|  |  |  |  |         /// <param name="scene">应用场景</param> | 
					
						
							|  |  |  |  |         /// <param name="props">获取的道具名称列表</param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogEarnVirtualCurrencyByPaidAds(string currencyName,  | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |             int value = 0, int balance = 0, string levelName = "",  | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             string scene = Consts.ParameterDefaultScene, string[] props = null, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             string category = Consts.CurrencyCategoryBonus; | 
					
						
							|  |  |  |  |             string itemName = "ads"; | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             LogEarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 过关奖励获取到货币/道具 (earn_virtual_currency) (reward:level)  | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// <li>通常类型: Coin 收入 </li> | 
					
						
							|  |  |  |  |         /// <li>特殊类型: Coin + Props (道具列表) </li> | 
					
						
							|  |  |  |  |         /// <li>特殊类型: Props (道具列表) </li>  | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="currencyName">货币名称</param> | 
					
						
							|  |  |  |  |         /// <param name="value">赚取金额</param> | 
					
						
							|  |  |  |  |         /// <param name="balance">货币总量(累加后)</param> | 
					
						
							|  |  |  |  |         /// <param name="levelName">当前关卡名称</param> | 
					
						
							|  |  |  |  |         /// <param name="scene">应用场景</param> | 
					
						
							|  |  |  |  |         /// <param name="props">获取的道具名称列表</param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogEarnVirtualCurrencyByLevelComplete(string currencyName,  | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |             int value = 0, int balance = 0, string levelName = "",  | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             string scene = "store", string[] props = null, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             string category = Consts.CurrencyCategoryReward; | 
					
						
							|  |  |  |  |             string itemName = "level"; | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             LogEarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-06-27 09:41:05 +00:00
										 |  |  |  |         /// 购买获得 Prop (earn_virtual_currency) (reward:level)  | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 记录 Prop 增加的打点, 消费游戏内货币 | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							| 
									
										
										
										
											2024-06-27 09:41:05 +00:00
										 |  |  |  |         /// <param name="currencyName">购买的道具名称</param> | 
					
						
							|  |  |  |  |         /// <param name="spendCurrencyName">消费货币名称</param> | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// <param name="scene">应用场景</param> | 
					
						
							| 
									
										
										
										
											2024-06-27 09:41:05 +00:00
										 |  |  |  |         /// <param name="value">购入数量</param> | 
					
						
							|  |  |  |  |         /// <param name="balance">道具总量(累加后)</param> | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// <param name="levelName">当前关卡名称</param> | 
					
						
							| 
									
										
										
										
											2024-06-27 09:41:05 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							|  |  |  |  |         public static void LogEarnVirtualCurrencyByIGC(string currencyName, string spendCurrencyName, int value = 0, int balance = 0,  | 
					
						
							|  |  |  |  |             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             string category = Consts.CurrencyCategoryIGC; | 
					
						
							| 
									
										
										
										
											2024-06-27 09:41:05 +00:00
										 |  |  |  |             string itemName = spendCurrencyName; | 
					
						
							|  |  |  |  |             if (string.IsNullOrEmpty(scene)) scene = Consts.ParameterDefaultScene; | 
					
						
							|  |  |  |  |             LogEarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, null, extra); // TODO 这里的打点不对 | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 通过道具交换/合成或得了其他道具 (earn_virtual_currency) (igb:coin)  | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="propName"></param> | 
					
						
							| 
									
										
										
										
											2024-04-10 08:01:00 +00:00
										 |  |  |  |         /// <param name="otherName"></param> | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// <param name="scene"></param> | 
					
						
							|  |  |  |  |         /// <param name="value"></param> | 
					
						
							|  |  |  |  |         /// <param name="balance"></param> | 
					
						
							|  |  |  |  |         /// <param name="levelName"></param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogEarnPropByProp(string propName, string otherName, | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |             string scene = Consts.ParameterDefaultScene, | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             int value = 1, int balance = 0, string levelName = "", Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             string category = Consts.CurrencyCategoryIGB; | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             LogEarnVirtualCurrency(propName, value, balance, category, otherName, levelName, scene, extra); | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 通过转盘或者抽奖, 获取货币/道具 (earn_virtual_currency) (igb:lottery)  | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// <li>通常类型: Coin 收入 </li> | 
					
						
							|  |  |  |  |         /// <li>特殊类型: Coin + Props (道具列表) </li> | 
					
						
							|  |  |  |  |         /// <li>特殊类型: Props (道具列表) </li>  | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="currencyName">货币名称</param> | 
					
						
							|  |  |  |  |         /// <param name="value">赚取金额</param> | 
					
						
							|  |  |  |  |         /// <param name="balance">货币总量(累加后)</param> | 
					
						
							|  |  |  |  |         /// <param name="levelName">当前关卡名称</param> | 
					
						
							|  |  |  |  |         /// <param name="scene">应用场景</param> | 
					
						
							|  |  |  |  |         /// <param name="props">获取的道具名称列表</param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogEarnVirtualCurrencyByLottery(string currencyName,  | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |             int value = 0, int balance = 0, string levelName = "",  | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             string scene = "store", string[] props = null, Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             string category = Consts.CurrencyCategoryIGB; | 
					
						
							|  |  |  |  |             string itemName = "lottery"; | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             LogEarnVirtualCurrencyAndProps(currencyName, value, balance, category, itemName, levelName, scene, props, extra); | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |          | 
					
						
							| 
									
										
										
										
											2024-05-15 01:58:22 +00:00
										 |  |  |  |         //---------------------------------------- SPEND ----------------------------------------  | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 基础花费虚拟货币/道具 (spend_virtual_currency) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// 基础接口, 不推荐项目组直接调用 | 
					
						
							|  |  |  |  |         /// 请直接调用其他对应场景的统计接口 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							| 
									
										
										
										
											2024-05-15 01:58:22 +00:00
										 |  |  |  |         /// <param name="currencyName">货币名称</param> | 
					
						
							|  |  |  |  |         /// <param name="value">货币消耗值 10</param> | 
					
						
							|  |  |  |  |         /// <param name="balance">结算后货币总量 30 -> 20</param> | 
					
						
							|  |  |  |  |         /// <param name="category">消耗类型, 默认值请赋 reward</param> | 
					
						
							|  |  |  |  |         /// <param name="levelName">当前关卡或者人物等级名称</param> | 
					
						
							|  |  |  |  |         /// <param name="itemName">购买道具名称</param> | 
					
						
							|  |  |  |  |         /// <param name="scene">购买场景如 Store, Workbench, Sign, Ads....</param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogSpendVirtualCurrency(string currencyName, int value, int balance, string category = "", string itemName = "", | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             Analytics.SpendVirtualCurrency(currencyName, value, balance, category, itemName, levelName, scene, extra); | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-06-27 03:28:34 +00:00
										 |  |  |  |          | 
					
						
							| 
									
										
										
										
											2024-06-24 02:17:26 +00:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 消耗 Boost 道具 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="currencyName">货币/道具名称</param> | 
					
						
							|  |  |  |  |         /// <param name="value">货币消耗值 10</param> | 
					
						
							|  |  |  |  |         /// <param name="balance">结算后货币总量 30 -> 20</param> | 
					
						
							|  |  |  |  |         /// <param name="itemName"></param> | 
					
						
							|  |  |  |  |         /// <param name="levelName"></param> | 
					
						
							|  |  |  |  |         /// <param name="scene"></param> | 
					
						
							|  |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-06-27 03:28:34 +00:00
										 |  |  |  |         public static void LogSpendVirtualCurrencyAsBoost(string currencyName, int value, int balance, string itemName = "", | 
					
						
							| 
									
										
										
										
											2024-06-24 02:17:26 +00:00
										 |  |  |  |             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-06-27 03:28:34 +00:00
										 |  |  |  |             string category = Consts.CurrencyCategoryBoost; | 
					
						
							|  |  |  |  |             Analytics.SpendVirtualCurrency(currencyName, value, balance, category, itemName, levelName, scene, extra); | 
					
						
							| 
									
										
										
										
											2024-06-24 02:17:26 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 消耗货币购买道具 (spend_virtual_currency) (props) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="currencyName"></param> | 
					
						
							|  |  |  |  |         /// <param name="prop"></param> | 
					
						
							|  |  |  |  |         /// <param name="value"></param> | 
					
						
							|  |  |  |  |         /// <param name="balance"></param> | 
					
						
							|  |  |  |  |         /// <param name="levelName"></param> | 
					
						
							|  |  |  |  |         /// <param name="scene"></param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogSpendVirtualCurrencyWithProp(string currencyName, string prop, | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |             int value, int balance, | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-06-27 03:28:34 +00:00
										 |  |  |  |             string category = Consts.CurrencyCategoryProp; | 
					
						
							|  |  |  |  |             LogSpendVirtualCurrency(currencyName, value, balance, category, prop, levelName, scene, extra);  | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 消耗货币购买道具 (含多个) (spend_virtual_currency) (props) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="currencyName"></param> | 
					
						
							|  |  |  |  |         /// <param name="props"></param> | 
					
						
							|  |  |  |  |         /// <param name="value"></param> | 
					
						
							|  |  |  |  |         /// <param name="balance"></param> | 
					
						
							|  |  |  |  |         /// <param name="levelName"></param> | 
					
						
							|  |  |  |  |         /// <param name="scene"></param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogSpendVirtualCurrencyWithProps(string currencyName, string[] props, | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |             int value, int balance,  | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             string category = Consts.CurrencyCategoryProps; | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |             if (props != null && props.Length > 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 int i = 0; | 
					
						
							|  |  |  |  |                 while (i < props.Length) | 
					
						
							|  |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |                     LogSpendVirtualCurrency(currencyName, value, balance, category, props[i], levelName, scene, extra);  | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |                     i++; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 消耗货币购买礼包或组合 (spend_virtual_currency) (bundle) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="currencyName"></param> | 
					
						
							|  |  |  |  |         /// <param name="bundle"></param> | 
					
						
							|  |  |  |  |         /// <param name="value"></param> | 
					
						
							|  |  |  |  |         /// <param name="balance"></param> | 
					
						
							|  |  |  |  |         /// <param name="levelName"></param> | 
					
						
							|  |  |  |  |         /// <param name="scene"></param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogSpendVirtualCurrencyWithBundle(string currencyName, string bundle, | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |             int value, int balance, | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             LogSpendVirtualCurrencyWithBundles(currencyName, new string[] {bundle}, value, balance, levelName, scene, extra); | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 消耗货币购买礼包或组合 (复数) (spend_virtual_currency) (bundle) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="currencyName"></param> | 
					
						
							|  |  |  |  |         /// <param name="bundles"></param> | 
					
						
							|  |  |  |  |         /// <param name="value"></param> | 
					
						
							|  |  |  |  |         /// <param name="balance"></param> | 
					
						
							|  |  |  |  |         /// <param name="levelName"></param> | 
					
						
							|  |  |  |  |         /// <param name="scene"></param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogSpendVirtualCurrencyWithBundles(string currencyName, string[] bundles, | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |             int value, int balance,  | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             string levelName = "", string scene = "", Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             string category = Consts.CurrencyCategoryBundle; | 
					
						
							|  |  |  |  |             if (bundles != null && bundles.Length > 0) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 int i = 0; | 
					
						
							|  |  |  |  |                 while (i < bundles.Length) | 
					
						
							|  |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |                     LogSpendVirtualCurrency(currencyName, value, balance, category, bundles[i], levelName, scene, extra);  | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  |                     i++; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-04-10 08:01:00 +00:00
										 |  |  |  |         /// <summary> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         /// 消耗物品, 交换其他物品 (spend_virtual_currency) (prop) | 
					
						
							| 
									
										
										
										
											2024-04-10 08:01:00 +00:00
										 |  |  |  |         /// </summary> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="propName"></param> | 
					
						
							|  |  |  |  |         /// <param name="otherName"></param> | 
					
						
							| 
									
										
										
										
											2024-04-10 08:01:00 +00:00
										 |  |  |  |         /// <param name="value"></param> | 
					
						
							|  |  |  |  |         /// <param name="balance"></param> | 
					
						
							|  |  |  |  |         /// <param name="levelName"></param> | 
					
						
							|  |  |  |  |         /// <param name="scene"></param> | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |         /// <param name="extraCategory"></param> | 
					
						
							|  |  |  |  |         /// <param name="extra"></param> | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |         public static void LogSpendPropWithProp(string propName, string otherName, | 
					
						
							| 
									
										
										
										
											2024-04-10 08:01:00 +00:00
										 |  |  |  |             int value, int balance,  | 
					
						
							| 
									
										
										
										
											2024-05-11 06:19:11 +00:00
										 |  |  |  |             string levelName = "", string scene = "", string extraCategory = "", Dictionary<string, object> extra = null) | 
					
						
							| 
									
										
										
										
											2024-04-10 08:01:00 +00:00
										 |  |  |  |         { | 
					
						
							|  |  |  |  |             string category = string.IsNullOrEmpty(extraCategory) ? Consts.CurrencyCategoryProp : extraCategory; | 
					
						
							| 
									
										
										
										
											2024-05-30 12:53:50 +00:00
										 |  |  |  |             LogSpendVirtualCurrency(propName, value, balance, category, otherName, levelName, scene, extra);  | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region ATT 二次引导弹窗 | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// ATT 二次引导弹窗展示 (att_reguide_imp) | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="type">引导样式名称</param> | 
					
						
							|  |  |  |  |         /// <param name="showTimes">第几次展示</param> | 
					
						
							|  |  |  |  |         /// <param name="installDays">举例安装日期的天数</param> | 
					
						
							|  |  |  |  |         /// <param name="extra">扩展数据</param> | 
					
						
							|  |  |  |  |         public static void LogAttReguideImp(string type,  | 
					
						
							|  |  |  |  |             int showTimes = 1, int installDays = 0, Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var dict = new Dictionary<string, object>() | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ["type"] = type, | 
					
						
							|  |  |  |  |                 ["show_times"] = showTimes, | 
					
						
							|  |  |  |  |                 ["install_days"] = installDays, | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (extra != null) dict = GuruSDKUtils.MergeDictionary(dict, extra); | 
					
						
							|  |  |  |  |             LogEvent(Consts.EventAttReguideImp, dict); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// ATT 二次引导弹窗点击 (att_reguide_clk) | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="type">引导样式名称</param> | 
					
						
							|  |  |  |  |         /// <param name="showTimes">第几次展示</param> | 
					
						
							|  |  |  |  |         /// <param name="installDays">举例安装日期的天数</param> | 
					
						
							|  |  |  |  |         /// <param name="action">点击引导页的动作:dissmiss/go</param> | 
					
						
							|  |  |  |  |         /// <param name="extra">扩展数据</param> | 
					
						
							|  |  |  |  |         public static void LogAttReguideClick(string type, string action,  | 
					
						
							|  |  |  |  |             int showTimes = 1, int installDays = 0, Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var dict = new Dictionary<string, object>() | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ["type"] = type, | 
					
						
							|  |  |  |  |                 ["show_times"] = showTimes, | 
					
						
							|  |  |  |  |                 ["install_days"] = installDays, | 
					
						
							|  |  |  |  |                 ["action"] = action, | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (extra != null) dict = GuruSDKUtils.MergeDictionary(dict, extra); | 
					
						
							|  |  |  |  |             LogEvent(Consts.EventAttReguideClk, dict); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// ATT 二次引导弹窗展示结果 (att_reguide_result) | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="type">引导样式名称</param> | 
					
						
							|  |  |  |  |         /// <param name="showTimes">第几次展示</param> | 
					
						
							|  |  |  |  |         /// <param name="installDays">举例安装日期的天数</param> | 
					
						
							|  |  |  |  |         /// <param name="action">点击引导页的动作:dissmiss/go</param> | 
					
						
							|  |  |  |  |         /// <param name="result">结果字段:authorized, denied, restricted, notDetermined</param> | 
					
						
							|  |  |  |  |         /// <param name="extra">扩展数据</param> | 
					
						
							|  |  |  |  |         public static void LogAttReguideResult(string type, string action, string result,  | 
					
						
							|  |  |  |  |             int showTimes = 1, int installDays = 0, Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var dict = new Dictionary<string, object>() | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ["type"] = type, | 
					
						
							|  |  |  |  |                 ["show_times"] = showTimes, | 
					
						
							|  |  |  |  |                 ["install_days"] = installDays, | 
					
						
							|  |  |  |  |                 ["action"] = action, | 
					
						
							|  |  |  |  |                 [Consts.ParameterItemCategory] = result, | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (extra != null) dict = GuruSDKUtils.MergeDictionary(dict, extra); | 
					
						
							|  |  |  |  |             LogEvent(Consts.EventAttReguideResult, dict); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         #region 教程引导 | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 教程开始 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="extra">扩展数据</param> | 
					
						
							|  |  |  |  |         public static void LogTutorialBegin(Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             LogEvent(Consts.EventTutorialBegin, extra); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 教程开始 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="step">教程步骤</param> | 
					
						
							|  |  |  |  |         /// <param name="extra">扩展数据</param> | 
					
						
							|  |  |  |  |         public static void LogTutorialImp(int step, Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string key = Consts.EventTutorialImp.Replace("{0}", step.ToString()); | 
					
						
							|  |  |  |  |             LogEvent(key, extra); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 教程开始 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="step">教程步骤</param> | 
					
						
							|  |  |  |  |         /// <param name="extra">扩展数据</param> | 
					
						
							|  |  |  |  |         public static void LogTutorialNextClick(int step, Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             string key = Consts.EventTutorialNextClick.Replace("{0}", step.ToString()); | 
					
						
							|  |  |  |  |             LogEvent(key, extra); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 教程结束 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="extra">扩展数据</param> | 
					
						
							|  |  |  |  |         public static void LogTutorialComplete(Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             LogEvent(Consts.EventTutorialComplete, extra); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 教程页面关闭 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="extra">扩展数据</param> | 
					
						
							|  |  |  |  |         public static void LogTutorialClose(Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             LogEvent(Consts.EventTutorialClose, extra); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 消息权限弹窗打点 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 通知栏请求权限展示时触发 (noti_perm_imp) | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="style">弹窗样式</param> | 
					
						
							|  |  |  |  |         /// <param name="requestTimes">请求弹窗的次数</param> | 
					
						
							|  |  |  |  |         /// <param name="showTimes">展现弹窗的次数</param> | 
					
						
							|  |  |  |  |         /// <param name="deniedTimes">点击 deny 的次数</param> | 
					
						
							|  |  |  |  |         /// <param name="promptTrigger">弹窗触发来源</param> | 
					
						
							|  |  |  |  |         /// <param name="scene">弹窗场景</param> | 
					
						
							|  |  |  |  |         /// <param name="extra">扩展参数</param> | 
					
						
							|  |  |  |  |         public static void LogNotiPermImp(int requestTimes,  int showTimes, int deniedTimes, string promptTrigger,string style = "default",  string scene = "", Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var dict = new Dictionary<string, object>() | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 [Consts.ParameterItemCategory] = style, | 
					
						
							|  |  |  |  |                 ["request_times"] = requestTimes, | 
					
						
							|  |  |  |  |                 ["show_times"] = showTimes, | 
					
						
							|  |  |  |  |                 ["denied_times"] = deniedTimes, | 
					
						
							|  |  |  |  |                 ["prompt_trigger"] = promptTrigger, | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(scene)) | 
					
						
							|  |  |  |  |                 dict[Consts.ParameterItemName] = scene; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (extra != null) dict = GuruSDKUtils.MergeDictionary(dict, extra); | 
					
						
							|  |  |  |  |             LogEvent(Consts.EventNotiPermImp, dict); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 得到权限结果时触发 (noti_perm_result) | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="requestTimes"></param> | 
					
						
							|  |  |  |  |         /// <param name="showTimes"></param> | 
					
						
							|  |  |  |  |         /// <param name="deniedTimes"></param> | 
					
						
							|  |  |  |  |         /// <param name="result"></param> | 
					
						
							|  |  |  |  |         /// <param name="promptTrigger"></param> | 
					
						
							|  |  |  |  |         /// <param name="style"></param> | 
					
						
							|  |  |  |  |         /// <param name="scene"></param> | 
					
						
							|  |  |  |  |         /// <param name="extra"></param> | 
					
						
							|  |  |  |  |         public static void LogNotiPermResult( int requestTimes,  int showTimes, int deniedTimes, string result, string promptTrigger, string style = "default", string scene = "", Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var dict = new Dictionary<string, object>() | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ["request_times"] = requestTimes, | 
					
						
							|  |  |  |  |                 ["show_times"] = showTimes, | 
					
						
							|  |  |  |  |                 ["denied_times"] = deniedTimes, | 
					
						
							|  |  |  |  |                 ["prompt_trigger"] = promptTrigger, | 
					
						
							|  |  |  |  |                 ["result"] = result, | 
					
						
							|  |  |  |  |                 [Consts.ParameterItemCategory] = style, | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(scene)) | 
					
						
							|  |  |  |  |                 dict[Consts.ParameterItemName] = scene; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (extra != null) dict = GuruSDKUtils.MergeDictionary(dict, extra); | 
					
						
							|  |  |  |  |             LogEvent(Consts.EventNotiPermResult, dict); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 说明性通知栏权限引导展示时触发 (noti_perm_rationale_imp) | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="pageName">引导页的名称,自定义</param> | 
					
						
							|  |  |  |  |         /// <param name="scene"></param> | 
					
						
							|  |  |  |  |         /// <param name="extra"></param> | 
					
						
							|  |  |  |  |         public static void LogNotiPermRationaleImp(string pageName, string scene = "", Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var dict = new Dictionary<string, object>() | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 [Consts.ParameterItemCategory] = pageName, | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(scene)) | 
					
						
							|  |  |  |  |                 dict[Consts.ParameterItemName] = scene; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (extra != null) dict = GuruSDKUtils.MergeDictionary(dict, extra); | 
					
						
							|  |  |  |  |             LogEvent(Consts.EventNotiPermRationaleImp, dict); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 说明性通知栏权限引导结果时触发 (noti_perm_rationale_result) | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="result"></param> | 
					
						
							|  |  |  |  |         /// <param name="pageName"></param> | 
					
						
							|  |  |  |  |         /// <param name="scene"></param> | 
					
						
							|  |  |  |  |         /// <param name="extra"></param> | 
					
						
							|  |  |  |  |         public static void LogNotiPermRationaleResult(string result, string pageName, string scene = "", Dictionary<string, object> extra = null) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var dict = new Dictionary<string, object>() | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 ["result"] = result, | 
					
						
							|  |  |  |  |                 [Consts.ParameterItemCategory] = pageName, | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (!string.IsNullOrEmpty(scene)) | 
					
						
							|  |  |  |  |                 dict[Consts.ParameterItemName] = scene; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             if (extra != null) dict = GuruSDKUtils.MergeDictionary(dict, extra); | 
					
						
							|  |  |  |  |             LogEvent(Consts.EventNotiPermRationaleResult, dict); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 错误时间上报 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 上报错误事件 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="errorCode"></param> | 
					
						
							|  |  |  |  |         /// <param name="err"></param> | 
					
						
							|  |  |  |  |         /// <param name="country"></param> | 
					
						
							|  |  |  |  |         /// <param name="network"></param> | 
					
						
							|  |  |  |  |         public static void LogDevAudit(string errorCode, string err, string country = "", string network = "") | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             var dict = new Dictionary<string, object>() | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 [Consts.ParameterItemCategory] = "error_event", | 
					
						
							|  |  |  |  |                 [Consts.ParameterItemName] = errorCode, | 
					
						
							|  |  |  |  |                 ["err"] = err, | 
					
						
							|  |  |  |  |                 ["country"] = country, | 
					
						
							|  |  |  |  |                 ["network"] = network, | 
					
						
							|  |  |  |  |             }; | 
					
						
							|  |  |  |  |             LogEvent(Consts.EventDevAudit, dict); | 
					
						
							| 
									
										
										
										
											2024-04-10 08:01:00 +00:00
										 |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2024-04-10 06:08:49 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |         #endregion | 
					
						
							| 
									
										
										
										
											2024-05-29 13:00:43 +00:00
										 |  |  |  |          | 
					
						
							| 
									
										
										
										
											2024-03-20 07:40:22 +00:00
										 |  |  |  |         #region Crashlytics 接口 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static void CrashLog(string message) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsFirebaseReady) return; | 
					
						
							|  |  |  |  |             CrashlyticsAgent.Log(message); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         public static void CrashException(string message) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsFirebaseReady) return; | 
					
						
							|  |  |  |  |             CrashlyticsAgent.LogException(message); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static void CrashException(Exception ex) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsFirebaseReady) return; | 
					
						
							|  |  |  |  |             CrashlyticsAgent.LogException(ex); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static void CrashCustomKeys(string key, string value) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (!IsFirebaseReady) return; | 
					
						
							|  |  |  |  |             CrashlyticsAgent.SetCustomKey(key, value); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         #endregion | 
					
						
							| 
									
										
										
										
											2024-06-18 02:14:33 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         #region 优先级设置 | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 设置 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="priority"></param> | 
					
						
							|  |  |  |  |         /// <param name="eventNames"></param> | 
					
						
							|  |  |  |  |         public static void SetEventPriority(EventPriority priority, string[] eventNames) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-06-18 03:58:42 +00:00
										 |  |  |  |             if (Model.event_priorities == null) Model.event_priorities = new Dictionary<string, int>(10); | 
					
						
							| 
									
										
										
										
											2024-06-18 02:14:33 +00:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |             int i = 0; | 
					
						
							|  |  |  |  |             while (i < eventNames.Length) | 
					
						
							|  |  |  |  |             { | 
					
						
							| 
									
										
										
										
											2024-07-31 04:56:01 +00:00
										 |  |  |  |                 var evt = eventNames[i]; | 
					
						
							| 
									
										
										
										
											2024-06-18 02:14:33 +00:00
										 |  |  |  |                 if (!string.IsNullOrEmpty(evt)) | 
					
						
							|  |  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2024-06-18 03:58:42 +00:00
										 |  |  |  |                     Model.event_priorities[evt] = (int)priority; | 
					
						
							| 
									
										
										
										
											2024-06-18 02:14:33 +00:00
										 |  |  |  |                 } | 
					
						
							|  |  |  |  |                 i++; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static void SetEventPriority(EventPriority priority, string eventName) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             SetEventPriority(priority, new string[]{eventName}); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public static EventPriority GetEventPriority(string eventName) | 
					
						
							|  |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-06-18 03:58:42 +00:00
										 |  |  |  |             if (Model.event_priorities != null  | 
					
						
							|  |  |  |  |                 && Model.event_priorities.TryGetValue(eventName, out int p)) | 
					
						
							| 
									
										
										
										
											2024-06-18 02:14:33 +00:00
										 |  |  |  |             { | 
					
						
							|  |  |  |  |                 return (EventPriority)p; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return EventPriority.Default; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |          | 
					
						
							|  |  |  |  |         internal static int GetEventPriorityInt(string eventName) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             return (int)GetEventPriority(eventName); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-18 02:24:43 +00:00
										 |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// set all events as 'Emergence' event, which will be triggered immediately | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         internal void SetSDKEventPriority() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             SetEventPriority(EventPriority.Emergence, new [] | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 Consts.EventTchAdRev001Impression, | 
					
						
							|  |  |  |  |                 Consts.EventTchAdRev02Impression, | 
					
						
							|  |  |  |  |                 Consts.EventLevelStart, | 
					
						
							|  |  |  |  |                 Consts.EventLevelEnd, | 
					
						
							|  |  |  |  |             }); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-06-18 02:14:33 +00:00
										 |  |  |  |         #endregion | 
					
						
							| 
									
										
										
										
											2023-12-26 03:40:48 +00:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | } |