Skip to content

Commit 1bd8ddd

Browse files
committed
[增加]1. 增加设置玩家ID的接口
1 parent 54b98b1 commit 1bd8ddd

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

Runtime/GameAnalytics/BaseGameAnalyticsManager.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,11 @@ public bool IsInit()
112112
/// <param name="eventValue">事件数值</param>
113113
/// <param name="customF">自定义字段</param>
114114
public abstract void Event(string eventName, float eventValue, Dictionary<string, object> customF);
115+
116+
/// <summary>
117+
/// 设置玩家ID
118+
/// </summary>
119+
/// <param name="playerId">玩家ID</param>
120+
public abstract void SetPlayerId(string playerId);
115121
}
116122
}

Runtime/GameAnalytics/GameAnalyticsComponent.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ private void OnEnable()
2929
Init();
3030
}
3131

32+
/// <summary>
33+
/// 设置玩家ID
34+
/// </summary>
35+
/// <param name="playerId">玩家ID</param>
36+
public void SetPlayerId(string playerId)
37+
{
38+
foreach (var gameAnalyticsManager in m_GameAnalyticsManager)
39+
{
40+
gameAnalyticsManager.SetPlayerId(playerId);
41+
}
42+
}
43+
3244
/// <summary>
3345
/// 初始化
3446
/// </summary>

Runtime/GameAnalytics/IGameAnalyticsManager.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,11 @@ public interface IGameAnalyticsManager
9696
/// <param name="eventValue">事件数值</param>
9797
/// <param name="customF">自定义字段</param>
9898
void Event(string eventName, float eventValue, Dictionary<string, object> customF);
99+
100+
/// <summary>
101+
/// 设置玩家ID
102+
/// </summary>
103+
/// <param name="playerId">玩家ID</param>
104+
void SetPlayerId(string playerId);
99105
}
100106
}

0 commit comments

Comments
 (0)