示例#1
0
        protected sealed override void LoadContent()
        {
            PlayerData.Initialize();

            Logger = new LoggerConfiguration()
                     .WriteTo.PGNConsole()
                     .WriteTo.File(Path.Combine(PlayerData.UserDataPath, "log.txt"), rollingInterval: RollingInterval.Day)
                     .CreateLogger();

            Renderer = new Renderer(DisplayParams.ScreenWidth, DisplayParams.ScreenHeight, DisplayParams.InitialScale);

            Renderer.GraphicsDeviceMgr.SynchronizeWithVerticalRetrace = false; //Vsync
            IsFixedTimeStep = true;

            TargetElapsedTime     = TimeSpan.FromSeconds(1 / (float)FrameRate);
            Instance.Window.Title = WindowTitle;

            ResourceCache.Initialize(TemplateProcessor);

            GameData.Initialize();

            Renderer.SpriteBatch = new SpriteBatch(GraphicsDevice);

            loadResources();

            Sfx.Initialize();
            Music.Initialize();

            LoadGame();

            Console = new PGNConsole(ConsoleOpts);
            Console.LoadContent();
            Console.AddGlobalCommands(EngineCommands.Build());

            EngineBkgdColor = DefaultBkgdColor;

            World = InitialWorld;
            World.LoadContent();

            Logger.Information("Starting {WindowTitle}", WindowTitle, TargetElapsedTime);
        }