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.
This commit is contained in:
Yadciel 2024-08-19 22:46:52 +02:00
parent b9bf5d6a74
commit 50e777a6fa
3 changed files with 18 additions and 2 deletions

View File

@ -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

View File

@ -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:

4
OptionButton.tres Normal file
View File

@ -0,0 +1,4 @@
[gd_resource type="Theme" format=3 uid="uid://dt11061t2etln"]
[resource]
PopupMenu/font_sizes/font_size = 50