且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

谷歌玩游戏服务与多人活动切换

更新时间:2023-01-01 11:10:41

所以,其中一个原因,我们写的所有谷歌玩游戏服务的样品为单活动游戏是因为活动之间的切换需要您从GamesClient断开并连接的新的活动一个新的。

So, one of the reasons we wrote all the Google Play game services samples as single-Activity games is because switching between Activities require you to disconnect from the GamesClient and connect a new one from the new Activity.

因此​​,使用碎片可能是去最简单的方法。它也pretty的清洁,可以让你,如果你想通过结合他们做平板电脑的布局。

So using Fragments is probably the easiest way to go about this. It's also pretty clean and allows you to make a tablet layout by combining them if you want to.

在特定的,如果你正在建立一个多人游戏,断开将断开的房间,所以你不能启动握手后切换到不同的活动: - )

In particular, if you are setting up a multiplayer game, disconnecting will disconnect you from the room, so you can't switch to a different Activity after starting the handshake :-)