Can hold down Advance and Regress now
This commit is contained in:
parent
eb668bfd63
commit
33333714e2
|
@ -4,12 +4,16 @@ using System;
|
||||||
public partial class AdvanceButton : Button
|
public partial class AdvanceButton : Button
|
||||||
{
|
{
|
||||||
TAS_System TAS;
|
TAS_System TAS;
|
||||||
|
bool isButtonPressed = false;
|
||||||
|
|
||||||
// Called when the node enters the scene tree for the first time.
|
// Called when the node enters the scene tree for the first time.
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
TAS = GetNode<TAS_System>("/root/TAS_System");
|
TAS = GetNode<TAS_System>("/root/TAS_System");
|
||||||
this.Pressed += () => { TAS.Advance(1); };
|
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.
|
// 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)
|
if (TAS.AdvancedFramesRemaining == 0)
|
||||||
{
|
{
|
||||||
this.Disabled = true;
|
this.Disabled = true;
|
||||||
|
this.isButtonPressed = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.Disabled = false;
|
this.Disabled = false;
|
||||||
|
|
||||||
|
if (this.isButtonPressed)
|
||||||
|
{
|
||||||
|
TAS.Advance(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,12 +4,16 @@ using System;
|
||||||
public partial class RegressButton : Button
|
public partial class RegressButton : Button
|
||||||
{
|
{
|
||||||
TAS_System TAS;
|
TAS_System TAS;
|
||||||
|
bool isButtonPressed = false;
|
||||||
|
|
||||||
// Called when the node enters the scene tree for the first time.
|
// Called when the node enters the scene tree for the first time.
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
TAS = GetNode<TAS_System>("/root/TAS_System");
|
TAS = GetNode<TAS_System>("/root/TAS_System");
|
||||||
this.Pressed += () => { TAS.Regress(1); };
|
this.Pressed += () => { TAS.Regress(1); };
|
||||||
|
|
||||||
|
this.ButtonDown += () => { this.isButtonPressed = true; };
|
||||||
|
this.ButtonUp += () => { this.isButtonPressed = false; };
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void OnFrameIncremented(int newFrame)
|
public virtual void OnFrameIncremented(int newFrame)
|
||||||
|
@ -23,10 +27,16 @@ public partial class RegressButton : Button
|
||||||
if (TAS.CurrentFrame == 0)
|
if (TAS.CurrentFrame == 0)
|
||||||
{
|
{
|
||||||
this.Disabled = true;
|
this.Disabled = true;
|
||||||
|
this.isButtonPressed = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.Disabled = false;
|
this.Disabled = false;
|
||||||
|
|
||||||
|
if (this.isButtonPressed)
|
||||||
|
{
|
||||||
|
TAS.Regress(1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue