WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview 
MaxDurationEffect.cs
Go to the documentation of this file.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Xml.Serialization;
6 using DirectOutput.Table;
7 
8 namespace DirectOutput.FX.TimmedFX
9 {
14  {
15  private RetriggerBehaviourEnum _RetriggerBehaviour = RetriggerBehaviourEnum.Restart;
16 
25  public RetriggerBehaviourEnum RetriggerBehaviour
26  {
27  get { return _RetriggerBehaviour; }
28  set { _RetriggerBehaviour = value; }
29  }
30 
31  private int _DurationMs = 500;
32 
39  public int MaxDurationMs
40  {
41  get { return _DurationMs; }
42  set { _DurationMs = value.Limit(1,int.MaxValue); }
43  }
44 
45 
46 
53  [XmlIgnoreAttribute]
54  public bool Active { get; private set; }
55 
56  private TableElementData UntriggerData;
57  private DateTime DurationStart = DateTime.MinValue;
58 
59 
64  public override void Trigger(Table.TableElementData TableElementData)
65  {
66  if (TableElementData.Value != 0)
67  {
68 
69  if (!Active || RetriggerBehaviour == RetriggerBehaviourEnum.Restart)
70  {
71  TriggerTargetEffect(TableElementData);
72  UntriggerData=TableElementData;
73  UntriggerData.Value = 0;
74  Table.Pinball.Alarms.RegisterAlarm(MaxDurationMs, DurationEnd);
75  Active = true;
76  }
77 
78  }
79  else
80  {
81  if (Active && UntriggerData.TableElementType == TableElementData.TableElementType && UntriggerData.Number == TableElementData.Number)
82  {
83  TriggerTargetEffect(TableElementData);
84  Table.Pinball.Alarms.UnregisterAlarm(DurationEnd);
85  Active = false;
86  }
87 
88  }
89 
90  }
91 
92 
93  private void DurationEnd()
94  {
95  TriggerTargetEffect(UntriggerData);
96  Active = false;
97 
98  }
99  }
100 }
Pinball Pinball
Gets the pinball object to which the Table object belongs.
Definition: Table.cs:36
TableElementTypeEnum TableElementType
The type of the table element.
override void Trigger(Table.TableElementData TableElementData)
Triggers the effect with the given TableElementData.
int Number
The number of the table element.
Limits the max duration of the effect to the specified number of milliseconds.
int Value
The value of the table element.
AlarmHandler Alarms
Gets the AlarmHandler object for the Pinball object.
Definition: Pinball.cs:71
RetriggerBehaviourEnum
This enum describes the different retrigger behaviours for the effects. Retriggering means that a ef...
Data representing the state of a table emlement
Base class for effects targeting another effect.
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