Global refactor
This commit is contained in:
parent
3868af29e3
commit
0589ca4e23
180 changed files with 249 additions and 401 deletions
37
gui/team_choice/team_choice_menu.gd
Normal file
37
gui/team_choice/team_choice_menu.gd
Normal 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
|
||||
1
gui/team_choice/team_choice_menu.gd.uid
Normal file
1
gui/team_choice/team_choice_menu.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://m8qq2eynls6n
|
||||
47
gui/team_choice/team_choice_menu.tscn
Normal file
47
gui/team_choice/team_choice_menu.tscn
Normal 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"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue