Exemplo n.º 1
0
        public void GenerateStatisticsBackground(GameplayGameState Self)
        {
            Bitmap buildbg     = new Bitmap(1120, 2576);
            Size   BlockSize   = new Size(128, 128);
            int    ColumnCount = (buildbg.Width / BlockSize.Width) + 1;
            int    RowCount    = (buildbg.Height / BlockSize.Height) + 1;

            using (Graphics g = Graphics.FromImage(buildbg))
            {
                g.Clear(Color.Black);
                for (int col = 0; col < ColumnCount; col++)
                {
                    for (int row = 0; row < RowCount; row++)
                    {
                        int DrawBlockX = col * BlockSize.Width;
                        int DrawBlockY = row * BlockSize.Height;
                        StandardColouredBlock GenerateColorBlock = new StandardColouredBlock();
                        Nomino ArbitraryGroup = new Nomino();
                        ArbitraryGroup.AddBlock(new Point[] { Point.Empty }, GenerateColorBlock);
                        Self.PlayField.Theme.ApplyRandom(ArbitraryGroup, Self.GameHandler, Self.PlayField);
                        //this.PlayField.Theme.ApplyTheme(ArbitraryGroup, this.PlayField);
                        TetrisBlockDrawGDIPlusParameters tbd = new TetrisBlockDrawGDIPlusParameters(g, new RectangleF(DrawBlockX, DrawBlockY, BlockSize.Width, BlockSize.Height), null, new SettingsManager());
                        RenderingProvider.Static.DrawElement(null, tbd.g, GenerateColorBlock, tbd);
                    }
                }
            }

            StatisticsBackground = buildbg;
            GeneratedImageTheme  = Self.PlayField.Theme;
        }
Exemplo n.º 2
0
        public override void Render(IStateOwner pOwner, SKCanvas pRenderTarget, GameplayGameState Source, GameStateSkiaDrawParameters Element)
        {
            GamePlayGameStateDataTagInfo tagData = Element.TagData as GamePlayGameStateDataTagInfo;

            bool SkipParticles = tagData != null && tagData.SkipParticlePaint;

            //testing code for background.
            if (Source.DoRefreshBackground || _Background == null || CurrentTheme != Source.PlayField.Theme)
            {
                BuildBackground(Source, Element.Bounds);
                CurrentTheme = Source.PlayField.Theme;
            }
            _Background.FrameProc(pOwner);

            RenderingProvider.Static.DrawElement(pOwner, pRenderTarget, _Background, new SkiaBackgroundDrawData(Element.Bounds));
            //draw particles.

            if (!SkipParticles)
            {
                RenderingProvider.Static.DrawElement(pOwner, pRenderTarget, Source.Particles, Element);
            }
            var PlayField = Source.PlayField;

            if (PlayField != null)
            {
                Object grabdata = RenderingProvider.Static.GetExtendedData(PlayField.GetType(), PlayField,
                                                                           (o) =>
                                                                           new TetrisFieldDrawSkiaParameters()
                {
                    Bounds        = Element.Bounds,
                    COLCOUNT      = PlayField.ColCount,
                    ROWCOUNT      = PlayField.RowCount,
                    FieldBitmap   = null,
                    LastFieldSave = SKRect.Empty,
                    VISIBLEROWS   = PlayField.VisibleRows
                });

                TetrisFieldDrawSkiaParameters parameters = (TetrisFieldDrawSkiaParameters)grabdata;
                parameters.LastFieldSave = Element.Bounds;
                //if (!Source.GameHandler.AllowFieldImageCache) parameters.FieldBitmap = null;
                RenderingProvider.Static.DrawElement(pOwner, pRenderTarget, PlayField, parameters);
            }
            var particledrawer = RenderingProvider.Static.GetHandler(typeof(List <BaseParticle>), typeof(SKCanvas), typeof(GameStateSkiaDrawParameters));

            if (Source.TopParticles != null && Source.TopParticles.Count > 0)
            {
                if (!SkipParticles)
                {
                    RenderingProvider.Static.DrawElement(pOwner, pRenderTarget, Source.TopParticles, Element);
                }
            }
        }
        MenuStateThemeSelection[] ThemeOptions = null; /*new MenuStateThemeSelection[] {
                                                        *
                                                        * new MenuStateThemeSelection("Standard",typeof(StandardTetrominoTheme), ()=>new StandardTetrominoTheme(StandardColouredBlock.BlockStyle.Style_Shine)),
                                                        * new MenuStateThemeSelection("Nintendo NES",typeof(NESTetrominoTheme),() => new NESTetrominoTheme()),
                                                        * new MenuStateThemeSelection("Game Boy",typeof(GameBoyTetrominoTheme), ()=>new GameBoyTetrominoTheme()),
                                                        * new MenuStateThemeSelection("SNES TD&DRM",typeof(SNESTetrominoTheme), ()=>new SNESTetrominoTheme()),
                                                        * new MenuStateThemeSelection("Outlined",typeof(OutlinedTetrominoTheme), ()=>new OutlinedTetrominoTheme()),
                                                        * new MenuStateThemeSelection("Simple",typeof(SimpleBlockTheme), ()=>new SimpleBlockTheme()),
                                                        *
                                                        * };*/

        private IEnumerable <MenuStateThemeSelection> GetThemeSelectionsForHandler(IGameCustomizationHandler handler)
        {
            var themetypes = Program.GetHandlerThemes(handler.GetType());

            foreach (var themeiter in themetypes)
            {
                ConstructorInfo ci = themeiter.GetConstructor(new Type[] { });
                if (ci != null)
                {
                    NominoTheme             buildResult = (NominoTheme)ci.Invoke(new object[] { });
                    MenuStateThemeSelection msst        = new MenuStateThemeSelection(buildResult.Name, themeiter, () => buildResult);
                    yield return(msst);
                }
            }
        }
Exemplo n.º 4
0
 public GarbageFieldInitializer(Random prgen, NominoTheme pTheme, int NumRows)
 {
     rgen          = prgen;
     GarbageRows   = NumRows;
     GenerateBlock = DefaultGenerateBlock;
 }