Esempio n. 1
0
        public AppBootstrapper()
        {
            Initialize();

            Engine.SaveGame = data =>
            {
                var project = Project.Current;
                Debug.Assert(project != null);
                var path = Path.Combine(project.ProjectPath, $"{project.Name}.game");
                using (var file = File.Create(path))
                    data.CopyTo(file);
            };

            Engine.SavePlace = (place, data) =>
            {
                var project = Project.Current;
                Debug.Assert(project != null);
                var path = Path.Combine(project.ProjectPath, "Places", $"{place}.place");
                using (var file = File.Create(path))
                    data.CopyTo(file);
            };

            ContentProvider.CustomFetchHandler = CustomFetchHandler;
            Engine.Start(EngineMode.LevelEditor);
            DataModel.SetStartupArguments(new Dictionary <string, string> {
                { "IsEditor", "true" }
            });
            InputService.MouseInputApi = InputApi.Windows;
            Editor.Current.Settings    = new EditorSettings {
                Name = "Editor", Parent = Engine.Settings
            };
            Engine.Settings.Load();
            KeyBindings.Init();

            //InstTest();

            ToolManager.SelectTool.IsEquipped = true;

            AutoSaveTimer = new DispatcherTimer(System.TimeSpan.FromMinutes(EditorSettings.AutosaveInterval),
                                                DispatcherPriority.Background, PerformAutoSave, Editor.Current.Dispatcher);
        }