/// <summary> /// GUI displayed when the user is authenticated but there is no match loaded /// </summary> private void authenticatedWithNoMatchLoadedGUI() { #if UNITY_IOS // iOS only if (GUILayout.Button("Register Device Token")) { if (NotificationServices.deviceToken != null) { GPGMultiplayer.registerDeviceToken(NotificationServices.deviceToken, false); } else { Debug.LogWarning("NotificationServices.deviceToken is null so we are not registering with Google"); } } #else // Android only if (GUILayout.Button("Check for Invites and Matches after Launch")) { GPGTurnBasedMultiplayer.checkForInvitesAndMatches(); } #endif GUILayout.Label("Match Creation and Management"); if (GUILayout.Button("Show Match Inbox")) { GPGTurnBasedMultiplayer.showInbox(); } if (GUILayout.Button("Show Player Selector")) { GPGTurnBasedMultiplayer.showPlayerSelector(1, 2); } if (GUILayout.Button("Create Match Programmatically")) { GPGTurnBasedMultiplayer.createMatchProgrammatically(1, 1, 0); } if (GUILayout.Button("Load All Matches")) { GPGTurnBasedMultiplayer.loadAllMatches(); } }
void OnGUI() { GUI.skin.label.alignment = TextAnchor.MiddleCenter; beginColumn(); // if there is no game in progress we show buttons to setup a room if (!_isGameInProgress) { if (GUILayout.Button("Authenticate")) { PlayGameServices.authenticate(); } #if UNITY_IOS if (GUILayout.Button("Register Device Token")) { if (NotificationServices.deviceToken != null) { GPGMultiplayer.registerDeviceToken(NotificationServices.deviceToken, false); } else { Debug.LogWarning("NotificationServices.deviceToken is null so we are not registering with Google"); } } #endif GUILayout.Label("Room Creation"); if (GUILayout.Button("Show Invitation Inbox")) { GPGMultiplayer.showInvitationInbox(); } if (GUILayout.Button("Start Quick Match")) { GPGMultiplayer.startQuickMatch(1, 1); } if (GUILayout.Button("Create Room Programmatically")) { GPGMultiplayer.createRoomProgrammatically(1, 1); } if (GUILayout.Button("Show Player Selector")) { GPGMultiplayer.showPlayerSelector(1, 1); } } else { GUILayout.Label("In Real-time Match"); if (GUILayout.Button("Send Unreliable Message to All")) { var bytes = System.Text.Encoding.UTF8.GetBytes("howdy. current time: " + System.DateTime.Now); GPGMultiplayer.sendUnreliableRealtimeMessageToAll(bytes); } if (GUILayout.Button("Get Room Participants")) { var participants = GPGMultiplayer.getParticipants(); Utils.logObject(participants); } if (GUILayout.Button("Leave Room")) { GPGMultiplayer.leaveRoom(); } GUILayout.Space(40); GUILayout.Label(_lastReceivedMessage); } endColumn(false); if (bottomLeftButton("Back to Standard Demo Scene")) { Application.LoadLevel("PlayGameServicesDemoScene"); } }