Made tab buttons more dynamic
This commit is contained in:
parent
b918871be2
commit
a540ae1f83
3 changed files with 64 additions and 1 deletions
|
|
@ -1,13 +1,29 @@
|
|||
extends MarginContainer
|
||||
|
||||
@onready var printers_button: Button = $HBoxContainer/PrintersButton
|
||||
@onready var filaments_button: Button = $HBoxContainer/FilamentsButton
|
||||
|
||||
func _ready() -> void:
|
||||
%Printers.visible = true
|
||||
%Filaments.visible = false
|
||||
disable_buttons("printers")
|
||||
|
||||
func _on_printers_button_pressed() -> void:
|
||||
%Printers.visible = true
|
||||
%Filaments.visible = false
|
||||
disable_buttons("printers")
|
||||
|
||||
func _on_filaments_button_pressed() -> void:
|
||||
%Printers.visible = false
|
||||
%Filaments.visible = true
|
||||
disable_buttons("filaments")
|
||||
|
||||
func disable_buttons(tab: String) -> void:
|
||||
printers_button.disabled = true
|
||||
filaments_button.disabled = true
|
||||
|
||||
match tab:
|
||||
"printers":
|
||||
filaments_button.disabled = false
|
||||
"filaments":
|
||||
printers_button.disabled = false
|
||||
|
|
|
|||
|
|
@ -26,6 +26,9 @@ bg_color = Color(0.6, 0.6, 0.6, 0)
|
|||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_qru7b"]
|
||||
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mmlst"]
|
||||
bg_color = Color(0.6, 0.6, 0.6, 0)
|
||||
|
||||
[node name="UI" type="Control" unique_id=256887379]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
|
|
@ -213,7 +216,6 @@ theme_override_constants/separation = 8
|
|||
|
||||
[node name="ShopTab" type="PanelContainer" parent="VBoxContainer/MainAreaMargin/MainArea/RightColumn/MainMargin" unique_id=23859514]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_vqjbf")
|
||||
|
||||
|
|
@ -243,6 +245,7 @@ text = "Filaments"
|
|||
|
||||
[node name="Printers" type="PanelContainer" parent="VBoxContainer/MainAreaMargin/MainArea/RightColumn/MainMargin/ShopTab/VBoxContainer" unique_id=1896524960]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_qru7b")
|
||||
|
|
@ -271,6 +274,26 @@ theme_override_constants/separation = 8
|
|||
[node name="Filaments" type="PanelContainer" parent="VBoxContainer/MainAreaMargin/MainArea/RightColumn/MainMargin/ShopTab/VBoxContainer" unique_id=1891341317]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 3
|
||||
theme_override_styles/panel = SubResource("StyleBoxFlat_mmlst")
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer/MainAreaMargin/MainArea/RightColumn/MainMargin/ShopTab/VBoxContainer/Filaments" unique_id=1087434821]
|
||||
layout_mode = 2
|
||||
horizontal_scroll_mode = 0
|
||||
|
||||
[node name="MarginContainer" type="MarginContainer" parent="VBoxContainer/MainAreaMargin/MainArea/RightColumn/MainMargin/ShopTab/VBoxContainer/Filaments/ScrollContainer" unique_id=1350479691]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_constants/margin_left = 10
|
||||
theme_override_constants/margin_top = 10
|
||||
theme_override_constants/margin_right = 10
|
||||
theme_override_constants/margin_bottom = 10
|
||||
|
||||
[node name="FilamentList" type="VBoxContainer" parent="VBoxContainer/MainAreaMargin/MainArea/RightColumn/MainMargin/ShopTab/VBoxContainer/Filaments/ScrollContainer/MarginContainer" unique_id=1017092781]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="MenuTab" type="PanelContainer" parent="VBoxContainer/MainAreaMargin/MainArea/RightColumn/MainMargin" unique_id=526907583]
|
||||
unique_name_in_owner = true
|
||||
|
|
|
|||
|
|
@ -1,21 +1,45 @@
|
|||
extends MarginContainer
|
||||
|
||||
@onready var jobs_tab_button: Button = $TabButtons/JobsTabButton
|
||||
@onready var shop_tab_button: Button = $TabButtons/ShopTabButton
|
||||
@onready var menu_tab_button: Button = $TabButtons/MenuTabButton
|
||||
|
||||
func _ready() -> void:
|
||||
%JobsTab.visible = true
|
||||
%ShopTab.visible = false
|
||||
%MenuTab.visible = false
|
||||
disable_buttons("jobs")
|
||||
|
||||
func _on_jobs_tab_button_pressed() -> void:
|
||||
%JobsTab.visible = true
|
||||
%ShopTab.visible = false
|
||||
%MenuTab.visible = false
|
||||
disable_buttons("jobs")
|
||||
|
||||
func _on_shop_tab_button_pressed() -> void:
|
||||
%JobsTab.visible = false
|
||||
%ShopTab.visible = true
|
||||
%MenuTab.visible = false
|
||||
disable_buttons("shop")
|
||||
|
||||
func _on_menu_tab_button_pressed() -> void:
|
||||
%JobsTab.visible = false
|
||||
%ShopTab.visible = false
|
||||
%MenuTab.visible = true
|
||||
disable_buttons("menu")
|
||||
|
||||
func disable_buttons(tab: String) -> void:
|
||||
jobs_tab_button.disabled = true
|
||||
shop_tab_button.disabled = true
|
||||
menu_tab_button.disabled = true
|
||||
|
||||
match tab:
|
||||
"jobs":
|
||||
shop_tab_button.disabled = false
|
||||
menu_tab_button.disabled = false
|
||||
"shop":
|
||||
jobs_tab_button.disabled = false
|
||||
menu_tab_button.disabled = false
|
||||
"menu":
|
||||
jobs_tab_button.disabled = false
|
||||
shop_tab_button.disabled = false
|
||||
|
|
|
|||
Loading…
Reference in a new issue