Csharp/C#教程:Google Play游戏实时多人游戏:获取参与者ID并将其存储到字符串中分享


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,即使他们没有接受邀请或连接到房间……谁能告诉我怎么做?

上述就是C#学习教程:Google Play游戏实时多人游戏:获取参与者ID并将其存储到字符串中分享的全部内容,如果对大家有所用处且需要了解更多关于C#学习教程,希望大家多多关注—计算机技术网(www.ctvol.com)!

www.ctvol.com true Article Csharp/C#教程:Google Play游戏实时多人游戏:获取参与者ID并将其存储到字符串中分享

本文来自网络收集,不代表计算机技术网立场,如涉及侵权请联系管理员删除。

ctvol管理联系方式QQ:251552304

本文章地址:https://www.ctvol.com/cdevelopment/1251030.html

(0)
上一篇 2022年11月8日 上午9:33
下一篇 2022年11月8日 上午9:35

精彩推荐