[英]How to detect if client intentionally left Room in Google Play Games Real-time Multiplayer?
Here is a multiplayer game and I need to display two notifications to player: first when rival disconnected due to some networking problems, and second - when he left game intentionally. 这是一个多人游戏,我需要向玩家显示两个通知:首先当竞争对手由于某些网络问题而断开连接时,第二个 - 当他故意离开游戏时。 Room is created with auto-match criteria (max players - 2).
使用自动匹配条件创建会议室(最多玩家 - 2)。 And each time when one of the players left game due to network problems or intentionally
RoomStatusUpdateListener
callbacks called in the next order: onDisconnectedFromRoom
, onPeerLeft
, onPeersDisconnected
. 并且每当其中一个玩家因网络问题离开游戏或故意在下一个顺序中调用
RoomStatusUpdateListener
回调: onDisconnectedFromRoom
, onPeerLeft
, onPeersDisconnected
。
So I show notification in onDisconnectedFromRoom
callback, the problem is you can't detect if it was network problem that happened to rival or he left intentionally. 所以我在
onDisconnectedFromRoom
回调中显示通知,问题是你无法检测是否是发生在竞争对手或他故意离开的网络问题。 Participant.getStatus()
returns STATUS_JOINED
. Participant.getStatus()
返回STATUS_JOINED
。
So, how to detect if client left room intentionally? 那么,如何检测客户是否故意离开房间?
Thank you in advance! 先感谢您!
you can send game data between the clients. 您可以在客户端之间发送游戏数据。 So just in case a player wants to left the game, send a message that this specific user will disconnect now to all other players.
因此,如果玩家想要离开游戏,请发送此特定用户现在将与所有其他玩家断开连接的消息。
best whishes, Steve. 最好的,史蒂夫。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.