cleanup main menu

This commit is contained in:
Crispy 2021-06-06 17:28:22 +02:00
parent 64a51bdd7e
commit 7dd5a544ab
3 changed files with 55 additions and 42 deletions

View file

@ -7,16 +7,17 @@ func _ready() -> void:
for o in Settings.s.overlays: for o in Settings.s.overlays:
if o != "MainOverlay": if o != "MainOverlay":
_add_overlay_to_list(o) _add_overlay_to_list(o)
$VSplitContainer/Control/Overlays.visible = false $MarginContainer/VSplitContainer/Control/Overlays.visible = false
func _add_overlay_to_list(name): func _add_overlay_to_list(name):
var new = preload("res://ui/ListOverlayItem.tscn").instance() var new = preload("res://ui/ListOverlayItem.tscn").instance()
new.overlay_name = name new.overlay_name = name
$VSplitContainer/Control/Overlays.add_child(new) $MarginContainer/VSplitContainer/Control/Overlays.add_child(new)
func _remove_overlay_from_list(name): func _remove_overlay_from_list(name):
$VSplitContainer/Control/Overlays.get_node(name).queue_free() $MarginContainer/VSplitContainer/Control/Overlays.get_node(name).queue_free()
func _on_GrabMode_toggled(state: bool) -> void: func _on_GrabMode_toggled(state: bool) -> void:
@ -24,9 +25,9 @@ func _on_GrabMode_toggled(state: bool) -> void:
func _on_ShowOverlays_toggled(state: bool) -> void: func _on_ShowOverlays_toggled(state: bool) -> void:
$VSplitContainer/Control/Overlays.visible = state $MarginContainer/VSplitContainer/Control/Overlays.visible = state
func _on_AddOverlay_pressed() -> void: func _on_AddOverlay_toggled(state: bool) -> void:
$VSplitContainer/Control/AddMenu.visible = !$VSplitContainer/Control/AddMenu.visible $MarginContainer/VSplitContainer/Control/AddMenu.visible = state

View file

