Google Play游戏实时多人游戏:获取参与者ID并将其存储到字符串中
我在团结游戏中第一次尝试谷歌实时多人游戏。 QuickMatch
工作正常,我的意思是我能够获取连接参与者的ID并使用以下方法将其存储到字符串:
string MyId = PlayGamesPlatform.Instance.RealTime.GetSelf ().ParticipantId; //string frndId = PlayGamesPlatform.Instance.RealTime.GetParticipant (); //Get all opponent's ID List 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 (); }
在对手连接到房间后,我可以显示他的显示名称。 但是对于CreateWithInvitationScreen
我想获得邀请(我邀请使用邀请屏幕的人)参与者的ID,即使他们没有接受邀请或连接到房间……谁能告诉我怎么做?