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) }; } }
private void ApplyImages(Nomino Target, Image[] BlockImages) { var BlockData = Target.GetBlockData(); for (int i = 0; i < BlockData.Count; i++) { if (BlockData[i].Block is StandardColouredBlock) { ((StandardColouredBlock)BlockData[i].Block).DisplayStyle = StandardColouredBlock.BlockStyle.Style_Custom; ((StandardColouredBlock)BlockData[i].Block)._RotationImagesSK = (from p in GetImageRotations(BlockImages[i]) select SkiaSharp.Views.Desktop.Extensions.ToSKImage(new Bitmap(p))).ToArray(); } } }