feat: basic settings menu
This commit is contained in:
parent
70785c3b35
commit
8e215a6962
38 changed files with 1308 additions and 51 deletions
21
src/UI/buttons/container_selection_button.gd
Normal file
21
src/UI/buttons/container_selection_button.gd
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
class_name ContainerSelectionButton extends MarginContainer
|
||||
|
||||
@export var button: Button
|
||||
@export var container_box: ContainerBox
|
||||
|
||||
var button_index: int
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
var text: String = "Collection %d" % container_box.container_id
|
||||
button_index = container_box.container_id
|
||||
button.text = text
|
||||
|
||||
## Request to change to a panel with the ID - 1 of the button. [br]
|
||||
## Buttons are 1-indexed, while [member UIManager.panel_array] is 0-index
|
||||
func _on_button_pressed() -> void:
|
||||
SignalBus.on_panel_requested.emit(button_index-1)
|
||||
1
src/UI/buttons/container_selection_button.gd.uid
Normal file
1
src/UI/buttons/container_selection_button.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://osei0aimuya2
|
||||
33
src/UI/buttons/container_selection_button.tscn
Normal file
33
src/UI/buttons/container_selection_button.tscn
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
[gd_scene load_steps=6 format=3 uid="uid://csre4kogd8afg"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://osei0aimuya2" path="res://src/UI/buttons/container_selection_button.gd" id="1_g121j"]
|
||||
[ext_resource type="Theme" uid="uid://bal6yp0a25hf2" path="res://src/theme/main_theme.tres" id="1_ru1ls"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_dv4hw"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_05tj4"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gtrax"]
|
||||
bg_color = Color(0.43134, 0.43134, 0.43134, 1)
|
||||
|
||||
[node name="ContainerSelectionButton" type="MarginContainer" node_paths=PackedStringArray("button")]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 40.0
|
||||
scale = Vector2(1, 1.02369)
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
script = ExtResource("1_g121j")
|
||||
button = NodePath("Button")
|
||||
|
||||
[node name="Button" type="Button" parent="."]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_ru1ls")
|
||||
theme_type_variation = &"CollectionButton"
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_dv4hw")
|
||||
theme_override_styles/hover = SubResource("StyleBoxFlat_05tj4")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxFlat_gtrax")
|
||||
text = "Collection 1"
|
||||
|
||||
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
|
||||
16
src/UI/container_add_button.gd
Normal file
16
src/UI/container_add_button.gd
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
extends Button
|
||||
|
||||
@export var container_box: VBoxContainer
|
||||
@export var container_button_scene: PackedScene
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
func _on_pressed() -> void:
|
||||
container_box.container_id = container_box.container_id +1
|
||||
var new_button: ContainerSelectionButton = container_button_scene.instantiate()
|
||||
new_button.container_box = container_box
|
||||
container_box.add_child(new_button)
|
||||
container_box.move_child(new_button, -2)
|
||||
SignalBus.on_panel_created.emit()
|
||||
|
||||
1
src/UI/container_add_button.gd.uid
Normal file
1
src/UI/container_add_button.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://mpcin6c2bydu
|
||||
4
src/UI/container_box.gd
Normal file
4
src/UI/container_box.gd
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
class_name ContainerBox extends VBoxContainer
|
||||
|
||||
@export var container_id: int = 1
|
||||
|
||||
1
src/UI/container_box.gd.uid
Normal file
1
src/UI/container_box.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b36rq8vvxs2cr
|
||||
11
src/UI/m_panel.gd
Normal file
11
src/UI/m_panel.gd
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
extends Panel
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
1
src/UI/m_panel.gd.uid
Normal file
1
src/UI/m_panel.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://b4q5pgorn5osd
|
||||
10
src/UI/main.gd
Normal file
10
src/UI/main.gd
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
extends Control
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
1
src/UI/main.gd.uid
Normal file
1
src/UI/main.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://cned1fnc85l8x
|
||||
153
src/UI/main.tscn
153
src/UI/main.tscn
|
|
@ -1,11 +1,20 @@
|
|||
[gd_scene load_steps=13 format=3 uid="uid://brs37lcvmx2h5"]
|
||||
[gd_scene load_steps=23 format=3 uid="uid://brs37lcvmx2h5"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bal6yp0a25hf2" path="res://src/theme/main_theme.tres" id="1_apmt2"]
|
||||
[ext_resource type="Script" uid="uid://cned1fnc85l8x" path="res://src/UI/main.gd" id="1_gtrax"]
|
||||
[ext_resource type="Script" uid="uid://hiyarq0kbm45" path="res://src/UI/menu_bar.gd" id="1_rt51c"]
|
||||
[ext_resource type="Script" uid="uid://dv5tmj6la8jql" path="res://src/UI/titlebar.gd" id="3_64rym"]
|
||||
[ext_resource type="Texture2D" uid="uid://bpvgbghct7ayv" path="res://src/assets/icons/x.svg" id="4_6nn4n"]
|
||||
[ext_resource type="Texture2D" uid="uid://duloi6af1avtm" path="res://src/assets/icons/chevron-compact-down.svg" id="5_dv4hw"]
|
||||
[ext_resource type="Script" uid="uid://bdaqnjmoi6k1q" path="res://src/UI/ui_manager.gd" id="5_05tj4"]
|
||||
[ext_resource type="PackedScene" uid="uid://csre4kogd8afg" path="res://src/UI/buttons/container_selection_button.tscn" id="5_14o3q"]
|
||||
[ext_resource type="Script" uid="uid://b36rq8vvxs2cr" path="res://src/UI/container_box.gd" id="5_cqoei"]
|
||||
[ext_resource type="Script" uid="uid://cs8ywlsgql3pg" path="res://src/UI/close_button.gd" id="5_teubg"]
|
||||
[ext_resource type="Script" uid="uid://d3l1hl06c3n56" path="res://src/UI/minimize_button.gd" id="7_14o3q"]
|
||||
[ext_resource type="Texture2D" uid="uid://cyu4k12a2o0qc" path="res://src/assets/icons/settings.svg" id="6_dlcq6"]
|
||||
[ext_resource type="Script" uid="uid://mpcin6c2bydu" path="res://src/UI/container_add_button.gd" id="7_cqoei"]
|
||||
[ext_resource type="Texture2D" uid="uid://dof65a47bfapk" path="res://src/assets/icons/library-plus.svg" id="7_teubg"]
|
||||
[ext_resource type="PackedScene" uid="uid://cirolvhfd455u" path="res://src/UI/main_panel.tscn" id="9_cqoei"]
|
||||
[ext_resource type="Script" uid="uid://dajxw3a0wx83r" path="res://src/UI/settings/settings_button.gd" id="12_g3kvb"]
|
||||
[ext_resource type="PackedScene" uid="uid://c75khb0lmemy4" path="res://src/UI/settings/settings_menu.tscn" id="13_v0ovx"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_5vilm"]
|
||||
bg_color = Color(0.962281, 0.933337, 0.999483, 1)
|
||||
|
|
@ -36,18 +45,20 @@ expand_margin_top = 2.0
|
|||
expand_margin_right = 2.0
|
||||
expand_margin_bottom = 2.0
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_14o3q"]
|
||||
bg_color = Color(1, 0.956863, 0.0823529, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_cqoei"]
|
||||
bg_color = Color(0.728507, 0.695771, 0, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_apmt2"]
|
||||
corner_radius_top_left = 30
|
||||
corner_radius_top_right = 30
|
||||
corner_radius_bottom_right = 30
|
||||
corner_radius_bottom_left = 30
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_dv4hw"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_64rym"]
|
||||
bg_color = Color(0.43134, 0.43134, 0.43134, 1)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dlcq6"]
|
||||
bg_color = Color(0.461058, 0.420568, 0.461121, 0.419608)
|
||||
|
||||
[node name="Main" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
|
|
@ -55,6 +66,7 @@ anchor_right = 1.0
|
|||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
script = ExtResource("1_gtrax")
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
layout_mode = 1
|
||||
|
|
@ -73,17 +85,26 @@ anchor_bottom = 1.0
|
|||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Panel/VBoxContainer"]
|
||||
[node name="Titlebar" type="MarginContainer" parent="Panel/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 30)
|
||||
layout_mode = 2
|
||||
mouse_filter = 0
|
||||
theme = ExtResource("1_apmt2")
|
||||
theme_override_constants/margin_left = 30
|
||||
theme_override_constants/margin_right = 30
|
||||
|
||||
[node name="MenuBar" type="MenuBar" parent="Panel/VBoxContainer/MarginContainer"]
|
||||
[node name="ColorRect" type="ColorRect" parent="Panel/VBoxContainer/Titlebar"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
color = Color(0.960351, 0.960351, 0.960351, 1)
|
||||
|
||||
[node name="MenuBar" type="MenuBar" parent="Panel/VBoxContainer/Titlebar"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_apmt2")
|
||||
script = ExtResource("1_rt51c")
|
||||
|
||||
[node name="CloseButton" type="Button" parent="Panel/VBoxContainer/MarginContainer/MenuBar"]
|
||||
[node name="CloseButton" type="Button" parent="Panel/VBoxContainer/Titlebar/MenuBar"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 6
|
||||
anchor_left = 1.0
|
||||
|
|
@ -104,40 +125,28 @@ action_mode = 0
|
|||
icon = ExtResource("4_6nn4n")
|
||||
script = ExtResource("5_teubg")
|
||||
|
||||
[node name="MinimizeButton" type="Button" parent="Panel/VBoxContainer/MarginContainer/MenuBar"]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
anchors_preset = 6
|
||||
anchor_left = 1.0
|
||||
anchor_top = 0.5
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 0.5
|
||||
offset_left = -73.0
|
||||
offset_top = -11.5
|
||||
offset_right = -49.0
|
||||
offset_bottom = 12.5
|
||||
grow_horizontal = 0
|
||||
grow_vertical = 2
|
||||
[node name="Label" type="Label" parent="Panel/VBoxContainer/Titlebar"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_apmt2")
|
||||
theme_type_variation = &"FlatButton"
|
||||
theme_override_constants/outline_size = 3
|
||||
theme_override_styles/hover = SubResource("StyleBoxFlat_14o3q")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxFlat_cqoei")
|
||||
action_mode = 0
|
||||
icon = ExtResource("5_dv4hw")
|
||||
script = ExtResource("7_14o3q")
|
||||
theme_override_colors/font_color = Color(0.374139, 0.374139, 0.374139, 1)
|
||||
text = "Whydt"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Panel/VBoxContainer"]
|
||||
[node name="UIManager" type="HBoxContainer" parent="Panel/VBoxContainer" node_paths=PackedStringArray("current_active_panel", "container_collection_box")]
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("5_05tj4")
|
||||
current_active_panel = NodePath("MainPanel")
|
||||
container_collection_box = NodePath("Panel/MarginContainer/ScrollContainer/ContainerBox")
|
||||
|
||||
[node name="Panel" type="Panel" parent="Panel/VBoxContainer/HBoxContainer"]
|
||||
[node name="Panel" type="Panel" parent="Panel/VBoxContainer/UIManager"]
|
||||
custom_minimum_size = Vector2(200, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 0
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_apmt2")
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Panel/VBoxContainer/HBoxContainer/Panel"]
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Panel/VBoxContainer/UIManager/Panel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
|
@ -149,29 +158,75 @@ theme_override_constants/margin_top = 30
|
|||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 30
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="Panel/VBoxContainer/HBoxContainer/Panel/MarginContainer"]
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="Panel/VBoxContainer/UIManager/Panel/MarginContainer"]
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
horizontal_scroll_mode = 0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/VBoxContainer/HBoxContainer/Panel/MarginContainer/ScrollContainer"]
|
||||
[node name="ContainerBox" type="VBoxContainer" parent="Panel/VBoxContainer/UIManager/Panel/MarginContainer/ScrollContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("5_cqoei")
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="Panel/VBoxContainer/HBoxContainer/Panel/MarginContainer/ScrollContainer/VBoxContainer"]
|
||||
[node name="ContainerSelectionButton" parent="Panel/VBoxContainer/UIManager/Panel/MarginContainer/ScrollContainer/ContainerBox" node_paths=PackedStringArray("container_box") instance=ExtResource("5_14o3q")]
|
||||
layout_mode = 2
|
||||
container_box = NodePath("..")
|
||||
|
||||
[node name="ContainerAddButton" type="Button" parent="Panel/VBoxContainer/UIManager/Panel/MarginContainer/ScrollContainer/ContainerBox" node_paths=PackedStringArray("container_box")]
|
||||
layout_mode = 2
|
||||
tooltip_text = "Add a new collection"
|
||||
theme = ExtResource("1_apmt2")
|
||||
theme_type_variation = &"CollectionButton"
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_dv4hw")
|
||||
theme_override_styles/hover = SubResource("StyleBoxFlat_64rym")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxFlat_dlcq6")
|
||||
icon = ExtResource("7_teubg")
|
||||
icon_alignment = 1
|
||||
script = ExtResource("7_cqoei")
|
||||
container_box = NodePath("..")
|
||||
container_button_scene = ExtResource("5_14o3q")
|
||||
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="Panel/VBoxContainer/UIManager/Panel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 7
|
||||
anchor_left = 0.5
|
||||
anchor_top = 1.0
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -12.0
|
||||
offset_top = -24.0
|
||||
offset_right = 12.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 0
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="SettingsButton" type="Button" parent="Panel/VBoxContainer/UIManager/Panel/MarginContainer2"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_apmt2")
|
||||
text = "aaaaa"
|
||||
fit_content = true
|
||||
theme_type_variation = &"FlatButton"
|
||||
theme_override_styles/hover = SubResource("StyleBoxFlat_dv4hw")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxFlat_teubg")
|
||||
action_mode = 0
|
||||
icon = ExtResource("6_dlcq6")
|
||||
icon_alignment = 1
|
||||
script = ExtResource("12_g3kvb")
|
||||
settings_menu = ExtResource("13_v0ovx")
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="Panel/VBoxContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
horizontal_scroll_mode = 0
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Panel/VBoxContainer/HBoxContainer/ScrollContainer"]
|
||||
[node name="MainPanel" parent="Panel/VBoxContainer/UIManager" instance=ExtResource("9_cqoei")]
|
||||
layout_mode = 2
|
||||
|
||||
[connection signal="pressed" from="Panel/VBoxContainer/MarginContainer/MenuBar/CloseButton" to="Panel/VBoxContainer/MarginContainer/MenuBar/CloseButton" method="_on_pressed"]
|
||||
[connection signal="pressed" from="Panel/VBoxContainer/MarginContainer/MenuBar/MinimizeButton" to="Panel/VBoxContainer/MarginContainer/MenuBar/MinimizeButton" method="_on_pressed"]
|
||||
[node name="Control" type="Control" parent="."]
|
||||
anchors_preset = 0
|
||||
offset_right = 1183.0
|
||||
offset_bottom = 30.0
|
||||
mouse_default_cursor_shape = 13
|
||||
script = ExtResource("3_64rym")
|
||||
|
||||
[connection signal="pressed" from="Panel/VBoxContainer/Titlebar/MenuBar/CloseButton" to="Panel/VBoxContainer/Titlebar/MenuBar/CloseButton" method="_on_pressed"]
|
||||
[connection signal="pressed" from="Panel/VBoxContainer/UIManager/Panel/MarginContainer/ScrollContainer/ContainerBox/ContainerAddButton" to="Panel/VBoxContainer/UIManager/Panel/MarginContainer/ScrollContainer/ContainerBox/ContainerAddButton" method="_on_pressed"]
|
||||
[connection signal="pressed" from="Panel/VBoxContainer/UIManager/Panel/MarginContainer2/SettingsButton" to="Panel/VBoxContainer/UIManager/Panel/MarginContainer2/SettingsButton" method="_on_pressed"]
|
||||
[connection signal="gui_input" from="Control" to="Control" method="_on_gui_input"]
|
||||
|
|
|
|||
20
src/UI/main_panel.gd
Normal file
20
src/UI/main_panel.gd
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
class_name MainPanel extends ScrollContainer
|
||||
|
||||
@export var container_name_label: RichTextLabel
|
||||
@export var style_box: StyleBoxFlat
|
||||
@export var panel_main_color: Color
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
panel_main_color = style_box.bg_color
|
||||
|
||||
SignalBus.main_panel_color_changed.connect(_on_main_panel_color_changed)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
|
||||
func _on_main_panel_color_changed(color: Color):
|
||||
style_box.bg_color = color
|
||||
1
src/UI/main_panel.gd.uid
Normal file
1
src/UI/main_panel.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bmsw85eprqln1
|
||||
8
src/UI/main_panel.tres
Normal file
8
src/UI/main_panel.tres
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
[gd_resource type="StyleBoxFlat" format=3 uid="uid://b7rqx5hwj7wff"]
|
||||
|
||||
[resource]
|
||||
bg_color = Color(0.117647, 0.439216, 0.988235, 0.317647)
|
||||
corner_radius_top_left = 30
|
||||
corner_radius_top_right = 30
|
||||
corner_radius_bottom_right = 30
|
||||
corner_radius_bottom_left = 30
|
||||
42
src/UI/main_panel.tscn
Normal file
42
src/UI/main_panel.tscn
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://cirolvhfd455u"]
|
||||
|
||||
[ext_resource type="Theme" uid="uid://bal6yp0a25hf2" path="res://src/theme/main_theme.tres" id="1_c0dr6"]
|
||||
[ext_resource type="Script" uid="uid://bmsw85eprqln1" path="res://src/UI/main_panel.gd" id="2_5qsb6"]
|
||||
[ext_resource type="StyleBox" uid="uid://b7rqx5hwj7wff" path="res://src/UI/main_panel.tres" id="3_enj05"]
|
||||
[ext_resource type="Script" uid="uid://b4q5pgorn5osd" path="res://src/UI/m_panel.gd" id="4_1citv"]
|
||||
|
||||
[node name="MainPanel" type="ScrollContainer" node_paths=PackedStringArray("container_name_label")]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
theme = ExtResource("1_c0dr6")
|
||||
horizontal_scroll_mode = 0
|
||||
script = ExtResource("2_5qsb6")
|
||||
container_name_label = NodePath("Panel/VBoxContainer/RichTextLabel")
|
||||
style_box = ExtResource("3_enj05")
|
||||
|
||||
[node name="Panel" type="Panel" parent="."]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_styles/panel = ExtResource("3_enj05")
|
||||
script = ExtResource("4_1citv")
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Panel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="RichTextLabel" type="RichTextLabel" parent="Panel/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme = ExtResource("1_c0dr6")
|
||||
text = "Container"
|
||||
fit_content = true
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
21
src/UI/settings/settings_button.gd
Normal file
21
src/UI/settings/settings_button.gd
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
extends Button
|
||||
|
||||
@export var settings_menu: PackedScene
|
||||
var instantiated_menu: SettingsMenu
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
SignalBus.settings_window_closed.connect(_on_window_closed)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_pressed() -> void:
|
||||
instantiated_menu = settings_menu.instantiate()
|
||||
get_parent().add_child(instantiated_menu)
|
||||
|
||||
func _on_window_closed() -> void:
|
||||
instantiated_menu.queue_free()
|
||||
1
src/UI/settings/settings_button.gd.uid
Normal file
1
src/UI/settings/settings_button.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dajxw3a0wx83r
|
||||
22
src/UI/settings/settings_menu.gd
Normal file
22
src/UI/settings/settings_menu.gd
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
class_name SettingsMenu extends Control
|
||||
|
||||
@export var window: Window
|
||||
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_window_close_requested() -> void:
|
||||
SignalBus.settings_window_closed.emit()
|
||||
|
||||
|
||||
func _on_main_panel_color_picker_button_color_changed(color:Color) -> void:
|
||||
SignalBus.main_panel_color_changed.emit(color)
|
||||
1
src/UI/settings/settings_menu.gd.uid
Normal file
1
src/UI/settings/settings_menu.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bcvjbqfa3m0l0
|
||||
121
src/UI/settings/settings_menu.tscn
Normal file
121
src/UI/settings/settings_menu.tscn
Normal file
|
|
@ -0,0 +1,121 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://c75khb0lmemy4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bcvjbqfa3m0l0" path="res://src/UI/settings/settings_menu.gd" id="1_qbcvd"]
|
||||
[ext_resource type="Theme" uid="uid://bal6yp0a25hf2" path="res://src/theme/main_theme.tres" id="1_w8rff"]
|
||||
|
||||
[node name="SettingsMenu" type="Control" node_paths=PackedStringArray("window")]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_qbcvd")
|
||||
window = NodePath("Window")
|
||||
|
||||
[node name="Window" type="Window" parent="."]
|
||||
title = "Settings"
|
||||
initial_position = 2
|
||||
size = Vector2i(400, 600)
|
||||
exclusive = true
|
||||
theme = ExtResource("1_w8rff")
|
||||
|
||||
[node name="Panel" type="Panel" parent="Window"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="Window/Panel"]
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Window/Panel/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Colors"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="MarginContainer4" type="MarginContainer" parent="Window/Panel/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="Window/Panel/VBoxContainer/MarginContainer4"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="Window/Panel/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Window/Panel/VBoxContainer/MarginContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Window/Panel/VBoxContainer/MarginContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Main Panel Color"
|
||||
|
||||
[node name="ColorPickerButton" type="ColorPickerButton" parent="Window/Panel/VBoxContainer/MarginContainer/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
alignment = 0
|
||||
|
||||
[node name="MarginContainer2" type="MarginContainer" parent="Window/Panel/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Window/Panel/VBoxContainer/MarginContainer2"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Window/Panel/VBoxContainer/MarginContainer2/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Side Panel Color"
|
||||
|
||||
[node name="ColorPickerButton" type="ColorPickerButton" parent="Window/Panel/VBoxContainer/MarginContainer2/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
alignment = 0
|
||||
|
||||
[node name="MarginContainer3" type="MarginContainer" parent="Window/Panel/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
theme_override_constants/margin_left = 5
|
||||
theme_override_constants/margin_top = 5
|
||||
theme_override_constants/margin_right = 5
|
||||
theme_override_constants/margin_bottom = 5
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="Window/Panel/VBoxContainer/MarginContainer3"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="Label" type="Label" parent="Window/Panel/VBoxContainer/MarginContainer3/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
text = "Main Window Color"
|
||||
|
||||
[node name="ColorPickerButton" type="ColorPickerButton" parent="Window/Panel/VBoxContainer/MarginContainer3/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
alignment = 0
|
||||
|
||||
[node name="MarginContainer5" type="MarginContainer" parent="Window/Panel/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="HSeparator" type="HSeparator" parent="Window/Panel/VBoxContainer/MarginContainer5"]
|
||||
layout_mode = 2
|
||||
|
||||
[connection signal="close_requested" from="Window" to="." method="_on_window_close_requested"]
|
||||
[connection signal="color_changed" from="Window/Panel/VBoxContainer/MarginContainer/HBoxContainer/ColorPickerButton" to="." method="_on_main_panel_color_picker_button_color_changed"]
|
||||
[connection signal="color_changed" from="Window/Panel/VBoxContainer/MarginContainer2/HBoxContainer/ColorPickerButton" to="." method="_on_main_panel_color_picker_button_color_changed"]
|
||||
[connection signal="color_changed" from="Window/Panel/VBoxContainer/MarginContainer3/HBoxContainer/ColorPickerButton" to="." method="_on_main_panel_color_picker_button_color_changed"]
|
||||
17
src/UI/titlebar.gd
Normal file
17
src/UI/titlebar.gd
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
class_name Titlebar extends Control
|
||||
|
||||
var following: bool = false
|
||||
var dragging_start_position: Vector2i = Vector2i()
|
||||
|
||||
|
||||
func _process(_delta):
|
||||
if following:
|
||||
var mouse_position: Vector2i = get_global_mouse_position()
|
||||
var window_position: Vector2i = Vector2i(DisplayServer.window_get_position())
|
||||
DisplayServer.window_set_position(window_position + (mouse_position - dragging_start_position))
|
||||
|
||||
func _on_gui_input(event:InputEvent) -> void:
|
||||
if event is InputEventMouseButton:
|
||||
if event.get_button_index() == 1:
|
||||
following = !following
|
||||
dragging_start_position = get_local_mouse_position()
|
||||
1
src/UI/titlebar.gd.uid
Normal file
1
src/UI/titlebar.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://dv5tmj6la8jql
|
||||
30
src/UI/ui_manager.gd
Normal file
30
src/UI/ui_manager.gd
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
class_name UIManager extends HBoxContainer
|
||||
|
||||
@export var current_active_panel: MainPanel
|
||||
@export var panel_array: Array[MainPanel] = []
|
||||
@export var container_collection_box: ContainerBox
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var text: String = "Container %d" % container_collection_box.container_id
|
||||
current_active_panel.container_name_label.text = text
|
||||
panel_array.append(current_active_panel)
|
||||
|
||||
SignalBus.on_panel_created.connect(_on_panel_created)
|
||||
SignalBus.on_panel_requested.connect(_on_panel_requested)
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func _on_panel_created() -> void:
|
||||
var new_panel: MainPanel = MainPanel.new()
|
||||
panel_array.append(new_panel)
|
||||
|
||||
func _on_panel_requested(index: int) -> void:
|
||||
print("Panel: %d requested" % index)
|
||||
current_active_panel.hide()
|
||||
current_active_panel = panel_array[index]
|
||||
add_child(current_active_panel)
|
||||
1
src/UI/ui_manager.gd.uid
Normal file
1
src/UI/ui_manager.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bdaqnjmoi6k1q
|
||||
Loading…
Add table
Add a link
Reference in a new issue