From 2ece3a573bbe1fb88a070436861229ab2c853c53 Mon Sep 17 00:00:00 2001 From: Sofia Date: Sat, 25 Jul 2026 23:28:35 +0300 Subject: [PATCH] Add credits --- credits.toml | 55 ++++++++++++++++++++++++ godot/scenes/credits.tscn | 54 +++++++++++++++++++++++ rust/src/credits.rs | 19 +++++++++ rust/src/lib.rs | 1 + rust/src/ui/credits.rs | 90 +++++++++++++++++++++++++++++++++++++++ rust/src/ui/mod.rs | 1 + 6 files changed, 220 insertions(+) create mode 100644 credits.toml create mode 100644 godot/scenes/credits.tscn create mode 100644 rust/src/credits.rs create mode 100644 rust/src/ui/credits.rs diff --git a/credits.toml b/credits.toml new file mode 100644 index 0000000..0ae0022 --- /dev/null +++ b/credits.toml @@ -0,0 +1,55 @@ +[[people]] +name = "Teascade" +link = "https://teascade.itch.io/" +[[people.credits]] +credit = "Game Designer" +[[people.credits]] +credit = "Developer" + +[[people]] +name = "Neon" +link = "https://nc.itch.io/" +[[people.credits]] +credit = "Level Designer" + +[[people]] +name = "Lucian Pavel" +[[people.credits]] +credit = "Crosshair" +link = "https://opengameart.org/content/3-fps-crosshairs" + +[[people]] +name = "Zapsplat" +[[people.credits]] +credit = "Beam sound effect" +[[people.credits]] +credit = "Hit sound effect" +[[people.credits]] +credit = "Footsteps" +link = "https://www.zapsplat.com/sound-effect-packs/footsteps-on-fallen-tree-trunk" + +[[people]] +name = "TripleSnail" +[[people.credits]] +credit = "Announcer effects" +link = "https://opengameart.org/content/announcer-kill-sounds" + +[[people]] +name = "Michel Baradari" +[[people.credits]] +credit = "Shotgun sound effect" +link = "https://opengameart.org/content/chaingun-pistol-rifle-shotgun-shots" + +[[people]] +name = "Casti_131" +[[people.credits]] +credit = "Soldier model & rig" +link = "https://opengameart.org/content/low-poly-soldier-with-weapons" + +[[people]] +name = "Bradley D." +link = "https://strideh.itch.io" +[[people.credits]] +credit = "Torment Textures" + + diff --git a/godot/scenes/credits.tscn b/godot/scenes/credits.tscn new file mode 100644 index 0000000..204b325 --- /dev/null +++ b/godot/scenes/credits.tscn @@ -0,0 +1,54 @@ +[gd_scene format=3 uid="uid://dsxu0y8pjbw3k"] + +[sub_resource type="LabelSettings" id="LabelSettings_1cgct"] +font_size = 32 + +[node name="credits" type="CreditsMenu" unique_id=1258538655 node_paths=PackedStringArray("credits_container")] +credits_container = NodePath("panel/scroll_container/v_box_container") +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="panel" type="Panel" parent="." unique_id=931856419] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="label" type="Label" parent="panel" unique_id=64573048] +layout_mode = 0 +offset_left = 43.0 +offset_top = 28.0 +offset_right = 153.0 +offset_bottom = 73.0 +text = "Credits" +label_settings = SubResource("LabelSettings_1cgct") + +[node name="scroll_container" type="ScrollContainer" parent="panel" unique_id=257439878] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_left = 41.0 +offset_top = 90.0 +offset_right = -88.0 +offset_bottom = -74.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="v_box_container" type="VBoxContainer" parent="panel/scroll_container" unique_id=1886820635] +layout_mode = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="back" type="Button" parent="panel" unique_id=676253720] +layout_mode = 0 +offset_left = 46.0 +offset_top = 575.0 +offset_right = 91.0 +offset_bottom = 606.0 +text = "Back to Main Menu" diff --git a/rust/src/credits.rs b/rust/src/credits.rs new file mode 100644 index 0000000..85e3869 --- /dev/null +++ b/rust/src/credits.rs @@ -0,0 +1,19 @@ +use serde::{Deserialize, Serialize}; + +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +pub struct Credits { + pub people: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct CreditPerson { + pub name: String, + pub link: Option, + pub credits: Vec, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct Credit { + pub credit: String, + pub link: Option, +} diff --git a/rust/src/lib.rs b/rust/src/lib.rs index f2808db..ac9e1fb 100644 --- a/rust/src/lib.rs +++ b/rust/src/lib.rs @@ -3,6 +3,7 @@ use godot::prelude::*; pub mod announcer; pub mod chat; pub mod cli_parser; +pub mod credits; pub mod game_manager; pub mod game_settings; pub mod goal; diff --git a/rust/src/ui/credits.rs b/rust/src/ui/credits.rs new file mode 100644 index 0000000..8c96e57 --- /dev/null +++ b/rust/src/ui/credits.rs @@ -0,0 +1,90 @@ +use godot::{ + classes::{Control, IControl, Label, LinkButton, MarginContainer, VBoxContainer}, + prelude::*, +}; + +use crate::credits::{Credit, CreditPerson, Credits}; + +const CREDITS: &'static str = include_str!("../../../credits.toml"); + +#[derive(GodotClass)] +#[class(base=Control, tool)] +pub struct CreditsMenu { + #[export] + credits_container: Option>, + + credits: Credits, + + base: Base, +} + +#[godot_api] +impl IControl for CreditsMenu { + fn init(base: Base) -> Self { + let credits = toml::from_str(CREDITS).unwrap_or(Default::default()); + + CreditsMenu { + credits_container: None, + credits, + base, + } + } + + fn ready(&mut self) { + if let Some(container) = &mut self.credits_container { + for child in container.get_children().iter_shared() { + container.remove_child(&child); + } + } + + for person in self.credits.people.clone() { + self.add_credit(person); + } + } +} + +impl CreditsMenu { + pub fn add_credit(&mut self, credit: CreditPerson) { + if let Some(container) = &mut self.credits_container { + let mut margin = MarginContainer::new_alloc(); + margin.add_theme_constant_override("margin_bottom", 15); + + let mut vbox = VBoxContainer::new_alloc(); + + let name = if let Some(uri) = credit.link { + let mut link = LinkButton::new_alloc(); + link.set_text(&credit.name); + link.set_uri(&uri); + link.upcast::() + } else { + let mut label = Label::new_alloc(); + label.set_text(&credit.name); + label.upcast() + }; + + vbox.add_child(&name); + + for credit in credit.credits { + let mut credit_margin = MarginContainer::new_alloc(); + credit_margin.add_theme_constant_override("margin_left", 20); + + let credit = if let Some(uri) = credit.link { + let mut link = LinkButton::new_alloc(); + link.set_text(&format!("- {}", credit.credit)); + link.set_uri(&uri); + link.upcast::() + } else { + let mut label = Label::new_alloc(); + label.set_text(&format!("- {}", credit.credit)); + label.upcast() + }; + + credit_margin.add_child(&credit); + vbox.add_child(&credit_margin); + } + + margin.add_child(&vbox); + container.add_child(&margin); + } + } +} diff --git a/rust/src/ui/mod.rs b/rust/src/ui/mod.rs index e4f5374..0542b62 100644 --- a/rust/src/ui/mod.rs +++ b/rust/src/ui/mod.rs @@ -1,5 +1,6 @@ pub mod chatbox; pub mod cli; +pub mod credits; pub mod game_finished_screen; pub mod lobby; pub mod lobby_player_listing;