private void DrawGridHeader()
        {
            GUILayout.BeginHorizontal();

            GUILayout.BeginHorizontal(GUILayout.Width(25));
            if (GUILayout.Button(Ascending ? "▲" : "▼", ButtonStyle))
            {
                Ascending = !Ascending;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.Width(50));
            if (GUILayout.Button("Ping", ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.Ping).ToList() :
                                   DisplayedServers.OrderByDescending(s => s.Ping).ToList();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.Width(50));
            if (GUILayout.Button("Players", ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.PlayerCount).ToList() :
                                   DisplayedServers.OrderByDescending(s => s.PlayerCount).ToList();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.Width(85));
            if (GUILayout.Button("Max players", ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.MaxPlayers).ToList() :
                                   DisplayedServers.OrderByDescending(s => s.MaxPlayers).ToList();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.Width(85));
            if (GUILayout.Button("Mode", ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.GameMode).ToList() :
                                   DisplayedServers.OrderByDescending(s => s.GameMode).ToList();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.Width(75));
            if (GUILayout.Button("Warp mode", ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.WarpMode).ToList() :
                                   DisplayedServers.OrderByDescending(s => s.WarpMode).ToList();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.Width(50));
            if (GUILayout.Button("Cheats", ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.Cheats).ToList() :
                                   DisplayedServers.OrderByDescending(s => s.Cheats).ToList();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.Width(325));
            if (GUILayout.Button("Name", ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.ServerName).ToList() :
                                   DisplayedServers.OrderByDescending(s => s.ServerName).ToList();
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.Width(1000));
            if (GUILayout.Button("Description", ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.Description).ToList() :
                                   DisplayedServers.OrderByDescending(s => s.Description).ToList();
            }
            GUILayout.EndHorizontal();

            GUILayout.EndHorizontal();
        }
示例#2
0
        private void DrawGridHeader()
        {
            GUILayout.BeginHorizontal(GUI.skin.box);

            GUILayout.BeginHorizontal(GUILayout.Width(25));
            if (GUILayout.Button(Ascending ? "▲" : "▼", ButtonStyle))
            {
                Ascending = !Ascending;
            }
            if (Event.current.type == EventType.Repaint)
            {
                HeaderGridSize[0] = GUILayoutUtility.GetLastRect().width;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(30));
            if (GUILayout.Button(KeyIcon, ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.Password) :
                                   DisplayedServers.OrderByDescending(s => s.Password);
            }
            if (Event.current.type == EventType.Repaint)
            {
                HeaderGridSize[1] = GUILayoutUtility.GetLastRect().width;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(50));
            if (GUILayout.Button(LocalizationContainer.ServerListWindowText.Ping, ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.Ping) :
                                   DisplayedServers.OrderByDescending(s => s.Ping);
            }
            if (Event.current.type == EventType.Repaint)
            {
                HeaderGridSize[2] = GUILayoutUtility.GetLastRect().width;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(50));
            if (GUILayout.Button(LocalizationContainer.ServerListWindowText.Players, ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.PlayerCount) :
                                   DisplayedServers.OrderByDescending(s => s.PlayerCount);
            }
            if (Event.current.type == EventType.Repaint)
            {
                HeaderGridSize[3] = GUILayoutUtility.GetLastRect().width;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(85));
            if (GUILayout.Button(LocalizationContainer.ServerListWindowText.MaxPlayers, ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.MaxPlayers) :
                                   DisplayedServers.OrderByDescending(s => s.MaxPlayers);
            }
            if (Event.current.type == EventType.Repaint)
            {
                HeaderGridSize[4] = GUILayoutUtility.GetLastRect().width;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(85));
            if (GUILayout.Button(LocalizationContainer.ServerListWindowText.Mode, ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.GameMode) :
                                   DisplayedServers.OrderByDescending(s => s.GameMode);
            }
            if (Event.current.type == EventType.Repaint)
            {
                HeaderGridSize[5] = GUILayoutUtility.GetLastRect().width;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(75));
            if (GUILayout.Button(LocalizationContainer.ServerListWindowText.WarpMode, ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.WarpMode) :
                                   DisplayedServers.OrderByDescending(s => s.WarpMode);
            }
            if (Event.current.type == EventType.Repaint)
            {
                HeaderGridSize[6] = GUILayoutUtility.GetLastRect().width;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(50));
            if (GUILayout.Button(LocalizationContainer.ServerListWindowText.Terrain, ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.TerrainQuality) :
                                   DisplayedServers.OrderByDescending(s => s.TerrainQuality);
            }
            if (Event.current.type == EventType.Repaint)
            {
                HeaderGridSize[7] = GUILayoutUtility.GetLastRect().width;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(50));
            if (GUILayout.Button(LocalizationContainer.ServerListWindowText.Cheats, ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.Cheats) :
                                   DisplayedServers.OrderByDescending(s => s.Cheats);
            }
            if (Event.current.type == EventType.Repaint)
            {
                HeaderGridSize[8] = GUILayoutUtility.GetLastRect().width;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(325));
            if (GUILayout.Button(LocalizationContainer.ServerListWindowText.Name, ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.ServerName) :
                                   DisplayedServers.OrderByDescending(s => s.ServerName);
            }
            if (Event.current.type == EventType.Repaint)
            {
                HeaderGridSize[9] = GUILayoutUtility.GetLastRect().width;
            }
            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal(GUILayout.MinWidth(1000));
            if (GUILayout.Button(LocalizationContainer.ServerListWindowText.Description, ButtonStyle))
            {
                DisplayedServers = Ascending ? DisplayedServers.OrderBy(s => s.Description) :
                                   DisplayedServers.OrderByDescending(s => s.Description);
            }
            if (Event.current.type == EventType.Repaint)
            {
                HeaderGridSize[10] = GUILayoutUtility.GetLastRect().width;
            }
            GUILayout.EndHorizontal();

            GUILayout.EndHorizontal();
        }