aboutsummaryrefslogtreecommitdiff
path: root/Northstar.Client/mod
diff options
context:
space:
mode:
Diffstat (limited to 'Northstar.Client/mod')
-rw-r--r--Northstar.Client/mod/resource/ui/menus/connect_password.menu36
-rw-r--r--Northstar.Client/mod/resource/ui/menus/server_browser.menu11
-rw-r--r--Northstar.Client/mod/scripts/vscripts/sh_menu_models.gnut24
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_ns_connect_password.nut42
-rw-r--r--Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut257
5 files changed, 218 insertions, 152 deletions
diff --git a/Northstar.Client/mod/resource/ui/menus/connect_password.menu b/Northstar.Client/mod/resource/ui/menus/connect_password.menu
index b5e12ad2..d2421477 100644
--- a/Northstar.Client/mod/resource/ui/menus/connect_password.menu
+++ b/Northstar.Client/mod/resource/ui/menus/connect_password.menu
@@ -34,7 +34,7 @@ resource/ui/menus/mods_browse.menu
ControlName ImagePanel
InheritProperties MenuTopBar
}
-
+
ButtonRowAnchor
{
ControlName Label
@@ -43,7 +43,7 @@ resource/ui/menus/mods_browse.menu
xpos 120
ypos 160
}
-
+
MatchmakingStatus
{
ControlName CNestedPanel
@@ -62,6 +62,34 @@ resource/ui/menus/mods_browse.menu
ControlName TextEntry
wide 700
tall 53
+ zpos 1
+ visible 1
+ enabled 1
+ textHidden 0
+ editable 1
+ maxchars 32
+ NumericInputOnly 0
+ textAlignment "east"
+ font DefaultBold_53
+ keyboardTitle "#CONNECT_WITH_PASSWORD"
+ keyboardDescription "#ENTER_PASSWORD"
+ allowRightClickMenu 1
+ allowSpecialCharacters 0
+ unicode 0
+ paintborder 0
+ alpha 0
+
+ pin_to_sibling ButtonRowAnchor
+ pin_corner_to_sibling TOP_LEFT
+ pin_to_sibling_corner BOTTOM_LEFT
+ }
+
+ EnterPasswordBoxDummy
+ {
+ ControlName TextEntry
+ wide 700
+ tall 53
+ zpos 0
visible 1
enabled 1
textHidden 1
@@ -76,12 +104,12 @@ resource/ui/menus/mods_browse.menu
allowSpecialCharacters 0
unicode 0
paintborder 0
-
+
pin_to_sibling ButtonRowAnchor
pin_corner_to_sibling TOP_LEFT
pin_to_sibling_corner BOTTOM_LEFT
}
-
+
ConnectButton
{
ControlName RuiButton
diff --git a/Northstar.Client/mod/resource/ui/menus/server_browser.menu b/Northstar.Client/mod/resource/ui/menus/server_browser.menu
index 959c1b09..94b57451 100644
--- a/Northstar.Client/mod/resource/ui/menus/server_browser.menu
+++ b/Northstar.Client/mod/resource/ui/menus/server_browser.menu
@@ -2142,6 +2142,7 @@ resource/ui/menus/mods_browse.menu
wide 1200
tall 153
xpos -8
+ classname FilterPanelChild
rui "ui/control_options_description.rpak"
@@ -2159,6 +2160,8 @@ resource/ui/menus/mods_browse.menu
InheritProperties RuiSmallButton
labelText "#SEARCHBAR_LABEL"
textAlignment west
+ classname FilterPanelChild
+
wide 500
xpos -23
ypos -16
@@ -2178,6 +2181,7 @@ resource/ui/menus/mods_browse.menu
BtnServerSearch
{
ControlName TextEntry
+ classname FilterPanelChild
zpos 100 // This works around input weirdness when the control is constructed by code instead of VGUI blackbox.
xpos -400
ypos -5
@@ -2204,6 +2208,7 @@ resource/ui/menus/mods_browse.menu
InheritProperties SwitchButton
labelText "#MAP_FILTER"
ConVar "filter_map"
+ classname FilterPanelChild
wide 500
pin_to_sibling BtnSearchLabel
@@ -2220,6 +2225,7 @@ resource/ui/menus/mods_browse.menu
InheritProperties SwitchButton
labelText "#GAMEMODE_FILTER"
ConVar "filter_gamemode"
+ classname FilterPanelChild
wide 500
pin_to_sibling SwtBtnSelectMap
@@ -2236,6 +2242,7 @@ resource/ui/menus/mods_browse.menu
InheritProperties SwitchButton
labelText "#HIDE_FULL_FILTER"
ConVar "filter_hide_full"
+ classname FilterPanelChild
wide 500
@@ -2259,6 +2266,7 @@ resource/ui/menus/mods_browse.menu
InheritProperties SwitchButton
labelText "#HIDE_EMPTY_FILTER"
ConVar "filter_hide_empty"
+ classname FilterPanelChild
wide 500
@@ -2282,6 +2290,7 @@ resource/ui/menus/mods_browse.menu
InheritProperties SwitchButton
labelText "#HIDE_PROT_FILTER"
ConVar "filter_hide_protected"
+ classname FilterPanelChild
wide 500
list
@@ -2303,6 +2312,7 @@ resource/ui/menus/mods_browse.menu
ControlName RuiButton
InheritProperties RuiSmallButton
labelText "#CLEAR_FILTERS"
+ classname FilterPanelChild
wide 100
xpos -17
ypos -57
@@ -2322,6 +2332,7 @@ resource/ui/menus/mods_browse.menu
BtnDummyAfterFilterClear {
ControlName RuiButton
+ classname FilterPanelChild
width 0
height 0
visible 1
diff --git a/Northstar.Client/mod/scripts/vscripts/sh_menu_models.gnut b/Northstar.Client/mod/scripts/vscripts/sh_menu_models.gnut
index cd663a06..b1b97bc9 100644
--- a/Northstar.Client/mod/scripts/vscripts/sh_menu_models.gnut
+++ b/Northstar.Client/mod/scripts/vscripts/sh_menu_models.gnut
@@ -2,9 +2,9 @@
// Model tracking and save/Clear functions are temp. We already update the client knowledge of loadouts. Derive from that.
// Move the struct off the player?
-#if CLIENT && MP
+//#if CLIENT && MP
untyped
-#endif //client && MP
+//#endif //client && MP
#if CLIENT
const float CARD_TAG_SCALE = 0.0 // update to match same const in hud_defs.rui
@@ -207,12 +207,18 @@
#endif // CLIENT && MP
#if UI
+ struct
+ {
+ table MouseMovementCaptureFunctionsTable = {}
+ } file
+
const MOUSE_ROTATE_MULTIPLIER = 25.0
global function UpdateUIMapSupportsMenuModels
global function RunMenuClientFunction
global function UI_SetPresentationType
+ global function AddMouseMovementCaptureHandler
global function UICodeCallback_MouseMovementCapture
#endif // UI
@@ -2892,6 +2898,18 @@
}
}
+ void function AddMouseMovementCaptureHandler( var menu, void functionref( int, int ) func )
+ {
+ file.MouseMovementCaptureFunctionsTable.rawset( menu, func )
+ }
+
+ void function UpdateMouseMovementCaptureFunctions( int deltaX, int deltaY )
+ {
+ var activeMenu = GetActiveMenu()
+ if ( file.MouseMovementCaptureFunctionsTable.rawin( activeMenu ) )
+ file.MouseMovementCaptureFunctionsTable.rawget( activeMenu )(deltaX, deltaY)
+ }
+
void function UICodeCallback_MouseMovementCapture( var capturePanel, int deltaX, int deltaY )
{
float screenScaleXModifier = 1920.0 / GetScreenSize()[0] // 1920 is base screen width
@@ -2901,7 +2919,7 @@
float screenScaleYModifier = 1080.0 / GetScreenSize()[1] // 1920 is base screen width
float mouseYRotationDelta = deltaY * screenScaleYModifier * MOUSE_ROTATE_MULTIPLIER
- UpdateMouseDeltaBuffer( deltaX, deltaY )
+ UpdateMouseMovementCaptureFunctions( deltaX, deltaY )
RunMenuClientFunction( "UpdateMouseRotateDelta", mouseXRotateDelta, mouseYRotationDelta )
}
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_connect_password.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_connect_password.nut
index e1ed8991..56db0ccc 100644
--- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_connect_password.nut
+++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_connect_password.nut
@@ -1,5 +1,13 @@
global function AddNorthstarConnectWithPasswordMenu
+struct
+{
+ var menu
+ var enterPasswordBox
+ var enterPasswordDummy
+ var connectButton
+} file
+
void function AddNorthstarConnectWithPasswordMenu()
{
AddMenu( "ConnectWithPasswordMenu", $"resource/ui/menus/connect_password.menu", InitConnectWithPasswordMenu, "#MENU_CONNECT" )
@@ -7,24 +15,42 @@ void function AddNorthstarConnectWithPasswordMenu()
void function InitConnectWithPasswordMenu()
{
- AddMenuEventHandler( GetMenu( "ConnectWithPasswordMenu" ), eUIEvent.MENU_OPEN, OnConnectWithPasswordMenuOpened )
- AddMenuFooterOption( GetMenu( "ConnectWithPasswordMenu" ), BUTTON_B, "#B_BUTTON_BACK", "#BACK" )
+ file.menu = GetMenu( "ConnectWithPasswordMenu" )
+
+ file.enterPasswordBox = Hud_GetChild( file.menu, "EnterPasswordBox")
+ file.enterPasswordDummy = Hud_GetChild( file.menu, "EnterPasswordBoxDummy")
+ file.connectButton = Hud_GetChild( file.menu, "ConnectButton")
+
+ AddMenuEventHandler( file.menu, eUIEvent.MENU_OPEN, OnConnectWithPasswordMenuOpened )
+ AddMenuFooterOption( file.menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" )
+
+ AddButtonEventHandler( file.connectButton, UIE_CLICK, ConnectWithPassword )
+
+ AddButtonEventHandler( file.enterPasswordBox, UIE_CHANGE, UpdatePasswordLabel )
- AddButtonEventHandler( Hud_GetChild( GetMenu( "ConnectWithPasswordMenu" ), "ConnectButton" ), UIE_CLICK, ConnectWithPassword )
RegisterButtonPressedCallback( KEY_ENTER, ConnectWithPassword )
}
+void function UpdatePasswordLabel( var n )
+{
+ string hiddenPSWD
+ for ( int i = 0; i < Hud_GetUTF8Text( file.enterPasswordBox ).len(); i++)
+ hiddenPSWD += "*"
+ Hud_SetText( file.enterPasswordDummy, hiddenPSWD )
+}
+
void function OnConnectWithPasswordMenuOpened()
{
UI_SetPresentationType( ePresentationType.KNOWLEDGEBASE_SUB )
- Hud_SetText( Hud_GetChild( GetMenu( "ConnectWithPasswordMenu" ), "Title" ), "#MENU_TITLE_CONNECT_PASSWORD" )
- Hud_SetText( Hud_GetChild( GetMenu( "ConnectWithPasswordMenu" ), "ConnectButton" ), "#MENU_CONNECT_MENU_CONNECT" )
- Hud_SetText( Hud_GetChild( GetMenu( "ConnectWithPasswordMenu" ), "EnterPasswordBox" ), "" )
+ Hud_SetText( Hud_GetChild( file.menu, "Title" ), "#MENU_TITLE_CONNECT_PASSWORD" )
+ Hud_SetText( file.connectButton, "#MENU_CONNECT_MENU_CONNECT" )
+ Hud_SetText( file.enterPasswordBox, "" )
+ Hud_SetText( file.enterPasswordDummy, "" )
}
void function ConnectWithPassword( var button )
{
- if ( GetTopNonDialogMenu() == GetMenu( "ConnectWithPasswordMenu" ) )
- thread ThreadedAuthAndConnectToServer( Hud_GetUTF8Text( Hud_GetChild( GetMenu( "ConnectWithPasswordMenu" ), "EnterPasswordBox" ) ) )
+ if ( GetTopNonDialogMenu() == file.menu )
+ thread ThreadedAuthAndConnectToServer( Hud_GetUTF8Text( Hud_GetChild( file.menu, "EnterPasswordBox" ) ) )
} \ No newline at end of file
diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut
index 7c3e2fae..437a8cf2 100644
--- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut
+++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut
@@ -4,12 +4,11 @@ untyped
global function AddNorthstarServerBrowserMenu
global function ThreadedAuthAndConnectToServer
-global function UpdateMouseDeltaBuffer
// Stop peeking
const int BUTTONS_PER_PAGE = 15
-const float DOUBLE_CLICK_TIME_MS = 0.2 // unsure what the ideal value is
+const float DOUBLE_CLICK_TIME_MS = 0.3 // unsure what the ideal value is
struct {
@@ -29,6 +28,17 @@ struct {
string filterGamemode
} filterArguments
+
+enum sortingBy
+{
+ NONE,
+ NAME,
+ PLAYERS,
+ MAP,
+ GAMEMODE,
+ LATENCY
+}
+
struct {
// true = alphabeticaly false = reverse
bool serverName = true
@@ -100,22 +110,22 @@ void function UpdatePrivateMatchModesAndMaps()
{
if ( filterArguments.filterMaps.find( map ) != -1 )
continue
-
+
filterArguments.filterMaps.append( map )
-
+
string localized = GetMapDisplayName( map )
Hud_DialogList_AddListItem( Hud_GetChild( file.menu, "SwtBtnSelectMap" ) , localized, string( enum_ + 1 ) )
- }
-
+ }
+
array<string> realModes = [ "private_match" ]
realModes.extend( GetPrivateMatchModes() )
-
+
foreach( int enum_, string mode in realModes )
{
string localized = GetGameModeDisplayName( mode )
if ( filterArguments.filterGamemodes.find( localized ) != -1 )
continue
-
+
filterArguments.filterGamemodes.append( localized )
Hud_DialogList_AddListItem( Hud_GetChild( file.menu, "SwtBtnSelectGamemode" ) , localized, string( enum_ + 1 ) )
}
@@ -125,6 +135,8 @@ void function InitServerBrowserMenu()
{
file.menu = GetMenu( "ServerBrowserMenu" )
+ AddMouseMovementCaptureHandler( file.menu, UpdateMouseDeltaBuffer )
+
// Get menu stuff
file.serverButtons = GetElementsByClassname( file.menu, "ServerButton" )
file.serversName = GetElementsByClassname( file.menu, "ServerName" )
@@ -136,7 +148,7 @@ void function InitServerBrowserMenu()
filterArguments.filterMaps = [ "SWITCH_ANY" ]
Hud_DialogList_AddListItem( Hud_GetChild( file.menu, "SwtBtnSelectMap" ), "SWITCH_ANY", "0" )
-
+
filterArguments.filterGamemodes = [ "SWITCH_ANY" ]
Hud_DialogList_AddListItem( Hud_GetChild( file.menu, "SwtBtnSelectGamemode" ), "SWITCH_ANY", "0" )
@@ -171,11 +183,11 @@ void function InitServerBrowserMenu()
AddButtonEventHandler( Hud_GetChild( file.menu, "BtnFiltersClear"), UIE_CLICK, OnBtnFiltersClear_Activate )
- AddButtonEventHandler( Hud_GetChild( file.menu, "BtnServerNameTab"), UIE_CLICK, SortServerListByName )
- AddButtonEventHandler( Hud_GetChild( file.menu, "BtnServerPlayersTab"), UIE_CLICK, SortServerListByPlayers )
- AddButtonEventHandler( Hud_GetChild( file.menu, "BtnServerMapTab"), UIE_CLICK, SortServerListByMap )
- AddButtonEventHandler( Hud_GetChild( file.menu, "BtnServerGamemodeTab"), UIE_CLICK, SortServerListByGamemode )
- AddButtonEventHandler( Hud_GetChild( file.menu, "BtnServerLatencyTab"), UIE_CLICK, SortServerListByLatency )
+ AddButtonEventHandler( Hud_GetChild( file.menu, "BtnServerNameTab"), UIE_CLICK, SortServerListByName_Activate )
+ AddButtonEventHandler( Hud_GetChild( file.menu, "BtnServerPlayersTab"), UIE_CLICK, SortServerListByPlayers_Activate )
+ AddButtonEventHandler( Hud_GetChild( file.menu, "BtnServerMapTab"), UIE_CLICK, SortServerListByMap_Activate )
+ AddButtonEventHandler( Hud_GetChild( file.menu, "BtnServerGamemodeTab"), UIE_CLICK, SortServerListByGamemode_Activate )
+ AddButtonEventHandler( Hud_GetChild( file.menu, "BtnServerLatencyTab"), UIE_CLICK, SortServerListByLatency_Activate )
AddButtonEventHandler( Hud_GetChild( file.menu, "SwtBtnSelectMap"), UIE_CHANGE, FilterAndUpdateList )
@@ -278,10 +290,12 @@ void function UpdateListSliderHeight( float servers )
var movementCapture = Hud_GetChild( file.menu , "MouseMovementCapture" )
float maxHeight = 562.0 * (GetScreenSize()[1] / 1080.0)
+ float minHeight = 80.0 * (GetScreenSize()[1] / 1080.0)
float height = maxHeight * (15.0 / servers )
if ( height > maxHeight ) height = maxHeight
+ if ( height < minHeight ) height = minHeight
Hud_SetHeight( sliderButton , height )
Hud_SetHeight( sliderPanel , height )
@@ -419,36 +433,29 @@ bool function IsFilterPanelElementFocused() {
var focusedElement = GetFocus();
var name = Hud_GetHudName(focusedElement);
- print(name)
-
- // kinda sucks but just check if any of the filter elements
- // has focus. would be nice to have tags or sth here
- bool match = (name == "FilterPanel") ||
- (name == "BtnSearchLabel") ||
- (name == "BtnServerSearch") ||
- (name == "SwtBtnSelectMap") ||
- (name == "SwtBtnSelectGamemode") ||
- (name == "SwtBtnHideFull") ||
- (name == "SwtBtnHideEmpty") ||
- (name == "SwtBtnHideProtected") ||
- (name == "BtnFiltersClear") ||
- (name == "BtnDummyAfterFilterClear");
+ foreach (element in GetElementsByClassname( file.menu, "FilterPanelChild")) {
+ if ( element == focusedElement ) return true
+ }
- return match;
+ return false;
}
void function OnKeyTabPressed(var button) {
- // toggle focus between server list and filter panel
- if (IsFilterPanelElementFocused()) {
- // print("Switching focus from filter panel to server list")
- Hud_SetFocused(Hud_GetChild(file.menu, "BtnServer1"))
- }
- else {
- // print("Switching focus from server list to filter panel")
- Hud_SetFocused(Hud_GetChild(file.menu, "BtnServerSearch"))
- HideServerInfo()
+ try
+ {
+ // toggle focus between server list and filter panel
+ if (IsFilterPanelElementFocused()) {
+ // print("Switching focus from filter panel to server list")
+ Hud_SetFocused(Hud_GetChild(file.menu, "BtnServer1"))
+ }
+ else {
+ // print("Switching focus from server list to filter panel")
+ Hud_SetFocused(Hud_GetChild(file.menu, "BtnServerSearch"))
+ HideServerInfo()
+ }
}
+ catch ( ex ) {}
}
void function OnHitDummyTop(var button) {
@@ -570,30 +577,31 @@ void function FilterAndUpdateList( var n )
FilterServerList()
+
switch ( filterDirection.sortingBy )
{
- case 0:
+ case sortingBy.NONE:
UpdateShownPage()
break
- case 1:
+ case sortingBy.NAME:
filterDirection.serverName = !filterDirection.serverName
- SortServerListByName(0)
+ SortServerListByName_Activate(0)
break
- case 2:
+ case sortingBy.PLAYERS:
filterDirection.serverPlayers = !filterDirection.serverPlayers
- SortServerListByPlayers(0)
+ SortServerListByPlayers_Activate(0)
break
- case 3:
+ case sortingBy.MAP:
filterDirection.serverMap = !filterDirection.serverMap
- SortServerListByMap(0)
+ SortServerListByMap_Activate(0)
break
- case 5: // 4 skipped cause it doesn't work respawn pls fix
+ case sortingBy.GAMEMODE:
filterDirection.serverGamemode = !filterDirection.serverGamemode
- SortServerListByGamemode(0)
+ SortServerListByGamemode_Activate(0)
break
- case 6:
+ case sortingBy.LATENCY:
filterDirection.serverLatency = !filterDirection.serverLatency
- SortServerListByLatency(0)
+ SortServerListByLatency_Activate(0)
break
default:
printt( "How the f did you get here" )
@@ -1021,130 +1029,105 @@ void function ThreadedAuthAndConnectToServer( string password = "" )
//////////////////////////////////////
// Shadow realm
//////////////////////////////////////
-void function SortServerListByName( var button )
+int function ServerSortLogic ( serverStruct a, serverStruct b)
{
- filterDirection.sortingBy = 1
+ var aTemp
+ var bTemp
+
+ bool direction
+
+ // We can hard code this cause adding entire columns isn't as easy
+ switch ( filterDirection.sortingBy ) {
+ case sortingBy.NAME:
+ aTemp = a.serverName.tolower()
+ bTemp = b.serverName.tolower()
+ direction = filterDirection.serverName
+ break;
+ case sortingBy.PLAYERS:
+ aTemp = a.serverPlayers
+ bTemp = b.serverPlayers
+ direction = filterDirection.serverPlayers
+ break;
+ case sortingBy.MAP:
+ aTemp = Localize(a.serverMap).tolower()
+ bTemp = Localize(b.serverMap).tolower()
+ direction = filterDirection.serverMap
+ break;
+ case sortingBy.GAMEMODE:
+ aTemp = Localize(a.serverGamemode).tolower()
+ bTemp = Localize(b.serverGamemode).tolower()
+ direction = filterDirection.serverGamemode
+ break;
+ case sortingBy.LATENCY:
+ aTemp = a.serverLatency
+ bTemp = b.serverLatency
+ direction = filterDirection.serverLatency
+ break;
+ default:
+ return 0
+ }
- int n = file.serversArrayFiltered.len() - 1
+ int invert = direction == true ? 1 : -1
- serverStruct tempServer
+ if ( aTemp > bTemp )
+ return 1 * invert
- for ( int i = 0; i < n; i++)
- {
- for ( int j = 0; j < n - 1; j++)
- {
- if ( file.serversArrayFiltered[ j ].serverName < file.serversArrayFiltered[ j + 1 ].serverName && filterDirection.serverName || file.serversArrayFiltered[ j ].serverName > file.serversArrayFiltered[ j + 1 ].serverName && !filterDirection.serverName)
- {
- tempServer = file.serversArrayFiltered[ j ]
- file.serversArrayFiltered[ j ] = file.serversArrayFiltered[ j + 1 ]
- file.serversArrayFiltered[ j + 1 ] = tempServer
- }
- }
- }
+ if ( aTemp < bTemp )
+ return -1 * invert
+
+ return 0
+}
+
+void function SortServerListByName_Activate ( var button )
+{
+ filterDirection.sortingBy = sortingBy.NAME
+
+ file.serversArrayFiltered.sort( ServerSortLogic )
filterDirection.serverName = !filterDirection.serverName
UpdateShownPage()
}
-void function SortServerListByPlayers( var button )
-{
- filterDirection.sortingBy = 2
- int n = file.serversArrayFiltered.len() - 1
+void function SortServerListByPlayers_Activate( var button )
+{
+ filterDirection.sortingBy = sortingBy.PLAYERS
- serverStruct tempServer
-
- for ( int i = 0; i < n; i++)
- {
- for ( int j = 0; j < n - 1; j++)
- {
- if ( file.serversArrayFiltered[ j ].serverPlayers < file.serversArrayFiltered[ j + 1 ].serverPlayers && filterDirection.serverPlayers || file.serversArrayFiltered[ j ].serverPlayers > file.serversArrayFiltered[ j + 1 ].serverPlayers && !filterDirection.serverPlayers)
- {
- tempServer = file.serversArrayFiltered[ j ]
- file.serversArrayFiltered[ j ] = file.serversArrayFiltered[ j + 1 ]
- file.serversArrayFiltered[ j + 1 ] = tempServer
- }
- }
- }
+ file.serversArrayFiltered.sort( ServerSortLogic )
filterDirection.serverPlayers = !filterDirection.serverPlayers
UpdateShownPage()
}
-void function SortServerListByMap( var button )
+void function SortServerListByMap_Activate( var button )
{
- filterDirection.sortingBy = 3
-
- int n = file.serversArrayFiltered.len() - 1
+ filterDirection.sortingBy = sortingBy.MAP
- serverStruct tempServer
-
- for ( int i = 0; i < n; i++)
- {
- for ( int j = 0; j < n - 1; j++)
- {
- if ( Localize(file.serversArrayFiltered[ j ].serverMap) < Localize(file.serversArrayFiltered[ j + 1 ].serverMap) && filterDirection.serverMap || Localize(file.serversArrayFiltered[ j ].serverMap) > Localize(file.serversArrayFiltered[ j + 1 ].serverMap) && !filterDirection.serverMap)
- {
- tempServer = file.serversArrayFiltered[ j ]
- file.serversArrayFiltered[ j ] = file.serversArrayFiltered[ j + 1 ]
- file.serversArrayFiltered[ j + 1 ] = tempServer
- }
- }
- }
+ file.serversArrayFiltered.sort( ServerSortLogic )
filterDirection.serverMap = !filterDirection.serverMap
UpdateShownPage()
}
-void function SortServerListByGamemode( var button )
+void function SortServerListByGamemode_Activate( var button )
{
- filterDirection.sortingBy = 5
-
- int n = file.serversArrayFiltered.len() - 1
-
- serverStruct tempServer
+ filterDirection.sortingBy = sortingBy.GAMEMODE
- for ( int i = 0; i < n; i++)
- {
- for ( int j = 0; j < n - 1; j++)
- {
- if ( Localize(file.serversArrayFiltered[ j ].serverGamemode) < Localize(file.serversArrayFiltered[ j + 1 ].serverGamemode) && filterDirection.serverGamemode || Localize(file.serversArrayFiltered[ j ].serverGamemode) > Localize(file.serversArrayFiltered[ j + 1 ].serverGamemode) && !filterDirection.serverGamemode)
- {
- tempServer = file.serversArrayFiltered[ j ]
- file.serversArrayFiltered[ j ] = file.serversArrayFiltered[ j + 1 ]
- file.serversArrayFiltered[ j + 1 ] = tempServer
- }
- }
- }
+ file.serversArrayFiltered.sort( ServerSortLogic )
filterDirection.serverGamemode = !filterDirection.serverGamemode
UpdateShownPage()
}
-void function SortServerListByLatency( var button )
+void function SortServerListByLatency_Activate( var button )
{
- filterDirection.sortingBy = 5
+ filterDirection.sortingBy = sortingBy.LATENCY
- int n = file.serversArrayFiltered.len() - 1
-
- serverStruct tempServer
-
- for ( int i = 0; i < n; i++)
- {
- for ( int j = 0; j < n - 1; j++)
- {
- if ( file.serversArrayFiltered[ j ].serverLatency < file.serversArrayFiltered[ j + 1 ].serverLatency && filterDirection.serverLatency || file.serversArrayFiltered[ j ].serverLatency > file.serversArrayFiltered[ j + 1 ].serverLatency && !filterDirection.serverLatency)
- {
- tempServer = file.serversArrayFiltered[ j ]
- file.serversArrayFiltered[ j ] = file.serversArrayFiltered[ j + 1 ]
- file.serversArrayFiltered[ j + 1 ] = tempServer
- }
- }
- }
+ file.serversArrayFiltered.sort( ServerSortLogic )
filterDirection.serverLatency = !filterDirection.serverLatency