diff --git a/README.md b/README.md index 1f0f4ecc..daeef2f7 100644 --- a/README.md +++ b/README.md @@ -47,4 +47,3 @@ We now have a Steam page! The repository license **does not** apply to any music or image files in this repository, including but not limited to `.wav`, `.mp3`, `.ogg`, `.png`, `.jpg`, and other media formats. These assets are **not licensed** for use, private or public, without prior written consent from the team. All source code and documentation files are licensed under the **GNU Affero General Public License v3.0 (AGPL-3.0)**. - diff --git a/Scenes/UI/Options/Credits.tscn b/Scenes/UI/Options/Credits.tscn new file mode 100644 index 00000000..53deb38c --- /dev/null +++ b/Scenes/UI/Options/Credits.tscn @@ -0,0 +1,64 @@ +[gd_scene load_steps=4 format=3 uid="uid://dgjmb0wllsj41"] + +[ext_resource type="Script" uid="uid://drt21hext7pm2" path="res://Scenes/UI/Options/Scripts/CreditsMenu.cs" id="1_n36fd"] +[ext_resource type="Theme" uid="uid://d37e3tpsbxwak" path="res://Scenes/UI/Assets/GeneralTheme.tres" id="3_agb8c"] +[ext_resource type="PackedScene" uid="uid://dfevfib11kou1" path="res://Scenes/ChartViewport/ChartViewport.tscn" id="3_ch0mg"] + +[node name="Credits" type="Control" node_paths=PackedStringArray("CreditsText", "_returnButton")] +process_mode = 3 +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +script = ExtResource("1_n36fd") +CreditsText = NodePath("Node2D/Label") +ScrollSpeed = 24.0 +RestartPositionY = 400.0 +_returnButton = NodePath("Return Button") + +[node name="Node2D2" type="Node2D" parent="."] +position = Vector2(80, -12.26) +scale = Vector2(2.255, 2.01) + +[node name="SubViewport" parent="Node2D2" instance=ExtResource("3_ch0mg")] +offset_left = -57.1486 +offset_top = 5.0 +offset_right = 422.851 +offset_bottom = 185.0 + +[node name="Node2D" type="Node2D" parent="."] + +[node name="Label" type="Label" parent="Node2D"] +offset_left = 217.0 +offset_top = -3.0 +offset_right = 467.0 +offset_bottom = 410.0 +text = "Credits + +Programmers + Jarod Spanger: Project Lead +Connor Lowe +Raul Mojarro +Thomas Wessel +Michael Quinn + +Artists +Ares Atlas +Evelyn Fu +Emily Wen + +Sound +Sam Meyer: Composer" +horizontal_alignment = 1 + +[node name="Return Button" type="Button" parent="."] +layout_mode = 2 +offset_left = 570.0 +offset_top = 314.0 +offset_right = 631.0 +offset_bottom = 351.0 +theme = ExtResource("3_agb8c") +text = "Return" +icon_alignment = 1 diff --git a/Scenes/UI/Options/Scripts/CreditsMenu.cs b/Scenes/UI/Options/Scripts/CreditsMenu.cs new file mode 100644 index 00000000..a634515d --- /dev/null +++ b/Scenes/UI/Options/Scripts/CreditsMenu.cs @@ -0,0 +1,89 @@ +using System; +using FunkEngine; +using Godot; + +public partial class CreditsMenu : Control, IFocusableMenu +{ + public static readonly string LoadPath = "res://Scenes/UI/Options/Credits.tscn"; + + [Export] + public Label CreditsText; + + [Export] + public float ScrollSpeed = 50f; + + public float FadeStartY = 0; + public float FadeEndY = -400f; + + [Export] + public float RestartPositionY = 800f; + + [Export] + private Button _returnButton; + + public IFocusableMenu Prev { get; set; } + + public override void _Ready() + { + if (CreditsText != null) + { + CreditsText.Position = new Vector2(CreditsText.Position.X, RestartPositionY); + FadeEndY = -CreditsText.Size.Y; + } + _returnButton.Pressed += ReturnToPrev; + _returnButton.GrabFocus(); + } + + public void ResumeFocus() + { + ProcessMode = ProcessModeEnum.Inherit; + _returnButton.GrabFocus(); + } + + public void PauseFocus() + { + ProcessMode = ProcessModeEnum.Disabled; + } + + public void OpenMenu(IFocusableMenu prev) + { + Prev = prev; + Prev.PauseFocus(); + _returnButton.GrabFocus(); + } + + public void ReturnToPrev() + { + Prev.ResumeFocus(); + QueueFree(); + } + + public override void _Input(InputEvent @event) + { + if (@event.IsActionPressed("ui_cancel")) + { + ReturnToPrev(); + GetViewport().SetInputAsHandled(); + } + } + + public override void _Process(double delta) + { + if (CreditsText == null) + return; + + CreditsText.Position += Vector2.Up * (float)(ScrollSpeed * delta); + + float alpha = Mathf.Clamp( + 1 - (CreditsText.GlobalPosition.Y - FadeStartY) / (FadeEndY - FadeStartY), + 0, + 1 + ); + CreditsText.Modulate = new Color(1, 1, 1, alpha); + + if (CreditsText.GlobalPosition.Y < -CreditsText.Size.Y) + { + CreditsText.Position = new Vector2(CreditsText.Position.X, RestartPositionY); + } + } +} diff --git a/Scenes/UI/Options/Scripts/CreditsMenu.cs.uid b/Scenes/UI/Options/Scripts/CreditsMenu.cs.uid new file mode 100644 index 00000000..af14f6ae --- /dev/null +++ b/Scenes/UI/Options/Scripts/CreditsMenu.cs.uid @@ -0,0 +1 @@ +uid://drt21hext7pm2 diff --git a/Scenes/UI/Options/Scripts/OptionsMenu.cs b/Scenes/UI/Options/Scripts/OptionsMenu.cs index 22eeb316..614d777e 100644 --- a/Scenes/UI/Options/Scripts/OptionsMenu.cs +++ b/Scenes/UI/Options/Scripts/OptionsMenu.cs @@ -124,4 +124,12 @@ private void OpenHowToPlay() AddChild(howtoPlay); howtoPlay.OpenMenu(this); } + + private void OpenCredits() + { + CreditsMenu creditsMenu = GD.Load(CreditsMenu.LoadPath) + .Instantiate(); + AddChild(creditsMenu); + creditsMenu.OpenMenu(this); + } }