WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview 
ExtendDurationEffect.cs
Go to the documentation of this file.
1 using System;
2 using DirectOutput.Table;
3 
4 namespace DirectOutput.FX.TimmedFX
5 {
12  {
13  private int _DurationMs = 500;
14 
21  public int DurationMs
22  {
23  get { return _DurationMs; }
24  set { _DurationMs = value.Limit(0, int.MaxValue); }
25  }
26 
27 
28 
36  public override void Trigger(Table.TableElementData TableElementData)
37  {
38  if (TargetEffect != null)
39  {
40  if (TableElementData.Value != 0)
41  {
42  TriggerTargetEffect(TableElementData);
43  }
44  else
45  {
46  if (DurationMs > 0)
47  {
48  Table.Pinball.Alarms.RegisterAlarm(DurationMs, ExtendedDurationEnd, TableElementData, true);
49  }
50  else
51  {
52  TriggerTargetEffect(TableElementData);
53  }
54  }
55 
56  }
57  }
58 
59 
60  private void ExtendedDurationEnd(object Data)
61  {
62  TriggerTargetEffect((TableElementData)Data);
63  }
64 
65 
70  public override void Init(Table.Table Table)
71  {
72  base.Init(Table);
73  }
74 
79  public override void Finish()
80  {
81  try
82  {
83  Table.Pinball.Alarms.UnregisterAlarm(ExtendedDurationEnd);
84  }
85  catch { }
86  base.Finish();
87  }
88 
89  }
90 }
Pinball Pinball
Gets the pinball object to which the Table object belongs.
Definition: Table.cs:36
int Value
The value of the table element.
The extend duration effect triggers another effect for a duration which is extebnded by the number of...
AlarmHandler Alarms
Gets the AlarmHandler object for the Pinball object.
Definition: Pinball.cs:71
Data representing the state of a table emlement
override void Trigger(Table.TableElementData TableElementData)
Triggers the effect with the given TableElementData. Trigger calls of a TableElemenData value which ...
override void Finish()
Finishes the ExtendDurationEffect. Clears all pending/delayed calls.
Base class for effects targeting another effect.
override void Init(Table.Table Table)
Inititializes the ExtendDurationEffect.
The Table namespace contains all table specific classes like the Table class itself, TableElement and effect assigment classes.
Definition: Table.cs:14
Holds all table specific information and handles all TableElements
Definition: Table.cs:20
Table()
Initializes a new instance of the Table class.
Definition: Table.cs:388