feat: use wx.createUserInfoButton to get weixin's avarta

This commit is contained in:
jakciehan
2026-05-14 22:41:32 +08:00
parent c4bd390478
commit 9359139186
13 changed files with 1181 additions and 184 deletions
+4 -2
View File
@@ -196,17 +196,19 @@ class NetworkManager {
return;
}
// Always include the player's current nickname (if any) so the server
// can propagate it to other clients. Falls back silently when the
// Always include the player's current nickname and avatarUrl so the server
// can propagate them to other clients. Falls back silently when the
// profile is not yet available.
const profile = (typeof GameGlobal !== 'undefined') ? GameGlobal.playerProfile : null;
const nickname = (profile && profile.nickname) ? profile.nickname : '';
const avatarUrl = (profile && profile.avatarUrl) ? profile.avatarUrl : '';
const message = JSON.stringify({
type,
data,
playerId: this._playerId,
nickname,
avatarUrl,
roomId: this._roomId,
timestamp: Date.now(),
});