diff options
author | Spartan322 <Megacake1234@gmail.com> | 2023-03-01 20:54:10 +0100 |
---|---|---|
committer | Spartan322 <Megacake1234@gmail.com> | 2023-03-07 19:34:23 +0100 |
commit | 787784bb6b5b9f252b23ae6f5de7af8f91d0eb7f (patch) | |
tree | 1fb0ad26014531b25eeda85ba3b8ccb80a24b6dd /game | |
parent | 95173891f7c5eea7717a58ae4f1438fd09e0ee1f (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')
-rw-r--r-- | game/default_theme.tres | 101 | ||||
-rw-r--r-- | game/src/Credits/Credits.gd | 20 | ||||
-rw-r--r-- | game/src/Credits/Credits.tscn | 11 | ||||
-rw-r--r-- | game/src/Credits/PersonLabelSettings.tres | 5 | ||||
-rw-r--r-- | game/src/Credits/ProjectLabelSettings.tres | 5 | ||||
-rw-r--r-- | game/src/Credits/RoleLabelSettings.tres | 5 | ||||
-rw-r--r-- | game/src/GameMenu.tscn | 4 |
7 files changed, 27 insertions, 124 deletions
diff --git a/game/default_theme.tres b/game/default_theme.tres index 8685f3e..0f9119b 100644 --- a/game/default_theme.tres +++ b/game/default_theme.tres @@ -1,4 +1,4 @@ -[gd_resource type="Theme" load_steps=23 format=3 uid="uid://cr4lh0vraucx7"] +[gd_resource type="Theme" load_steps=18 format=3 uid="uid://cr4lh0vraucx7"] [ext_resource type="Texture2D" uid="uid://c0p34i3d3b0pw" path="res://theme_assets/main_menu_button.png" id="1_dwmy4"] [ext_resource type="StyleBox" uid="uid://4ypja147f4mb" path="res://theme_assets/main_menu_button_normal.stylebox" id="2_8nk80"] @@ -9,75 +9,6 @@ [ext_resource type="Texture2D" uid="uid://dapuqgpjs56bs" path="res://theme_assets/main_menu_background.png" id="7_ioley"] [ext_resource type="Texture2D" uid="uid://q25s41oavuxw" path="res://theme_assets/main_menu_border_paper.png" id="8_pqg86"] -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_mgyot"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(0.1, 0.1, 0.1, 0.3) -corner_radius_top_left = 3 -corner_radius_top_right = 3 -corner_radius_bottom_right = 3 -corner_radius_bottom_left = 3 -corner_detail = 5 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_35106"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(1, 1, 1, 0.75) -draw_center = false -border_width_left = 2 -border_width_top = 2 -border_width_right = 2 -border_width_bottom = 2 -corner_radius_top_left = 3 -corner_radius_top_right = 3 -corner_radius_bottom_right = 3 -corner_radius_bottom_left = 3 -corner_detail = 5 -expand_margin_left = 2.0 -expand_margin_top = 2.0 -expand_margin_right = 2.0 -expand_margin_bottom = 2.0 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_jxhab"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(0.225, 0.225, 0.225, 0.6) -corner_radius_top_left = 3 -corner_radius_top_right = 3 -corner_radius_bottom_right = 3 -corner_radius_bottom_left = 3 -corner_detail = 5 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yorb8"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(0.1, 0.1, 0.1, 0.6) -corner_radius_top_left = 3 -corner_radius_top_right = 3 -corner_radius_bottom_right = 3 -corner_radius_bottom_left = 3 -corner_detail = 5 - -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ufyfw"] -content_margin_left = 4.0 -content_margin_top = 4.0 -content_margin_right = 4.0 -content_margin_bottom = 4.0 -bg_color = Color(0, 0, 0, 0.6) -corner_radius_top_left = 3 -corner_radius_top_right = 3 -corner_radius_bottom_right = 3 -corner_radius_bottom_left = 3 -corner_detail = 5 - [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_dd2b8"] content_margin_left = 20.0 content_margin_top = 10.0 @@ -183,27 +114,6 @@ script = ExtResource("5_lricc") texture_settings = Array[ExtResource("6_oq58n")]([SubResource("Resource_hxpog"), SubResource("Resource_c0k5l")]) [resource] -Button/colors/font_color = Color(0.87451, 0.87451, 0.87451, 1) -Button/colors/font_disabled_color = Color(0.875, 0.875, 0.875, 0.5) -Button/colors/font_focus_color = Color(0.95, 0.95, 0.95, 1) -Button/colors/font_hover_color = Color(0.95, 0.95, 0.95, 1) -Button/colors/font_hover_pressed_color = Color(1, 1, 1, 1) -Button/colors/font_outline_color = Color(1, 1, 1, 1) -Button/colors/font_pressed_color = Color(1, 1, 1, 1) -Button/colors/icon_disabled_color = Color(1, 1, 1, 0.4) -Button/colors/icon_focus_color = Color(1, 1, 1, 1) -Button/colors/icon_hover_color = Color(1, 1, 1, 1) -Button/colors/icon_hover_pressed_color = Color(1, 1, 1, 1) -Button/colors/icon_normal_color = Color(1, 1, 1, 1) -Button/colors/icon_pressed_color = Color(1, 1, 1, 1) -Button/constants/h_separation = 2 -Button/constants/outline_size = 0 -Button/font_sizes/font_size = 16 -Button/styles/disabled = SubResource("StyleBoxFlat_mgyot") -Button/styles/focus = SubResource("StyleBoxFlat_35106") -Button/styles/hover = SubResource("StyleBoxFlat_jxhab") -Button/styles/normal = SubResource("StyleBoxFlat_yorb8") -Button/styles/pressed = SubResource("StyleBoxFlat_ufyfw") Button_MainMenu/base_type = &"Button" Button_MainMenu/colors/font_color = Color(0.87451, 0.87451, 0.87451, 1) Button_MainMenu/colors/font_disabled_color = Color(0.875, 0.875, 0.875, 0.5) @@ -226,5 +136,14 @@ Button_MainMenu/styles/normal = ExtResource("2_8nk80") Button_MainMenu/styles/pressed = SubResource("StyleBox_uuspe") Label_Checksum/base_type = &"Label" Label_Checksum/colors/font_color = Color(0.247059, 0.392157, 1, 1) +Label_PersonCredits/base_type = &"Label" +Label_PersonCredits/constants/line_spacing = 10 +Label_PersonCredits/font_sizes/font_size = 20 +Label_ProjectCredits/base_type = &"Label" +Label_ProjectCredits/constants/line_spacing = 20 +Label_ProjectCredits/font_sizes/font_size = 50 +Label_RoleCredits/base_type = &"Label" +Label_RoleCredits/constants/line_spacing = 10 +Label_RoleCredits/font_sizes/font_size = 30 Panel_MainMenu/base_type = &"Panel" Panel_MainMenu/styles/panel = SubResource("StyleBox_rvlty") 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")] |