forked from woofmeow/straywild
fix: clarify controller room browser focus
This commit is contained in:
parent
908cf2733a
commit
6db6fbba7f
5 changed files with 79 additions and 6 deletions
|
|
@ -104,6 +104,29 @@ func _validate_join_game_navigation() -> void:
|
||||||
var discover_controls: Array[Control] = modes.duplicate()
|
var discover_controls: Array[Control] = modes.duplicate()
|
||||||
discover_controls.append_array([server_list, refresh, join, back])
|
discover_controls.append_array([server_list, refresh, join, back])
|
||||||
_assert_directionally_reachable(discover, discover_controls)
|
_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.show()
|
||||||
address.editable = true
|
address.editable = true
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ extends Node
|
||||||
|
|
||||||
const CONTROLLER_MOTION_THRESHOLD: float = 0.35
|
const CONTROLLER_MOTION_THRESHOLD: float = 0.35
|
||||||
const FOCUS_ARROW_TEXTURE: Texture2D = preload(
|
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_SIZE: Vector2 = Vector2(32.0, 32.0)
|
||||||
const FOCUS_ARROW_ROTATION_DEGREES: float = 150.0
|
const FOCUS_ARROW_ROTATION_DEGREES: float = 150.0
|
||||||
|
|
|
||||||
BIN
ui/icons/pictograms/arrow_cursor.png
Normal file
BIN
ui/icons/pictograms/arrow_cursor.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 658 B |
40
ui/icons/pictograms/arrow_cursor.png.import
Normal file
40
ui/icons/pictograms/arrow_cursor.png.import
Normal file
|
|
@ -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
|
||||||
|
|
@ -249,6 +249,8 @@ func _set_mode(mode: Mode, clear_connection_error: bool = true) -> void:
|
||||||
_selected_discovery_index = -1
|
_selected_discovery_index = -1
|
||||||
_clear_edit_state()
|
_clear_edit_state()
|
||||||
_refresh_entries()
|
_refresh_entries()
|
||||||
|
if mode == Mode.DISCOVER and not _discovery_rooms.is_empty():
|
||||||
|
_select_discovery_index(0)
|
||||||
_refresh()
|
_refresh()
|
||||||
if mode == Mode.DISCOVER:
|
if mode == Mode.DISCOVER:
|
||||||
_discovery_refresh_timer.start()
|
_discovery_refresh_timer.start()
|
||||||
|
|
@ -465,10 +467,8 @@ func _cancel_delete() -> void:
|
||||||
|
|
||||||
func _on_list_item_selected(index: int) -> void:
|
func _on_list_item_selected(index: int) -> void:
|
||||||
if _mode == Mode.DISCOVER:
|
if _mode == Mode.DISCOVER:
|
||||||
if index < 0 or index >= _discovery_rooms.size():
|
if not _select_discovery_index(index):
|
||||||
return
|
return
|
||||||
_selected_discovery_index = index
|
|
||||||
_selected_entry = null
|
|
||||||
_refresh()
|
_refresh()
|
||||||
return
|
return
|
||||||
if index < 0 or index >= _visible_entries.size():
|
if index < 0 or index >= _visible_entries.size():
|
||||||
|
|
@ -486,6 +486,15 @@ func _select_entry_id(entry_id: String) -> void:
|
||||||
return
|
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:
|
func _refresh_entries() -> void:
|
||||||
_visible_entries.clear()
|
_visible_entries.clear()
|
||||||
_server_list.clear()
|
_server_list.clear()
|
||||||
|
|
@ -906,9 +915,10 @@ func _on_discovery_rooms_updated(rooms: Array[Dictionary]) -> void:
|
||||||
if not selected_id.is_empty():
|
if not selected_id.is_empty():
|
||||||
for index: int in _discovery_rooms.size():
|
for index: int in _discovery_rooms.size():
|
||||||
if str(_discovery_rooms[index].get("room_id", "")) == selected_id:
|
if str(_discovery_rooms[index].get("room_id", "")) == selected_id:
|
||||||
_selected_discovery_index = index
|
_select_discovery_index(index)
|
||||||
_server_list.select(index)
|
|
||||||
break
|
break
|
||||||
|
if _selected_discovery_index < 0 and not _discovery_rooms.is_empty():
|
||||||
|
_select_discovery_index(0)
|
||||||
_refresh()
|
_refresh()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue