From 787784bb6b5b9f252b23ae6f5de7af8f91d0eb7f Mon Sep 17 00:00:00 2001 From: Spartan322 Date: Wed, 1 Mar 2023 14:54:10 -0500 Subject: Fix Credits to use theme type variants over LabelSettings - Enables reliable theme application Remove LabelSettings resources from Credits Moved theme load from MainMenu to GameMenu scene Removed Button references from default_theme resource --- game/src/Credits/Credits.gd | 20 ++++++++++---------- game/src/Credits/Credits.tscn | 11 ++++------- game/src/Credits/PersonLabelSettings.tres | 5 ----- game/src/Credits/ProjectLabelSettings.tres | 5 ----- game/src/Credits/RoleLabelSettings.tres | 5 ----- 5 files changed, 14 insertions(+), 32 deletions(-) delete mode 100644 game/src/Credits/PersonLabelSettings.tres delete mode 100644 game/src/Credits/ProjectLabelSettings.tres delete mode 100644 game/src/Credits/RoleLabelSettings.tres (limited to 'game/src/Credits') diff --git a/game/src/Credits/Credits.gd b/game/src/Credits/Credits.gd index 0d13424..a69732c 100644 --- a/game/src/Credits/Credits.gd +++ b/game/src/Credits/Credits.gd @@ -19,15 +19,15 @@ var core_credits_path : String # TODO: implement for theme instead # waiting for https://github.com/OpenVic2Project/OpenVic2/pull/48 -@export_group("Label Settings", "label_settings_") +@export_group("Label Variants", "label_variants_") @export -var label_settings_project : LabelSettings +var label_variants_project : StringName @export -var label_settings_role : LabelSettings +var label_variants_role : StringName @export -var label_settings_personel : LabelSettings +var label_variants_person : StringName @export var credits_list: VBoxContainer @@ -82,12 +82,12 @@ func _load_credit_file(path : String) -> Dictionary: role_list.sort_custom(func(a : String, b : String) -> bool: return a.naturalnocasecmp_to(b) < 0) return roles -func _add_label(node : Node, text : String, settings : LabelSettings) -> void: +func _add_label(node : Node, text : String, type_variation : StringName) -> void: var label := Label.new() label.name = 'Label' + text label.text = text label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER - label.label_settings = settings + label.theme_type_variation = type_variation node.add_child(label) # REQUIREMENTS: @@ -98,7 +98,7 @@ func _add_project_credits(project : Dictionary) -> void: if title_key in project: var title : String = project[title_key][0] project_credits_list.name += title - _add_label(project_credits_list, title, label_settings_project) + _add_label(project_credits_list, title, label_variants_project) project_credits_list.add_child(HSeparator.new()) for role in project: @@ -108,9 +108,9 @@ func _add_project_credits(project : Dictionary) -> void: var role_parent = VBoxContainer.new() for person in project[role]: - _add_label(role_parent, person, label_settings_personel) + _add_label(role_parent, person, label_variants_person) - _add_label(project_credits_list, role, label_settings_role) + _add_label(project_credits_list, role, label_variants_role) project_credits_list.add_child(role_parent) project_credits_list.add_child(HSeparator.new()) @@ -125,4 +125,4 @@ func _ready(): # * UI-38 # * UIFUN-37 func _on_back_button_pressed() -> void: - back_button_pressed.emit() + back_button_pressed.emit() \ No newline at end of file diff --git a/game/src/Credits/Credits.tscn b/game/src/Credits/Credits.tscn index 9889119..fce29fa 100644 --- a/game/src/Credits/Credits.tscn +++ b/game/src/Credits/Credits.tscn @@ -1,9 +1,6 @@ -[gd_scene load_steps=5 format=3 uid="uid://c8knthxkwj1uj"] +[gd_scene load_steps=2 format=3 uid="uid://c8knthxkwj1uj"] [ext_resource type="Script" path="res://src/Credits/Credits.gd" id="1_csd7i"] -[ext_resource type="LabelSettings" uid="uid://biqo8cmnvubow" path="res://src/Credits/ProjectLabelSettings.tres" id="2_u7onr"] -[ext_resource type="LabelSettings" uid="uid://dm4km45avs13l" path="res://src/Credits/RoleLabelSettings.tres" id="3_y8oin"] -[ext_resource type="LabelSettings" uid="uid://bwmyvoa3q0ve5" path="res://src/Credits/PersonLabelSettings.tres" id="4_004ma"] [node name="Credits" type="Control" node_paths=PackedStringArray("credits_list")] editor_description = "UI-34" @@ -15,9 +12,9 @@ grow_horizontal = 2 grow_vertical = 2 script = ExtResource("1_csd7i") core_credits_path = "res://common/credits.csv" -label_settings_project = ExtResource("2_u7onr") -label_settings_role = ExtResource("3_y8oin") -label_settings_personel = ExtResource("4_004ma") +label_variants_project = &"Label_ProjectCredits" +label_variants_role = &"Label_RoleCredits" +label_variants_person = &"Label_PersonCredits" credits_list = NodePath("Scroll/CreditsList") [node name="ControlMargin" type="MarginContainer" parent="."] diff --git a/game/src/Credits/PersonLabelSettings.tres b/game/src/Credits/PersonLabelSettings.tres deleted file mode 100644 index dda6436..0000000 --- a/game/src/Credits/PersonLabelSettings.tres +++ /dev/null @@ -1,5 +0,0 @@ -[gd_resource type="LabelSettings" format=3 uid="uid://bwmyvoa3q0ve5"] - -[resource] -line_spacing = 10.0 -font_size = 20 diff --git a/game/src/Credits/ProjectLabelSettings.tres b/game/src/Credits/ProjectLabelSettings.tres deleted file mode 100644 index cad8acb..0000000 --- a/game/src/Credits/ProjectLabelSettings.tres +++ /dev/null @@ -1,5 +0,0 @@ -[gd_resource type="LabelSettings" format=3 uid="uid://biqo8cmnvubow"] - -[resource] -line_spacing = 20.0 -font_size = 50 diff --git a/game/src/Credits/RoleLabelSettings.tres b/game/src/Credits/RoleLabelSettings.tres deleted file mode 100644 index 3a8381b..0000000 --- a/game/src/Credits/RoleLabelSettings.tres +++ /dev/null @@ -1,5 +0,0 @@ -[gd_resource type="LabelSettings" format=3 uid="uid://dm4km45avs13l"] - -[resource] -line_spacing = 10.0 -font_size = 30 -- cgit v1.2.3-56-ga3b1