public void DrawContent(int windowId)
        {
            GUILayout.BeginVertical();
            GUI.DragWindow(MoveRect);

            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.ServerDetailsWindowText.Password, LabelOptions);
            NetworkServerList.Password = GUILayout.TextArea(NetworkServerList.Password, 30, TextAreaStyle, GUILayout.Width(200));
            GUILayout.EndHorizontal();
            GUILayout.Space(20);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(LocalizationContainer.ServerDetailsWindowText.Connect, ButtonStyle))
            {
                NetworkServerList.IntroduceToServer(ServerId);
                Display = false;
                ServerListWindow.Singleton.Display = false;
            }
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(LocalizationContainer.ServerDetailsWindowText.Close, ButtonStyle))
            {
                Display = false;
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
        }
Exemplo n.º 2
0
        public void DrawServerDetailsContent(int windowId)
        {
            //Always draw close button first
            DrawCloseButton(() => _selectedServerId = 0, _serverDetailWindowRect);

            GUILayout.BeginVertical();
            GUI.DragWindow(MoveRect);

            GUILayout.BeginHorizontal();
            GUILayout.Label(LocalizationContainer.ServerListWindowText.Password, LabelOptions);
            NetworkServerList.Password = GUILayout.PasswordField(NetworkServerList.Password, '*', 30, GUILayout.Width(200));
            GUILayout.EndHorizontal();
            GUILayout.Space(20);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button(LocalizationContainer.ServerListWindowText.Connect))
            {
                NetworkServerList.IntroduceToServer(_selectedServerId);
                _selectedServerId = 0;
                Display           = false;
            }
            GUILayout.FlexibleSpace();
            GUILayout.EndHorizontal();

            GUILayout.EndVertical();
        }
Exemplo n.º 3
0
        public void DrawContent(int windowId)
        {
            GUILayout.BeginVertical();
            GUI.DragWindow(MoveRect);

            GUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("Close", ButtonStyle))
            {
                Display = false;
            }
            if (GUILayout.Button("Refresh", ButtonStyle))
            {
                NetworkServerList.RequestServers();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.BeginVertical();
            GUILayout.Label("Name");
            GUILayout.EndVertical();

            GUILayout.BeginVertical();
            GUILayout.Label("Players/Max");
            GUILayout.EndVertical();

            GUILayout.BeginVertical();
            GUILayout.Label("Mode");
            GUILayout.EndVertical();

            GUILayout.FlexibleSpace();

            GUILayout.EndHorizontal();

            if (NetworkServerList.Servers == null || !NetworkServerList.Servers.Any())
            {
                GUILayout.Space(200);
                GUILayout.BeginHorizontal();
                GUILayout.Label("No servers!", BigLabelStyle);
                GUILayout.EndHorizontal();
            }
            else
            {
                ScrollPosition = GUILayout.BeginScrollView(ScrollPosition, ScrollStyle);
                foreach (var currentEntry in NetworkServerList.Servers)
                {
                    GUILayout.BeginHorizontal();

                    var tooltip = currentEntry.Description;
                    GUILayout.BeginVertical();
                    GUILayout.Label(new GUIContent($"{currentEntry.ServerName}", tooltip));
                    GUILayout.EndVertical();

                    GUILayout.BeginVertical();
                    GUILayout.Label(new GUIContent($"{currentEntry.PlayerCount}/{currentEntry.MaxPlayers}", tooltip));
                    GUILayout.EndVertical();

                    GUILayout.BeginVertical();
                    GUILayout.Label(new GUIContent($"{(GameMode)currentEntry.GameMode}", tooltip));
                    GUILayout.EndVertical();

                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("Connect", ButtonStyle))
                    {
                        NetworkServerList.IntroduceToServer(currentEntry.Id);
                        Display = false;
                    }

                    GUILayout.EndHorizontal();
                }
                GUILayout.EndScrollView();
            }

            GUILayout.EndVertical();
        }
