diff --git a/godot/UI/TAS UI/AdvanceButton.cs b/godot/UI/TAS UI/AdvanceButton.cs index 6a365ca..3a75e45 100644 --- a/godot/UI/TAS UI/AdvanceButton.cs +++ b/godot/UI/TAS UI/AdvanceButton.cs @@ -10,10 +10,19 @@ public partial class AdvanceButton : Button public override void _Ready() { TAS = GetNode("/root/TAS_System"); - this.Pressed += () => { TAS.Advance(1); }; + + AudioStreamPlayer buttonSound = this.GetNode("../../ButtonSound"); + + bool playSound = true; + + this.Pressed += () => { + TAS.Advance(1); + if (playSound) buttonSound.Play(); + playSound = false; + }; this.ButtonDown += () => { this.isButtonPressed = true; }; - this.ButtonUp += () => { this.isButtonPressed = false; TAS.ResetSpeedup(); }; + this.ButtonUp += () => { this.isButtonPressed = false; TAS.ResetSpeedup(); playSound = true; }; } // Called every frame. 'delta' is the elapsed time since the previous frame. diff --git a/godot/UI/TAS UI/RegressButton.cs b/godot/UI/TAS UI/RegressButton.cs index 908a591..883e2dd 100644 --- a/godot/UI/TAS UI/RegressButton.cs +++ b/godot/UI/TAS UI/RegressButton.cs @@ -10,12 +10,18 @@ public partial class RegressButton : Button public override void _Ready() { TAS = GetNode("/root/TAS_System"); + AudioStreamPlayer buttonSound = this.GetNode("../../ButtonSound"); + + bool playSound = true; + this.Pressed += () => { TAS.Regress(1); + if (playSound) buttonSound.Play(); + playSound = false; }; this.ButtonDown += () => { this.isButtonPressed = true; TAS.StopIncrementingFrames(); }; - this.ButtonUp += () => { this.isButtonPressed = false; TAS.ResetSpeedup(); }; + this.ButtonUp += () => { this.isButtonPressed = false; TAS.ResetSpeedup(); playSound = true; }; } public virtual void OnFrameIncremented(int newFrame) diff --git a/godot/UI/TAS UI/TAS UI.tscn b/godot/UI/TAS UI/TAS UI.tscn index 51d0091..2233202 100644 --- a/godot/UI/TAS UI/TAS UI.tscn +++ b/godot/UI/TAS UI/TAS UI.tscn @@ -1,10 +1,12 @@ -[gd_scene load_steps=9 format=3 uid="uid://b1uf31ed6h0ir"] +[gd_scene load_steps=11 format=3 uid="uid://b1uf31ed6h0ir"] [ext_resource type="Script" path="res://UI/TAS UI/CurrentFrameLabel.cs" id="1_27u4w"] [ext_resource type="Script" path="res://UI/TAS UI/TAS UI.gd" id="1_ytl0x"] [ext_resource type="Script" path="res://UI/TAS UI/RegressButton.cs" id="2_fhmsa"] +[ext_resource type="AudioStream" uid="uid://cio6yfcnyf2lx" path="res://audio/note.wav" id="2_nsxig"] [ext_resource type="Script" path="res://UI/TAS UI/Label2.gd" id="2_otida"] [ext_resource type="Script" path="res://UI/TAS UI/AdvanceButton.cs" id="3_0ti6q"] +[ext_resource type="Script" path="res://UI/TAS UI/UIAudioPlayer.cs" id="3_251uv"] [ext_resource type="Script" path="res://UI/TAS UI/StopIncrementButton.cs" id="4_4gd4c"] [ext_resource type="Script" path="res://UI/TAS UI/StartIncrementButton.cs" id="5_5af83"] [ext_resource type="Script" path="res://UI/TAS UI/ResetFramesButton.cs" id="6_nwwkv"] @@ -19,6 +21,10 @@ grow_vertical = 2 mouse_filter = 2 script = ExtResource("1_ytl0x") +[node name="ButtonSound" type="AudioStreamPlayer" parent="."] +stream = ExtResource("2_nsxig") +script = ExtResource("3_251uv") + [node name="DEBUG" type="Control" parent="."] visible = false layout_mode = 1 diff --git a/godot/UI/TAS UI/UIAudioPlayer.cs b/godot/UI/TAS UI/UIAudioPlayer.cs new file mode 100644 index 0000000..7c26bc2 --- /dev/null +++ b/godot/UI/TAS UI/UIAudioPlayer.cs @@ -0,0 +1,15 @@ +using Godot; +using System; + +public partial class UIAudioPlayer : AudioStreamPlayer +{ + // Called when the node enters the scene tree for the first time. + public override void _Ready() + { + } + + // Called every frame. 'delta' is the elapsed time since the previous frame. + public override void _Process(double delta) + { + } +} diff --git a/godot/audio/note.wav b/godot/audio/note.wav new file mode 100644 index 0000000..c9a51cb Binary files /dev/null and b/godot/audio/note.wav differ diff --git a/godot/audio/note.wav.import b/godot/audio/note.wav.import new file mode 100644 index 0000000..f7cefad --- /dev/null +++ b/godot/audio/note.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cio6yfcnyf2lx" +path="res://.godot/imported/note.wav-f74766d8f2fafbaa9729bf4b58d8f300.sample" + +[deps] + +source_file="res://audio/note.wav" +dest_files=["res://.godot/imported/note.wav-f74766d8f2fafbaa9729bf4b58d8f300.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/godot/tests/TAS_system/TAS_test_003.tscn b/godot/tests/TAS_system/TAS_test_003.tscn index 6f61e73..bf65058 100644 --- a/godot/tests/TAS_system/TAS_test_003.tscn +++ b/godot/tests/TAS_system/TAS_test_003.tscn @@ -28,7 +28,6 @@ camera = NodePath("Camera3D") initial_target = NodePath("../grape") [node name="Camera3D" type="Camera3D" parent="controller" index="1"] -current = true [node name="billiard" parent="." index="4" instance=ExtResource("3_kg8e8")] @@ -50,5 +49,4 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0205169, 0.381115, -0.02601 transform = Transform3D(0.358936, -0.000516907, -0.141382, 0.000873357, 0.385775, 0.00080681, 0.14138, -0.00107074, 0.358935, -1.91181, 1.97725, -0.189681) [node name="Domino" parent="." index="11" instance=ExtResource("8_2krw6")] -transform = Transform3D(0.999994, -0.00349065, 0, -1.52581e-10, -4.37111e-08, 1, -0.00349065, -0.999994, -4.37114e-08, 0.087864, 0.212463, -1.74624) -continuous_cd = false +transform = Transform3D(0.999994, -0.00349065, 0, -1.52581e-10, -4.37111e-08, 1, -0.00349065, -0.999994, -4.37114e-08, 0.087864, 1.44443, -0.526911)