Esempio n. 1
0
        public static void JoinGame(Lobby lobby, bool requestData = true)
        {
            // Data not received
            if (requestData && String.IsNullOrEmpty(lobby.GetLobbyData(MyMultiplayer.AppVersionTag)))
            {
                var helper = new MyLobbyHelper(lobby);
                helper.OnSuccess += (l) => JoinGame(l, false);
                if (helper.RequestData())
                    return;
            }

            if (!JoinGameTest(lobby))
                return;

            if (MyMultiplayerLobby.GetLobbyScenario(lobby))
            {
                MyJoinGameHelper.JoinScenarioGame(lobby.LobbyId);
            }
            else if (MyFakes.ENABLE_BATTLE_SYSTEM && MyMultiplayerLobby.GetLobbyBattle(lobby))
            {
                bool canBeJoined = MyMultiplayerLobby.GetLobbyBattleCanBeJoined(lobby);
                // Check also valid faction ids in battle lobby.
                long faction1Id = MyMultiplayerLobby.GetLobbyBattleFaction1Id(lobby);
                long faction2Id = MyMultiplayerLobby.GetLobbyBattleFaction2Id(lobby);

                if (canBeJoined && faction1Id != 0 && faction2Id != 0)
                    MyJoinGameHelper.JoinBattleGame(lobby.LobbyId);
            }
            else
            {
                JoinGame(lobby.LobbyId);
            }
        }
        public static void JoinGame(Lobby lobby, bool requestData = true)
        {
            // Data not received
            if (requestData && String.IsNullOrEmpty(lobby.GetLobbyData(MyMultiplayer.AppVersionTag)))
            {
                var helper = new MyLobbyHelper(lobby);
                helper.OnSuccess += (l) => JoinGame(l, false);
                if (helper.RequestData())
                    return;
            }

            if (!JoinGameTest(lobby))
                return;

            JoinGame(lobby.LobbyId);
        }