Beispiel #1
0
        public void Apply_I(Nomino Group, TetrisField Field, int CurrLevel)
        {
            //mottled. need to set rotation images as well.

            //we have four indices:
            //index one is left side
            //index two is left middle
            //index three is right middle
            //index four is right side.
            var BlockData = Group.GetBlockData();

            if (BlockData.Count < 4)
            {
                BlockData = new List <NominoElement>(BlockData);
                while (BlockData.Count < 4)
                {
                    BlockData.Add(null);
                }
                BlockData = TetrisGame.Shuffle(BlockData).ToList();
            }
            var LeftSide    = BlockData[0];
            var LeftMiddle  = BlockData[1];
            var RightMiddle = BlockData[2];
            var RightSide   = BlockData[3];

            if (LeftSide != null && LeftSide.Block is StandardColouredBlock)
            {
                var scb = (LeftSide.Block as StandardColouredBlock);
                scb.DisplayStyle      = StandardColouredBlock.BlockStyle.Style_Custom;
                scb._RotationImagesSK = NominoTheme.GetImageRotations(SkiaSharp.Views.Desktop.Extensions.ToSKBitmap(new Bitmap(GetLeftCap(CurrLevel))));
                //scb._RotationImages = new Image[] {TetrisGame.Imageman.getLoadedImage("FLIPX:mottle_right_cap",ReductionFactor), TetrisGame.Imageman.getLoadedImage("FLIPXROT90:mottle_right_cap",ReductionFactor),
                //        TetrisGame.Imageman.getLoadedImage("FLIPXROT180:mottle_right_cap",ReductionFactor), TetrisGame.Imageman.getLoadedImage("FLIPXROT270:mottle_right_cap",ReductionFactor) };
            }
            if (LeftMiddle != null && LeftMiddle.Block is StandardColouredBlock)
            {
                var scb = (LeftMiddle.Block as StandardColouredBlock);
                scb.DisplayStyle      = StandardColouredBlock.BlockStyle.Style_Custom;
                scb._RotationImagesSK = NominoTheme.GetImageRotations(SkiaSharp.Views.Desktop.Extensions.ToSKBitmap(new Bitmap(GetHorizontal(CurrLevel))));
                //scb._RotationImages = new Image[] {TetrisGame.Imageman.getLoadedImage("mottle_horizontal",ReductionFactor), TetrisGame.Imageman.getLoadedImage("ROT90:mottle_horizontal",ReductionFactor),
                //    TetrisGame.Imageman.getLoadedImage("ROT180:mottle_horizontal",ReductionFactor), TetrisGame.Imageman.getLoadedImage("ROT270:mottle_horizontal",ReductionFactor) };
            }

            if (RightMiddle != null && RightMiddle.Block is StandardColouredBlock)
            {
                var scb = (RightMiddle.Block as StandardColouredBlock);
                scb.DisplayStyle      = StandardColouredBlock.BlockStyle.Style_Custom;
                scb._RotationImagesSK = NominoTheme.GetImageRotations(SkiaSharp.Views.Desktop.Extensions.ToSKBitmap(new Bitmap(GetHorizontal(CurrLevel))));
                //scb._RotationImages = new Image[] {TetrisGame.Imageman.getLoadedImage("mottle_horizontal",ReductionFactor), TetrisGame.Imageman.getLoadedImage("ROT90:mottle_horizontal",ReductionFactor),
                //    TetrisGame.Imageman.getLoadedImage("ROT180:mottle_horizontal",ReductionFactor), TetrisGame.Imageman.getLoadedImage("ROT270:mottle_horizontal",ReductionFactor) };
            }
            if (RightSide != null && RightSide.Block is StandardColouredBlock)
            {
                var scb = (RightSide.Block as StandardColouredBlock);
                scb.DisplayStyle      = StandardColouredBlock.BlockStyle.Style_Custom;
                scb._RotationImagesSK = NominoTheme.GetImageRotations(SkiaSharp.Views.Desktop.Extensions.ToSKBitmap(new Bitmap(GetRightCap(CurrLevel))));
                //scb._RotationImages = new Image[] {TetrisGame.Imageman.getLoadedImage("mottle_right_cap",ReductionFactor), TetrisGame.Imageman.getLoadedImage("ROT90:mottle_right_cap",ReductionFactor),
                //    TetrisGame.Imageman.getLoadedImage("ROT180:mottle_right_cap",ReductionFactor), TetrisGame.Imageman.getLoadedImage("ROT270:mottle_right_cap",ReductionFactor) };
            }
        }
Beispiel #2
0
 public TetrisField(NominoTheme theme, IGameCustomizationHandler Handler, int pRowCount = DEFAULT_ROWCOUNT, int pColCount = DEFAULT_COLCOUNT)
 {
     _Theme           = theme;
     _Handler         = Handler;
     this.RowCount    = pRowCount;
     this.ColCount    = pColCount;
     this.VisibleRows = RowCount - 2;
     Reset();
 }
Beispiel #3
0
        public static Dictionary <String, List <Image> > GetTetrominoBitmaps(RectangleF Bounds, NominoTheme UseTheme, IGameCustomizationHandler Handler, TetrisField PlayField = null, float ScaleFactor = 1)
        {
            Dictionary <String, List <Image> > TetrominoImages = new Dictionary <String, List <Image> >();
            float useSize    = 18 * ScaleFactor;
            SizeF useTetSize = new SizeF(useSize, useSize);

            Nomino[] AllNominos = Handler.GetNominos();
            Image[]  bitmaps    = new Image[AllNominos.Length];

            foreach (var nom in AllNominos)
            {
                UseTheme.ApplyTheme(nom, Handler, PlayField, NominoTheme.ThemeApplicationReason.Normal);
            }

            for (int i = 0; i < AllNominos.Length; i++)
            {
                bitmaps[i] = OutLineImage(AllNominos[i].GetImage(useTetSize));
                String NominoKey = UseTheme.GetNominoKey(AllNominos[i], Handler, PlayField);
                if (!TetrominoImages.ContainsKey(NominoKey))
                {
                    TetrominoImages.Add(NominoKey, new List <Image>());
                }
                TetrominoImages[NominoKey].Add(bitmaps[i]);
            }

            return(TetrominoImages);
        }
Beispiel #4
0
        public static Dictionary <String, List <SKBitmap> > GetTetrominoBitmapsSK(SKRect Bounds, NominoTheme UseTheme, IGameCustomizationHandler handler, TetrisField PlayField = null, float ScaleFactor = 1)
        {
            Dictionary <String, List <SKBitmap> > TetrominoImages = new Dictionary <String, List <SKBitmap> >();
            float  useSize    = 18 * ScaleFactor;
            SKSize useTetSize = new SKSize(useSize, useSize);

            Nomino[]   AllNominos = handler.GetNominos();
            SKBitmap[] bitmaps    = new SKBitmap[AllNominos.Length];
            foreach (var iterate in AllNominos)
            {
                UseTheme.ApplyTheme(iterate, handler, PlayField, NominoTheme.ThemeApplicationReason.Normal);
            }

            for (int i = 0; i < AllNominos.Length; i++)
            {
                bitmaps[i] = TetrisGame.OutlineImageSK(AllNominos[i].GetImageSK(useTetSize));
                String GetNominoKey = UseTheme.GetNominoKey(AllNominos[i], handler, PlayField);
                if (!TetrominoImages.ContainsKey(GetNominoKey))
                {
                    TetrominoImages.Add(GetNominoKey, new List <SKBitmap>());
                }
                TetrominoImages[GetNominoKey].Add(bitmaps[i]);
            }

            return(TetrominoImages);
        }