public void ReceiveInvitaion(Invitation invitation, bool shouldAutoAccept) { DataLogger.LogMessage("Received Invitation"); shouldAutoAccept = true; if (shouldAutoAccept) { isOnline = true; canPlay = false; searchingForGame = true; VC_MultiplayerMenuController.SetSearchingPanelState(true); gameInProgress = false; gameMode = invitation.Variant; if (gameMode == -1) { gameMode = 0; } PlayGamesPlatform.Instance.RealTime.AcceptInvitation(invitation.InvitationId, this); if (!showingWaitingRoom) { PlayGamesPlatform.Instance.RealTime.ShowWaitingRoomUI(); showingWaitingRoom = true; } } else { // The user has not yet indicated that they want to accept this invitation. // We should *not* automatically accept it. Rather we store it and // display an in-game popup: mIncomingInvitation = invitation; } }
public void GetInvitationMatch(int GameVariant) { if (canPlay) { isOnline = true; canPlay = false; searchingForGame = true; VC_MultiplayerMenuController.SetSearchingPanelState(true); gameInProgress = false; DataLogger.LogMessage("Initiating Invitation"); PlayGamesPlatform.Instance.RealTime.ShowWaitingRoomUI(); //sInstance = new MultiPlayerConnect(); //const int MinOpponents = 1, MaxOpponents = 1; try { gameMode = GameVariant; PlayGamesPlatform.Instance.RealTime.CreateWithInvitationScreen((uint)(playerCount - 1), (uint)(playerCount - 1), (uint)GameVariant, this); if (!showingWaitingRoom) { PlayGamesPlatform.Instance.RealTime.ShowWaitingRoomUI(); showingWaitingRoom = true; } } catch { DataLogger.LogMessage("Invitation Failed"); canPlay = true; } //DataLogger.LogMessage("Searching for Room"; } VC_MultiplayerMenuController.s.UpdateMenu(); }
public void OnRoomConnected(bool success) { DataLogger.LogMessage("OnRoomConnected"); if (success) { gameInProgress = true; searchingForGame = false; VC_MultiplayerMenuController.SetSearchingPanelState(true); DataLogger.LogMessage("Room Connection Successful"); participants = GetParticipants(); SceneMaster.s.LoadPlayingLevel(gameMode); } else { DataLogger.LogMessage("Room Connection Failure"); PlayGamesPlatform.Instance.RealTime.LeaveRoom(); } }
public void OnLeftRoom() { DataLogger.LogMessage("Left Room"); showingWaitingRoom = false; canPlay = true; if (SceneMaster.GetSceneID() != SceneMaster.menuId) { if (GameObjectiveMaster.s != null) { GameObjectiveMaster.s.DisconnectedFromGame(); } else { SceneMaster.s.LoadMenu(); } } else { VC_MultiplayerMenuController.SetSearchingPanelState(false); } searchingForGame = false; // display error message and go back to the menu screen gameInProgress = false; if (PlayGamesPlatform.Instance != null) { if (PlayGamesPlatform.Instance.localUser.authenticated) { canPlay = true; } //Login (); //MultiplayerMenuController.s.UpdateMenu (); } // (do NOT call PlayGamesPlatform.Instance.RealTime.LeaveRoom() here -- // you have already left the room!) }
void Update() { s = this; }
void Start() { s = this; searchingGamePanel.SetActive(false); }
void OnSceneWasLoaded() { s = this; }