Skip to content

Commit

Permalink
wip: mute buttons in controls
Browse files Browse the repository at this point in the history
  • Loading branch information
russmatney committed Jan 19, 2024
1 parent 5d7a645 commit df9aaba
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/menus/ControlsPanel.tscn
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
[gd_scene load_steps=4 format=3 uid="uid://cq5r4oojxyu5a"]
[gd_scene load_steps=5 format=3 uid="uid://cq5r4oojxyu5a"]

[ext_resource type="Script" path="res://src/menus/ControlsPanel.gd" id="1_j8soe"]
[ext_resource type="FontFile" uid="uid://d06oxhmw5eq58" path="res://addons/core/assets/fonts/vexed/Arcade_Cabinet.ttf" id="2_s8vdu"]
[ext_resource type="PackedScene" uid="uid://cpxj4aeuv006l" path="res://addons/dj/MuteButtonList.tscn" id="3_88sjl"]

[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6sn6c"]
bg_color = Color(0.94902, 0.811765, 0.615686, 1)
Expand Down Expand Up @@ -61,6 +62,9 @@ custom_minimum_size = Vector2(200, 0)
layout_mode = 2
text = "World Map"

[node name="MuteButtonList" parent="PanelContainer/VBoxContainer/CenterContainer2/VBoxContainer" instance=ExtResource("3_88sjl")]
layout_mode = 2

[node name="ScrollContainer" type="ScrollContainer" parent="PanelContainer/VBoxContainer"]
layout_mode = 2
size_flags_vertical = 3
Expand Down
48 changes: 46 additions & 2 deletions src/menus/DotHopPauseList.gd
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,56 @@ var button_defs = [
label="Main Menu",
fn=Navi.nav_to_main_menu,
},
{
label="Mute Music",
hide_fn=func(): return DJ.muted_music,
fn=func():
DJ.toggle_mute_music(true)
reload(),
},
{
label="Unmute Music",
hide_fn=func(): return not DJ.muted_music,
fn=func():
DJ.toggle_mute_music(false)
reload(),
},
{
label="Mute Sound",
hide_fn=func(): return DJ.muted_sound,
fn=func():
DJ.toggle_mute_sound(true)
reload(),
},
{
label="Unmute Sound",
hide_fn=func(): return not DJ.muted_sound,
fn=func():
DJ.toggle_mute_sound(false)
reload(),
},
{
label="Unmute All",
hide_fn=func(): return not DJ.muted_sound or not DJ.muted_music,
fn=func():
DJ.mute_all(false)
reload(),
},
{
label="Mute All",
hide_fn=func(): return DJ.muted_sound and DJ.muted_music,
fn=func():
DJ.mute_all(true)
reload(),
},
]


func _ready():
func reload():
for def in button_defs:
add_menu_item(def)

func _ready():
reload()

if Engine.is_editor_hint():
request_ready()

0 comments on commit df9aaba

Please sign in to comment.