Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Unity-Google Play Games Services close WaitingRoomUI()方法上的实时多人游戏?_Android_Unity3d_Google Play Games - Fatal编程技术网

Android Unity-Google Play Games Services close WaitingRoomUI()方法上的实时多人游戏?

Android Unity-Google Play Games Services close WaitingRoomUI()方法上的实时多人游戏?,android,unity3d,google-play-games,Android,Unity3d,Google Play Games,是否有一个方法在WaitingRoomUI关闭时执行 非常感谢您的帮助。因为候诊室正在使用startActivityForResult启动。您需要在启动等候室的活动的onActivityResult()方法中捕获结果 @Override public void onActivityResult(int request, int response, Intent intent) { if (request == RC_WAITING_ROOM) { if (resp

是否有一个方法在WaitingRoomUI关闭时执行


非常感谢您的帮助。

因为候诊室正在使用startActivityForResult启动。您需要在启动等候室的活动的onActivityResult()方法中捕获结果

@Override
public void onActivityResult(int request, int response, Intent intent)     {
    if (request == RC_WAITING_ROOM) {
        if (response == Activity.RESULT_OK) {
            // (start game)
        }
        else if (response == Activity.RESULT_CANCELED) {
        // Waiting room was dismissed with the back button. The meaning of this
        // action is up to the game. You may choose to leave the room and cancel the
        // match, or do something else like minimize the waiting room and
        // continue to connect in the background.

        // in this example, we take the simple approach and just leave the room:
        Games.RealTimeMultiplayer.leave(mGoogleApiClient, null, mRoomId);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }
    else if (response == GamesActivityResultCodes.RESULT_LEFT_ROOM) {
        // player wants to leave the room.
        Games.RealTimeMultiplayer.leave(mGoogleApiClient, null, mRoomId);
        getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    }
}
}

您可以在下面的链接中阅读完整的实现。