Implemented audio mute function with hotkey "m" and icon in top right corner

feature-rocketlauncher
unfa 2021-12-18 14:18:16 +01:00
parent a0626116f9
commit 9c6dc9948a
3 changed files with 24 additions and 1 deletions

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=24 format=3 uid="uid://bs80rhfpgh2m2"]
[gd_scene load_steps=25 format=3 uid="uid://bs80rhfpgh2m2"]
[ext_resource type="Texture2D" uid="uid://dlw3sb5tygqf4" path="res://Assets/HUD/Vignette.png" id="1"]
[ext_resource type="Script" path="res://Assets/HUD/HUD.gd" id="1_wc430"]
@ -17,6 +17,7 @@
[ext_resource type="Texture2D" uid="uid://csoue1u7vfgqq" path="res://Assets/HUD/BarOver.png" id="10_5i332"]
[ext_resource type="Texture2D" uid="uid://w4j1crvoxo5y" path="res://Assets/HUD/BarProgress.png" id="11_tlgqu"]
[ext_resource type="Script" path="res://Assets/HUD/Performance.gd" id="17_getmp"]
[ext_resource type="Texture2D" uid="uid://nvmxqamvgmwl" path="res://Assets/HUD/MuteIcon.png" id="18_gshf6"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_dxk5q"]
resource_local_to_scene = true
@ -453,4 +454,17 @@ __meta__ = {
"_edit_use_anchors_": false
}
[node name="MuteIcon" type="TextureRect" parent="."]
visible = false
anchor_left = 1.0
anchor_right = 1.0
offset_left = -80.0
offset_top = 16.0
offset_right = -16.0
offset_bottom = 80.0
texture = ExtResource( "18_gshf6" )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="text_submitted" from="Chat/VBoxContainer/Typing/Editor" to="Chat" method="_on_Editor_text_submitted"]

View File

@ -188,6 +188,10 @@ func _input(_event) -> void:
if Input.is_action_just_pressed("screenshot"):
var res = get_viewport().get_texture().get_image().save_exr('res://Screnshot.exr')
chat.chat_notification("Screenshot taken: " + str(res))
if Input.is_action_just_pressed("mute_audio"):
AudioServer.set_bus_mute(0, not AudioServer.is_bus_mute(0))
hud.get_node("MuteIcon").visible = AudioServer.is_bus_mute(0)
@rpc(any_peer, call_local, reliable) func game_over(winner):
if local_player:

View File

@ -170,6 +170,11 @@ screenshot={
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":true,"alt_pressed":false,"shift_pressed":false,"meta_pressed":false,"command_pressed":false,"pressed":false,"keycode":16777253,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
]
}
mute_audio={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"store_command":false,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":77,"physical_keycode":0,"unicode":0,"echo":false,"script":null)
]
}
[layer_names]