2 using System.Collections.Generic;
5 using System.Xml.Serialization;
16 where MatrixElementType:new()
18 private List<List<string>> _ToyNames =
new List<List<string>>();
27 [XmlArrayItem(
"Column",NestingLevel=1)]
28 public List<List<string>> ToyNames
30 get {
return _ToyNames; }
31 set { _ToyNames = value; }
37 private int _LayerOffset;
46 public int LayerOffset
48 get {
return _LayerOffset; }
49 set { _LayerOffset = value; }
58 foreach (KeyValuePair<
int, MatrixElementType[,]> Layer
in Layers)
60 int LayerNr = Layer.Key+LayerOffset;
62 int Height = Toys.GetUpperBound(1) + 1;
63 int Width=Toys.GetUpperBound(0) + 1;
65 for (
int y = 0; y < Height; y++)
67 for (
int x = 0; x < Width; x++)
69 if (Toys[x, y] != null)
71 Toys[x, y].
Layers[LayerNr] = Layer.Value[x, y];
84 int RowCnt = ToyNames.Count;
87 ColCnt = ToyNames.Max(X => X.Count).Limit(1,
int.MaxValue);
91 ToyNames.Add(
new List<string>(
new []{
""}));
98 for (
int y = 0; y < RowCnt ; y++)
100 for (
int x = 0; x < ColCnt ; x++)
102 if (ToyNames[y].Count > x)
150 #region IMatrix Member
162 return Layers[LayerNr];
175 return Toys.GetUpperBound(1) + 1;
190 return Toys.GetUpperBound(0) + 1;
Sorted dictionary of layers for the matrix toys.
override void Reset()
Resets the state of the IToy to its default state.
This toys allows the grouping of several toys into a matrix, which can be controlled by matrix effect...
The Cabinet object describes the parts of a pinball cabinet (toys, outputcontrollers, outputs and more).
The namespace DirectOutput.Cab.Toys contains all toy related classes.
Interface for toys having a matrix of elements (e.g. ledstrips)
override void Init(Cabinet Cabinet)
Initializes the toy.
DirectOutput.Cab.Toys.ToyList Toys
List of IToy objects describing the toys in the cabinet.
Common interface for all toy implementations. The abstract class ToyBase implements this interface...
override void Finish()
Finished the toy, releases references to toys and layers.
The namespace DirectOutput.Cab contains all cabinet related classes like the Cabinet class itself...
LayerDictionary< LayerElementType > Layers
override void UpdateOutputs()
Updates the toys specified in the toy names array with the values from the layers of this toy...
MatrixElementType[,] GetLayer(int LayerNr)
Gets the 2 dimensional data array for the specified layer.
Namespace for objects dealing with layers
Base class for toys which need update calls to update the state of their assigned outputs...