我正在使用PUN构建多人游戏,一个房间中的两个玩家将彼此玩耍. 在播放时,如果播放器的网络看起来非常慢,则他/她会自动从Photon服务器断开连接. 我想给一个等待时间,以响应断开连接的玩家,同时他可以再次加入会议室并继续他的游戏.
I am building a multiplayer game using PUN where two player in a room will play with each other. While playing if network seems very slow of a player, he/she automatically disconnected from Photon server. I want to give a waiting time to respond the disconnected player and meanwhile he can again join the room and continue his game.
我该怎么做? 任何帮助都将受到高度赞赏. TIA
How can I do this? Any kind of help is highly appreciated. TIA
推荐答案PUN不支持基于Phtoon Turnbased的重新加入(保留了演员编号和玩家状态). 因此,您需要处理断开连接事件,然后以新播放器的身份重新连接,并使用断开连接的播放器的状态更新此播放器状态(有时可能很棘手).您可能会发现更容易将所有状态存储在房间属性中,并通过名称或userId在其中引用玩家.
PUN does not support rejoin as Phtoon Turnbased does (with actor number and player state preserved). So you need to handle disconnection event and reconnect again as a new player and update this player state with the state of disconnected player (that may be tricky sometimes). You may find easier to store all state in room properties and reference players there via name or userId.
更多推荐
如何使用PUN Unity3D将玩家重新加入房间?
发布评论