aboutsummaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
author Brendan Griffiths <96725360+Orwellian-225@users.noreply.github.com>2023-03-01 17:00:24 +0100
committer GitHub <noreply@github.com>2023-03-01 17:00:24 +0100
commit4e099cf1d3f5fa37e9aa520d90aaf505fee3ce23 (patch)
tree5355285405336b55eeab21ca5ecc24c8e9ecf1d8 /game
parent2062aaf394ee6581161add4bcb23076475e236ac (diff)
add: credits.csv - req: FS4 (#16)
Requirements met by this PR: SS-17 SS-29 [1] UI-32 UI-34 UIFUN-36 UI-35 UI-38 UIFUN-37 FS-4
Diffstat (limited to 'game')
-rw-r--r--game/common/credits.csv43
-rw-r--r--game/common/credits.csv.import17
-rw-r--r--game/src/Credits/Credits.gd116
-rw-r--r--game/src/Credits/Credits.tscn49
-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.gd10
-rw-r--r--game/src/GameMenu.tscn9
-rw-r--r--game/src/MainMenu/MainMenu.gd7
-rw-r--r--game/src/MainMenu/MainMenu.tscn16
11 files changed, 279 insertions, 3 deletions
diff --git a/game/common/credits.csv b/game/common/credits.csv
new file mode 100644
index 0000000..2d16684
--- /dev/null
+++ b/game/common/credits.csv
@@ -0,0 +1,43 @@
+Title,OpenVic2
+Project Lead,FakeByte
+Project Lead,joethepro36
+Project Lead,Catylist
+Project Lead,patrick c
+Project Lead,ZincLadder
+Vice Lead,hop311
+Community Manager,Catylist
+Project Management,JackRalph96
+Developer,Dekaizer
+Developer,forn
+Developer,ItsLateHere
+Developer,kai the demon dignitary
+Developer,KarneeKarnay
+Developer,Marty
+Developer,Orwellian
+Developer,Spartan322
+Developer,TheRedKing247
+Developer,VictoriaMFD,
+Developer,2ko
+Developer,BrickPi,
+Developer,Catze
+Developer,CyberTropic
+Developer,Masterchef,
+Developer,Punkrocky
+Developer,RonPaul2020
+Developer,Vercix
+Developer,wyrm
+Developer,Youri
+Artist,dolt
+Artist,Enigmatic
+Artist,JunkJen
+Artist,jΛk
+Artist,PeuPeu
+Artist,qazdr6
+Artist,ThatEvilOne
+Artist,Bon Marche
+Artist,kingscott84,
+Artist,spacemarine658
+Artist,Tupinamba
+Music,MOOp
+Music,Ale-
+Special Thanks,Spudgun
diff --git a/game/common/credits.csv.import b/game/common/credits.csv.import
new file mode 100644
index 0000000..63b33aa
--- /dev/null
+++ b/game/common/credits.csv.import
@@ -0,0 +1,17 @@
+[remap]
+
+importer="csv_translation"
+type="Translation"
+uid="uid://4dwpfaaedki"
+
+[deps]
+
+files=["res://common/credits.OpenVic2.translation"]
+
+source_file="res://common/credits.csv"
+dest_files=["res://common/credits.OpenVic2.translation"]
+
+[params]
+
+compress=true
+delimiter=0
diff --git a/game/src/Credits/Credits.gd b/game/src/Credits/Credits.gd
new file mode 100644
index 0000000..902207b
--- /dev/null
+++ b/game/src/Credits/Credits.gd
@@ -0,0 +1,116 @@
+extends Control
+
+signal back_button_pressed
+
+###############
+# Credits CSV format
+# The project title row is the only requirement within the csv file, however
+# it can be on any row, so long as it exists.
+# ----------------------
+# title,project-title
+# role-name,person-name
+# role-name,person-name
+# role-name,person-name
+# ...
+###############
+
+@export_file("*.csv")
+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
+var label_settings_project : LabelSettings
+
+@export
+var label_settings_role : LabelSettings
+
+@export
+var label_settings_personel : LabelSettings
+
+@export
+var credits_list: VBoxContainer
+
+# REQUIREMENTS:
+# * 1.5 Credits Menu
+# * SS-17
+
+# REQUIREMENTS
+# * FS-4
+func load_credit_file(path):
+ var roles = {}
+ var core_credits = FileAccess.open(path, FileAccess.READ)
+
+ while not core_credits.eof_reached():
+ var line = core_credits.get_csv_line()
+
+ # If the line does not have an identifiable role or is empty then skip it
+ if line[0].is_empty():
+ continue
+
+ var role := line[0].to_upper()
+ var person : String = line[1] # Cannot infer with := as line[1] does not have a set type
+
+ if role not in roles.keys():
+ roles[role] = []
+ roles[role].push_back(person)
+ else:
+ roles[role].push_back(person)
+
+ return roles
+
+# REQUIREMENTS:
+# * UI-34, UI-35
+func make_project_credits(project):
+ var project_credits_list = VBoxContainer.new()
+ var project_credits_label = Label.new()
+
+
+ # Spartan has some suggestions here but for now its good enough. Refer
+ # to PR 16 resolved comments for further details
+ project_credits_list.name = 'Credits' + project['TITLE'][0]
+ project_credits_label.name = 'Label' + project['TITLE'][0]
+ project_credits_label.text = project['TITLE'][0]
+ project_credits_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
+ project_credits_label.label_settings = label_settings_project
+
+ for role in project.keys():
+ if role == 'TITLE':
+ continue
+
+ var role_parent = VBoxContainer.new()
+ var role_label = Label.new()
+
+ role_parent.name = 'Role' + role
+ role_label.name = 'Label' + role
+ role_label.text = role
+ role_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
+ role_label.label_settings = label_settings_role
+
+ for person in project[role]:
+ var person_label = Label.new()
+
+ person_label.name = 'Label' + person
+ person_label.text = person
+ person_label.horizontal_alignment = HORIZONTAL_ALIGNMENT_CENTER
+ person_label.label_settings = label_settings_personel
+ role_parent.add_child(person_label)
+
+ project_credits_list.add_child(role_label)
+ project_credits_list.add_child(role_parent)
+ project_credits_list.add_child(HSeparator.new())
+
+ credits_list.add_child(project_credits_list)
+
+# REQUIREMENTS:
+# * SS-17
+func _ready():
+ var core_credits = load_credit_file(core_credits_path)
+ make_project_credits(core_credits)
+
+# REQUIREMENTS:
+# * UI-38
+# * UIFUN-37
+func _on_back_button_pressed():
+ back_button_pressed.emit()
diff --git a/game/src/Credits/Credits.tscn b/game/src/Credits/Credits.tscn
new file mode 100644
index 0000000..7151aa8
--- /dev/null
+++ b/game/src/Credits/Credits.tscn
@@ -0,0 +1,49 @@
+[gd_scene load_steps=5 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")]
+layout_mode = 3
+anchors_preset = 15
+anchor_right = 1.0
+anchor_bottom = 1.0
+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")
+credits_list = NodePath("Scroll/CreditsList")
+
+[node name="ControlMargin" type="MarginContainer" parent="."]
+layout_mode = 2
+anchor_right = 1.0
+anchor_bottom = 0.071
+offset_bottom = -0.120003
+theme_override_constants/margin_left = 20
+theme_override_constants/margin_top = 10
+theme_override_constants/margin_right = 20
+theme_override_constants/margin_bottom = 10
+
+[node name="BackButton" type="Button" parent="ControlMargin"]
+layout_mode = 2
+text = "Back to Main Menu"
+
+[node name="Scroll" type="ScrollContainer" parent="."]
+layout_mode = 2
+anchor_top = 0.071
+anchor_right = 1.0
+anchor_bottom = 1.0
+offset_top = -0.120003
+offset_bottom = -6.0
+
+[node name="CreditsList" type="VBoxContainer" parent="Scroll"]
+layout_mode = 2
+size_flags_horizontal = 3
+size_flags_vertical = 3
+
+[connection signal="pressed" from="ControlMargin/BackButton" to="." method="_on_back_button_pressed"]
diff --git a/game/src/Credits/PersonLabelSettings.tres b/game/src/Credits/PersonLabelSettings.tres
new file mode 100644
index 0000000..dda6436
--- /dev/null
+++ b/game/src/Credits/PersonLabelSettings.tres
@@ -0,0 +1,5 @@
+[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
new file mode 100644
index 0000000..cad8acb
--- /dev/null
+++ b/game/src/Credits/ProjectLabelSettings.tres
@@ -0,0 +1,5 @@
+[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
new file mode 100644
index 0000000..3a8381b
--- /dev/null
+++ b/game/src/Credits/RoleLabelSettings.tres
@@ -0,0 +1,5 @@
+[gd_resource type="LabelSettings" format=3 uid="uid://dm4km45avs13l"]
+
+[resource]
+line_spacing = 10.0
+font_size = 30
diff --git a/game/src/GameMenu.gd b/game/src/GameMenu.gd
index b899fc8..6856e0f 100644
--- a/game/src/GameMenu.gd
+++ b/game/src/GameMenu.gd
@@ -25,3 +25,13 @@ func _on_lobby_menu_back_button_pressed():
$MainMenu.show()
$LobbyMenu.hide()
$OptionsMenu.toggle_locale_button_visibility(true)
+
+
+func _on_credits_back_button_pressed():
+ $Credits.hide()
+ $MainMenu.show()
+
+
+func _on_main_menu_credits_button_pressed():
+ $Credits.show()
+ $MainMenu.hide()
diff --git a/game/src/GameMenu.tscn b/game/src/GameMenu.tscn
index 8f9d0f3..9442d1a 100644
--- a/game/src/GameMenu.tscn
+++ b/game/src/GameMenu.tscn
@@ -1,9 +1,10 @@
-[gd_scene load_steps=6 format=3 uid="uid://b4pg2y2ivib8f"]
+[gd_scene load_steps=7 format=3 uid="uid://b4pg2y2ivib8f"]
[ext_resource type="Script" path="res://src/GameMenu.gd" id="1_cafwe"]
[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"]
+[ext_resource type="PackedScene" uid="uid://c8knthxkwj1uj" path="res://src/Credits/Credits.tscn" id="4_n0hoo"]
[ext_resource type="PackedScene" uid="uid://crhkgngfnxf4y" path="res://src/LobbyMenu/LobbyMenu.tscn" id="4_nofk1"]
[node name="GameMenu" type="Control"]
@@ -27,6 +28,10 @@ layout_mode = 1
visible = false
layout_mode = 1
+[node name="Credits" parent="." instance=ExtResource("4_n0hoo")]
+visible = false
+layout_mode = 1
+
[node name="HBox" type="HBoxContainer" parent="."]
layout_mode = 1
anchors_preset = 3
@@ -43,7 +48,9 @@ alignment = 2
[node name="LocaleButton" parent="HBox" instance=ExtResource("4_jno35")]
layout_mode = 2
+[connection signal="credits_button_pressed" from="MainMenu" to="." method="_on_main_menu_credits_button_pressed"]
[connection signal="new_game_button_pressed" from="MainMenu" to="." method="_on_main_menu_new_game_button_pressed"]
[connection signal="options_button_pressed" from="MainMenu" to="." method="_on_main_menu_options_button_pressed"]
[connection signal="back_button_pressed" from="OptionsMenu" to="." method="_on_options_menu_back_button_pressed"]
[connection signal="back_button_pressed" from="LobbyMenu" to="." method="_on_lobby_menu_back_button_pressed"]
+[connection signal="back_button_pressed" from="Credits" to="." method="_on_credits_back_button_pressed"]
diff --git a/game/src/MainMenu/MainMenu.gd b/game/src/MainMenu/MainMenu.gd
index 1e15d10..4ffa3b0 100644
--- a/game/src/MainMenu/MainMenu.gd
+++ b/game/src/MainMenu/MainMenu.gd
@@ -2,6 +2,7 @@ extends Control
signal options_button_pressed
signal new_game_button_pressed
+signal credits_button_pressed
@export
var _new_game_button : BaseButton
@@ -37,6 +38,12 @@ func _on_options_button_pressed():
print("Check out some options!")
options_button_pressed.emit()
+# REQUIREMENTS
+# * UI-32
+# * UIFUN-36
+func _on_credits_button_pressed():
+ credits_button_pressed.emit()
+
func _on_exit_button_pressed():
print("See you later!")
diff --git a/game/src/MainMenu/MainMenu.tscn b/game/src/MainMenu/MainMenu.tscn
index f306c63..8d8a713 100644
--- a/game/src/MainMenu/MainMenu.tscn
+++ b/game/src/MainMenu/MainMenu.tscn
@@ -88,13 +88,24 @@ clip_text = true
layout_mode = 2
size_flags_horizontal = 3
focus_neighbor_left = NodePath("../MultiplayerButton")
-focus_neighbor_right = NodePath("../ExitButton")
-focus_next = NodePath("../ExitButton")
+focus_neighbor_right = NodePath("../CreditsButton")
+focus_next = NodePath("../CreditsButton")
focus_previous = NodePath("../MultiplayerButton")
theme_type_variation = &"Button_MainMenu"
text = "Options"
clip_text = true
+[node name="CreditsButton" type="Button" parent="Panel/VBox/Margin/ButtonList"]
+layout_mode = 2
+size_flags_horizontal = 3
+focus_neighbor_left = NodePath("../OptionsButton")
+focus_neighbor_right = NodePath("../ExitButton")
+focus_next = NodePath("../ExitButton")
+focus_previous = NodePath("../OptionsButton")
+theme_type_variation = &"Button_MainMenu"
+text = "Credits"
+clip_text = true
+
[node name="ExitButton" type="Button" parent="Panel/VBox/Margin/ButtonList"]
layout_mode = 2
size_flags_horizontal = 3
@@ -137,4 +148,5 @@ text = "(0000)"
[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/ContinueButton" to="." method="_on_continue_button_pressed"]
[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/MultiplayerButton" to="." method="_on_multi_player_button_pressed"]
[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/OptionsButton" to="." method="_on_options_button_pressed"]
+[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/CreditsButton" to="." method="_on_credits_button_pressed"]
[connection signal="pressed" from="Panel/VBox/Margin/ButtonList/ExitButton" to="." method="_on_exit_button_pressed"]