build animation on run
This commit is contained in:
@@ -12,6 +12,8 @@ public partial class RunMenuItem : HBoxContainer
|
||||
private Button _runButton = null!;
|
||||
private Button _debugButton = null!;
|
||||
private Button _stopButton = null!;
|
||||
private Control _animatedTextureParentControl = null!;
|
||||
private AnimationPlayer _buildAnimationPlayer = null!;
|
||||
|
||||
[Inject] private readonly RunService _runService = null!;
|
||||
public override void _Ready()
|
||||
@@ -24,6 +26,8 @@ public partial class RunMenuItem : HBoxContainer
|
||||
_stopButton.Pressed += OnStopButtonPressed;
|
||||
_debugButton = GetNode<Button>("DebugButton");
|
||||
_debugButton.Pressed += OnDebugButtonPressed;
|
||||
_animatedTextureParentControl = GetNode<Control>("%AnimatedTextureParentControl");
|
||||
_buildAnimationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
|
||||
Project.ProjectStartedRunning.Subscribe(OnProjectStartedRunning);
|
||||
Project.ProjectStoppedRunning.Subscribe(OnProjectStoppedRunning);
|
||||
}
|
||||
@@ -45,6 +49,8 @@ public partial class RunMenuItem : HBoxContainer
|
||||
_runButton.Visible = false;
|
||||
_debugButton.Visible = false;
|
||||
_stopButton.Visible = true;
|
||||
_animatedTextureParentControl.Visible = false;
|
||||
_buildAnimationPlayer.Stop();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -53,8 +59,13 @@ public partial class RunMenuItem : HBoxContainer
|
||||
await _runService.CancelRunningProject(Project);
|
||||
}
|
||||
|
||||
private StringName _buildAnimationName = "BuildingAnimation";
|
||||
private async void OnRunButtonPressed()
|
||||
{
|
||||
_runButton.Visible = false;
|
||||
_debugButton.Visible = false;
|
||||
_animatedTextureParentControl.Visible = true;
|
||||
_buildAnimationPlayer.Play(_buildAnimationName);
|
||||
await _runService.RunProject(Project).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user