From 33333714e2b3dad71d37ea74e6fa863f7466076a Mon Sep 17 00:00:00 2001 From: alex-kumpula Date: Sat, 11 Nov 2023 21:23:21 -0700 Subject: [PATCH] Can hold down Advance and Regress now --- godot/UI/TAS UI/AdvanceButton.cs | 13 ++++++++++--- godot/UI/TAS UI/RegressButton.cs | 10 ++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/godot/UI/TAS UI/AdvanceButton.cs b/godot/UI/TAS UI/AdvanceButton.cs index 962bd11..5024ba4 100644 --- a/godot/UI/TAS UI/AdvanceButton.cs +++ b/godot/UI/TAS UI/AdvanceButton.cs @@ -4,12 +4,16 @@ using System; public partial class AdvanceButton : Button { TAS_System TAS; + bool isButtonPressed = false; + // Called when the node enters the scene tree for the first time. public override void _Ready() { TAS = GetNode("/root/TAS_System"); this.Pressed += () => { TAS.Advance(1); }; + this.ButtonDown += () => { this.isButtonPressed = true; }; + this.ButtonUp += () => { this.isButtonPressed = false; }; } // Called every frame. 'delta' is the elapsed time since the previous frame. @@ -18,14 +22,17 @@ public partial class AdvanceButton : Button if (TAS.AdvancedFramesRemaining == 0) { this.Disabled = true; + this.isButtonPressed = false; } else { this.Disabled = false; + + if (this.isButtonPressed) + { + TAS.Advance(1); + } } } - - - } diff --git a/godot/UI/TAS UI/RegressButton.cs b/godot/UI/TAS UI/RegressButton.cs index e78f966..4336d54 100644 --- a/godot/UI/TAS UI/RegressButton.cs +++ b/godot/UI/TAS UI/RegressButton.cs @@ -4,12 +4,16 @@ using System; public partial class RegressButton : Button { TAS_System TAS; + bool isButtonPressed = false; // Called when the node enters the scene tree for the first time. public override void _Ready() { TAS = GetNode("/root/TAS_System"); this.Pressed += () => { TAS.Regress(1); }; + + this.ButtonDown += () => { this.isButtonPressed = true; }; + this.ButtonUp += () => { this.isButtonPressed = false; }; } public virtual void OnFrameIncremented(int newFrame) @@ -23,10 +27,16 @@ public partial class RegressButton : Button if (TAS.CurrentFrame == 0) { this.Disabled = true; + this.isButtonPressed = false; } else { this.Disabled = false; + + if (this.isButtonPressed) + { + TAS.Regress(1); + } } } }