From 50e777a6fa302eb13031d0f014d5bda95c397ed0 Mon Sep 17 00:00:00 2001 From: Yadciel Date: Mon, 19 Aug 2024 22:46:52 +0200 Subject: [PATCH] Apply theme to OptionButtons in GameScene Added a new theme resource for OptionButtons to ensure consistent font sizes. Updated MainMenu text to correctly number new players without adding one. --- GameScene.tscn | 14 +++++++++++++- MainMenu.gd | 2 +- OptionButton.tres | 4 ++++ 3 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 OptionButton.tres diff --git a/GameScene.tscn b/GameScene.tscn index 5baf390..3433afb 100644 --- a/GameScene.tscn +++ b/GameScene.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=3 format=3 uid="uid://bowvqy1rx2ldx"] +[gd_scene load_steps=4 format=3 uid="uid://bowvqy1rx2ldx"] [ext_resource type="Script" path="res://GameScene.gd" id="1_kyoq5"] [ext_resource type="Script" path="res://ScrollContainer.gd" id="2_xxo3x"] +[ext_resource type="Theme" uid="uid://dt11061t2etln" path="res://OptionButton.tres" id="3_hdjql"] [node name="Control" type="Control"] layout_mode = 3 @@ -108,6 +109,7 @@ vertical_alignment = 1 [node name="OptionButton" type="OptionButton" parent="ScrollContainer/VBoxContainer/One/HBoxContainer"] custom_minimum_size = Vector2(250, 150) layout_mode = 2 +theme = ExtResource("3_hdjql") theme_override_font_sizes/font_size = 50 alignment = 1 clip_text = true @@ -157,6 +159,7 @@ vertical_alignment = 1 [node name="OptionButton" type="OptionButton" parent="ScrollContainer/VBoxContainer/Two/HBoxContainer"] custom_minimum_size = Vector2(250, 150) layout_mode = 2 +theme = ExtResource("3_hdjql") theme_override_font_sizes/font_size = 50 alignment = 1 clip_text = true @@ -206,6 +209,7 @@ vertical_alignment = 1 [node name="OptionButton" type="OptionButton" parent="ScrollContainer/VBoxContainer/Three/HBoxContainer"] custom_minimum_size = Vector2(250, 150) layout_mode = 2 +theme = ExtResource("3_hdjql") theme_override_font_sizes/font_size = 50 alignment = 1 clip_text = true @@ -255,6 +259,7 @@ vertical_alignment = 1 [node name="OptionButton" type="OptionButton" parent="ScrollContainer/VBoxContainer/Four/HBoxContainer"] custom_minimum_size = Vector2(250, 150) layout_mode = 2 +theme = ExtResource("3_hdjql") theme_override_font_sizes/font_size = 50 alignment = 1 clip_text = true @@ -304,6 +309,7 @@ vertical_alignment = 1 [node name="OptionButton" type="OptionButton" parent="ScrollContainer/VBoxContainer/Five/HBoxContainer"] custom_minimum_size = Vector2(250, 150) layout_mode = 2 +theme = ExtResource("3_hdjql") theme_override_font_sizes/font_size = 50 alignment = 1 clip_text = true @@ -354,6 +360,7 @@ vertical_alignment = 1 [node name="OptionButton" type="OptionButton" parent="ScrollContainer/VBoxContainer/Six/HBoxContainer"] custom_minimum_size = Vector2(250, 150) layout_mode = 2 +theme = ExtResource("3_hdjql") theme_override_font_sizes/font_size = 50 alignment = 1 clip_text = true @@ -433,6 +440,7 @@ vertical_alignment = 1 [node name="OptionButton" type="OptionButton" parent="ScrollContainer/VBoxContainer/Three_of_a_kind/HBoxContainer"] custom_minimum_size = Vector2(250, 150) layout_mode = 2 +theme = ExtResource("3_hdjql") theme_override_font_sizes/font_size = 50 alignment = 1 clip_text = true @@ -467,6 +475,7 @@ vertical_alignment = 1 [node name="OptionButton" type="OptionButton" parent="ScrollContainer/VBoxContainer/Four_of_a_Kind/HBoxContainer"] custom_minimum_size = Vector2(250, 150) layout_mode = 2 +theme = ExtResource("3_hdjql") theme_override_font_sizes/font_size = 50 alignment = 1 clip_text = true @@ -501,6 +510,7 @@ vertical_alignment = 1 [node name="OptionButton" type="OptionButton" parent="ScrollContainer/VBoxContainer/Full_House/HBoxContainer"] custom_minimum_size = Vector2(250, 150) layout_mode = 2 +theme = ExtResource("3_hdjql") theme_override_font_sizes/font_size = 50 alignment = 1 clip_text = true @@ -535,6 +545,7 @@ vertical_alignment = 1 [node name="OptionButton" type="OptionButton" parent="ScrollContainer/VBoxContainer/Small_Straight/HBoxContainer"] custom_minimum_size = Vector2(250, 150) layout_mode = 2 +theme = ExtResource("3_hdjql") theme_override_font_sizes/font_size = 50 alignment = 1 clip_text = true @@ -569,6 +580,7 @@ vertical_alignment = 1 [node name="OptionButton" type="OptionButton" parent="ScrollContainer/VBoxContainer/Large_Straight/HBoxContainer"] custom_minimum_size = Vector2(250, 150) layout_mode = 2 +theme = ExtResource("3_hdjql") theme_override_font_sizes/font_size = 50 alignment = 1 clip_text = true diff --git a/MainMenu.gd b/MainMenu.gd index efa3cb7..5c9893b 100644 --- a/MainMenu.gd +++ b/MainMenu.gd @@ -22,7 +22,7 @@ func _on_button_pressed(): var player = PlayerPanel.instantiate() var player_name : TextEdit = player.get_child(0) if player_name != null: - player_name.text = "Player " + str(PlayerList.get_child_count() + 1) + player_name.text = "Player " + str(PlayerList.get_child_count()) player_name.connect("text_changed", Callable(self, "_on_text_changed")) PlayerList.add_child(player) else: diff --git a/OptionButton.tres b/OptionButton.tres new file mode 100644 index 0000000..eb9864d --- /dev/null +++ b/OptionButton.tres @@ -0,0 +1,4 @@ +[gd_resource type="Theme" format=3 uid="uid://dt11061t2etln"] + +[resource] +PopupMenu/font_sizes/font_size = 50