feat: Implement cycle timer toggle, refactor continuous input, and improve movement synchronization.
This commit is contained in:
+27
-11
@@ -32,6 +32,8 @@ extends Control
|
||||
@onready var duration_text_label = $LobbyPanel/TopBar/SettingsSection/DurationTextLabel
|
||||
@onready var random_spawn_check = $LobbyPanel/TopBar/SettingsSection/RandomSpawnCheck
|
||||
@onready var random_spawn_label = $LobbyPanel/TopBar/SettingsSection/RandomSpawnLabel
|
||||
@onready var enable_timer_check = $LobbyPanel/TopBar/SettingsSection/EnableTimerCheck
|
||||
@onready var enable_timer_label = $LobbyPanel/TopBar/SettingsSection/EnableTimerLabel
|
||||
|
||||
# UI References - Player Slots
|
||||
@onready var players_container = $LobbyPanel/PlayersContainer
|
||||
@@ -112,6 +114,7 @@ func _ready():
|
||||
copy_id_btn.pressed.connect(_on_copy_id_pressed)
|
||||
duration_option.item_selected.connect(_on_duration_selected)
|
||||
random_spawn_check.toggled.connect(_on_random_spawn_toggled)
|
||||
enable_timer_check.toggled.connect(_on_enable_timer_toggled)
|
||||
area_left_btn.pressed.connect(func(): LobbyManager.cycle_area(-1))
|
||||
area_right_btn.pressed.connect(func(): LobbyManager.cycle_area(1))
|
||||
leave_btn.pressed.connect(_on_leave_pressed)
|
||||
@@ -129,6 +132,7 @@ func _ready():
|
||||
LobbyManager.game_starting.connect(_on_game_starting)
|
||||
LobbyManager.match_duration_changed.connect(_on_match_duration_changed)
|
||||
LobbyManager.randomize_spawn_changed.connect(_on_randomize_spawn_changed)
|
||||
LobbyManager.enable_cycle_timer_changed.connect(_on_enable_cycle_timer_changed)
|
||||
LobbyManager.character_changed.connect(_on_character_changed)
|
||||
LobbyManager.area_changed.connect(_on_area_changed)
|
||||
LobbyManager.player_list_changed.connect(_update_player_slots)
|
||||
@@ -269,10 +273,11 @@ func _on_duration_selected(index: int) -> void:
|
||||
if index >= 0 and index < durations.size():
|
||||
LobbyManager.set_match_duration(durations[index])
|
||||
|
||||
func _on_random_spawn_toggled(enabled: bool) -> void:
|
||||
if not LobbyManager.is_host:
|
||||
return
|
||||
LobbyManager.set_randomize_spawn(enabled)
|
||||
func _on_random_spawn_toggled(toggled_on):
|
||||
LobbyManager.set_randomize_spawn(toggled_on)
|
||||
|
||||
func _on_enable_timer_toggled(toggled_on):
|
||||
LobbyManager.set_enable_cycle_timer(toggled_on)
|
||||
|
||||
func _update_random_spawn_label(enabled: bool) -> void:
|
||||
if random_spawn_label:
|
||||
@@ -328,14 +333,17 @@ func _on_room_joined(room_data: Dictionary) -> void:
|
||||
# Duration: host sees dropdown, clients see text
|
||||
duration_option.visible = is_host
|
||||
duration_text_label.visible = not is_host
|
||||
if not is_host:
|
||||
_update_duration_text_label(LobbyManager.get_match_duration())
|
||||
|
||||
# Random spawn: host sees checkbox, clients see label
|
||||
random_spawn_check.visible = is_host
|
||||
random_spawn_label.visible = not is_host
|
||||
random_spawn_check.button_pressed = LobbyManager.get_randomize_spawn()
|
||||
_update_random_spawn_label(LobbyManager.get_randomize_spawn())
|
||||
|
||||
enable_timer_check.visible = is_host
|
||||
enable_timer_label.visible = not is_host
|
||||
|
||||
# Update values from LobbyManager
|
||||
_on_match_duration_changed(LobbyManager.match_duration)
|
||||
_on_randomize_spawn_changed(LobbyManager.randomize_spawn)
|
||||
_on_enable_cycle_timer_changed(LobbyManager.enable_cycle_timer)
|
||||
|
||||
# Area selector: only host can interact
|
||||
area_left_btn.disabled = not is_host
|
||||
@@ -378,8 +386,16 @@ func _on_match_duration_changed(duration_seconds: int) -> void:
|
||||
_update_duration_text_label(duration_seconds)
|
||||
|
||||
func _on_randomize_spawn_changed(enabled: bool) -> void:
|
||||
if not LobbyManager.is_host:
|
||||
_update_random_spawn_label(enabled)
|
||||
if random_spawn_check:
|
||||
random_spawn_check.set_pressed_no_signal(enabled)
|
||||
if random_spawn_label:
|
||||
random_spawn_label.text = "Random \u2713" if enabled else "Random \u2717"
|
||||
|
||||
func _on_enable_cycle_timer_changed(enabled: bool) -> void:
|
||||
if enable_timer_check:
|
||||
enable_timer_check.set_pressed_no_signal(enabled)
|
||||
if enable_timer_label:
|
||||
enable_timer_label.text = "Timer \u2713" if enabled else "Timer \u2717"
|
||||
|
||||
func _on_character_changed(_player_id: int, _character_name: String) -> void:
|
||||
_update_player_slots()
|
||||
|
||||
Reference in New Issue
Block a user