diff options
author | F1F7Y <64418963+F1F7Y@users.noreply.github.com> | 2022-02-28 21:08:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-28 17:08:58 -0300 |
commit | 0e9445b79ac04ae8ef2265c434d4fa76ae3dab96 (patch) | |
tree | f8740c0be1a996e5b603fb69484b31bef5ce7b4a /Northstar.Client/mod | |
parent | 505254f5bdb1f7aae757fdd36daf509369869508 (diff) | |
download | NorthstarMods-0e9445b79ac04ae8ef2265c434d4fa76ae3dab96.tar.gz NorthstarMods-0e9445b79ac04ae8ef2265c434d4fa76ae3dab96.zip |
Add arrow nav to maps menu + fix server browser nav (#248)
Diffstat (limited to 'Northstar.Client/mod')
5 files changed, 382 insertions, 55 deletions
diff --git a/Northstar.Client/mod/resource/ui/menus/panels/map_grid.res b/Northstar.Client/mod/resource/ui/menus/panels/map_grid.res index 0c82bcb2..9e3c162a 100644 --- a/Northstar.Client/mod/resource/ui/menus/panels/map_grid.res +++ b/Northstar.Client/mod/resource/ui/menus/panels/map_grid.res @@ -1,201 +1,478 @@ "resource/ui/menus/panels/map_grid.res" { - GridButton0x0 + GridInfo0x0 { ControlName CNestedPanel wide 286 tall 165 - Classname MapGridButtons + Classname MapGridInfo scriptID 0 controlSettingsFile "resource/ui/menus/panels/map_grid_button.res" } - GridButton1x0 + GridInfo1x0 { ControlName CNestedPanel wide 286 tall 165 xpos 2 - Classname MapGridButtons + Classname MapGridInfo scriptID 1 controlSettingsFile "resource/ui/menus/panels/map_grid_button.res" - pin_to_sibling GridButton0x0 + + pin_to_sibling GridInfo0x0 pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner TOP_RIGHT } - GridButton2x0 + GridInfo2x0 { ControlName CNestedPanel wide 286 tall 165 xpos 2 - - Classname MapGridButtons + + Classname MapGridInfo scriptID 2 controlSettingsFile "resource/ui/menus/panels/map_grid_button.res" - pin_to_sibling GridButton1x0 + + pin_to_sibling GridInfo1x0 pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner TOP_RIGHT } - GridButton0x1 + GridInfo0x1 { ControlName CNestedPanel wide 286 tall 165 ypos 2 - Classname MapGridButtons + Classname MapGridInfo scriptID 3 controlSettingsFile "resource/ui/menus/panels/map_grid_button.res" - pin_to_sibling GridButton0x0 + + pin_to_sibling GridInfo0x0 pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - GridButton1x1 + GridInfo1x1 { ControlName CNestedPanel wide 286 tall 165 xpos 2 - Classname MapGridButtons + Classname MapGridInfo scriptID 4 controlSettingsFile "resource/ui/menus/panels/map_grid_button.res" - pin_to_sibling GridButton0x1 + + pin_to_sibling GridInfo0x1 pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner TOP_RIGHT } - GridButton2x1 + GridInfo2x1 { ControlName CNestedPanel wide 286 tall 165 xpos 2 - Classname MapGridButtons + + Classname MapGridInfo scriptID 5 controlSettingsFile "resource/ui/menus/panels/map_grid_button.res" - pin_to_sibling GridButton1x1 + + pin_to_sibling GridInfo1x1 pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner TOP_RIGHT } - GridButton0x2 + GridInfo0x2 { ControlName CNestedPanel wide 286 tall 165 ypos 2 - Classname MapGridButtons + + Classname MapGridInfo scriptID 6 controlSettingsFile "resource/ui/menus/panels/map_grid_button.res" - pin_to_sibling GridButton0x1 + + pin_to_sibling GridInfo0x1 pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - GridButton1x2 + GridInfo1x2 { ControlName CNestedPanel wide 286 tall 165 xpos 2 - Classname MapGridButtons + + Classname MapGridInfo scriptID 7 controlSettingsFile "resource/ui/menus/panels/map_grid_button.res" - pin_to_sibling GridButton0x2 + + pin_to_sibling GridInfo0x2 pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner TOP_RIGHT } - GridButton2x2 + GridInfo2x2 { ControlName CNestedPanel wide 286 tall 165 xpos 2 - Classname MapGridButtons + + Classname MapGridInfo scriptID 8 controlSettingsFile "resource/ui/menus/panels/map_grid_button.res" - pin_to_sibling GridButton1x2 + + pin_to_sibling GridInfo1x2 pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner TOP_RIGHT } - GridButton0x3 + GridInfo0x3 { ControlName CNestedPanel wide 286 tall 165 ypos 2 - Classname MapGridButtons + + Classname MapGridInfo scriptID 9 controlSettingsFile "resource/ui/menus/panels/map_grid_button.res" - pin_to_sibling GridButton0x2 + + pin_to_sibling GridInfo0x2 pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT } - GridButton1x3 + GridInfo1x3 { ControlName CNestedPanel wide 286 tall 165 xpos 2 - Classname MapGridButtons + + Classname MapGridInfo scriptID 10 controlSettingsFile "resource/ui/menus/panels/map_grid_button.res" - pin_to_sibling GridButton0x3 + + pin_to_sibling GridInfo0x3 pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner TOP_RIGHT } - GridButton2x3 + GridInfo2x3 { ControlName CNestedPanel wide 286 tall 165 xpos 2 - Classname MapGridButtons + + Classname MapGridInfo scriptID 11 controlSettingsFile "resource/ui/menus/panels/map_grid_button.res" + + pin_to_sibling GridInfo1x3 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + } + +//-------------------------------------------------------------------- + + GridButton0x0 + { + ControlName RuiButton + InheritProperties RuiSmallButton + wide 286 + tall 165 + + Classname MapGridButtons + scriptID 0 + + navDown GridButton0x1 + navRight GridButton1x0 + navUp DummyTop + } + + GridButton1x0 + { + ControlName RuiButton + InheritProperties RuiSmallButton + wide 286 + tall 165 + xpos 2 + + Classname MapGridButtons + scriptID 1 + + pin_to_sibling GridButton0x0 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + + navDown GridButton1x1 + navRight GridButton2x0 + navLeft GridButton0x0 + navUp DummyTop + } + + GridButton2x0 + { + ControlName RuiButton + InheritProperties RuiSmallButton + wide 286 + tall 165 + xpos 2 + + Classname MapGridButtons + scriptID 2 + + pin_to_sibling GridButton1x0 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + + navDown GridButton2x1 + navLeft GridButton1x0 + navUp DummyTop + } + + GridButton0x1 + { + ControlName RuiButton + InheritProperties RuiSmallButton + wide 286 + tall 165 + ypos 2 + + Classname MapGridButtons + scriptID 3 + + pin_to_sibling GridInfo0x0 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + + navUp GridButton0x0 + navRight GridButton1x1 + navDown GridButton0x2 + } + + GridButton1x1 + { + ControlName RuiButton + InheritProperties RuiSmallButton + wide 286 + tall 165 + xpos 2 + + Classname MapGridButtons + scriptID 4 + + pin_to_sibling GridButton0x1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + + navUp GridButton1x0 + navDown GridButton1x2 + navRight GridButton2x1 + navLeft GridButton0x1 + } + + GridButton2x1 + { + ControlName RuiButton + InheritProperties RuiSmallButton + wide 286 + tall 165 + xpos 2 + + Classname MapGridButtons + scriptID 5 + + pin_to_sibling GridButton1x1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + + navUp GridButton2x0 + navDown GridButton2x2 + navLeft GridButton1x1 + } + + GridButton0x2 + { + ControlName RuiButton + InheritProperties RuiSmallButton + wide 286 + tall 165 + ypos 2 + + Classname MapGridButtons + scriptID 6 + + pin_to_sibling GridInfo0x1 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + + navUp GridButton0x1 + navDown GridButton0x3 + navRight GridButton1x2 + } + + GridButton1x2 + { + ControlName RuiButton + InheritProperties RuiSmallButton + wide 286 + tall 165 + xpos 2 + + Classname MapGridButtons + scriptID 7 + + pin_to_sibling GridButton0x2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + + navUp GridButton1x1 + navDown GridButton1x3 + navRight GridButton2x2 + navLeft GridButton0x2 + } + + GridButton2x2 + { + ControlName RuiButton + InheritProperties RuiSmallButton + wide 286 + tall 165 + xpos 2 + + Classname MapGridButtons + scriptID 8 + + pin_to_sibling GridButton1x2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + + navUp GridButton2x1 + navDown GridButton2x3 + navLeft GridButton1x2 + } + + GridButton0x3 + { + ControlName RuiButton + InheritProperties RuiSmallButton + wide 286 + tall 165 + ypos 2 + + Classname MapGridButtons + scriptID 9 + + pin_to_sibling GridInfo0x2 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner BOTTOM_LEFT + + navUp GridButton0x2 + navRight GridButton1x3 + navDown DummyBottom + } + + GridButton1x3 + { + ControlName RuiButton + InheritProperties RuiSmallButton + wide 286 + tall 165 + xpos 2 + + Classname MapGridButtons + scriptID 10 + + pin_to_sibling GridButton0x3 + pin_corner_to_sibling TOP_LEFT + pin_to_sibling_corner TOP_RIGHT + + navUp GridButton1x2 + navRight GridButton2x3 + navLeft GridButton0x3 + navDown DummyBottom + } + + GridButton2x3 + { + ControlName RuiButton + InheritProperties RuiSmallButton + wide 286 + tall 165 + xpos 2 + + Classname MapGridButtons + scriptID 11 + pin_to_sibling GridButton1x3 pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner TOP_RIGHT + + navUp GridButton2x2 + navLeft GridButton1x3 + navDown DummyBottom + } + +//-------------------------------------------------------------------- + + DummyTop + { + ControlName RuiButton + InheritProperties RuiSmallButton + wide 0 + tall 0 + } + + DummyBottom + { + ControlName RuiButton + InheritProperties RuiSmallButton + wide 0 + tall 0 } -}
\ No newline at end of file +} diff --git a/Northstar.Client/mod/resource/ui/menus/panels/map_grid_button.res b/Northstar.Client/mod/resource/ui/menus/panels/map_grid_button.res index 23c040db..3e1ffe0c 100644 --- a/Northstar.Client/mod/resource/ui/menus/panels/map_grid_button.res +++ b/Northstar.Client/mod/resource/ui/menus/panels/map_grid_button.res @@ -49,14 +49,6 @@ pin_to_sibling_corner BOTTOM_RIGHT } - MapButton - { - ControlName RuiButton - InheritProperties RuiSmallButton - wide 286 - tall 165 - } - MapNameLockedForeground { ControlName RuiPanel diff --git a/Northstar.Client/mod/resource/ui/menus/server_browser.menu b/Northstar.Client/mod/resource/ui/menus/server_browser.menu index b03e0da8..89fb951d 100644 --- a/Northstar.Client/mod/resource/ui/menus/server_browser.menu +++ b/Northstar.Client/mod/resource/ui/menus/server_browser.menu @@ -2583,6 +2583,7 @@ resource/ui/menus/mods_browse.menu fgcolor_override "255 255 255 175" visible 1 + pin_to_sibling FilterPanel pin_corner_to_sibling TOP_LEFT pin_to_sibling_corner BOTTOM_LEFT diff --git a/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut b/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut index edaf582e..44a54e62 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_map_select.nut @@ -18,11 +18,15 @@ struct { int mapsPerPage = 21 int currentMapPage + array< var > gridInfos array< var > gridButtons + array< string > mapsArrayFiltered int scrollOffset = 0 + int lastSelectedID + var menu } file @@ -60,12 +64,16 @@ void function InitMapsMenu() RuiSetString( Hud_GetRui( Hud_GetChild( file.menu, "SwtBtnhideLocked")), "buttonText", "") + file.gridInfos = GetElementsByClassname( file.menu, "MapGridInfo" ) + file.gridButtons = GetElementsByClassname( file.menu, "MapGridButtons" ) + AddButtonEventHandler( Hud_GetChild( Hud_GetChild( file.menu , "MapsGridPanel" ), "DummyTop" ), UIE_GET_FOCUS, OnHitDummyTop ) + AddButtonEventHandler( Hud_GetChild( Hud_GetChild( file.menu , "MapsGridPanel" ), "DummyBottom" ), UIE_GET_FOCUS, OnHitDummyBottom ) + // uhh - foreach ( var mapButton in file.gridButtons ) + foreach ( var button in file.gridButtons ) { - var button = Hud_GetChild( mapButton, "MapButton" ) AddButtonEventHandler( button, UIE_CLICK, MapButton_Activate ) AddButtonEventHandler( button, UIE_GET_FOCUS, MapButton_Focus ) } @@ -94,11 +102,55 @@ void function OnOpenMapsMenu() { RefreshList() + Hud_SetFocused( file.gridButtons[0] ) + RegisterButtonPressedCallback(MOUSE_WHEEL_UP , OnScrollUp) RegisterButtonPressedCallback(MOUSE_WHEEL_DOWN , OnScrollDown) //RegisterButtonPressedCallback(KEY_TAB , OnKeyTabPressed) } +void function OnHitDummyTop( var button ) +{ + if( file.scrollOffset == 0 ) + { + Hud_SetFocused( file.gridButtons[ file.lastSelectedID ] ) + return + } + + file.scrollOffset-- + + UpdateMapsGrid() + UpdateListSliderPosition() + UpdateNextMapInfo() + + Hud_SetFocused( file.gridButtons[ file.lastSelectedID ] ) +} + +void function OnHitDummyBottom( var button ) +{ + if ( file.mapsArrayFiltered.len() <= BUTTONS_PER_PAGE || file.mapsArrayFiltered.len() <= 12 ) + return + + file.scrollOffset += 1 + + if ((file.scrollOffset + BUTTONS_PER_PAGE) * 3 > file.mapsArrayFiltered.len()) + file.scrollOffset = (file.mapsArrayFiltered.len() - BUTTONS_PER_PAGE * 3) / 3 + 1 + + UpdateMapsGrid() + UpdateListSliderPosition() + UpdateNextMapInfo() + + int scriptID = file.lastSelectedID + + if( scriptID > file.mapsArrayFiltered.len() - 1 - file.scrollOffset * 3 ) + scriptID = file.mapsArrayFiltered.len() - file.scrollOffset * 3 - 1 + + + var lastButton = file.gridButtons[ scriptID ] + + Hud_SetFocused( lastButton ) +} + void function RefreshList() { file.scrollOffset = 0 @@ -122,7 +174,7 @@ void function MapButton_Activate( var button ) if ( !AmIPartyLeader() && GetPartySize() > 1 ) return - int mapID = int( Hud_GetScriptID( Hud_GetParent( button ) ) ) + int mapID = int( Hud_GetScriptID( button ) ) string mapName = file.mapsArrayFiltered[ mapID + file.scrollOffset * 3 ] if ( IsLocked( mapName ) ) @@ -137,9 +189,11 @@ void function MapButton_Activate( var button ) void function MapButton_Focus( var button ) { - int mapID = int( Hud_GetScriptID( Hud_GetParent( button ) ) ) + int mapID = int( Hud_GetScriptID( button ) ) string mapName = file.mapsArrayFiltered[ mapID + file.scrollOffset * 3 ] - + + file.lastSelectedID = mapID + UpdateMapsInfo( mapName ) } @@ -179,7 +233,7 @@ void function UpdateMapsGrid() int trueOffset = file.scrollOffset * 3 - foreach ( int _index, var element in file.gridButtons ) + foreach ( int _index, var element in file.gridInfos ) { if ( ( _index + trueOffset ) >= mapsArray.len() ) return @@ -194,6 +248,7 @@ void function UpdateMapsGrid() if ( IsLocked( name ) ) LockMapButton( element ) + Hud_SetVisible( file.gridButtons[ _index ], true ) MakeMapButtonVisible( element ) } } @@ -225,14 +280,15 @@ void function FilterMapsArray() void function HideAllMapButtons() { - foreach ( var element in file.gridButtons ) + foreach ( _index, var element in file.gridInfos ) { Hud_SetVisible( element, false ) - var mapButton = Hud_GetChild( element, "MapButton" ) + var mapButton = file.gridButtons[ _index ] var mapFG = Hud_GetChild( element, "MapNameLockedForeground" ) Hud_SetLocked( mapButton, false ) + Hud_SetVisible( mapButton, false ) Hud_SetVisible( mapFG, false ) } } @@ -245,10 +301,8 @@ void function MakeMapButtonVisible( var element ) void function LockMapButton( var element ) { - var mapButton = Hud_GetChild( element, "MapButton" ) var mapFG = Hud_GetChild( element, "MapNameLockedForeground" ) - Hud_SetVisible( mapButton, true ) Hud_SetVisible( mapFG, true ) } @@ -381,7 +435,6 @@ void function OnDownArrowSelected( var button ) } UpdateMapsGrid() UpdateListSliderPosition() - printt(file.scrollOffset) } 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 b7c8c44b..b294f57c 100644 --- a/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut +++ b/Northstar.Client/mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut @@ -665,6 +665,7 @@ void function WaitForServerListRequest() else { FilterAndUpdateList(0) + Hud_SetFocused(Hud_GetChild(file.menu, "BtnServer1")) } } @@ -784,6 +785,9 @@ void function UpdateShownPage() void function OnServerButtonFocused( var button ) { + if (file.scrollOffset < 0) + file.scrollOffset = 0 + int scriptID = int (Hud_GetScriptID(button)) file.serverButtonFocusedID = scriptID if ( file.serversArrayFiltered.len() > 0 ) |