gpt4 book ai didi

android - Google Real Time Multiplayer 玩家名称

转载 作者:行者123 更新时间:2023-11-30 02:44:59 26 4
gpt4 key购买 nike

创建房间和自动匹配时一切正常,但问题是当我调用 p.getDisplayName() 时,在这段代码中它不返回对手名称,而是返回一些垃圾字母..

      void updatePeerScoresDisplay() {
((TextView) findViewById(R.id.score0)).setText(formatScore(mScore) + " - Me");
int[] arr = {
R.id.score1, R.id.score2, R.id.score3
};
int i = 0;

if (mRoomId != null) {
for (Participant p : mParticipants) {
String pid = p.getParticipantId();
if (pid.equals(mMyId))
continue;
if (p.getStatus() != Participant.STATUS_JOINED)
continue;


int score = mParticipantScore.containsKey(pid) ? mParticipantScore.get(pid) : 0;
((TextView) findViewById(arr[i])).setText(formatScore(score) + " - "+
p.getDisplayName());
++i;
}
}

最佳答案

它返回类似 Player234 的内容,它不会返回玩家的名字,即使他/她在您的圈子中(正如我所经历的)。这就是随机对手比赛的意义所在。

google play game realtime multiplayer how to get quickmatch player's name?

关于android - Google Real Time Multiplayer 玩家名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25219448/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com