diff options
Diffstat (limited to 'Northstar.Client')
-rw-r--r-- | Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut | 33 |
1 files changed, 28 insertions, 5 deletions
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 63377f9f..de4a663e 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut @@ -15,9 +15,13 @@ void function AddNorthstarServerBrowserMenu() void function InitServerBrowserMenu() { - AddMenuEventHandler( GetMenu( "ServerBrowserMenu" ), eUIEvent.MENU_OPEN, OnServerBrowserMenuOpened ) - AddMenuFooterOption( GetMenu( "ServerBrowserMenu" ), BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) - AddMenuFooterOption( GetMenu( "ServerBrowserMenu" ), BUTTON_Y, "#Y_REFRESH_SERVERS", "#REFRESH_SERVERS", RefreshServers ) + var menu = GetMenu( "ServerBrowserMenu" ) + + AddMenuEventHandler( menu, eUIEvent.MENU_OPEN, OnServerBrowserMenuOpened ) + AddMenuFooterOption( menu, BUTTON_B, "#B_BUTTON_BACK", "#BACK" ) + AddMenuFooterOption( menu, BUTTON_Y, "#Y_REFRESH_SERVERS", "#REFRESH_SERVERS", RefreshServers ) + AddMenuFooterOption( menu, BUTTON_SHOULDER_LEFT, "#PRIVATE_MATCH_PAGE_PREV", "#PRIVATE_MATCH_PAGE_PREV", CycleServersBack ) + AddMenuFooterOption( menu, BUTTON_SHOULDER_RIGHT, "#PRIVATE_MATCH_PAGE_NEXT", "#PRIVATE_MATCH_PAGE_NEXT", CycleServersForward ) foreach ( var button in GetElementsByClassname( GetMenu( "ServerBrowserMenu" ), "ServerButton" ) ) { @@ -47,12 +51,31 @@ void function RefreshServers( var button ) if ( NSIsRequestingServerList() ) return + file.page = 0 NSClearRecievedServerList() NSRequestServerList() thread WaitForServerListRequest() } +void function CycleServersBack( var button ) +{ + if ( file.page == 0 ) + return + + file.page-- + UpdateShownPage() +} + +void function CycleServersForward( var button ) +{ + if ( ( file.page + 1 ) * BUTTONS_PER_PAGE >= NSGetServerCount() ) + return + + file.page++ + UpdateShownPage() +} + void function WaitForServerListRequest() { var menu = GetMenu( "ServerBrowserMenu" ) @@ -104,9 +127,9 @@ void function UpdateShownPage() Hud_SetVisible( Hud_GetChild( menu, "NextModeIcon" ), false ) Hud_SetVisible( Hud_GetChild( menu, "NextGameModeName" ), false ) - for ( int i = 0; i < NSGetServerCount() && i < serverButtons.len(); i++ ) + for ( int i = 0; ( file.page * BUTTONS_PER_PAGE ) + i < NSGetServerCount() - 1 && i < serverButtons.len(); i++ ) { - int serverIndex = file.page * BUTTONS_PER_PAGE + i + int serverIndex = ( file.page * BUTTONS_PER_PAGE ) + i Hud_SetEnabled( serverButtons[ i ], true ) Hud_SetVisible( serverButtons[ i ], true ) |