From ea10b40844f9d34cda8893b7e0a3d53b08c53053 Mon Sep 17 00:00:00 2001 From: Quinn-Hub <56490493+Quinn-Hub@users.noreply.github.com> Date: Thu, 10 Apr 2025 14:59:10 -0700 Subject: [PATCH 1/3] Update: Rough Draft of Credits Changelog -> Changed redirect to options menu scene to my "CreditsOptionTest" scene to represent how we can use the credits button in the options. -> Added functionality of entering and exiting the credits menu -> Made a rough draft of the credits menu --- Scenes/UI/Options/Credits.tscn | 114 +++++++++++++++++ Scenes/UI/Options/CreditsOptionTest.tscn | 127 +++++++++++++++++++ Scenes/UI/Options/Scripts/CreditsMenu.cs | 50 ++++++++ Scenes/UI/Options/Scripts/CreditsMenu.cs.uid | 1 + Scenes/UI/Options/Scripts/OptionsMenu.cs | 14 +- 5 files changed, 305 insertions(+), 1 deletion(-) create mode 100644 Scenes/UI/Options/Credits.tscn create mode 100644 Scenes/UI/Options/CreditsOptionTest.tscn create mode 100644 Scenes/UI/Options/Scripts/CreditsMenu.cs create mode 100644 Scenes/UI/Options/Scripts/CreditsMenu.cs.uid diff --git a/Scenes/UI/Options/Credits.tscn b/Scenes/UI/Options/Credits.tscn new file mode 100644 index 00000000..a6cf4116 --- /dev/null +++ b/Scenes/UI/Options/Credits.tscn @@ -0,0 +1,114 @@ +[gd_scene load_steps=2 format=3 uid="uid://dgjmb0wllsj41"] + +[ext_resource type="Script" uid="uid://drt21hext7pm2" path="res://Scenes/UI/Options/Scripts/CreditsMenu.cs" id="1_n36fd"] + +[node name="Control" type="Control" node_paths=PackedStringArray("_returnButton")] +process_mode = 3 +layout_mode = 3 +anchors_preset = 0 +offset_right = 40.0 +offset_bottom = 40.0 +script = ExtResource("1_n36fd") +_returnButton = NodePath("CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer4/Return Button") + +[node name="ColorRect" type="ColorRect" parent="."] +layout_mode = 0 +offset_right = 640.0 +offset_bottom = 358.0 +color = Color(0.241156, 0.241156, 0.241156, 1) + +[node name="CenterContainer" type="CenterContainer" parent="."] +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 + +[node name="MarginContainer" type="MarginContainer" parent="CenterContainer"] +layout_mode = 2 + +[node name="ColorRect" type="ColorRect" parent="CenterContainer/MarginContainer"] +layout_mode = 2 + +[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/MarginContainer/ColorRect"] +layout_mode = 0 +offset_left = 8.0 +offset_top = -1.0 +offset_right = 48.0 +offset_bottom = 39.0 +scale = Vector2(14.6, 7.88) + +[node name="ColorRect" type="ColorRect" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer"] +layout_mode = 2 +color = Color(0.306923, 0.306923, 0.306923, 1) + +[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"] +layout_mode = 0 +offset_left = 15.5479 +offset_top = 2.28426 +offset_right = 70.5479 +offset_bottom = 42.2843 +scale = Vector2(0.150685, 0.248731) + +[node name="Title" type="Label" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/VBoxContainer"] +layout_mode = 2 +text = "Credits" + +[node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"] +layout_mode = 0 +offset_left = 2.32877 +offset_top = 11.6751 +offset_right = 219.329 +offset_bottom = 164.675 +scale = Vector2(0.0566447, 0.0947541) + +[node name="Label" type="Label" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer"] +layout_mode = 2 +text = "Programmers + Jarod Spanger: Project Lead +Connor Lowe +Raul Mojarro +Thomas Wessel +Michael Quinn" +horizontal_alignment = 1 + +[node name="HBoxContainer2" type="HBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"] +layout_mode = 0 +offset_left = 18.0137 +offset_top = 12.3096 +offset_right = 99.0137 +offset_bottom = 113.31 +scale = Vector2(0.0602738, 0.102849) + +[node name="Label" type="Label" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer2"] +layout_mode = 2 +text = "Artists +Ares Atlas +Evelyn Fu +Emily Wen" +horizontal_alignment = 1 + +[node name="HBoxContainer3" type="HBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"] +layout_mode = 0 +offset_left = 26.1644 +offset_top = 11.802 +offset_right = 200.164 +offset_bottom = 86.802 +scale = Vector2(0.0544615, 0.10085) + +[node name="Label" type="Label" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer3"] +layout_mode = 2 +text = "Sound +Sam Meyer: Composer +" + +[node name="HBoxContainer4" type="HBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"] +layout_mode = 0 +offset_left = 14.3836 +offset_top = 30.7107 +offset_right = 133.384 +offset_bottom = 70.7107 +scale = Vector2(0.101568, 0.177799) + +[node name="Return Button" type="Button" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer4"] +layout_mode = 2 +text = "Return Button" +flat = true diff --git a/Scenes/UI/Options/CreditsOptionTest.tscn b/Scenes/UI/Options/CreditsOptionTest.tscn new file mode 100644 index 00000000..33824bc0 --- /dev/null +++ b/Scenes/UI/Options/CreditsOptionTest.tscn @@ -0,0 +1,127 @@ +[gd_scene load_steps=3 format=3 uid="uid://fxio0pfqwmn6"] + +[ext_resource type="Script" uid="uid://dkuui4eib1q3e" path="res://Scenes/UI/Options/Scripts/OptionsMenu.cs" id="1_bykv1"] +[ext_resource type="Script" uid="uid://cery6g5ojnl16" path="res://Scenes/UI/Options/Scripts/LanguageSelection.cs" id="2_rqxu7"] + +[node name="OptionsMenu" type="CanvasLayer" node_paths=PackedStringArray("_focused", "_volumeSlider", "_closeButton", "_controlsButton", "_creditsButton", "_highContrastToggle", "_howToPlayButton")] +process_mode = 3 +script = ExtResource("1_bykv1") +_focused = NodePath("Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/HBoxContainer/CheckBox") +_volumeSlider = NodePath("Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/Container/Volume") +_closeButton = NodePath("Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/TitleButton") +_controlsButton = NodePath("Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/ControlsButton") +_creditsButton = NodePath("Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/CreditsButton") +_highContrastToggle = NodePath("Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/HBoxContainer/CheckBox") +_howToPlayButton = NodePath("Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/HowToPlayButton") + +[node name="Control" type="Control" parent="."] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = -55.0 +grow_horizontal = 2 +grow_vertical = 2 +size_flags_horizontal = 3 +size_flags_vertical = 3 + +[node name="ColorRect" type="ColorRect" parent="Control"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0.133, 0.133, 0.133, 1) + +[node name="CenterContainer" type="CenterContainer" parent="Control"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 + +[node name="MarginContainer" type="MarginContainer" parent="Control/CenterContainer"] +layout_mode = 2 + +[node name="ColorRect" type="ColorRect" parent="Control/CenterContainer/MarginContainer"] +layout_mode = 2 +color = Color(0.24, 0.24, 0.24, 0.854902) + +[node name="MarginContainer" type="MarginContainer" parent="Control/CenterContainer/MarginContainer"] +layout_mode = 2 +theme_override_constants/margin_left = 0 +theme_override_constants/margin_top = 0 +theme_override_constants/margin_right = 0 +theme_override_constants/margin_bottom = 0 + +[node name="VBoxContainer" type="VBoxContainer" parent="Control/CenterContainer/MarginContainer/MarginContainer"] +custom_minimum_size = Vector2(240, 0) +layout_mode = 2 +size_flags_horizontal = 0 +theme_override_constants/separation = 16 +alignment = 1 + +[node name="Title" type="Label" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "TITLE_OPTIONS" +horizontal_alignment = 1 + +[node name="HSeparator" type="HSeparator" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 + +[node name="HBoxContainer" type="HBoxContainer" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +alignment = 1 + +[node name="CheckBox" type="CheckBox" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/HBoxContainer"] +layout_mode = 2 + +[node name="Label" type="Label" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/HBoxContainer"] +layout_mode = 2 +size_flags_horizontal = 8 +text = "OPTIONS_CONTRAST_LABEL" +horizontal_alignment = 1 + +[node name="Container" type="VBoxContainer" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +theme_override_constants/separation = 0 + +[node name="Label" type="Label" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/Container"] +layout_mode = 2 +text = "OPTIONS_VOLUME_LABEL" +horizontal_alignment = 1 + +[node name="Volume" type="HSlider" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/Container"] +layout_mode = 2 +tooltip_text = "OPTIONS_VOLUME_LABEL" +max_value = 1.0 +step = 0.01 +value = 1.0 + +[node name="LanguageSelection" type="OptionButton" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] +unique_name_in_owner = true +layout_mode = 2 +item_count = 2 +popup/item_0/text = "English" +popup/item_0/id = 0 +popup/item_1/text = "中文" +popup/item_1/id = 1 +script = ExtResource("2_rqxu7") + +[node name="ControlsButton" type="Button" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "TITLE_CONTROLS" + +[node name="HowToPlayButton" type="Button" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "HOW_TO_PLAY" + +[node name="TitleButton" type="Button" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "CONTROLS_RETURN_BUTTON" + +[node name="CreditsButton" type="Button" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] +layout_mode = 2 +text = "CREDITS_BUTTON" diff --git a/Scenes/UI/Options/Scripts/CreditsMenu.cs b/Scenes/UI/Options/Scripts/CreditsMenu.cs new file mode 100644 index 00000000..2e9638c5 --- /dev/null +++ b/Scenes/UI/Options/Scripts/CreditsMenu.cs @@ -0,0 +1,50 @@ +using FunkEngine; +using Godot; + +public partial class CreditsMenu : Control, IFocusableMenu +{ + public static readonly string LoadPath = "res://Scenes/UI/Options/Credits.tscn"; + + [Export] + private Button _returnButton; + + public IFocusableMenu Prev { get; set; } + + public override void _Ready() + { + _returnButton.Pressed += ReturnToPrev; + } + + 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(); + } + } +} 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..7a6a4828 100644 --- a/Scenes/UI/Options/Scripts/OptionsMenu.cs +++ b/Scenes/UI/Options/Scripts/OptionsMenu.cs @@ -3,7 +3,7 @@ public partial class OptionsMenu : CanvasLayer, IFocusableMenu { - public static readonly string LoadPath = "res://Scenes/UI/Options/OptionsMenu.tscn"; + public static readonly string LoadPath = "res://Scenes/UI/Options/CreditsOptionTest.tscn"; public IFocusableMenu Prev { get; set; } @@ -20,6 +20,9 @@ public partial class OptionsMenu : CanvasLayer, IFocusableMenu [Export] private Button _controlsButton; + [Export] + private Button _creditsButton; + [Export] private CheckBox _highContrastToggle; @@ -44,6 +47,7 @@ public override void _Ready() _closeButton.Pressed += ReturnToPrev; _controlsButton.Pressed += OpenControls; + _creditsButton.Pressed += OpenCredits; _highContrastToggle.Toggled += HighContrastChanged; _howToPlayButton.Pressed += OpenHowToPlay; } @@ -124,4 +128,12 @@ private void OpenHowToPlay() AddChild(howtoPlay); howtoPlay.OpenMenu(this); } + + private void OpenCredits() + { + CreditsMenu creditsMenu = GD.Load(CreditsMenu.LoadPath) + .Instantiate(); + AddChild(creditsMenu); + creditsMenu.OpenMenu(this); + } } From dc7fc64be4a488d7f2dfe6ea5adfc06f4b9c5604 Mon Sep 17 00:00:00 2001 From: Quinn-Hub <56490493+Quinn-Hub@users.noreply.github.com> Date: Sun, 27 Apr 2025 23:30:56 -0700 Subject: [PATCH 2/3] Update: Scrolling Credits Menu Changelog -> Added vertical scrolling and fadeout -> Reused assets to make a nice relaxing background. --- Scenes/UI/Options/Credits.tscn | 153 ++++++++++++++++-- Scenes/UI/Options/CreditsScroller.cs.uid | 1 + Scenes/UI/Options/Scripts/CreditsMenu.cs | 56 +++++++ .../UI/Options/Scripts/CreditsScroller.cs.uid | 1 + 4 files changed, 196 insertions(+), 15 deletions(-) create mode 100644 Scenes/UI/Options/CreditsScroller.cs.uid create mode 100644 Scenes/UI/Options/Scripts/CreditsScroller.cs.uid diff --git a/Scenes/UI/Options/Credits.tscn b/Scenes/UI/Options/Credits.tscn index a6cf4116..e0235949 100644 --- a/Scenes/UI/Options/Credits.tscn +++ b/Scenes/UI/Options/Credits.tscn @@ -1,31 +1,61 @@ -[gd_scene load_steps=2 format=3 uid="uid://dgjmb0wllsj41"] +[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="Texture2D" uid="uid://dbjotl0v1ymia" path="res://SharedAssets/BattleFrame1.png" id="2_72li1"] +[ext_resource type="PackedScene" uid="uid://dfevfib11kou1" path="res://Scenes/ChartViewport/ChartViewport.tscn" id="3_ch0mg"] -[node name="Control" type="Control" node_paths=PackedStringArray("_returnButton")] +[node name="Control" type="Control" node_paths=PackedStringArray("CreditsText", "_returnButton")] process_mode = 3 layout_mode = 3 anchors_preset = 0 offset_right = 40.0 offset_bottom = 40.0 script = ExtResource("1_n36fd") -_returnButton = NodePath("CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer4/Return Button") +CreditsText = NodePath("Node2D/Label") +ScrollSpeed = 24.0 +FadeStartY = -120.0 +FadeEndY = -200.0 +RestartPositionY = 400.0 +_returnButton = NodePath("Return Button") + +[node name="BattleFrame" type="TextureRect" parent="."] +visible = false +z_index = 2 +layout_mode = 0 +offset_left = -2.0 +offset_right = 1225.0 +offset_bottom = 349.0 +texture = ExtResource("2_72li1") + +[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="ColorRect" type="ColorRect" parent="."] +visible = false layout_mode = 0 -offset_right = 640.0 +offset_right = 664.8 offset_bottom = 358.0 color = Color(0.241156, 0.241156, 0.241156, 1) [node name="CenterContainer" type="CenterContainer" parent="."] +visible = false layout_mode = 0 offset_right = 40.0 offset_bottom = 40.0 [node name="MarginContainer" type="MarginContainer" parent="CenterContainer"] +visible = false layout_mode = 2 [node name="ColorRect" type="ColorRect" parent="CenterContainer/MarginContainer"] +visible = false layout_mode = 2 [node name="MarginContainer" type="MarginContainer" parent="CenterContainer/MarginContainer/ColorRect"] @@ -55,9 +85,9 @@ text = "Credits" [node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"] layout_mode = 0 offset_left = 2.32877 -offset_top = 11.6751 +offset_top = 11.0406 offset_right = 219.329 -offset_bottom = 164.675 +offset_bottom = 164.041 scale = Vector2(0.0566447, 0.0947541) [node name="Label" type="Label" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer"] @@ -72,10 +102,10 @@ horizontal_alignment = 1 [node name="HBoxContainer2" type="HBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"] layout_mode = 0 -offset_left = 18.0137 -offset_top = 12.3096 -offset_right = 99.0137 -offset_bottom = 113.31 +offset_left = 17.6027 +offset_top = 11.2944 +offset_right = 98.6027 +offset_bottom = 112.295 scale = Vector2(0.0602738, 0.102849) [node name="Label" type="Label" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer2"] @@ -88,11 +118,11 @@ horizontal_alignment = 1 [node name="HBoxContainer3" type="HBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"] layout_mode = 0 -offset_left = 26.1644 -offset_top = 11.802 -offset_right = 200.164 -offset_bottom = 86.802 -scale = Vector2(0.0544615, 0.10085) +offset_left = 26.2329 +offset_top = 10.533 +offset_right = 200.232 +offset_bottom = 85.533 +scale = Vector2(0.0572012, 0.105926) [node name="Label" type="Label" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer3"] layout_mode = 2 @@ -112,3 +142,96 @@ scale = Vector2(0.101568, 0.177799) layout_mode = 2 text = "Return Button" flat = true + +[node name="MarginContainer2" type="MarginContainer" parent="CenterContainer"] +layout_mode = 2 + +[node name="VScrollBar" type="VScrollBar" parent="CenterContainer/MarginContainer2"] +layout_mode = 2 + +[node name="RichTextLabel" type="RichTextLabel" parent="CenterContainer/MarginContainer2/VScrollBar"] +layout_mode = 2 +offset_left = 52.0 +offset_top = 13.0 +offset_right = 92.0 +offset_bottom = 53.0 +scale = Vector2(12.36, 7.2) +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" + +[node name="ScrollContainer" type="ScrollContainer" parent="CenterContainer/MarginContainer2"] +layout_mode = 2 + +[node name="ColorRect" type="ColorRect" parent="CenterContainer/MarginContainer2"] +layout_mode = 2 + +[node name="Node2D" type="Node2D" parent="."] + +[node name="RichTextLabel" type="RichTextLabel" parent="Node2D"] +visible = false +offset_right = 637.0 +offset_bottom = 356.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="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 = 321.0 +offset_right = 631.0 +offset_bottom = 355.0 +text = "Return" +flat = true +icon_alignment = 1 diff --git a/Scenes/UI/Options/CreditsScroller.cs.uid b/Scenes/UI/Options/CreditsScroller.cs.uid new file mode 100644 index 00000000..5d820df7 --- /dev/null +++ b/Scenes/UI/Options/CreditsScroller.cs.uid @@ -0,0 +1 @@ +uid://8u3fl0hlirqs diff --git a/Scenes/UI/Options/Scripts/CreditsMenu.cs b/Scenes/UI/Options/Scripts/CreditsMenu.cs index 2e9638c5..bde404b1 100644 --- a/Scenes/UI/Options/Scripts/CreditsMenu.cs +++ b/Scenes/UI/Options/Scripts/CreditsMenu.cs @@ -5,6 +5,21 @@ 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; + + [Export] + public float FadeStartY = 200f; + + [Export] + public float FadeEndY = 50f; + + [Export] + public float RestartPositionY = 800f; + [Export] private Button _returnButton; @@ -12,6 +27,10 @@ public partial class CreditsMenu : Control, IFocusableMenu public override void _Ready() { + if (CreditsText != null) + { + CreditsText.Position = new Vector2(CreditsText.Position.X, RestartPositionY); + } _returnButton.Pressed += ReturnToPrev; } @@ -47,4 +66,41 @@ public override void _Input(InputEvent @event) GetViewport().SetInputAsHandled(); } } + + public override void _Process(double delta) + { + if (CreditsText == null) + return; + + Vector2 position = CreditsText.Position; + position.Y -= (float)(ScrollSpeed * delta); + CreditsText.Position = position; + + float alpha = 1.0f; + if (CreditsText.GlobalPosition.Y < FadeStartY) + { + alpha = Mathf.Clamp( + (CreditsText.GlobalPosition.Y - FadeEndY) / (FadeStartY - FadeEndY), + 0, + 1 + ); + } + CreditsText.Modulate = new Color(1, 1, 1, alpha); + + float bottomScreenY = RestartPositionY; + float topScreenY = -780; + float t = Mathf.Clamp( + (CreditsText.GlobalPosition.Y - topScreenY) / (bottomScreenY - topScreenY), + 0, + 1 + ); + + float scaleValue = Mathf.Lerp(0.05f, 1.0f, t); + CreditsText.Scale = new Vector2(scaleValue, scaleValue); + + if (CreditsText.GlobalPosition.Y + CreditsText.Size.Y * CreditsText.Scale.Y < 0) + { + CreditsText.Position = new Vector2(CreditsText.Position.X, RestartPositionY); + } + } } diff --git a/Scenes/UI/Options/Scripts/CreditsScroller.cs.uid b/Scenes/UI/Options/Scripts/CreditsScroller.cs.uid new file mode 100644 index 00000000..e286019d --- /dev/null +++ b/Scenes/UI/Options/Scripts/CreditsScroller.cs.uid @@ -0,0 +1 @@ +uid://del0uuo6fwtfn From 7800d9eda17f00c3b8095d194c8813c4fda0b809 Mon Sep 17 00:00:00 2001 From: LifeHckr Date: Sat, 10 May 2025 21:33:00 -0700 Subject: [PATCH 3/3] Clean up credits scene and script --- README.md | 1 - Scenes/UI/Options/Credits.tscn | 193 +----------------- Scenes/UI/Options/CreditsOptionTest.tscn | 127 ------------ Scenes/UI/Options/CreditsScroller.cs.uid | 1 - Scenes/UI/Options/Scripts/CreditsMenu.cs | 37 +--- .../UI/Options/Scripts/CreditsScroller.cs.uid | 1 - Scenes/UI/Options/Scripts/OptionsMenu.cs | 6 +- 7 files changed, 21 insertions(+), 345 deletions(-) delete mode 100644 Scenes/UI/Options/CreditsOptionTest.tscn delete mode 100644 Scenes/UI/Options/CreditsScroller.cs.uid delete mode 100644 Scenes/UI/Options/Scripts/CreditsScroller.cs.uid 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 index e0235949..53deb38c 100644 --- a/Scenes/UI/Options/Credits.tscn +++ b/Scenes/UI/Options/Credits.tscn @@ -1,32 +1,23 @@ [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="Texture2D" uid="uid://dbjotl0v1ymia" path="res://SharedAssets/BattleFrame1.png" id="2_72li1"] +[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="Control" type="Control" node_paths=PackedStringArray("CreditsText", "_returnButton")] +[node name="Credits" type="Control" node_paths=PackedStringArray("CreditsText", "_returnButton")] process_mode = 3 layout_mode = 3 -anchors_preset = 0 -offset_right = 40.0 -offset_bottom = 40.0 +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 -FadeStartY = -120.0 -FadeEndY = -200.0 RestartPositionY = 400.0 _returnButton = NodePath("Return Button") -[node name="BattleFrame" type="TextureRect" parent="."] -visible = false -z_index = 2 -layout_mode = 0 -offset_left = -2.0 -offset_right = 1225.0 -offset_bottom = 349.0 -texture = ExtResource("2_72li1") - [node name="Node2D2" type="Node2D" parent="."] position = Vector2(80, -12.26) scale = Vector2(2.255, 2.01) @@ -37,172 +28,8 @@ offset_top = 5.0 offset_right = 422.851 offset_bottom = 185.0 -[node name="ColorRect" type="ColorRect" parent="."] -visible = false -layout_mode = 0 -offset_right = 664.8 -offset_bottom = 358.0 -color = Color(0.241156, 0.241156, 0.241156, 1) - -[node name="CenterContainer" type="CenterContainer" parent="."] -visible = false -layout_mode = 0 -offset_right = 40.0 -offset_bottom = 40.0 - -[node name="MarginContainer" type="MarginContainer" parent="CenterContainer"] -visible = false -layout_mode = 2 - -[node name="ColorRect" type="ColorRect" parent="CenterContainer/MarginContainer"] -visible = false -layout_mode = 2 - -[node name="MarginContainer" type="MarginContainer" parent="CenterContainer/MarginContainer/ColorRect"] -layout_mode = 0 -offset_left = 8.0 -offset_top = -1.0 -offset_right = 48.0 -offset_bottom = 39.0 -scale = Vector2(14.6, 7.88) - -[node name="ColorRect" type="ColorRect" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer"] -layout_mode = 2 -color = Color(0.306923, 0.306923, 0.306923, 1) - -[node name="VBoxContainer" type="VBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"] -layout_mode = 0 -offset_left = 15.5479 -offset_top = 2.28426 -offset_right = 70.5479 -offset_bottom = 42.2843 -scale = Vector2(0.150685, 0.248731) - -[node name="Title" type="Label" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/VBoxContainer"] -layout_mode = 2 -text = "Credits" - -[node name="HBoxContainer" type="HBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"] -layout_mode = 0 -offset_left = 2.32877 -offset_top = 11.0406 -offset_right = 219.329 -offset_bottom = 164.041 -scale = Vector2(0.0566447, 0.0947541) - -[node name="Label" type="Label" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer"] -layout_mode = 2 -text = "Programmers - Jarod Spanger: Project Lead -Connor Lowe -Raul Mojarro -Thomas Wessel -Michael Quinn" -horizontal_alignment = 1 - -[node name="HBoxContainer2" type="HBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"] -layout_mode = 0 -offset_left = 17.6027 -offset_top = 11.2944 -offset_right = 98.6027 -offset_bottom = 112.295 -scale = Vector2(0.0602738, 0.102849) - -[node name="Label" type="Label" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer2"] -layout_mode = 2 -text = "Artists -Ares Atlas -Evelyn Fu -Emily Wen" -horizontal_alignment = 1 - -[node name="HBoxContainer3" type="HBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"] -layout_mode = 0 -offset_left = 26.2329 -offset_top = 10.533 -offset_right = 200.232 -offset_bottom = 85.533 -scale = Vector2(0.0572012, 0.105926) - -[node name="Label" type="Label" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer3"] -layout_mode = 2 -text = "Sound -Sam Meyer: Composer -" - -[node name="HBoxContainer4" type="HBoxContainer" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect"] -layout_mode = 0 -offset_left = 14.3836 -offset_top = 30.7107 -offset_right = 133.384 -offset_bottom = 70.7107 -scale = Vector2(0.101568, 0.177799) - -[node name="Return Button" type="Button" parent="CenterContainer/MarginContainer/ColorRect/MarginContainer/ColorRect/HBoxContainer4"] -layout_mode = 2 -text = "Return Button" -flat = true - -[node name="MarginContainer2" type="MarginContainer" parent="CenterContainer"] -layout_mode = 2 - -[node name="VScrollBar" type="VScrollBar" parent="CenterContainer/MarginContainer2"] -layout_mode = 2 - -[node name="RichTextLabel" type="RichTextLabel" parent="CenterContainer/MarginContainer2/VScrollBar"] -layout_mode = 2 -offset_left = 52.0 -offset_top = 13.0 -offset_right = 92.0 -offset_bottom = 53.0 -scale = Vector2(12.36, 7.2) -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" - -[node name="ScrollContainer" type="ScrollContainer" parent="CenterContainer/MarginContainer2"] -layout_mode = 2 - -[node name="ColorRect" type="ColorRect" parent="CenterContainer/MarginContainer2"] -layout_mode = 2 - [node name="Node2D" type="Node2D" parent="."] -[node name="RichTextLabel" type="RichTextLabel" parent="Node2D"] -visible = false -offset_right = 637.0 -offset_bottom = 356.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="Label" type="Label" parent="Node2D"] offset_left = 217.0 offset_top = -3.0 @@ -229,9 +56,9 @@ horizontal_alignment = 1 [node name="Return Button" type="Button" parent="."] layout_mode = 2 offset_left = 570.0 -offset_top = 321.0 +offset_top = 314.0 offset_right = 631.0 -offset_bottom = 355.0 +offset_bottom = 351.0 +theme = ExtResource("3_agb8c") text = "Return" -flat = true icon_alignment = 1 diff --git a/Scenes/UI/Options/CreditsOptionTest.tscn b/Scenes/UI/Options/CreditsOptionTest.tscn deleted file mode 100644 index 33824bc0..00000000 --- a/Scenes/UI/Options/CreditsOptionTest.tscn +++ /dev/null @@ -1,127 +0,0 @@ -[gd_scene load_steps=3 format=3 uid="uid://fxio0pfqwmn6"] - -[ext_resource type="Script" uid="uid://dkuui4eib1q3e" path="res://Scenes/UI/Options/Scripts/OptionsMenu.cs" id="1_bykv1"] -[ext_resource type="Script" uid="uid://cery6g5ojnl16" path="res://Scenes/UI/Options/Scripts/LanguageSelection.cs" id="2_rqxu7"] - -[node name="OptionsMenu" type="CanvasLayer" node_paths=PackedStringArray("_focused", "_volumeSlider", "_closeButton", "_controlsButton", "_creditsButton", "_highContrastToggle", "_howToPlayButton")] -process_mode = 3 -script = ExtResource("1_bykv1") -_focused = NodePath("Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/HBoxContainer/CheckBox") -_volumeSlider = NodePath("Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/Container/Volume") -_closeButton = NodePath("Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/TitleButton") -_controlsButton = NodePath("Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/ControlsButton") -_creditsButton = NodePath("Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/CreditsButton") -_highContrastToggle = NodePath("Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/HBoxContainer/CheckBox") -_howToPlayButton = NodePath("Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/HowToPlayButton") - -[node name="Control" type="Control" parent="."] -layout_mode = 3 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -offset_top = -55.0 -grow_horizontal = 2 -grow_vertical = 2 -size_flags_horizontal = 3 -size_flags_vertical = 3 - -[node name="ColorRect" type="ColorRect" parent="Control"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 -color = Color(0.133, 0.133, 0.133, 1) - -[node name="CenterContainer" type="CenterContainer" parent="Control"] -layout_mode = 1 -anchors_preset = 15 -anchor_right = 1.0 -anchor_bottom = 1.0 -grow_horizontal = 2 -grow_vertical = 2 - -[node name="MarginContainer" type="MarginContainer" parent="Control/CenterContainer"] -layout_mode = 2 - -[node name="ColorRect" type="ColorRect" parent="Control/CenterContainer/MarginContainer"] -layout_mode = 2 -color = Color(0.24, 0.24, 0.24, 0.854902) - -[node name="MarginContainer" type="MarginContainer" parent="Control/CenterContainer/MarginContainer"] -layout_mode = 2 -theme_override_constants/margin_left = 0 -theme_override_constants/margin_top = 0 -theme_override_constants/margin_right = 0 -theme_override_constants/margin_bottom = 0 - -[node name="VBoxContainer" type="VBoxContainer" parent="Control/CenterContainer/MarginContainer/MarginContainer"] -custom_minimum_size = Vector2(240, 0) -layout_mode = 2 -size_flags_horizontal = 0 -theme_override_constants/separation = 16 -alignment = 1 - -[node name="Title" type="Label" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] -layout_mode = 2 -text = "TITLE_OPTIONS" -horizontal_alignment = 1 - -[node name="HSeparator" type="HSeparator" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] -layout_mode = 2 - -[node name="HBoxContainer" type="HBoxContainer" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] -layout_mode = 2 -alignment = 1 - -[node name="CheckBox" type="CheckBox" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/HBoxContainer"] -layout_mode = 2 - -[node name="Label" type="Label" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/HBoxContainer"] -layout_mode = 2 -size_flags_horizontal = 8 -text = "OPTIONS_CONTRAST_LABEL" -horizontal_alignment = 1 - -[node name="Container" type="VBoxContainer" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] -layout_mode = 2 -theme_override_constants/separation = 0 - -[node name="Label" type="Label" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/Container"] -layout_mode = 2 -text = "OPTIONS_VOLUME_LABEL" -horizontal_alignment = 1 - -[node name="Volume" type="HSlider" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer/Container"] -layout_mode = 2 -tooltip_text = "OPTIONS_VOLUME_LABEL" -max_value = 1.0 -step = 0.01 -value = 1.0 - -[node name="LanguageSelection" type="OptionButton" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] -unique_name_in_owner = true -layout_mode = 2 -item_count = 2 -popup/item_0/text = "English" -popup/item_0/id = 0 -popup/item_1/text = "中文" -popup/item_1/id = 1 -script = ExtResource("2_rqxu7") - -[node name="ControlsButton" type="Button" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] -layout_mode = 2 -text = "TITLE_CONTROLS" - -[node name="HowToPlayButton" type="Button" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] -layout_mode = 2 -text = "HOW_TO_PLAY" - -[node name="TitleButton" type="Button" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] -layout_mode = 2 -text = "CONTROLS_RETURN_BUTTON" - -[node name="CreditsButton" type="Button" parent="Control/CenterContainer/MarginContainer/MarginContainer/VBoxContainer"] -layout_mode = 2 -text = "CREDITS_BUTTON" diff --git a/Scenes/UI/Options/CreditsScroller.cs.uid b/Scenes/UI/Options/CreditsScroller.cs.uid deleted file mode 100644 index 5d820df7..00000000 --- a/Scenes/UI/Options/CreditsScroller.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://8u3fl0hlirqs diff --git a/Scenes/UI/Options/Scripts/CreditsMenu.cs b/Scenes/UI/Options/Scripts/CreditsMenu.cs index bde404b1..a634515d 100644 --- a/Scenes/UI/Options/Scripts/CreditsMenu.cs +++ b/Scenes/UI/Options/Scripts/CreditsMenu.cs @@ -1,3 +1,4 @@ +using System; using FunkEngine; using Godot; @@ -11,11 +12,8 @@ public partial class CreditsMenu : Control, IFocusableMenu [Export] public float ScrollSpeed = 50f; - [Export] - public float FadeStartY = 200f; - - [Export] - public float FadeEndY = 50f; + public float FadeStartY = 0; + public float FadeEndY = -400f; [Export] public float RestartPositionY = 800f; @@ -30,8 +28,10 @@ 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() @@ -72,33 +72,16 @@ public override void _Process(double delta) if (CreditsText == null) return; - Vector2 position = CreditsText.Position; - position.Y -= (float)(ScrollSpeed * delta); - CreditsText.Position = position; - - float alpha = 1.0f; - if (CreditsText.GlobalPosition.Y < FadeStartY) - { - alpha = Mathf.Clamp( - (CreditsText.GlobalPosition.Y - FadeEndY) / (FadeStartY - FadeEndY), - 0, - 1 - ); - } - CreditsText.Modulate = new Color(1, 1, 1, alpha); + CreditsText.Position += Vector2.Up * (float)(ScrollSpeed * delta); - float bottomScreenY = RestartPositionY; - float topScreenY = -780; - float t = Mathf.Clamp( - (CreditsText.GlobalPosition.Y - topScreenY) / (bottomScreenY - topScreenY), + float alpha = Mathf.Clamp( + 1 - (CreditsText.GlobalPosition.Y - FadeStartY) / (FadeEndY - FadeStartY), 0, 1 ); + CreditsText.Modulate = new Color(1, 1, 1, alpha); - float scaleValue = Mathf.Lerp(0.05f, 1.0f, t); - CreditsText.Scale = new Vector2(scaleValue, scaleValue); - - if (CreditsText.GlobalPosition.Y + CreditsText.Size.Y * CreditsText.Scale.Y < 0) + if (CreditsText.GlobalPosition.Y < -CreditsText.Size.Y) { CreditsText.Position = new Vector2(CreditsText.Position.X, RestartPositionY); } diff --git a/Scenes/UI/Options/Scripts/CreditsScroller.cs.uid b/Scenes/UI/Options/Scripts/CreditsScroller.cs.uid deleted file mode 100644 index e286019d..00000000 --- a/Scenes/UI/Options/Scripts/CreditsScroller.cs.uid +++ /dev/null @@ -1 +0,0 @@ -uid://del0uuo6fwtfn diff --git a/Scenes/UI/Options/Scripts/OptionsMenu.cs b/Scenes/UI/Options/Scripts/OptionsMenu.cs index 7a6a4828..614d777e 100644 --- a/Scenes/UI/Options/Scripts/OptionsMenu.cs +++ b/Scenes/UI/Options/Scripts/OptionsMenu.cs @@ -3,7 +3,7 @@ public partial class OptionsMenu : CanvasLayer, IFocusableMenu { - public static readonly string LoadPath = "res://Scenes/UI/Options/CreditsOptionTest.tscn"; + public static readonly string LoadPath = "res://Scenes/UI/Options/OptionsMenu.tscn"; public IFocusableMenu Prev { get; set; } @@ -20,9 +20,6 @@ public partial class OptionsMenu : CanvasLayer, IFocusableMenu [Export] private Button _controlsButton; - [Export] - private Button _creditsButton; - [Export] private CheckBox _highContrastToggle; @@ -47,7 +44,6 @@ public override void _Ready() _closeButton.Pressed += ReturnToPrev; _controlsButton.Pressed += OpenControls; - _creditsButton.Pressed += OpenCredits; _highContrastToggle.Toggled += HighContrastChanged; _howToPlayButton.Pressed += OpenHowToPlay; }