aboutsummaryrefslogtreecommitdiff
path: root/game/src
diff options
context:
space:
mode:
author Spartan322 <Megacake1234@gmail.com>2023-03-01 20:54:10 +0100
committer Spartan322 <Megacake1234@gmail.com>2023-03-07 19:34:23 +0100
commit787784bb6b5b9f252b23ae6f5de7af8f91d0eb7f (patch)
tree1fb0ad26014531b25eeda85ba3b8ccb80a24b6dd /game/src
parent95173891f7c5eea7717a58ae4f1438fd09e0ee1f (diff)
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
Diffstat (limited to 'game/src')
-rw-r--r--game/src/Credits/Credits.gd20
-rw-r--r--game/src/Credits/Credits.tscn11
-rw-r--r--game/src/Credits/PersonLabelSettings.tres5
-rw-r--r--game/src/Credits/ProjectLabelSettings.tres5
-rw-r--r--game/src/Credits/RoleLabelSettings.tres5
-rw-r--r--game/src/GameMenu.tscn4
6 files changed, 17 insertions, 33 deletions
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
diff --git a/game/src/GameMenu.tscn b/game/src/GameMenu.tscn
index 9442d1a..3c72991 100644
--- a/game/src/GameMenu.tscn
+++ b/game/src/GameMenu.tscn
@@ -1,6 +1,7 @@
-[gd_scene load_steps=7 format=3 uid="uid://b4pg2y2ivib8f"]
+[gd_scene load_steps=8 format=3 uid="uid://b4pg2y2ivib8f"]
[ext_resource type="Script" path="res://src/GameMenu.gd" id="1_cafwe"]
+[ext_resource type="Theme" uid="uid://cr4lh0vraucx7" path="res://default_theme.tres" id="1_q3b4c"]
[ext_resource type="PackedScene" uid="uid://dvoin538iby54" path="res://src/MainMenu/MainMenu.tscn" id="2_2jbkh"]
[ext_resource type="PackedScene" uid="uid://cnbfxjy1m6wja" path="res://src/OptionMenu/OptionsMenu.tscn" id="3_111lv"]
[ext_resource type="PackedScene" uid="uid://b7oncobnacxmt" path="res://src/LocaleButton.tscn" id="4_jno35"]
@@ -14,6 +15,7 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
+theme = ExtResource("1_q3b4c")
script = ExtResource("1_cafwe")
[node name="MainMenu" parent="." instance=ExtResource("2_2jbkh")]