Add credits

This commit is contained in:
Sofia 2026-07-25 23:28:35 +03:00
parent bde066af06
commit 2ece3a573b
6 changed files with 220 additions and 0 deletions

55
credits.toml Normal file
View File

@ -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"

54
godot/scenes/credits.tscn Normal file
View File

@ -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"

19
rust/src/credits.rs Normal file
View File

@ -0,0 +1,19 @@
use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Serialize, Deserialize, Default)]
pub struct Credits {
pub people: Vec<CreditPerson>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CreditPerson {
pub name: String,
pub link: Option<String>,
pub credits: Vec<Credit>,
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Credit {
pub credit: String,
pub link: Option<String>,
}

View File

@ -3,6 +3,7 @@ use godot::prelude::*;
pub mod announcer; pub mod announcer;
pub mod chat; pub mod chat;
pub mod cli_parser; pub mod cli_parser;
pub mod credits;
pub mod game_manager; pub mod game_manager;
pub mod game_settings; pub mod game_settings;
pub mod goal; pub mod goal;

90
rust/src/ui/credits.rs Normal file
View File

@ -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<Gd<VBoxContainer>>,
credits: Credits,
base: Base<Control>,
}
#[godot_api]
impl IControl for CreditsMenu {
fn init(base: Base<Self::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::<Control>()
} 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::<Control>()
} 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);
}
}
}

View File

@ -1,5 +1,6 @@
pub mod chatbox; pub mod chatbox;
pub mod cli; pub mod cli;
pub mod credits;
pub mod game_finished_screen; pub mod game_finished_screen;
pub mod lobby; pub mod lobby;
pub mod lobby_player_listing; pub mod lobby_player_listing;