2 using System.Xml.Serialization;
12 #region Config properties
14 private string _ToyName;
24 get {
return _ToyName; }
27 if (_ToyName != value)
49 private float _Width = 100;
59 get {
return _Width; }
60 set { _Width = value.Limit(0, 100); }
63 private float _Height = 100;
73 get {
return _Height; }
74 set { _Height = value.Limit(0, 100); }
77 private float _Left = 0;
88 set { _Left = value.Limit(0, 100); }
91 private float _Top = 0;
102 set { _Top = value.Limit(0, 100); }
108 private int _LayerNr = 0;
118 get {
return _LayerNr; }
119 set { _LayerNr = value; }
133 get {
return _FadeMode; }
134 set { _FadeMode = value; }
144 protected int AreaLeft = 0;
149 protected int AreaTop = 0;
154 protected int AreaRight = 0;
159 protected int AreaBottom = 0;
168 protected int AreaWidth
170 get {
return (AreaRight - AreaLeft) + 1; }
180 protected int AreaHeight
182 get {
return (AreaBottom - AreaTop) + 1; }
192 protected Table.Table Table {
get;
private set; }
213 public override void Init(Table.Table Table)
215 if (!ToyName.IsNullOrWhiteSpace() && Table.Pinball.Cabinet.Toys.Contains(ToyName) && Table.Pinball.Cabinet.Toys[ToyName] is
IMatrixToy<MatrixElementType>)
218 MatrixLayer = Matrix.GetLayer(LayerNr);
220 AreaLeft = (int)((
float)Matrix.Width / 100 *
Left).Floor().Limit(0, Matrix.Width - 1);
221 AreaTop = (int)((
float)Matrix.Height / 100 * Top).Floor().Limit(0, Matrix.Height - 1);
222 AreaRight = (int)((
float)Matrix.Width / 100 * (
Left + Width).Limit(0, 100)).Floor().Limit(0, Matrix.Width - 1);
223 AreaBottom = (int)((
float)Matrix.Height / 100 * (Top + Height).Limit(0, 100)).Floor().Limit(0, Matrix.Height - 1);
226 if (AreaLeft > AreaRight) { Tmp = AreaRight; AreaRight = AreaLeft; AreaLeft = AreaRight; }
227 if (AreaTop > AreaBottom) { Tmp = AreaBottom; AreaBottom = AreaTop; AreaTop = Tmp; }
229 Log.
Debug(
"MatrixBase for {12}. Calculated area size: AreaDef(L:{0}, T:{1}, W:{2}, H:{3}), Matrix(W:{4}, H:{5}), ResultArea(Left: {6}, Top:{7}, Right:{8}, Bottom:{9}, Width:{10}, Height:{11})".Build(
new object[] {
Left, Top, Width, Height, Matrix.Height, Matrix.Width, AreaLeft, AreaTop, AreaRight, AreaBottom, AreaWidth, AreaHeight, this.GetType().Name }));
The namespace DirectOutput.Cab.Toys contains all toy related classes.
Base class for effects targeting a matrix of toys (e.g. addressable ledstrip)
Interface for toys having a matrix of elements (e.g. ledstrips)
MatrixElementType[,] MatrixLayer
The layer array of a IRGBAMatrix object as specified by the ToyName and the LayerNr. This reference is initialized by the Init method.
A simple logger used to record important events and exceptions.
override void Finish()
Finishes the effect and releases object references
override void Init(Table.Table Table)
Initializes the effect. Resolves object references.
Abstract base class for IEffect objects. This class inherits NamedItemBase and implements IEffect...
static void Debug(string Message="")
Writes the specified debug message to the log file.
The namespace DirectOutput.Cab contains all cabinet related classes like the Cabinet class itself...
FadeModeEnum
Defines the fading behaviour.
Namespace for objects dealing with layers