예제 #1
0
    private HeadlessGame(HeadlessGameOptions options)
    {
        var config = new GameConfig
        {
            InstallationFolder = options.InstallationFolder,
            SkipIntro          = true,
            SkipLegal          = true,
            // Debug UI makes no sense in the headless client
            EnableDebugUI = false,
            Rendering     =
            {
                DebugDevice = options.UseDebugRenderer
            }
        };
        var settings = new TigSettings
        {
            DataFolder   = options.OpenTempleDataPath ?? FindDataFolder(),
            OffScreen    = true,
            DisableSound = true
        };

        Globals.ConfigManager = new GameConfigManager(config);
        Globals.GameFolders   = new GameFolders(options.UserDataFolder);

        Tig.Startup(config, settings);

        GameSystems.InitializeFonts();
        GameSystems.InitializeSystems(new DummyLoadingProgress());

        GameSystems.GameInit.EnableStartMap = options.EnableStartMap; // Prevents shopmap from opening

        if (options.WithUserInterface)
        {
            Globals.UiManager          = new UiManager(Tig.MainWindow);
            Globals.UiAssets           = new UiAssets();
            Globals.UiStyles           = new UiStyles();
            Globals.WidgetButtonStyles = new WidgetButtonStyles();

            UiSystems.Startup(config);
        }

        GameSystems.LoadModule("ToEE", true);
    }