shuffle and team control

This commit is contained in:
Rendo 2025-12-12 17:20:19 +05:00
commit 13cfa692ce
4 changed files with 59 additions and 10 deletions

View file

@ -7,6 +7,7 @@ func _ready() -> void:
%TeamSwitchBox.set_value_no_signal(LobbySettings.half_rounds)
%RoundBox.set_value_no_signal(LobbySettings.win_score)
%AllowMultipleAbilityButton.set_pressed_no_signal(LobbySettings.allow_multiple_abilities)
%AllowTeamSwitch.set_pressed_no_signal(LobbySettings.allow_team_switch)
func _on_round_time_box_value_changed(value: float) -> void:
LobbySettings.round_time = value
@ -31,3 +32,11 @@ func _on_team_switch_box_value_changed(value: float) -> void:
func _on_allow_multiple_ability_button_toggled(toggled_on: bool) -> void:
LobbySettings.allow_multiple_abilities = toggled_on
func _on_shuffle_pressed() -> void:
Lobby.shuffle_teams()
func _on_allow_team_switch_toggled(toggled_on: bool) -> void:
LobbySettings.allow_team_switch = toggled_on

View file

@ -143,7 +143,16 @@ script = ExtResource("3_f5ibf")
layout_mode = 2
title = "Команды"
[node name="Shuffle" type="Button" parent="Teams"]
[node name="VBoxContainer" type="VBoxContainer" parent="Teams"]
layout_mode = 2
[node name="AllowTeamSwitch" type="CheckButton" parent="Teams/VBoxContainer"]
unique_name_in_owner = true
layout_mode = 2
text = "Разрешить смену команд"
autowrap_mode = 2
[node name="Shuffle" type="Button" parent="Teams/VBoxContainer"]
layout_mode = 2
text = "Перемешать"
@ -154,3 +163,5 @@ text = "Перемешать"
[connection signal="value_changed" from="Round/VBoxContainer/TeamSwitchAmount/TeamSwitchBox" to="." method="_on_team_switch_box_value_changed"]
[connection signal="toggled" from="Gameplay/AllowMultipleAbilityButton" to="." method="_on_allow_multiple_ability_button_toggled"]
[connection signal="update_ip" from="PortForward/PortForwardContainer/ForwardPortButton" to="PortForward/PortForwardContainer/PublicIP" method="on_update_ip"]
[connection signal="toggled" from="Teams/VBoxContainer/AllowTeamSwitch" to="." method="_on_allow_team_switch_toggled"]
[connection signal="pressed" from="Teams/VBoxContainer/Shuffle" to="." method="_on_shuffle_pressed"]