Example #1
0
    private static void SteamMatchMaking_SteamLobbyDataUpdate(object sender, SteamLobbyDataUpdateEventArgs e)
    {
        PleaseWaitPanel.Instance.Hide(false);
        Diagnostics.Log("ELCP: LobbyDataUpdate, success? {0}, lobby {1}, expected {2}", new object[]
        {
            e.Message.m_bSuccess,
            e.Message.m_ulSteamIDLobby,
            ELCPUtilities.LobbyID
        });
        if (e.Message.m_bSuccess == 0 || ELCPUtilities.LobbyID != e.Message.m_ulSteamIDLobby)
        {
            return;
        }
        ISteamMatchMakingService service = Services.GetService <ISteamMatchMakingService>();

        Steamworks.SteamID steamID = new Steamworks.SteamID(ELCPUtilities.LobbyID);
        MenuJoinGameScreen.LobbyDescription lobbyDescription = new MenuJoinGameScreen.LobbyDescription(service, steamID);
        Diagnostics.Log("[Lobby] Flags: {0}, Lobby valid? {1}", new object[]
        {
            lobbyDescription.Flags,
            lobbyDescription.IsValid
        });
        service.SteamLobbyDataUpdate -= ELCPUtilities.SteamMatchMaking_SteamLobbyDataUpdate;
        ELCPUtilities.LobbyID         = 0UL;
        if (!lobbyDescription.IsValid)
        {
            return;
        }
        IRuntimeModuleSubscriptionService service2 = Services.GetService <IRuntimeModuleSubscriptionService>();

        if (service == null || service2 == null || !steamID.IsValid)
        {
            return;
        }
        string[] array  = new string[0];
        string[] array2 = new string[0];
        RuntimeModuleConfigurationState runtimeModuleListState = service2.GetRuntimeModuleListState(lobbyDescription.RuntimeConfiguration, out array, out array2);

        Diagnostics.Log("ELCP runtimeModuleConfigurationState {0} missingWorkshopItems {1} missingNonWorkshopItems {2} RuntimeConfiguration {3}", new object[]
        {
            runtimeModuleListState + 1,
            array.Length,
            array2.Length,
            (lobbyDescription.RuntimeConfiguration == null) ? -1 : lobbyDescription.RuntimeConfiguration.Length
        });
        switch (runtimeModuleListState + 1)
        {
        case RuntimeModuleConfigurationState.Yellow:
            Services.GetService <IRuntimeService>().Runtime.FiniteStateMachine.PostStateChange(typeof(RuntimeState_Lobby), new object[]
            {
                steamID
            });
            return;

        case RuntimeModuleConfigurationState.Red:
            ELCPUtilities.SelectedLobby = lobbyDescription;
            if (array.Length != 0)
            {
                string text = AgeLocalizer.Instance.LocalizeString("%ConfirmDownloadModsBeforeActivation");
                MessagePanel.Instance.Show(text.Replace("$NumberOfMods", array.Length.ToString()), "%Confirmation", MessagePanelButtons.OkCancel, new MessagePanel.EventHandler(ELCPUtilities.SteamMatchMaking_OnConfirmOpenActivationPanel), MessagePanelType.IMPORTANT, new MessagePanelButton[0]);
                return;
            }
            ELCPUtilities.SteamMatchMaking_OnConfirmOpenActivationPanel(Amplitude.Unity.Gui.GuiScreen.CurrentScreen, new MessagePanelResultEventArgs(MessagePanelResult.Ok));
            return;

        case (RuntimeModuleConfigurationState)3:
            ELCPUtilities.SelectedLobby = lobbyDescription;
            ELCPUtilities.SteamMatchMaking_OnConfirmOpenActivationPanel(Amplitude.Unity.Gui.GuiScreen.CurrentScreen, new MessagePanelResultEventArgs(MessagePanelResult.Ok));
            return;

        default:
            return;
        }
    }
