Made the Advance Button disable when it should
This commit is contained in:
parent
27a98286ef
commit
84aa101636
|
@ -33,6 +33,11 @@ public partial class TAS_System : Node
|
||||||
private set { this._currentFrame = value; }
|
private set { this._currentFrame = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int AdvancedFramesRemaining
|
||||||
|
{
|
||||||
|
get { return this.LastAdvancedFrame - this.CurrentFrame; }
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The last frame that can be advanced to. This will
|
/// The last frame that can be advanced to. This will
|
||||||
/// only be greater than CurrentFrame after the player
|
/// only be greater than CurrentFrame after the player
|
||||||
|
|
|
@ -3,15 +3,25 @@ using System;
|
||||||
|
|
||||||
public partial class AdvanceButton : Button
|
public partial class AdvanceButton : Button
|
||||||
{
|
{
|
||||||
|
TAS_System TAS;
|
||||||
// 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_System TAS = GetNode<TAS_System>("/root/TAS_System");
|
TAS = GetNode<TAS_System>("/root/TAS_System");
|
||||||
this.Pressed += () => { TAS.Advance(1); };
|
this.Pressed += () => { TAS.Advance(1); };
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
public override void _Process(double delta)
|
public override void _Process(double delta)
|
||||||
{
|
{
|
||||||
|
if (TAS.AdvancedFramesRemaining == 0)
|
||||||
|
{
|
||||||
|
this.Disabled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this.Disabled = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,7 @@ anchor_left = 0.5
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
anchor_bottom = 1.0
|
anchor_bottom = 1.0
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
disabled = true
|
||||||
text = "Advance"
|
text = "Advance"
|
||||||
script = ExtResource("3_0ti6q")
|
script = ExtResource("3_0ti6q")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue