Buy menu
This commit is contained in:
parent
b59cb48b77
commit
4e8971b12d
12 changed files with 134 additions and 15 deletions
|
|
@ -19,7 +19,7 @@
|
|||
[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://m8qq2eynls6n" path="res://scripts/gui/team_choice_menu.gd" id="19_0hcup"]
|
||||
[ext_resource type="PackedScene" uid="uid://l4t1mflutm3t" path="res://scenes/projectiles/molikman/molikman_molotov_fire.tscn" id="20_gcyg7"]
|
||||
[ext_resource type="PackedScene" uid="uid://j5lgbg8c0pq" path="res://scenes/gui/buy_menu/buy_menu.tscn" id="20_gcyg7"]
|
||||
|
||||
[sub_resource type="BoxShape3D" id="BoxShape3D_ysk2e"]
|
||||
size = Vector3(15.324341, 0.96273804, 21.381592)
|
||||
|
|
@ -292,7 +292,7 @@ script = ExtResource("11_02ic3")
|
|||
exlusion_list = [NodePath("MultiplayerSpawner"), NodePath("Bomb")]
|
||||
|
||||
[node name="MultiplayerSpawner" type="MultiplayerSpawner" parent="DynamicObjectsContainer"]
|
||||
_spawnable_scenes = PackedStringArray("uid://cxdgk74ln5xpn", "uid://dgfqppi21c2u0")
|
||||
_spawnable_scenes = PackedStringArray("uid://cxdgk74ln5xpn", "uid://dgfqppi21c2u0", "uid://l4t1mflutm3t")
|
||||
spawn_path = NodePath("..")
|
||||
script = ExtResource("6_oujx2")
|
||||
|
||||
|
|
@ -414,8 +414,8 @@ text = "Defenders"
|
|||
layout_mode = 2
|
||||
text = "Cancel"
|
||||
|
||||
[node name="MolikmanMolotovFire" parent="." instance=ExtResource("20_gcyg7")]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -25.65116, 0.67484045, 14.924126)
|
||||
[node name="BuyMenu" parent="CanvasLayer" instance=ExtResource("20_gcyg7")]
|
||||
visible = false
|
||||
|
||||
[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"]
|
||||
|
|
|
|||
|
|
@ -164,6 +164,11 @@ menu_team_choice={
|
|||
"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)
|
||||
]
|
||||
}
|
||||
plr_buy={
|
||||
"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":66,"key_label":0,"unicode":98,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[layer_names]
|
||||
|
||||
|
|
|
|||
7
scenes/gui/buy_menu/buy_button/buy_button.gd
Normal file
7
scenes/gui/buy_menu/buy_button/buy_button.gd
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
extends Button
|
||||
|
||||
@export var weapon: WeaponResource
|
||||
|
||||
func _ready() -> void:
|
||||
icon = weapon.preview
|
||||
text = str(weapon.cost)
|
||||
1
scenes/gui/buy_menu/buy_button/buy_button.gd.uid
Normal file
1
scenes/gui/buy_menu/buy_button/buy_button.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bq32y7eee1f63
|
||||
17
scenes/gui/buy_menu/buy_button/buy_button.tscn
Normal file
17
scenes/gui/buy_menu/buy_button/buy_button.tscn
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://b1ej6kmbjpm78"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dnxw4x3cmu7io" path="res://icon.svg" id="1_apu4l"]
|
||||
[ext_resource type="Script" uid="uid://bq32y7eee1f63" path="res://scenes/gui/buy_menu/buy_button/buy_button.gd" id="1_impj7"]
|
||||
|
||||
[node name="BuyButton" type="Button"]
|
||||
anchors_preset = -1
|
||||
anchor_right = 0.035
|
||||
anchor_bottom = 0.075
|
||||
offset_right = -4.799999
|
||||
offset_bottom = -14.000004
|
||||
text = "3600"
|
||||
icon = ExtResource("1_apu4l")
|
||||
icon_alignment = 1
|
||||
vertical_icon_alignment = 0
|
||||
expand_icon = true
|
||||
script = ExtResource("1_impj7")
|
||||
29
scenes/gui/buy_menu/buy_menu.gd
Normal file
29
scenes/gui/buy_menu/buy_menu.gd
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
extends ColorRect
|
||||
|
||||
func _ready() -> void:
|
||||
Session.round_state_changed.connect(on_round_state_changed)
|
||||
|
||||
func on_round_state_changed(state: int) -> void:
|
||||
if state != Session.ROUND_STATES.BUY:
|
||||
visible = false
|
||||
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
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("plr_buy"):
|
||||
if Session.round_state == Session.ROUND_STATES.BUY:
|
||||
visible = not visible
|
||||
else:
|
||||
visible = false
|
||||
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
scenes/gui/buy_menu/buy_menu.gd.uid
Normal file
1
scenes/gui/buy_menu/buy_menu.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dba17sgimp4j0
|
||||
37
scenes/gui/buy_menu/buy_menu.tscn
Normal file
37
scenes/gui/buy_menu/buy_menu.tscn
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://j5lgbg8c0pq"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://b1ej6kmbjpm78" path="res://scenes/gui/buy_menu/buy_button/buy_button.tscn" id="1_8guql"]
|
||||
[ext_resource type="Script" uid="uid://dba17sgimp4j0" path="res://scenes/gui/buy_menu/buy_menu.gd" id="1_ko0fn"]
|
||||
[ext_resource type="Resource" uid="uid://b081hg7uxx1wu" path="res://weapons/molikman_molotov.tres" id="2_0gws3"]
|
||||
|
||||
[node name="BuyMenu" type="ColorRect"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0, 0, 0, 0.22745098)
|
||||
script = ExtResource("1_ko0fn")
|
||||
|
||||
[node name="CenterContainer" type="CenterContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="PanelContainer" type="PanelContainer" parent="CenterContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="WeaponsContainer" type="GridContainer" parent="CenterContainer/PanelContainer"]
|
||||
layout_mode = 2
|
||||
columns = 5
|
||||
|
||||
[node name="AbilitiesContainer" type="VBoxContainer" parent="CenterContainer/PanelContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="BuyButton" parent="CenterContainer/PanelContainer/AbilitiesContainer" instance=ExtResource("1_8guql")]
|
||||
layout_mode = 2
|
||||
weapon = ExtResource("2_0gws3")
|
||||
|
|
@ -8769,13 +8769,13 @@ script = ExtResource("10_a8ls1")
|
|||
max_speed = 6.0
|
||||
acceleration = 100.0
|
||||
deceleration = 50.0
|
||||
step_delay = 0.25
|
||||
step_speed_curve = SubResource("Curve_fbysy")
|
||||
player = NodePath("../..")
|
||||
player_movement = NodePath("../../PlayerMovement")
|
||||
player_input = NodePath("../../PlayerInput")
|
||||
weapon_system = NodePath("../../WeaponSystem")
|
||||
audio = NodePath("../../StepAudio")
|
||||
step_delay = 0.25
|
||||
step_speed_curve = SubResource("Curve_fbysy")
|
||||
|
||||
[node name="Walk" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("player", "player_movement", "player_input", "weapon_system")]
|
||||
script = ExtResource("11_qfm1y")
|
||||
|
|
@ -8789,10 +8789,10 @@ weapon_system = NodePath("../../WeaponSystem")
|
|||
|
||||
[node name="Fall" type="Node" parent="BodyStateMachine" node_paths=PackedStringArray("player", "player_movement", "player_input", "weapon_system", "land_sound")]
|
||||
script = ExtResource("12_fulsm")
|
||||
acceleration = 25.0
|
||||
player = NodePath("../..")
|
||||
player_movement = NodePath("../../PlayerMovement")
|
||||
player_input = NodePath("../../PlayerInput")
|
||||
acceleration = 25.0
|
||||
weapon_system = NodePath("../../WeaponSystem")
|
||||
land_sound = NodePath("../../LandAudio")
|
||||
|
||||
|
|
@ -8802,9 +8802,9 @@ animation_player = NodePath("../../AnimationPlayer")
|
|||
|
||||
[node name="PlayerMovement" type="Node" parent="." node_paths=PackedStringArray("player", "player_input")]
|
||||
script = ExtResource("19_70eug")
|
||||
jump_velocity = 12.0
|
||||
player = NodePath("..")
|
||||
player_input = NodePath("../PlayerInput")
|
||||
jump_velocity = 12.0
|
||||
|
||||
[node name="WeaponSystem" type="Node" parent="." node_paths=PackedStringArray("animation_player", "camera", "player", "player_input")]
|
||||
script = ExtResource("4_qlg0r")
|
||||
|
|
@ -8829,9 +8829,9 @@ libraries = {
|
|||
|
||||
[node name="TeamUpdater" type="Node" parent="." node_paths=PackedStringArray("player")]
|
||||
script = ExtResource("7_a8ls1")
|
||||
player = NodePath("..")
|
||||
layer = true
|
||||
inverse = true
|
||||
player = NodePath("..")
|
||||
|
||||
[node name="PickupRange" type="Area3D" parent="." node_paths=PackedStringArray("weapon_spawner", "weapon_system")]
|
||||
collision_layer = 0
|
||||
|
|
@ -8847,8 +8847,8 @@ shape = SubResource("CapsuleShape3D_3xmak")
|
|||
[node name="TeamMaterialSwitcher" type="Node" parent="." node_paths=PackedStringArray("player")]
|
||||
script = ExtResource("25_1mtds")
|
||||
material = ExtResource("26_r2jxp")
|
||||
blue_team_texture = ExtResource("27_j3w78")
|
||||
player = NodePath("..")
|
||||
blue_team_texture = ExtResource("27_j3w78")
|
||||
|
||||
[node name="Interaction" type="Node" parent="."]
|
||||
script = ExtResource("37_5amik")
|
||||
|
|
@ -8859,11 +8859,12 @@ script = ExtResource("37_b2eak")
|
|||
|
||||
[connection signal="died" from="." to="molikman_ingame/PlayerBasedVisibility" method="reverse_if_own"]
|
||||
[connection signal="died" from="." to="Camera3D" method="disable"]
|
||||
[connection signal="died" from="." to="Camera3D/molikman_hands/PlayerBasedVisibility" method="reverse_if_own"]
|
||||
[connection signal="died" from="." to="Camera3D/DeadSpectator" method="set_active"]
|
||||
[connection signal="died" from="." to="BodyStateMachine/Death" method="on_death"]
|
||||
[connection signal="died" from="." to="PlayerMovement" method="disable"]
|
||||
[connection signal="died" from="." to="WeaponSystem" method="disable"]
|
||||
[connection signal="died" from="." to="Camera3D/molikman_hands/PlayerBasedVisibility" method="reverse_if_own"]
|
||||
[connection signal="died" from="." to="PickupRange" method="disable"]
|
||||
[connection signal="health_changed" from="." to="HUD/Healthbar" method="on_hp_changed"]
|
||||
[connection signal="ammo_updated" from="WeaponSystem" to="HUD/AmmoDisplay" method="on_ammo_updated"]
|
||||
[connection signal="interact_begin" from="PlayerInput" to="Interaction" method="on_player_start_interacting"]
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
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)
|
||||
|
|
@ -31,7 +29,9 @@ func _input(event: InputEvent) -> void:
|
|||
|
||||
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
|
||||
if Session.session_started_flag:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
|
||||
else:
|
||||
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
|
||||
|
|
|
|||
|
|
@ -2,13 +2,19 @@ extends Area3D
|
|||
|
||||
@export var weapon_spawner: MultiplayerSpawner
|
||||
@export var weapon_system: WeaponSystem
|
||||
var disabled: bool
|
||||
|
||||
func _ready() -> void:
|
||||
if is_multiplayer_authority() == false: return
|
||||
|
||||
body_entered.connect(on_body_entered)
|
||||
|
||||
func disable() -> void:
|
||||
disabled = true
|
||||
|
||||
func on_body_entered(body: Node3D):
|
||||
if disabled:
|
||||
return
|
||||
if body is DroppableWeapon:
|
||||
if weapon_system.can_add(body.slot) == false or (body.team != Session.TEAMS.UNASSIGNED and get_parent().team != body.team):
|
||||
return
|
||||
|
|
@ -22,12 +28,16 @@ func on_body_entered(body: Node3D):
|
|||
Session.despawn(body.get_path())
|
||||
|
||||
func start_temp_ignore():
|
||||
if disabled:
|
||||
return
|
||||
if is_multiplayer_authority() == false:
|
||||
return
|
||||
monitoring = false
|
||||
get_tree().create_timer(0.5).timeout.connect(stop_temp_ignore)
|
||||
|
||||
func stop_temp_ignore():
|
||||
if disabled:
|
||||
return
|
||||
if is_multiplayer_authority() == false:
|
||||
return
|
||||
monitoring = true
|
||||
|
|
|
|||
11
weapons/molikman_molotov.tres
Normal file
11
weapons/molikman_molotov.tres
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[gd_resource type="Resource" script_class="WeaponResource" load_steps=3 format=3 uid="uid://b081hg7uxx1wu"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bmnqvop2dy5pm" path="res://textures/prototype_yellow_256x256.png" id="1_hmyxe"]
|
||||
[ext_resource type="Script" uid="uid://bvnn2eiwqbu7t" path="res://scripts/resources/weapon_resource.gd" id="1_ktfgd"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_ktfgd")
|
||||
cost = 300
|
||||
preview = ExtResource("1_hmyxe")
|
||||
slot = &"ability"
|
||||
metadata/_custom_type_script = "uid://bvnn2eiwqbu7t"
|
||||
Loading…
Add table
Add a link
Reference in a new issue