mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-13 11:44:54 +00:00
Various tech page framework items
This commit is contained in:
@@ -81,21 +81,25 @@ namespace PepperDash.Essentials.Core
|
||||
public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction, Action releaseAction)
|
||||
{
|
||||
CTimer heldTimer = null;
|
||||
bool wasHeld = false;
|
||||
return tl.SetBoolSigAction(sigNum, press =>
|
||||
{
|
||||
if (press)
|
||||
{
|
||||
|
||||
wasHeld = false;
|
||||
// Could insert a pressed action here
|
||||
heldTimer = new CTimer(o =>
|
||||
{
|
||||
// if still held and there's an action
|
||||
if (tl.BooleanOutput[sigNum].BoolValue && heldAction != null)
|
||||
{
|
||||
wasHeld = true;
|
||||
// Hold action here
|
||||
heldAction();
|
||||
}
|
||||
}, heldMs);
|
||||
}
|
||||
else if (heldTimer != null) // released
|
||||
else if(!wasHeld) // released
|
||||
{
|
||||
heldTimer.Stop();
|
||||
if (releaseAction != null)
|
||||
|
||||
Reference in New Issue
Block a user