Пример #1
0
        /// <summary>
        /// Initializes the effect.
        /// Resolves object references.
        /// </summary>
        /// <param name="Table">Table object containing the effect.</param>
        public override void Init(Table.Table Table)
        {
            if (!ToyName.IsNullOrWhiteSpace() && Table.Pinball.Cabinet.Toys.Contains(ToyName) && Table.Pinball.Cabinet.Toys[ToyName] is IMatrixToy <MatrixElementType> )
            {
                Matrix      = (IMatrixToy <MatrixElementType>)Table.Pinball.Cabinet.Toys[ToyName];
                MatrixLayer = Matrix.GetLayer(LayerNr);

                AreaLeft   = (int)((float)Matrix.Width / 100 * Left).Floor().Limit(0, Matrix.Width - 1);
                AreaTop    = (int)((float)Matrix.Height / 100 * Top).Floor().Limit(0, Matrix.Height - 1);
                AreaRight  = (int)((float)Matrix.Width / 100 * (Left + Width).Limit(0, 100)).Floor().Limit(0, Matrix.Width - 1);
                AreaBottom = (int)((float)Matrix.Height / 100 * (Top + Height).Limit(0, 100)).Floor().Limit(0, Matrix.Height - 1);

                int Tmp;
                if (AreaLeft > AreaRight)
                {
                    Tmp = AreaRight; AreaRight = AreaLeft; AreaLeft = AreaRight;
                }
                if (AreaTop > AreaBottom)
                {
                    Tmp = AreaBottom; AreaBottom = AreaTop; AreaTop = Tmp;
                }

                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 }));
            }

            this.Table = Table;
        }
Пример #2
0
 private void ResolveName(Table.Table Table)
 {
     if (!ToyName.IsNullOrWhiteSpace() && Table.Pinball.Cabinet.Toys.Contains(ToyName))
     {
         if (Table.Pinball.Cabinet.Toys[ToyName] is IAnalogAlphaToy)
         {
             Toy = (IAnalogAlphaToy)Table.Pinball.Cabinet.Toys[ToyName];
         }
     }
 }
Пример #3
0
 /// <summary>
 /// Initializes the RGBA effect.<br/>
 /// Resolves the name of the RGBA toy.
 /// </summary>
 /// <param name="Table">Table object containing the effect.</param>
 public override void Init(Table.Table Table)
 {
     this.Table = Table;
     if (!ToyName.IsNullOrWhiteSpace() && Table.Pinball.Cabinet.Toys.Contains(ToyName))
     {
         if (Table.Pinball.Cabinet.Toys[ToyName] is IRGBAToy)
         {
             RGBAToy = (IRGBAToy)Table.Pinball.Cabinet.Toys[ToyName];
             Layer   = RGBAToy.Layers[LayerNr];
         }
     }
 }
Пример #4
0
 /// <summary>
 /// Initializes the effect.
 /// </summary>
 /// <param name="Table">Table object containing the effect.</param>
 public override void Init(Table.Table Table)
 {
     if (!ToyName.IsNullOrWhiteSpace() && Table.Pinball.Cabinet.Toys.Contains(ToyName))
     {
         if (Table.Pinball.Cabinet.Toys[ToyName] is IAnalogAlphaToy)
         {
             Toy   = (IAnalogAlphaToy)Table.Pinball.Cabinet.Toys[ToyName];
             Layer = Toy.Layers[LayerNr];
         }
     }
     this.Table = Table;
     ResolveName(Table);
 }