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) }; } }
public override PlayFieldBackgroundInfo GetThemePlayFieldBackground(TetrisField Field, IGameCustomizationHandler Handler) { if (ColoredBG == null) { ColoredBG = GetColoredBackground(Color.AntiqueWhite, null); } return(ColoredBG); }
public override PlayFieldBackgroundInfo GetThemePlayFieldBackground(TetrisField Field, IGameCustomizationHandler GameHandler) { if (LightImage == null) { LightImage = new Bitmap(250, 500); using (Graphics drawdark = Graphics.FromImage(LightImage)) { drawdark.Clear(Color.PeachPuff); } } return(new PlayFieldBackgroundInfo(LightImage, Color.Transparent)); }
public void Apply_T(Nomino Group, TetrisField Field, int CurrLevel) { //inset bevel foreach (var blockcheck in Group) { if (blockcheck.Block is StandardColouredBlock) { StandardColouredBlock scb = blockcheck.Block as StandardColouredBlock; scb.DisplayStyle = StandardColouredBlock.BlockStyle.Style_Custom; scb._RotationImagesSK = new SKImage[] { SkiaSharp.Views.Desktop.Extensions.ToSKImage(new Bitmap(GetInsetBevel(CurrLevel))) }; //scb.BaseImageKey = Solid_Square; } } }
public void Apply_J(Nomino Group, TetrisField Field, int CurrLevel) { //darker outline with a middle white square. foreach (var blockcheck in Group) { if (blockcheck.Block is StandardColouredBlock) { StandardColouredBlock scb = blockcheck.Block as StandardColouredBlock; scb.DisplayStyle = StandardColouredBlock.BlockStyle.Style_Custom; scb._RotationImagesSK = new SKImage[] { SkiaSharp.Views.Desktop.Extensions.ToSKImage(new Bitmap(GetDottedLight(CurrLevel))) }; //scb.BaseImageKey = Solid_Square; } } }
public override void ApplyTheme(Nomino Group, IGameCustomizationHandler handler, TetrisField Field, ThemeApplicationReason Reason) { var LineCount = (handler.Statistics is TetrisStatistics ts) ? ts.LineCount : 0; int CurrLevel = Field == null ? 0 : (int)(LineCount / 10); if (Group is Tetromino_I) { ApplyTheme_I(Group, CurrLevel); } else if (Group is Tetromino_J) { ApplyTheme_J(Group, CurrLevel); } else if (Group is Tetromino_L) { ApplyTheme_L(Group, CurrLevel); } else if (Group is Tetromino_O) { ApplyTheme_O(Group, CurrLevel); } else if (Group is Tetromino_S) { ApplyTheme_S(Group, CurrLevel); } else if (Group is Tetromino_Z) { ApplyTheme_Z(Group, CurrLevel); } else if (Group is Tetromino_T) { ApplyTheme_T(Group, CurrLevel); } else { ApplyImages(Group, new Image[] { GetOutlinedImage(BlockOutlines.Outline_Bottom | BlockOutlines.Outline_Top | BlockOutlines.Outline_Right | BlockOutlines.Outline_Left, GetLevelColor(CurrLevel)) }); } }
public override void ApplyRandom(Nomino Group, IGameCustomizationHandler Handler, TetrisField Field) { int LevelUse = TetrisGame.rgen.Next(10); ApplyImages(Group, new Image[] { GetOutlinedImage(BlockOutlines.Outline_Bottom | BlockOutlines.Outline_Top | BlockOutlines.Outline_Right | BlockOutlines.Outline_Left, GetLevelColor(LevelUse)) }); }
public abstract PlayFieldBackgroundInfo GetThemePlayFieldBackground(TetrisField Field, IGameCustomizationHandler GameHandler);
public abstract void ApplyRandom(Nomino Group, IGameCustomizationHandler GameHandler, TetrisField Field);
public override void ApplyRandom(Nomino Group, IGameCustomizationHandler GameHandler, TetrisField Field) { PrepareTheme(); int RandomLevel = TetrisGame.rgen.Next(25); Action <Nomino, TetrisField, int> SelectL = Apply_L; Action <Nomino, TetrisField, int>[] Types = new Action <Nomino, TetrisField, int>[] { Apply_L, Apply_J, Apply_I, Apply_O, Apply_S, Apply_Z, Apply_T }; var selected = TetrisGame.Choose(Types); selected(Group, Field, RandomLevel); }
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); }
public override void ApplyTheme(Nomino Group, IGameCustomizationHandler GameHandler, TetrisField Field, ThemeApplicationReason Reason) { char DesiredNomino = 'I'; Dictionary <Type, char> NominoLookup = new Dictionary <Type, char>() { { typeof(Tetromino_T), 'T' }, { typeof(Tetromino_S), 'S' }, { typeof(Tetromino_Z), 'Z' }, { typeof(Tetromino_L), 'L' }, { typeof(Tetromino_J), 'J' }, { typeof(Tetromino_O), 'O' }, { typeof(Tetromino_I), 'I' }, { typeof(Tetromino_Y), 'Y' } }; if (NominoLookup.ContainsKey(Group.GetType())) { DesiredNomino = NominoLookup[Group.GetType()]; } else { DesiredNomino = TetrisGame.Choose(TetOrder); } foreach (var iterate in Group) { if (iterate.Block is StandardColouredBlock) { StandardColouredBlock sbc = iterate.Block as StandardColouredBlock; sbc.DisplayStyle = StandardColouredBlock.BlockStyle.Style_Custom; sbc.BlockColor = Color.Black; if (Field.GetActiveBlockGroups().Contains(Group)) { sbc._RotationImagesSK = new SKImage[] { SKImage.FromBitmap(GetUnsetImage(ColourData[Field.Level > 12 ? 12 : Field.Level].GetColor(DesiredNomino))) } } ; else { sbc._RotationImagesSK = new SKImage[] { SKImage.FromBitmap(GetSetImage(ColourData[Field.Level > 12 ? 12 : Field.Level].GetColor(DesiredNomino))) }; } } } }
public override void ApplyTheme(Nomino Group, IGameCustomizationHandler GameHandler, TetrisField Field, ThemeApplicationReason Reason) { var LineCount = (GameHandler.Statistics is TetrisStatistics ts) ? ts.LineCount : 0; int CurrLevel = Field == null ? 0 : (int)(LineCount / 10); ApplyColorSet(Group, CurrLevel); }
public override void ApplyRandom(Nomino Group, IGameCustomizationHandler GameHandler, TetrisField Field) { int useLevel = TetrisGame.rgen.Next(50); ApplyColorSet(Group, useLevel); }
public override void ApplyTheme(Nomino Group, IGameCustomizationHandler GameHandler, TetrisField Field, ThemeApplicationReason Reason) { PrepareTheme(); var LineCount = (GameHandler.Statistics is TetrisStatistics ts) ? ts.LineCount : 0; int CurrLevel = Field == null ? 0 : (int)(LineCount / 10); if (Group is Tetromino_L) { Apply_L(Group as Tetromino_L, Field, CurrLevel); } else if (Group is Tetromino_J) { Apply_J(Group as Tetromino_J, Field, CurrLevel); } else if (Group is Tetromino_I) { Apply_I(Group as Tetromino_I, Field, CurrLevel); } else if (Group is Tetromino_O) { Apply_O(Group as Tetromino_O, Field, CurrLevel); } else if (Group is Tetromino_S) { Apply_S(Group as Tetromino_S, Field, CurrLevel); } else if (Group is Tetromino_Z) { Apply_Z(Group as Tetromino_Z, Field, CurrLevel); } else if (Group is Tetromino_T) { Apply_T(Group as Tetromino_T, Field, CurrLevel); } else { foreach (var blockcheck in Group) { if (blockcheck.Block is StandardColouredBlock) { StandardColouredBlock scb = blockcheck.Block as StandardColouredBlock; scb.DisplayStyle = StandardColouredBlock.BlockStyle.Style_Custom; TetrisGame.Choose(new Image[] { GetSolidSquare(CurrLevel), GetDottedLight(CurrLevel), GetDottedDark(CurrLevel), GetFatDotted(CurrLevel), GetInsetBevel(CurrLevel) }); scb._RotationImagesSK = new SKImage[] { SkiaSharp.Views.Desktop.Extensions.ToSKImage(new Bitmap(GetInsetBevel(CurrLevel))) }; //scb.BaseImageKey = Solid_Square; } } } }
public virtual String GetNominoKey(Nomino Group, IGameCustomizationHandler GameHandler, TetrisField Field) { return(GetNominoTypeKey(Group.GetType(), GameHandler, Field)); }
public override void ApplyRandom(Nomino Group, IGameCustomizationHandler GameHandler, TetrisField Field) { //choose a random level... int Randomlevel = TetrisGame.rgen.Next(0, 13); //choose a random tetromino type. char randomTet = TetrisGame.Choose(TetOrder.ToCharArray()); //get the image for it foreach (var iterate in Group) { if (iterate.Block is StandardColouredBlock) { StandardColouredBlock sbc = iterate.Block as StandardColouredBlock; sbc.DisplayStyle = StandardColouredBlock.BlockStyle.Style_Custom; sbc._RotationImagesSK = new SKImage[] { SKImage.FromBitmap(GetSetImage(ColourData[Randomlevel].GetColor(randomTet))) }; } } }
public virtual String GetNominoTypeKey(Type src, IGameCustomizationHandler GameHandler, TetrisField Field) { return(src.FullName); }
public override PlayFieldBackgroundInfo GetThemePlayFieldBackground(TetrisField Field, IGameCustomizationHandler GameHandler) { return(new PlayFieldBackgroundInfo(TetrisGame.Imageman["background", 0.5f], Color.Transparent)); }
public abstract void ApplyTheme(Nomino Group, IGameCustomizationHandler GameHandler, TetrisField Field, ThemeApplicationReason Reason);
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); }
public bool IsActive(TetrisField pField) { return(pField.BlockGroups.Any((b) => b == this)); }