rabidus-test/Assets/Plugins/QFSW/Quantum Console/Source/Scripts/Actions/GetContext.cs

28 lines
736 B
C#
Raw Normal View History

2023-08-22 15:41:12 +03:00
using System;
namespace QFSW.QC.Actions
{
/// <summary>
/// Gets the <c>ActionContext</c> that the command is currently being invoked on.
/// </summary>
public class GetContext : ICommandAction
{
private readonly Action<ActionContext> _onContext;
public bool IsFinished => true;
public bool StartsIdle => false;
/// <param name="onContext">Action to invoke when the context is retrieved.</param>
public GetContext(Action<ActionContext> onContext)
{
_onContext = onContext;
}
public void Start(ActionContext context) { }
public void Finalize(ActionContext context)
{
_onContext(context);
}
}
}