diff --git a/tests/controller_menu_accessibility_validation.gd b/tests/controller_menu_accessibility_validation.gd index 702210b..71c9cd4 100644 --- a/tests/controller_menu_accessibility_validation.gd +++ b/tests/controller_menu_accessibility_validation.gd @@ -104,6 +104,29 @@ func _validate_join_game_navigation() -> void: var discover_controls: Array[Control] = modes.duplicate() discover_controls.append_array([server_list, refresh, join, back]) _assert_directionally_reachable(discover, discover_controls) + var rooms: Array[Dictionary] = [ + { + "room_id": "controller-default-room", + "room_name": "Controller default room", + "current_players": 1, + "max_players": 8, + }, + { + "room_id": "controller-second-room", + "room_name": "Controller second room", + "current_players": 2, + "max_players": 8, + }, + ] + page.call("_on_discovery_rooms_updated", rooms) + _expect( + int(page.get("_selected_discovery_index")) == 0, + "Discovery should select its first room as soon as results arrive.", + ) + _expect( + server_list.is_selected(0), + "Discovery's visible cursor and selected room should agree immediately.", + ) address.show() address.editable = true diff --git a/ui/controller_focus_presentation.gd b/ui/controller_focus_presentation.gd index 5399893..04b259f 100644 --- a/ui/controller_focus_presentation.gd +++ b/ui/controller_focus_presentation.gd @@ -3,7 +3,7 @@ extends Node const CONTROLLER_MOTION_THRESHOLD: float = 0.35 const FOCUS_ARROW_TEXTURE: Texture2D = preload( - "res://ui/icons/pictograms/arrow_light_up_full.png" + "res://ui/icons/pictograms/arrow_cursor.png" ) const FOCUS_ARROW_SIZE: Vector2 = Vector2(32.0, 32.0) const FOCUS_ARROW_ROTATION_DEGREES: float = 150.0 diff --git a/ui/icons/pictograms/arrow_cursor.png b/ui/icons/pictograms/arrow_cursor.png new file mode 100644 index 0000000..0ea6e39 Binary files /dev/null and b/ui/icons/pictograms/arrow_cursor.png differ diff --git a/ui/icons/pictograms/arrow_cursor.png.import b/ui/icons/pictograms/arrow_cursor.png.import new file mode 100644 index 0000000..5db7d2d --- /dev/null +++ b/ui/icons/pictograms/arrow_cursor.png.import @@ -0,0 +1,40 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://uko4p7icttb1" +path="res://.godot/imported/arrow_cursor.png-a83ef44dfa7d9e0b913b50188510345c.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://ui/icons/pictograms/arrow_cursor.png" +dest_files=["res://.godot/imported/arrow_cursor.png-a83ef44dfa7d9e0b913b50188510345c.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/uastc_level=0 +compress/rdo_quality_loss=0.0 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/channel_remap/red=0 +process/channel_remap/green=1 +process/channel_remap/blue=2 +process/channel_remap/alpha=3 +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/ui/network/join_game_page.gd b/ui/network/join_game_page.gd index b05bdc8..94ddbfa 100644 --- a/ui/network/join_game_page.gd +++ b/ui/network/join_game_page.gd @@ -249,6 +249,8 @@ func _set_mode(mode: Mode, clear_connection_error: bool = true) -> void: _selected_discovery_index = -1 _clear_edit_state() _refresh_entries() + if mode == Mode.DISCOVER and not _discovery_rooms.is_empty(): + _select_discovery_index(0) _refresh() if mode == Mode.DISCOVER: _discovery_refresh_timer.start() @@ -465,10 +467,8 @@ func _cancel_delete() -> void: func _on_list_item_selected(index: int) -> void: if _mode == Mode.DISCOVER: - if index < 0 or index >= _discovery_rooms.size(): + if not _select_discovery_index(index): return - _selected_discovery_index = index - _selected_entry = null _refresh() return if index < 0 or index >= _visible_entries.size(): @@ -486,6 +486,15 @@ func _select_entry_id(entry_id: String) -> void: return +func _select_discovery_index(index: int) -> bool: + if index < 0 or index >= _discovery_rooms.size(): + return false + _selected_discovery_index = index + _selected_entry = null + _server_list.select(index) + return true + + func _refresh_entries() -> void: _visible_entries.clear() _server_list.clear() @@ -906,9 +915,10 @@ func _on_discovery_rooms_updated(rooms: Array[Dictionary]) -> void: if not selected_id.is_empty(): for index: int in _discovery_rooms.size(): if str(_discovery_rooms[index].get("room_id", "")) == selected_id: - _selected_discovery_index = index - _server_list.select(index) + _select_discovery_index(index) break + if _selected_discovery_index < 0 and not _discovery_rooms.is_empty(): + _select_discovery_index(0) _refresh()