Example #1
0
 /// <summary>
 /// Resets the state of the IToy to its default state.
 /// </summary>
 public override void Reset()
 {
     Layers = new MatrixDictionaryBase <MatrixElementType>()
     {
         Width = Width, Height = Height
     };
 }
        /// <summary>
        /// Initializes the toy.
        /// </summary>
        /// <param name="Cabinet"><see cref="Cabinet" /> object  to which the <see cref="IToy" /> belongs.</param>
        public override void Init(Cabinet Cabinet)
        {
            this.Cabinet = Cabinet;

            if (Cabinet.OutputControllers.Contains(OutputControllerName) && Cabinet.OutputControllers[OutputControllerName] is ISupportsSetValues)
            {
                OutputController = (ISupportsSetValues)Cabinet.OutputControllers[OutputControllerName];
            }

            BuildMappingTables();
            OutputData = new byte[NumberOfOutputs];
            InitFadingCurve(Cabinet);

            Layers = new MatrixDictionaryBase <RGBAColor>()
            {
                Width = Width, Height = Height
            };
        }
Example #3
0
        /// <summary>
        /// Initializes the toy.
        /// </summary>
        /// <param name="Cabinet"><see cref="Cabinet" /> object  to which the <see cref="IToy" /> belongs.</param>
        public override void Init(Cabinet Cabinet)
        {
            int ColCnt = 0;
            int RowCnt = ToyNames.Count;

            if (RowCnt > 0)
            {
                ColCnt = ToyNames.Max(X => X.Count).Limit(1, int.MaxValue);
            }
            else
            {
                ToyNames.Add(new List <string>(new [] { "" }));
                RowCnt = 1;
                ColCnt = 1;
            }

            Toys = new ILayerToy <MatrixElementType> [ColCnt, RowCnt];

            for (int y = 0; y < RowCnt; y++)
            {
                for (int x = 0; x < ColCnt; x++)
                {
                    if (ToyNames[y].Count > x)
                    {
                        if (Cabinet.Toys.Contains(ToyNames[y][x]) && Cabinet.Toys[ToyNames[y][x]] is ILayerToy <MatrixElementType> )
                        {
                            Toys[x, y] = (ILayerToy <MatrixElementType>)Cabinet.Toys[ToyNames[y][x]];
                        }
                        else
                        {
                            Toys[x, y] = null;
                        }
                    }
                }
            }

            Layers = new MatrixDictionaryBase <MatrixElementType>()
            {
                Width = Width, Height = Height
            };
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="LedStrip"/> class.
 /// </summary>
 public LedStrip()
 {
     Layers = new MatrixDictionaryBase <RGBAColor>();
 }