Sum*_*Pal 5 c# multiplayer unity-game-engine google-play-games
我在我的统一游戏中第一次尝试使用Google实时多人游戏。QuickMatch工作正常,我的意思是我可以使用以下方法获取连接的参与者的ID并将其存储到字符串中:
string MyId = PlayGamesPlatform.Instance.RealTime.GetSelf ().ParticipantId;
//string frndId = PlayGamesPlatform.Instance.RealTime.GetParticipant ();
//Get all opponent's ID
List<Participant> playerIDs = PlayGamesPlatform.Instance.RealTime.GetConnectedParticipants ();
if (MyId == playerIDs [0].ParticipantId) {
oppoUsarname = playerIDs [1].DisplayName.ToString ();
multiplayersName [1].text = "nothosting" + oppoUsarname;
gameHost = true;
OppoID = playerIDs [1].ParticipantId;
OppoDN = playerIDs [1].DisplayName.ToString ();
} else {
oppoUsarname = playerIDs [0].DisplayName.ToString ();
multiplayersName [1].text = "gamehoster" + oppoUsarname;
gameHost = false;
OppoID = playerIDs [0].ParticipantId;
OppoDN = playerIDs [0].DisplayName.ToString ();
}
Run Code Online (Sandbox Code Playgroud)
对手进入房间后,我可以展示他的表情displayname。但是因为CreateWithInvitationScreen我想获得被邀请者(我已经使用邀请屏幕邀请过的人)的ID,即使他们没有接受邀请或没有连接到会议室,也没有人可以告诉我该怎么做吗?
| 归档时间: |
|
| 查看次数: |
222 次 |
| 最近记录: |