@ -19,9 +19,7 @@ margin_right = 2048.0
margin_bottom = 1920.0 margin_bottom = 1920.0
rect_min_size = Vector2( 100, 128 ) rect_min_size = Vector2( 100, 128 )
theme = ExtResource( 9 ) theme = ExtResource( 9 )
custom_constants/margin_right = 8
custom_constants/margin_top = 8 custom_constants/margin_top = 8
custom_constants/margin_left = 8
custom_constants/margin_bottom = 8 custom_constants/margin_bottom = 8
script = ExtResource( 1 ) script = ExtResource( 1 )
__meta__ = { __meta__ = {
@ -29,15 +27,14 @@ __meta__ = {
} }
[node name="BasicOptions" type="PanelContainer" parent="."] [node name="BasicOptions" type="PanelContainer" parent="."]
margin_left = 8.0
margin_top = 8.0 margin_top = 8.0
margin_right = 2040.0 margin_right = 2048.0
margin_bottom = 215.0 margin_bottom = 215.0
[node name="Label" type="Label" parent="BasicOptions"] [node name="Label" type="Label" parent="BasicOptions"]
margin_left = 8.0 margin_left = 8.0
margin_top = 16.0 margin_top = 16.0
margin_right = 2024.0 margin_right = 2040.0
margin_bottom = 191.0 margin_bottom = 191.0
text = "Main Menu" text = "Main Menu"
__meta__ = { __meta__ = {
@ -47,7 +44,7 @@ __meta__ = {
[node name="List" type="HBoxContainer" parent="BasicOptions"] [node name="List" type="HBoxContainer" parent="BasicOptions"]
margin_left = 8.0 margin_left = 8.0
margin_top = 8.0 margin_top = 8.0
margin_right = 2024.0 margin_right = 2040.0
margin_bottom = 199.0 margin_bottom = 199.0
alignment = 2 alignment = 2
__meta__ = { __meta__ = {
@ -55,16 +52,16 @@ __meta__ = {
} }
[node name="Grab" type="Button" parent="BasicOptions/List"] [node name="Grab" type="Button" parent="BasicOptions/List"]
margin_left = 1480.0 margin_left = 1496.0
margin_right = 1656.0 margin_right = 1672.0
margin_bottom = 191.0 margin_bottom = 191.0
focus_mode = 0 focus_mode = 0
toggle_mode = true toggle_mode = true
icon = ExtResource( 3 ) icon = ExtResource( 3 )
[node name="Visibility" type="Button" parent="BasicOptions/List"] [node name="Visibility" type="Button" parent="BasicOptions/List"]
margin_left = 1660.0 margin_left = 1676.0
margin_right = 1836.0 margin_right = 1852.0
margin_bottom = 191.0 margin_bottom = 191.0
focus_mode = 0 focus_mode = 0
toggle_mode = true toggle_mode = true
@ -72,25 +69,24 @@ pressed = true
icon = ExtResource( 8 ) icon = ExtResource( 8 )
[node name="Options" type="Button" parent="BasicOptions/List"] [node name="Options" type="Button" parent="BasicOptions/List"]
margin_left = 1840.0 margin_left = 1856.0
margin_right = 2016.0 margin_right = 2032.0
margin_bottom = 191.0 margin_bottom = 191.0
icon = ExtResource( 10 ) icon = ExtResource( 10 )
[node name="MoreOptions" type="HSplitContainer" parent="."] [node name="MoreOptions" type="HSplitContainer" parent="."]
margin_left = 8.0
margin_top = 8.0 margin_top = 8.0
margin_right = 2040.0 margin_right = 2048.0
margin_bottom = 215.0 margin_bottom = 215.0
[node name="Spacer" type="Control" parent="MoreOptions"] [node name="Spacer" type="Control" parent="MoreOptions"]
margin_right = 924.0 margin_right = 940.0
margin_bottom = 207.0 margin_bottom = 207.0
size_flags_horizontal = 3 size_flags_horizontal = 3
[node name="Container" type="PanelContainer" parent="MoreOptions"] [node name="Container" type="PanelContainer" parent="MoreOptions"]
margin_left = 936.0 margin_left = 952.0
margin_right = 2032.0 margin_right = 2048.0
margin_bottom = 207.0 margin_bottom = 207.0
[node name="List" type="HBoxContainer" parent="MoreOptions/Container"] [node name="List" type="HBoxContainer" parent="MoreOptions/Container"]

View file

@ -17,19 +17,33 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="VSplitContainer" type="VSplitContainer" parent="."] [node name="MarginContainer" type="MarginContainer" parent="."]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
custom_constants/margin_right = 8
custom_constants/margin_top = 8
custom_constants/margin_left = 8
custom_constants/margin_bottom = 8
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Control" type="Control" parent="VSplitContainer"] [node name="VSplitContainer" type="VSplitContainer" parent="MarginContainer"]
margin_right = 2048.0 margin_left = 8.0
margin_bottom = 1845.0 margin_top = 8.0
margin_right = 2040.0
margin_bottom = 2040.0
dragger_visibility = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Control" type="Control" parent="MarginContainer/VSplitContainer"]
margin_right = 2032.0
margin_bottom = 1841.0
size_flags_vertical = 3 size_flags_vertical = 3
[node name="Overlays" type="VBoxContainer" parent="VSplitContainer/Control"] [node name="Overlays" type="VBoxContainer" parent="MarginContainer/VSplitContainer/Control"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
size_flags_vertical = 3 size_flags_vertical = 3
@ -38,30 +52,31 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="ListOverlayItem" parent="VSplitContainer/Control/Overlays" instance=ExtResource( 7 )] [node name="ListOverlayItem" parent="MarginContainer/VSplitContainer/Control/Overlays" instance=ExtResource( 7 )]
margin_top = 1622.0 margin_top = 1618.0
margin_bottom = 1845.0 margin_right = 2032.0
margin_bottom = 1841.0
overlay_name = "MainOverlay" overlay_name = "MainOverlay"
[node name="AddMenu" parent="VSplitContainer/Control" instance=ExtResource( 3 )] [node name="AddMenu" parent="MarginContainer/VSplitContainer/Control" instance=ExtResource( 3 )]
visible = false visible = false
[node name="MainBar" type="HBoxContainer" parent="VSplitContainer"] [node name="MainBar" type="HBoxContainer" parent="MarginContainer/VSplitContainer"]
margin_top = 1857.0 margin_top = 1841.0
margin_right = 2048.0 margin_right = 2032.0
margin_bottom = 2048.0 margin_bottom = 2032.0
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="ShowOverlays" type="Button" parent="VSplitContainer/MainBar"] [node name="ShowOverlays" type="Button" parent="MarginContainer/VSplitContainer/MainBar"]
margin_right = 176.0 margin_right = 176.0
margin_bottom = 191.0 margin_bottom = 191.0
focus_mode = 0 focus_mode = 0
toggle_mode = true toggle_mode = true
icon = ExtResource( 6 ) icon = ExtResource( 6 )
[node name="GrabMode" type="Button" parent="VSplitContainer/MainBar"] [node name="GrabMode" type="Button" parent="MarginContainer/VSplitContainer/MainBar"]
margin_left = 180.0 margin_left = 180.0
margin_right = 356.0 margin_right = 356.0
margin_bottom = 191.0 margin_bottom = 191.0
@ -69,13 +84,14 @@ focus_mode = 0
toggle_mode = true toggle_mode = true
icon = ExtResource( 5 ) icon = ExtResource( 5 )
[node name="AddOverlay" type="Button" parent="VSplitContainer/MainBar"] [node name="AddOverlay" type="Button" parent="MarginContainer/VSplitContainer/MainBar"]
margin_left = 360.0 margin_left = 360.0
margin_right = 536.0 margin_right = 536.0
margin_bottom = 191.0 margin_bottom = 191.0
focus_mode = 0 focus_mode = 0
toggle_mode = true
icon = ExtResource( 4 ) icon = ExtResource( 4 )
[connection signal="toggled" from="VSplitContainer/MainBar/ShowOverlays" to="." method="_on_ShowOverlays_toggled"] [connection signal="toggled" from="MarginContainer/VSplitContainer/MainBar/ShowOverlays" to="." method="_on_ShowOverlays_toggled"]
[connection signal="toggled" from="VSplitContainer/MainBar/GrabMode" to="." method="_on_GrabMode_toggled"] [connection signal="toggled" from="MarginContainer/VSplitContainer/MainBar/GrabMode" to="." method="_on_GrabMode_toggled"]
[connection signal="pressed" from="VSplitContainer/MainBar/AddOverlay" to="." method="_on_AddOverlay_pressed"] [connection signal="toggled" from="MarginContainer/VSplitContainer/MainBar/AddOverlay" to="." method="_on_AddOverlay_toggled"]