Global refactor

This commit is contained in:
Rendo 2025-12-09 11:53:52 +05:00
commit 0589ca4e23
180 changed files with 249 additions and 401 deletions

View file

@ -0,0 +1,37 @@
extends Control
func _on_spectator_button_pressed() -> void:
if Lobby.get_team() != Session.TEAMS.SPECTATE:
Lobby.switch_team(Session.TEAMS.SPECTATE)
visible = false
update_mouse()
func _on_attack_button_pressed() -> void:
if Lobby.get_team() != Session.TEAMS.ATTACK:
Lobby.switch_team(Session.TEAMS.ATTACK)
visible = false
update_mouse()
func _on_defence_button_pressed() -> void:
if Lobby.get_team() != Session.TEAMS.DEFENCE:
Lobby.switch_team(Session.TEAMS.DEFENCE)
visible = false
update_mouse()
func _on_cancel_button_pressed() -> void:
visible = false
update_mouse()
func _input(event: InputEvent) -> void:
if event.is_action_pressed("menu_team_choice"):
visible = not visible
update_mouse()
func update_mouse() -> void:
if visible:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
else:
if Session.session_started_flag:
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
else:
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE

View file

@ -0,0 +1 @@
uid://m8qq2eynls6n

View file

@ -0,0 +1,47 @@
[gd_scene load_steps=2 format=3 uid="uid://cmon3g1lsm3q"]
[ext_resource type="Script" uid="uid://m8qq2eynls6n" path="res://gui/team_choice/team_choice_menu.gd" id="1_kch1g"]
[node name="TeamChoiceMenu" type="CenterContainer"]
visible = false
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_kch1g")
[node name="Panel" type="PanelContainer" parent="."]
layout_mode = 2
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
layout_mode = 2
[node name="Label" type="Label" parent="Panel/VBoxContainer"]
layout_mode = 2
text = "Choose your team"
horizontal_alignment = 1
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/VBoxContainer"]
layout_mode = 2
[node name="SpectatorButton" type="Button" parent="Panel/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Spectators"
[node name="AttackButton" type="Button" parent="Panel/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Attackers"
[node name="DefenceButton" type="Button" parent="Panel/VBoxContainer/HBoxContainer"]
layout_mode = 2
text = "Defenders"
[node name="CancelButton" type="Button" parent="Panel/VBoxContainer"]
layout_mode = 2
text = "Cancel"
[connection signal="pressed" from="Panel/VBoxContainer/HBoxContainer/SpectatorButton" to="." method="_on_spectator_button_pressed"]
[connection signal="pressed" from="Panel/VBoxContainer/HBoxContainer/AttackButton" to="." method="_on_attack_button_pressed"]
[connection signal="pressed" from="Panel/VBoxContainer/HBoxContainer/DefenceButton" to="." method="_on_defence_button_pressed"]
[connection signal="pressed" from="Panel/VBoxContainer/CancelButton" to="." method="_on_cancel_button_pressed"]