1 using DirectOutput.Cab.Toys.Layer;
2 using System.Xml.Serialization;
3 using DirectOutput.Cab.Toys;
5 namespace DirectOutput.FX.MatrixFX
10 public abstract class MatrixEffectBase<MatrixElementType> :
EffectBase
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; }
240 public override void Finish()