Skip to content
This repository was archived by the owner on Jan 10, 2022. It is now read-only.

Commit f3730de

Browse files
author
F1F7Y
committed
Fixed double tap
1 parent c4e3f0e commit f3730de

File tree

2 files changed

+28
-29
lines changed

2 files changed

+28
-29
lines changed

mod/resource/ui/menus/server_browser.menu

+6-7
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ resource/ui/menus/mods_browse.menu
319319
xpos -4
320320
ypos -1
321321

322-
scriptID 999
322+
scriptID 1
323323

324324
pin_to_sibling BtnServerPasswordProtectedTab
325325
pin_corner_to_sibling TOP_LEFT
@@ -564,7 +564,7 @@ resource/ui/menus/mods_browse.menu
564564
wide 104
565565
xpos 4
566566

567-
scriptID 999
567+
scriptID 1
568568

569569
pin_to_sibling BtnServerNameTab
570570
pin_corner_to_sibling TOP_LEFT
@@ -795,7 +795,7 @@ resource/ui/menus/mods_browse.menu
795795
wide 140
796796
xpos 4
797797

798-
scriptID 999
798+
scriptID 1
799799

800800
pin_to_sibling BtnServerPlayersTab
801801
pin_corner_to_sibling TOP_LEFT
@@ -1025,7 +1025,7 @@ resource/ui/menus/mods_browse.menu
10251025
wide 150
10261026
xpos 4
10271027

1028-
scriptID 999
1028+
scriptID 1
10291029

10301030
pin_to_sibling BtnServerMapTab
10311031
pin_corner_to_sibling TOP_LEFT
@@ -1255,7 +1255,7 @@ resource/ui/menus/mods_browse.menu
12551255
wide 110
12561256
xpos 4
12571257

1258-
scriptID 999
1258+
scriptID 1
12591259

12601260
pin_to_sibling BtnServerGamemodeTab
12611261
pin_corner_to_sibling TOP_LEFT
@@ -1597,7 +1597,6 @@ resource/ui/menus/mods_browse.menu
15971597
pin_to_sibling ButtonRowAnchor
15981598
pin_corner_to_sibling TOP_LEFT
15991599
pin_to_sibling_corner TOP_LEFT
1600-
navUp BtnServerNameTab
16011600
navRight BtnServerJoin
16021601
}
16031602
BtnServer2
@@ -2319,7 +2318,7 @@ resource/ui/menus/mods_browse.menu
23192318
ypos -57
23202319
zpos 999
23212320

2322-
scriptID 999
2321+
scriptID 1
23232322

23242323
pin_to_sibling ServerDetailsPanel
23252324
pin_corner_to_sibling TOP_RIGHT

mod/scripts/vscripts/ui/menu_ns_serverbrowser.nut

+22-22
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ global function UpdateMouseDeltaBuffer
2121
// Follow pointer, let scrollOffset be it's own thing -> will look more fluid; fix the sync issue?
2222

2323
const int BUTTONS_PER_PAGE = 15
24-
const int DOUBLE_CLICK_TIME_MS = 20 // unsure what the ideal value is
24+
const float DOUBLE_CLICK_TIME_MS = 0.2 // unsure what the ideal value is
2525

2626

2727
struct {
@@ -67,14 +67,15 @@ array<serverStruct> serversArrayFiltered
6767

6868
struct {
6969
var menu
70-
int lastSelectedServer = 0
70+
int lastSelectedServer = 1
7171
int focusedServerIndex = 0
7272
int scrollOffset = 0
7373
bool serverListRequestFailed = false
7474
float serverSelectedTime = 0
7575
float serverSelectedTimeLast = 0
7676
//array<string> serverButtons
7777
int serverButtonFocusedID = 0
78+
bool shouldFocus = true
7879
} file
7980

8081

@@ -127,7 +128,6 @@ void function SliderBarUpdate()
127128
Hud_SetPos( sliderPanel , 2, newPos )
128129
Hud_SetPos( movementCapture , 2, newPos )
129130

130-
printt("scrollOffset: ", -int( ( (newPos - minYPos) / useableSpace ) * (serversArrayFiltered.len() - 15) ), "max: ", serversArrayFiltered.len() - 15)
131131
file.scrollOffset = -int( ( (newPos - minYPos) / useableSpace ) * (serversArrayFiltered.len() - 15) )
132132
UpdateShownPage()
133133
}
@@ -403,8 +403,6 @@ void function UpdateListSliderPosition( int servers )
403403
Hud_SetPos( sliderButton , 2, jump )
404404
Hud_SetPos( sliderPanel , 2, jump )
405405
Hud_SetPos( movementCapture , 2, jump )
406-
407-
printt("scrollOffset: ", file.scrollOffset)
408406
}
409407

410408

@@ -633,7 +631,11 @@ void function FilterAndUpdateList( var n )
633631
printt( "How the f did you get here" )
634632
}
635633

636-
//Hud_SetFocused( Hud_GetChild( file.menu, "BtnServer1" ) )
634+
if ( file.shouldFocus )
635+
{
636+
file.shouldFocus = false
637+
Hud_SetFocused( Hud_GetChild( file.menu, "BtnServer1" ) )
638+
}
637639
}
638640

639641

@@ -820,26 +822,10 @@ void function OnServerButtonFocused( var button )
820822
void function OnServerFocused( var button )
821823
{
822824
DisplayFocusedServerInfo(int ( Hud_GetScriptID( button ) ))
823-
824-
file.focusedServerIndex = serversArrayFiltered[ file.scrollOffset + int ( Hud_GetScriptID( button ) ) ].serverIndex
825-
int serverIndex = file.scrollOffset + int ( Hud_GetScriptID( button ) )
826-
827-
bool sameServer = false
828-
if (file.lastSelectedServer == serverIndex) sameServer = true
829-
830-
831-
file.lastSelectedServer = serverIndex
832-
833-
file.serverSelectedTimeLast = file.serverSelectedTime
834-
file.serverSelectedTime = Time()
835-
836-
if ((file.serverSelectedTime - file.serverSelectedTimeLast < DOUBLE_CLICK_TIME_MS) && sameServer && ( serverIndex >= 0 && serverIndex <= 14 ) )
837-
OnServerSelected(0)
838825
}
839826

840827
void function DisplayFocusedServerInfo( int scriptID )
841828
{
842-
printt( scriptID )
843829
if ( scriptID == 999 ) return
844830

845831

@@ -851,6 +837,20 @@ void function DisplayFocusedServerInfo( int scriptID )
851837
file.focusedServerIndex = serversArrayFiltered[ file.scrollOffset + scriptID ].serverIndex
852838
int serverIndex = file.scrollOffset + scriptID
853839

840+
bool sameServer = false
841+
if (file.lastSelectedServer == serverIndex) sameServer = true
842+
843+
844+
file.lastSelectedServer = serverIndex
845+
846+
file.serverSelectedTimeLast = file.serverSelectedTime
847+
file.serverSelectedTime = Time()
848+
849+
printt(file.serverSelectedTime - file.serverSelectedTimeLast,";", file.lastSelectedServer,";", serverIndex, ";",sameServer)
850+
851+
if ((file.serverSelectedTime - file.serverSelectedTimeLast < DOUBLE_CLICK_TIME_MS) && sameServer )
852+
OnServerSelected(0)
853+
854854

855855

856856

0 commit comments

Comments
 (0)