Compare commits

..

2 Commits

Author SHA1 Message Date
520d44d564 Add credits 2026-07-25 23:48:20 +03:00
2ece3a573b Add credits 2026-07-25 23:28:35 +03:00
8 changed files with 248 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"

View File

@ -1,6 +1,7 @@
[gd_scene format=3 uid="uid://lahirbqfppvw"]
[ext_resource type="PackedScene" uid="uid://bbmc2gmy7g8ag" path="res://scenes/misc/menu_player.tscn" id="1_o5qli"]
[ext_resource type="PackedScene" uid="uid://dsxu0y8pjbw3k" path="res://scenes/ui/credits.tscn" id="1_sugp2"]
[ext_resource type="PackedScene" uid="uid://n3u0jr4wiib1" path="res://scenes/ui/settings.tscn" id="2_0wfyh"]
[node name="menu" type="MainMenu" unique_id=2036763876 node_paths=PackedStringArray("camera", "main_position", "host_position", "main_panel", "host_panel", "join_panel", "host_port", "join_addr", "recent_servers_button", "popup_panel", "popup_title", "popup_text", "popup_button")]
@ -17,6 +18,7 @@ popup_panel = NodePath("popup_panel")
popup_title = NodePath("popup_panel/v_box_container/title")
popup_text = NodePath("popup_panel/v_box_container/text")
popup_button = NodePath("popup_panel/v_box_container/ok")
credits = ExtResource("1_sugp2")
[node name="camera_3d" type="Camera3D" parent="." unique_id=1513321931]
transform = Transform3D(0.98629165, -0.031186381, 0.16203775, -1.4054481e-08, 0.981978, 0.1889952, -0.16501158, -0.18640438, 0.9685167, 1.0974052, 1.7166122, 1.4909106)
@ -72,6 +74,11 @@ layout_mode = 2
text = "Join Game"
metadata/_edit_lock_ = true
[node name="credits" type="Button" parent="main_panel/v_box_container" unique_id=953921422]
layout_mode = 2
text = "Credits"
metadata/_edit_lock_ = true
[node name="settings" type="Button" parent="main_panel/v_box_container" unique_id=1153899756]
layout_mode = 2
text = "Settings"
@ -240,6 +247,7 @@ text = "Ok"
[connection signal="pressed" from="main_panel/v_box_container/host" to="." method="go_to_host_game"]
[connection signal="pressed" from="main_panel/v_box_container/join" to="." method="go_to_join_game"]
[connection signal="pressed" from="main_panel/v_box_container/credits" to="." method="open_credits"]
[connection signal="pressed" from="main_panel/v_box_container/settings" to="settings" method="open"]
[connection signal="pressed" from="main_panel/v_box_container/quit" to="." method="quit_game"]
[connection signal="pressed" from="host_panel/v_box_container/host" to="." method="host_game"]

View File

@ -0,0 +1,56 @@
[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="close" 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 = "Close"
[connection signal="pressed" from="panel/close" to="." method="close"]

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 chat;
pub mod cli_parser;
pub mod credits;
pub mod game_manager;
pub mod game_settings;
pub mod goal;

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

@ -0,0 +1,96 @@
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);
}
}
}
#[godot_api]
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);
}
}
#[func]
pub fn close(&mut self) {
self.base_mut().queue_free();
}
}

View File

@ -8,6 +8,7 @@ use crate::{
game_settings::{GameSettingsManager, RecentServer},
net::network_manager::NetworkManager,
popup_queue::{Popup, PopupQueue},
ui::credits::CreditsMenu,
};
#[derive(Debug, Clone, GodotConvert, Default, Export)]
@ -57,6 +58,8 @@ pub struct MainMenu {
#[export]
current_menu: Menu,
#[export]
credits: Option<Gd<PackedScene>>,
prev_panel: Option<Gd<Panel>>,
@ -212,6 +215,15 @@ impl MainMenu {
self.base().get_tree().quit();
}
#[func]
pub fn open_credits(&mut self) {
if let Some(credits) = self.credits.clone() {
let credits = credits.instantiate_as::<CreditsMenu>();
godot_print!("{}", credits);
self.base_mut().add_child(&credits);
}
}
pub fn show_popup(&mut self, title: &str, text: &str, ok: bool) {
if let Some(panel) = &mut self.popup_panel {
panel.set_visible(true);

View File

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