Exemple #1
0
        public GameStateDungeonGame(Game game,
                                    IUIManager ui) : base(CreateDrawingService(game))
        {
            this.ui = ui;
            gd      = new DungeonGameData();

            var contentLoader = new MonoGameContentLoader(game.Content);
            var textureOps    = new MonoGameTextureOperations(game.GraphicsDevice);
            var tileProducer  = new MonoGameTileProducer(textureOps);

            var renderFactory = new DefaultGameRenderCallbackFactory <Nothing>(game);
            var tileSet       = new DungeonTileSet <MonoGameTile, XnaTexture, XnaRawTexture>(contentLoader, tileProducer);
            var config        = new GameRenderingConfig(RenderType.IsoDiamond,
                                                        new Range(0, gd.Map.Width),
                                                        new Range(0, gd.Map.Height));
            var grf = new DungeonGameRenderingFactory <MonoGameTile>(config, gd, tileSet);

            gameRendering = new GameRendering(game, grf.RenderingConfig, grf.RenderControl);
            gameRendering.AddLayers(grf.Create(renderFactory, Nothing.Instance, Nothing.Instance));
            gameRendering.TrackScreenSize();
            gameRendering.DrawOrder = -10;

            overlay = new DebugOverlayRenderer(game)
            {
                DrawOrder = -5
            };

            var navigationUI = new NavigationUI(ui, gameRendering);

            rootComponent = navigationUI.RootComponent;
        }
Exemple #2
0
        StrategyGameTileSet <MonoGameTile> CreateTileSet(Game game,
                                                         MonoGameTileProducer tileProducer)
        {
            var contentLoader = new MonoGameContentLoader(game.Content);
            var tp            = new TexturePackLoader <MonoGameTile, XnaTexture, XnaRawTexture>(contentLoader, tileProducer, game.Content.RootDirectory).Read("Tiles/Civ/tiles.xml");
            var rt            = tp.TextureType == TextureType.Grid ? RenderType.Grid : RenderType.IsoDiamond;

            var tileSet = new StrategyGameTileSet <MonoGameTile>(tp, rt);

            tileSet.InitializeBlendingRules(gd.Rules);
            return(tileSet);
        }