Esempio n. 1
0
    private void SetupGameSessionLine(AgeTransform tableItem, MenuJoinGameScreen.LobbyDescription lobbyDescription, int index)
    {
        MenuOnlineSessionLine component = tableItem.GetComponent <MenuOnlineSessionLine>();

        if (component == null)
        {
            Diagnostics.LogError("In the MenuJoinGameScreen, trying to refresh a table item that is not a GameSessionLine");
            return;
        }
        component.LobbyDescription = lobbyDescription;
        component.Parent           = this;
        component.RefreshContent();
    }
Esempio n. 2
0
    private void SteamMatchMaking_CallbackRequestLobbyList(object sender, SteamMatchMakingRequestLobbyListEventArgs e)
    {
        Diagnostics.Log("Request Lobby List : " + e.Message.m_nLobbiesMatching + " result(s).");
        this.GameSessionsTable.Enable          = true;
        this.RefreshButton.AgeTransform.Enable = true;
        this.StatusLabel.AgeTransform.Visible  = false;
        this.StatusLabel.Text = string.Empty;
        this.LobbyDescriptions.Clear();
        int num = 0;

        while ((long)num < (long)((ulong)e.Message.m_nLobbiesMatching))
        {
            Steamworks.SteamID lobbyByIndex = this.MatchMakingService.SteamMatchMaking.GetLobbyByIndex(num);
            if (lobbyByIndex.IsValid)
            {
                MenuJoinGameScreen.LobbyDescription lobbyDescription = new MenuJoinGameScreen.LobbyDescription(this.MatchMakingService, lobbyByIndex);
                Diagnostics.Log("[Lobby] {0}", new object[]
                {
                    lobbyDescription.Flags
                });
                if (lobbyDescription.IsValid)
                {
                    if (!lobbyDescription.HasFlag(MenuJoinGameScreen.LobbyDescription.LobbyFlag.GameHasEnded) && !lobbyDescription.HasFlag(MenuJoinGameScreen.LobbyDescription.LobbyFlag.GameIsMigrating))
                    {
                        if (!lobbyDescription.HasFlag(MenuJoinGameScreen.LobbyDescription.LobbyFlag.FriendsOnly))
                        {
                            this.LobbyDescriptions.Add(lobbyDescription);
                        }
                        else if (lobbyDescription.HasFlag(MenuJoinGameScreen.LobbyDescription.LobbyFlag.FriendsOnly | MenuJoinGameScreen.LobbyDescription.LobbyFlag.FriendlyLobby))
                        {
                            this.LobbyDescriptions.Add(lobbyDescription);
                        }
                    }
                }
            }
            num++;
        }
        this.MatchMakingService.SteamMatchMakingRequestLobbyList -= this.SteamMatchMaking_CallbackRequestLobbyList;
        this.steamAPICall = 0UL;
        this.RefreshContent();
    }
Esempio n. 3
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;
        }
    }
Esempio n. 4
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;
    }