diff options
author | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-12-24 05:57:40 +0000 |
---|---|---|
committer | BobTheBob <32057864+BobTheBob9@users.noreply.github.com> | 2021-12-24 05:57:40 +0000 |
commit | aafffda44116b7ac7911dc65826e391c61b458cd (patch) | |
tree | 52661b23573b6785721c60cb1ff4a3f9030a4659 /Northstar.Client/mod/scripts/vscripts | |
parent | 0fa8c57650daa9351f4cc4a153f7642001c7ce05 (diff) | |
download | NorthstarMods-aafffda44116b7ac7911dc65826e391c61b458cd.tar.gz NorthstarMods-aafffda44116b7ac7911dc65826e391c61b458cd.zip |
add multi-page server browser, fix deadly ground and amped weapons crash
Diffstat (limited to 'Northstar.Client/mod/scripts/vscripts')
-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 ) |