Team switch
This commit is contained in:
parent
775763a128
commit
59bf07b076
5 changed files with 89 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=23 format=3 uid="uid://cqrh2cc7m2i7f"]
|
[gd_scene load_steps=24 format=3 uid="uid://cqrh2cc7m2i7f"]
|
||||||
|
|
||||||
[ext_resource type="Environment" uid="uid://d0cfgtx2yxw13" path="res://environments/prototype_environment.tres" id="1_i6jab"]
|
[ext_resource type="Environment" uid="uid://d0cfgtx2yxw13" path="res://environments/prototype_environment.tres" id="1_i6jab"]
|
||||||
[ext_resource type="Material" uid="uid://bx3f5vx71ynh5" path="res://materials/Graymat.tres" id="4_y6i55"]
|
[ext_resource type="Material" uid="uid://bx3f5vx71ynh5" path="res://materials/Graymat.tres" id="4_y6i55"]
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
[ext_resource type="Script" uid="uid://3i00rp8urth7" path="res://scripts/object_container.gd" id="11_02ic3"]
|
[ext_resource type="Script" uid="uid://3i00rp8urth7" path="res://scripts/object_container.gd" id="11_02ic3"]
|
||||||
[ext_resource type="Script" uid="uid://bala54fa32e35" path="res://scripts/gui/hud/player_round_display.gd" id="17_wsuwo"]
|
[ext_resource type="Script" uid="uid://bala54fa32e35" path="res://scripts/gui/hud/player_round_display.gd" id="17_wsuwo"]
|
||||||
[ext_resource type="Script" uid="uid://bos7nftlx8tv3" path="res://scripts/gui/hud/player_round_time.gd" id="18_0hcup"]
|
[ext_resource type="Script" uid="uid://bos7nftlx8tv3" path="res://scripts/gui/hud/player_round_time.gd" id="18_0hcup"]
|
||||||
|
[ext_resource type="Script" uid="uid://m8qq2eynls6n" path="res://scripts/gui/team_choice_menu.gd" id="19_0hcup"]
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_ysk2e"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_ysk2e"]
|
||||||
size = Vector3(15.324341, 0.96273804, 21.381592)
|
size = Vector3(15.324341, 0.96273804, 21.381592)
|
||||||
|
|
@ -339,3 +340,47 @@ script = ExtResource("18_0hcup")
|
||||||
[node name="RoundDisplayTheir" type="Label" parent="CanvasLayer/RoundData"]
|
[node name="RoundDisplayTheir" type="Label" parent="CanvasLayer/RoundData"]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
script = ExtResource("17_wsuwo")
|
script = ExtResource("17_wsuwo")
|
||||||
|
|
||||||
|
[node name="CenterContainer" type="CenterContainer" parent="CanvasLayer"]
|
||||||
|
visible = false
|
||||||
|
anchors_preset = 15
|
||||||
|
anchor_right = 1.0
|
||||||
|
anchor_bottom = 1.0
|
||||||
|
grow_horizontal = 2
|
||||||
|
grow_vertical = 2
|
||||||
|
script = ExtResource("19_0hcup")
|
||||||
|
|
||||||
|
[node name="Panel" type="PanelContainer" parent="CanvasLayer/CenterContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="VBoxContainer" type="VBoxContainer" parent="CanvasLayer/CenterContainer/Panel"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="Label" type="Label" parent="CanvasLayer/CenterContainer/Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Choose your team"
|
||||||
|
horizontal_alignment = 1
|
||||||
|
|
||||||
|
[node name="HBoxContainer" type="HBoxContainer" parent="CanvasLayer/CenterContainer/Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
|
||||||
|
[node name="SpectatorButton" type="Button" parent="CanvasLayer/CenterContainer/Panel/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Spectators"
|
||||||
|
|
||||||
|
[node name="AttackButton" type="Button" parent="CanvasLayer/CenterContainer/Panel/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Attackers"
|
||||||
|
|
||||||
|
[node name="DefenceButton" type="Button" parent="CanvasLayer/CenterContainer/Panel/VBoxContainer/HBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Defenders"
|
||||||
|
|
||||||
|
[node name="CancelButton" type="Button" parent="CanvasLayer/CenterContainer/Panel/VBoxContainer"]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "Cancel"
|
||||||
|
|
||||||
|
[connection signal="pressed" from="CanvasLayer/CenterContainer/Panel/VBoxContainer/HBoxContainer/SpectatorButton" to="CanvasLayer/CenterContainer" method="_on_spectator_button_pressed"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer/CenterContainer/Panel/VBoxContainer/HBoxContainer/AttackButton" to="CanvasLayer/CenterContainer" method="_on_attack_button_pressed"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer/CenterContainer/Panel/VBoxContainer/HBoxContainer/DefenceButton" to="CanvasLayer/CenterContainer" method="_on_defence_button_pressed"]
|
||||||
|
[connection signal="pressed" from="CanvasLayer/CenterContainer/Panel/VBoxContainer/CancelButton" to="CanvasLayer/CenterContainer" method="_on_cancel_button_pressed"]
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,11 @@ menu_settings={
|
||||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194305,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
menu_team_choice={
|
||||||
|
"deadzone": 0.2,
|
||||||
|
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":77,"key_label":0,"unicode":109,"location":0,"echo":false,"script":null)
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
[layer_names]
|
[layer_names]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@ var cached_mouse_state: Input.MouseMode
|
||||||
func _on_check_button_toggled(toggled_on: bool) -> void:
|
func _on_check_button_toggled(toggled_on: bool) -> void:
|
||||||
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN if toggled_on else DisplayServer.WINDOW_MODE_WINDOWED)
|
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN if toggled_on else DisplayServer.WINDOW_MODE_WINDOWED)
|
||||||
|
|
||||||
|
|
||||||
func _on_h_slider_value_changed(value: float) -> void:
|
func _on_h_slider_value_changed(value: float) -> void:
|
||||||
$VBoxContainer/Sensitivity/SpinBox.set_value_no_signal(value)
|
$VBoxContainer/Sensitivity/SpinBox.set_value_no_signal(value)
|
||||||
ClientSettings.SENSITIVITY = value
|
ClientSettings.SENSITIVITY = value
|
||||||
|
|
|
||||||
37
scripts/gui/team_choice_menu.gd
Normal file
37
scripts/gui/team_choice_menu.gd
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
extends Control
|
||||||
|
|
||||||
|
var cached_mouse_state: Input.MouseMode
|
||||||
|
|
||||||
|
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:
|
||||||
|
cached_mouse_state = Input.mouse_mode
|
||||||
|
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||||
|
else:
|
||||||
|
Input.mouse_mode = cached_mouse_state
|
||||||
1
scripts/gui/team_choice_menu.gd.uid
Normal file
1
scripts/gui/team_choice_menu.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://m8qq2eynls6n
|
||||||
Loading…
Add table
Add a link
Reference in a new issue