Exemplo n.º 4
0
        private void DrawServerEntry(ServerInfo currentEntry)
        {
            ColorEffect.StartPaintingServer(currentEntry);
            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[0]));
            if (GUILayout.Button("▶"))
            {
                if (currentEntry.Password)
                {
                    _selectedServerId = currentEntry.Id;
                }
                else
                {
                    NetworkServerList.IntroduceToServer(currentEntry.Id);
                    Display = false;
                }
            }

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[1]));
            if (currentEntry.Password)
            {
                GUILayout.Label(KeyIcon, GetCorrectLabelStyle(currentEntry), GUILayout.MinWidth(HeaderGridSize[1]));
            }
            else
            {
                GUILayout.Label("", GetCorrectLabelStyle(currentEntry), GUILayout.MinWidth(HeaderGridSize[1]));
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[2]));
            GUILayout.Label(new GUIContent($"{currentEntry.Country}"), GetCorrectLabelStyle(currentEntry), GUILayout.MinWidth(HeaderGridSize[2]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[3]));
            GUILayout.Label(new GUIContent($"{currentEntry.DedicatedServer}"), GetCorrectLabelStyle(currentEntry), GUILayout.MinWidth(HeaderGridSize[3]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[4]));
            GUILayout.Label(new GUIContent($"{currentEntry.DisplayedPing}"), GetCorrectLabelStyle(currentEntry), GUILayout.MinWidth(HeaderGridSize[4]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[5]));
            GUILayout.Label(new GUIContent($"{currentEntry.PlayerCount}"), GetCorrectLabelStyle(currentEntry), GUILayout.MinWidth(HeaderGridSize[5]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[6]));
            GUILayout.Label(new GUIContent($"{currentEntry.MaxPlayers}"), GetCorrectLabelStyle(currentEntry), GUILayout.MinWidth(HeaderGridSize[6]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[7]));
            GUILayout.Label(new GUIContent($"{(GameMode)currentEntry.GameMode}"), GetCorrectLabelStyle(currentEntry), GUILayout.MinWidth(HeaderGridSize[7]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[8]));
            GUILayout.Label(new GUIContent($"{(WarpMode)currentEntry.WarpMode}"), GetCorrectLabelStyle(currentEntry), GUILayout.MinWidth(HeaderGridSize[8]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[9]));
            GUILayout.Label(new GUIContent($"{(TerrainQuality)currentEntry.TerrainQuality}"), GetCorrectLabelStyle(currentEntry), GUILayout.MinWidth(HeaderGridSize[9]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[10]));
            GUILayout.Label(new GUIContent($"{currentEntry.Cheats}"), GetCorrectLabelStyle(currentEntry), GUILayout.MinWidth(HeaderGridSize[10]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[11]));
            GUILayout.Label(new GUIContent($"{currentEntry.ServerName}"), GetCorrectLabelStyle(currentEntry), GUILayout.MinWidth(HeaderGridSize[11]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[12]));
            if (!string.IsNullOrEmpty(currentEntry.Website))
            {
                if (GUILayout.Button(new GUIContent(currentEntry.WebsiteText), GetCorrectHyperlinkLabelStyle(currentEntry), GUILayout.MinWidth(HeaderGridSize[12])))
                {
                    Application.OpenURL(currentEntry.Website);
                }
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[13]));
            GUILayout.Label(new GUIContent($"{currentEntry.Description}"), GetCorrectLabelStyle(currentEntry), GUILayout.MinWidth(HeaderGridSize[13]));
            GUILayout.EndHorizontal();

            ColorEffect.StopPaintingServer();
        }
Exemplo n.º 5
0
        private void DrawServerList()
        {
            GUILayout.BeginHorizontal();

            if (DisplayedServers == null || !DisplayedServers.Any())
            {
                GUILayout.BeginHorizontal();
                GUILayout.Space(WindowWidth * 0.25f);
                GUILayout.BeginVertical();
                GUILayout.Space(WindowHeight * 0.25f);
                GUILayout.Label("No servers!", BigLabelStyle);
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.BeginVertical();
                foreach (var currentEntry in DisplayedServers)
                {
                    GUILayout.BeginHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.Width(25));
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button("▶", ButtonStyle))
                    {
                        NetworkServerList.IntroduceToServer(currentEntry.Id);
                        Display = false;
                    }
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.Width(50));
                    GUILayout.FlexibleSpace();
                    GUILayout.Label(new GUIContent($"{currentEntry.Ping}"));
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.Width(50));
                    GUILayout.FlexibleSpace();
                    GUILayout.Label(new GUIContent($"{currentEntry.PlayerCount}"));
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.Width(90));
                    GUILayout.FlexibleSpace();
                    GUILayout.Label(new GUIContent($"{currentEntry.MaxPlayers}"));
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.Width(85));
                    GUILayout.FlexibleSpace();
                    GUILayout.Label(new GUIContent($"{(GameMode)currentEntry.GameMode}"));
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.Width(85));
                    GUILayout.FlexibleSpace();
                    GUILayout.Label(new GUIContent($"{(WarpMode)currentEntry.WarpMode}"));
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.Width(35));
                    GUILayout.FlexibleSpace();
                    GUILayout.Label(new GUIContent($"{currentEntry.Cheats}"));
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.Width(325));
                    GUILayout.Space(20);
                    GUILayout.Label(new GUIContent($"{currentEntry.ServerName}"));
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.Width(1000));
                    GUILayout.Space(20);
                    GUILayout.Label(new GUIContent($"{currentEntry.Description}"));
                    GUILayout.FlexibleSpace();
                    GUILayout.EndHorizontal();

                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();
        }
Exemplo n.º 6
0
        private void DrawServerList()
        {
            GUILayout.BeginHorizontal(BoxStyle);

            if (DisplayedServers == null || !DisplayedServers.Any())
            {
                GUILayout.BeginHorizontal();
                GUILayout.Space(WindowWidth * 0.25f);
                GUILayout.BeginVertical();
                GUILayout.Space(WindowHeight * 0.25f);
                GUILayout.Label(LocalizationContainer.ServerListWindowText.NoServers, BigLabelStyle);
                GUILayout.EndVertical();
                GUILayout.EndHorizontal();
            }
            else
            {
                GUILayout.BeginVertical();
                foreach (var currentEntry in DisplayedServers)
                {
                    GUILayout.BeginHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[0]));
                    if (GUILayout.Button("▶", ButtonStyle))
                    {
                        if (currentEntry.Password)
                        {
                            ServerDetailsWindow.Singleton.ServerId = currentEntry.Id;
                            ServerDetailsWindow.Singleton.Display  = true;
                        }
                        else
                        {
                            NetworkServerList.IntroduceToServer(currentEntry.Id);
                            Display = false;
                        }
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[1]));
                    if (currentEntry.Password)
                    {
                        GUILayout.Label(new GUIContent(KeyIcon, "Password"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[1]));
                    }
                    else
                    {
                        GUILayout.Label("", GUILayout.MinWidth(HeaderGridSize[1]));
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[2]));
                    GUILayout.Label(new GUIContent($"{currentEntry.Ping}"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[2]));
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[3]));
                    GUILayout.Label(new GUIContent($"{currentEntry.PlayerCount}"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[3]));
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[4]));
                    GUILayout.Label(new GUIContent($"{currentEntry.MaxPlayers}"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[4]));
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[5]));
                    GUILayout.Label(new GUIContent($"{(GameMode)currentEntry.GameMode}"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[5]));
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[6]));
                    GUILayout.Label(new GUIContent($"{(WarpMode)currentEntry.WarpMode}"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[6]));
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[7]));
                    GUILayout.Label(new GUIContent($"{(TerrainQuality)currentEntry.TerrainQuality}"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[7]));
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[8]));
                    GUILayout.Label(new GUIContent($"{currentEntry.Cheats}"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[8]));
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.MinWidth(325));
                    GUILayout.Label(new GUIContent($"{currentEntry.ServerName}"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[9]));
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal(GUILayout.MinWidth(1000));
                    GUILayout.Label(new GUIContent($"{currentEntry.Description}"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[10]));
                    GUILayout.EndHorizontal();

                    GUILayout.EndHorizontal();
                }
                GUILayout.EndVertical();
            }
            GUILayout.EndHorizontal();
        }
Exemplo n.º 7
0
        private void DrawServerEntry(ServerInfo currentEntry)
        {
            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[0]));
            if (GUILayout.Button("▶", ButtonStyle))
            {
                if (currentEntry.Password)
                {
                    _selectedServerId = currentEntry.Id;
                }
                else
                {
                    NetworkServerList.IntroduceToServer(currentEntry.Id);
                    Display = false;
                }
            }

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[1]));
            if (currentEntry.Password)
            {
                GUILayout.Label(KeyIcon, LabelStyle, GUILayout.MinWidth(HeaderGridSize[1]));
            }
            else
            {
                GUILayout.Label("", GUILayout.MinWidth(HeaderGridSize[1]));
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[2]));
            GUILayout.Label(new GUIContent($"{currentEntry.DisplayedPing}"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[2]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[3]));
            GUILayout.Label(new GUIContent($"{currentEntry.PlayerCount}"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[3]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[4]));
            GUILayout.Label(new GUIContent($"{currentEntry.MaxPlayers}"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[4]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[5]));
            GUILayout.Label(new GUIContent($"{(GameMode) currentEntry.GameMode}"), LabelStyle,
                            GUILayout.MinWidth(HeaderGridSize[5]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[6]));
            GUILayout.Label(new GUIContent($"{(WarpMode) currentEntry.WarpMode}"), LabelStyle,
                            GUILayout.MinWidth(HeaderGridSize[6]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[7]));
            GUILayout.Label(new GUIContent($"{(TerrainQuality) currentEntry.TerrainQuality}"), LabelStyle,
                            GUILayout.MinWidth(HeaderGridSize[7]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(HeaderGridSize[8]));
            GUILayout.Label(new GUIContent($"{currentEntry.Cheats}"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[8]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(325));
            GUILayout.Label(new GUIContent($"{currentEntry.ServerName}"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[9]));
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(550));
            GUILayout.Label(new GUIContent($"{currentEntry.Description}"), LabelStyle, GUILayout.MinWidth(HeaderGridSize[10]));
            GUILayout.EndHorizontal();
        }