public override void OnLobbyDataUpdated(GalaxyID lobbyID, GalaxyID memberID) { Debug.Log("LobbyID: " + lobbyID + "\nMemberID: " + memberID); if (memberID.IsValid()) { if (matchmaking.IsCurrentUserLobbyOwner()) { matchmaking.SetLobbyData(lobbyID, "state", AllMembersReady(lobbyID) ? "ready" : "notReady"); } return; } GameObject.Find("OnlineWaitScreen").GetComponent <OnlineWaitController>().startGameButton.GetComponent <Button>(). interactable = (matchmaking.GetLobbyData(lobbyID, "state") == "ready" && matchmaking.IsCurrentUserLobbyOwner()); if (matchmaking.GetLobbyData(lobbyID, "state") == "steady") { Debug.Assert(matchmaking.GetLobbyMemberData(GalaxyManager.Instance.MyGalaxyID, "state") == "ready"); matchmaking.SetLobbyMemberData("state", "steady"); friends.SetRichPresence("connect", null); matchmaking.LobbyManagmentMainMenuListenersDispose(); matchmaking.LobbyManagmentInGameListenersInit(); SceneController.Instance.LoadScene(SceneController.SceneName.Online2PlayerGame, true); } }
void LobbyDataUpdatedSteady(GalaxyID lobbyID) { if (matchmaking.GetLobbyData(lobbyID, "state") == "steady") { Debug.Assert(matchmaking.GetLobbyMemberData(GalaxyManager.Instance.MyGalaxyID, "state") == "ready"); matchmaking.SetLobbyMemberData("state", "steady"); SceneController.Instance.LoadScene(SceneController.SceneName.Online2PlayerGame, true); matchmaking.ShutdownLobbyManagementMainMenu(); } }
bool AllMembersGo(GalaxyID lobbyID, GalaxyID memberID) { uint go = 0; // Check how many players are in game for (uint i = 0; i < 2; i++) { if (matchmaking.GetLobbyMemberData(matchmaking.GetLobbyMemberByIndex(lobbyID, i), "state") == "go") { go++; } } return((go == 2) ? true : false); }
bool AllMembersGo(GalaxyID lobbyID) { uint lobbyMembersCount = matchmaking.GetNumLobbyMembers(lobbyID); if (lobbyMembersCount < 2) { return(false); } for (uint i = 0; i < lobbyMembersCount; i++) { if (matchmaking.GetLobbyMemberData(matchmaking.GetLobbyMemberByIndex(lobbyID, i), "state") != "go") { return(false); } } return(true); }