Example #2
0
    private static void SteamMatchMaking_CallbackRequestLobbyList(object sender, SteamMatchMakingRequestLobbyListEventArgs e)
    {
        PleaseWaitPanel.Instance.Hide(false);
        Diagnostics.Log("ELCP: Request Lobby List : " + e.Message.m_nLobbiesMatching + " result(s).");
        ISteamMatchMakingService service = Services.GetService <ISteamMatchMakingService>();

        Steamworks.SteamID steamID = new Steamworks.SteamID(ELCPUtilities.LobbyID);
        Diagnostics.Log("ELCP: looking for lobby: " + steamID.AccountID);
        int num = 0;

        while ((long)num < (long)((ulong)e.Message.m_nLobbiesMatching))
        {
            Steamworks.SteamID lobbyByIndex = service.SteamMatchMaking.GetLobbyByIndex(num);
            Diagnostics.Log(string.Concat(new object[]
            {
                "ELCP: lobbybyindex: ",
                lobbyByIndex.AccountID,
                " ",
                lobbyByIndex.IsValid.ToString()
            }));
            if (lobbyByIndex.IsValid && steamID.AccountID == lobbyByIndex.AccountID)
            {
                MenuJoinGameScreen.LobbyDescription lobbyDescription = new MenuJoinGameScreen.LobbyDescription(service, lobbyByIndex);
                Diagnostics.Log("[Lobby] Flags: {0}, Lobby valid? {1}", new object[]
                {
                    lobbyDescription.Flags,
                    lobbyDescription.IsValid
                });
                if (!lobbyDescription.IsValid)
                {
                    break;
                }
                IRuntimeModuleSubscriptionService service2 = Services.GetService <IRuntimeModuleSubscriptionService>();
                if (service == null || service2 == null || !steamID.IsValid)
                {
                    break;
                }
                string[] array  = new string[0];
                string[] array2 = new string[0];
                RuntimeModuleConfigurationState runtimeModuleListState = service2.GetRuntimeModuleListState(lobbyDescription.RuntimeConfiguration, out array, out array2);
                Diagnostics.Log("ELCP runtimeModuleConfigurationState {0} missingWorkshopItems {1} missingNonWorkshopItems {2} RuntimeConfiguration {3}", new object[]
                {
                    runtimeModuleListState + 1,
                    array.Length,
                    array2.Length,
                    (lobbyDescription.RuntimeConfiguration == null) ? -1 : lobbyDescription.RuntimeConfiguration.Length
                });
                switch (runtimeModuleListState + 1)
                {
                case RuntimeModuleConfigurationState.Yellow:
                    Services.GetService <IRuntimeService>().Runtime.FiniteStateMachine.PostStateChange(typeof(RuntimeState_Lobby), new object[]
                    {
                        steamID
                    });
                    goto IL_28B;

                case RuntimeModuleConfigurationState.Red:
                    ELCPUtilities.SelectedLobby = lobbyDescription;
                    if (array.Length != 0)
                    {
                        string text = AgeLocalizer.Instance.LocalizeString("%ConfirmDownloadModsBeforeActivation");
                        MessagePanel.Instance.Show(text.Replace("$NumberOfMods", array.Length.ToString()), "%Confirmation", MessagePanelButtons.OkCancel, new MessagePanel.EventHandler(ELCPUtilities.SteamMatchMaking_OnConfirmOpenActivationPanel), MessagePanelType.IMPORTANT, new MessagePanelButton[0]);
                        goto IL_28B;
                    }
                    ELCPUtilities.SteamMatchMaking_OnConfirmOpenActivationPanel(Amplitude.Unity.Gui.GuiScreen.CurrentScreen, new MessagePanelResultEventArgs(MessagePanelResult.Ok));
                    goto IL_28B;

                case (RuntimeModuleConfigurationState)3:
                    ELCPUtilities.SelectedLobby = lobbyDescription;
                    ELCPUtilities.SteamMatchMaking_OnConfirmOpenActivationPanel(Amplitude.Unity.Gui.GuiScreen.CurrentScreen, new MessagePanelResultEventArgs(MessagePanelResult.Ok));
                    goto IL_28B;

                default:
                    goto IL_28B;
                }
            }
            else
            {
                num++;
            }
        }
IL_28B:
        service.SteamMatchMakingRequestLobbyList -= ELCPUtilities.SteamMatchMaking_CallbackRequestLobbyList;
        ELCPUtilities.LobbyID      = 0UL;
        ELCPUtilities.steamAPICall = 0UL;
    }