/// <summary> /// Triggers the effect.<br/> /// If the TargetEffect throws a exception, it will be deactivated. /// </summary> /// <param name="TableElementData">The TableElementData object for the TableElement which has triggered the effect.</param> public override void Trigger(TableElementData TableElementData) { if (TargetEffect != null) { Table.Pinball.Alarms.RegisterAlarm(DelayMs, TriggerTargetEffect, TableElementData, true); } }
/// <summary> /// Method to update the state and/or add a entry to the list /// </summary> /// <param name="Data">Table elemtn data for the update.</param> public void UpdateState(TableElementData Data) { if (Data.TableElementType != TableElementTypeEnum.NamedElement) { if (Contains(Data.TableElementType, Data.Number)) { _NumberedTableElementsDictionary[Data.TableElementType][Data.Number].Value = Data.Value; } else { Add(Data.TableElementType, Data.Number, Data.Value); } } else { //Update named element if (Contains(Data.Name)) { _NamedTableElementsDictionary[Data.Name.ToUpperInvariant()].Value = Data.Value; } else { Add(Data.Name.ToUpperInvariant(), Data.Value); } } }
/// <summary> /// Updates the TableElements list with data received from Pinmame. /// </summary> /// <param name="Data">Data received from Pinmame and handled by the PinMameInputManger</param> public void UpdateTableElement(TableElementData Data) { TableElements.UpdateState(Data); }
/// <summary> /// Updates the TableElements list with data received from Pinmame. /// </summary> /// <param name="Data">Data received from Pinmame and handled by the PinMameInputManger</param> public void UpdateTableElement(TableElementData Data) { TableElements.UpdateState(Data.TableElementType, Data.Number, Data.Value); }
/// <summary> /// Receives the table element data from the calling app.<br /> /// The received data is put in a queue and the internal thread of the framework is notified about the availability of new data. /// </summary> /// <param name="TableElementData">The table element data to be received.</param> public void ReceiveData(TableElementData TableElementData) { InputQueue.Enqueue(TableElementData); MainThreadSignal(); ThreadInfoList.HeartBeat("Data delivery"); }
/// <summary> /// Updates the table element statistics. /// </summary> /// <param name="TableElementData">The table element data.</param> /// <param name="Duration">The duration.</param> public void UpdateTableElementStatistics(TableElementData TableElementData, TimeSpan Duration) { try { TableElementCallStatistics[TableElementData.TableElementType].AddDuration(Duration); } catch (Exception E) { Log.Exception("Could not update TimeSpanStatistics for Pinball table element type {0} ({1})".Build(TableElementData.ToString(), TableElementData), E); } }
/// <summary> /// Triggers the effect with the given TableElementData.<br></br> /// \warning Remember that the TableElementData parameter will contain null if a effect is called as a static effect. Make sure your implementation of this method does not fail resp. throw exceptions when called with null. /// </summary> /// <param name="TableElementData">TableElementData for the TableElement which has triggered the effect.</param> public abstract void Trigger(TableElementData TableElementData);
/// <summary> /// Triggers the assigned Effect. /// <remarks> If the assigned effect throws a exception the effect will be deactivated.</remarks> /// </summary> /// <param name="TableElementData">The table element data.</param> public void Trigger(TableElementData TableElementData) { if (Effect != null) { try { Effect.Trigger(TableElementData); } catch (Exception E) { if (TableElementData != null) { Log.Exception("A exception occured when triggering effect {0} for table element {1} {2} with value {3}. Effect assignement will be deactivated.".Build(new object[] { Effect.Name, TableElementData.TableElementType, TableElementData.Number, TableElementData.Value }), E); } else { Log.Exception("A exception occured when triggering effect {0} as a static effect.Effect assignement will be deactivated.".Build(new object[] { Effect.Name}), E); } Effect = null; } } }