コード例 #1
0
ファイル: Document.cs プロジェクト: ChristopherHaws/sledge
        public Document(string mapFile, Map map, Game game)
        {
            MapFile = mapFile;
            Map = map;
            Game = game;
            MapFileName = mapFile == null
                              ? DocumentManager.GetUntitledDocumentName()
                              : Path.GetFileName(mapFile);

            _subscriptions = new DocumentSubscriptions(this);

            _memory = new DocumentMemory();

            var cam = Map.GetActiveCamera();
            if (cam != null) _memory.SetCamera(cam.EyePosition, cam.LookPosition);

            Selection = new SelectionManager(this);
            History = new HistoryManager(this);
            if (Map.GridSpacing <= 0)
            {
                Map.GridSpacing = Grid.DefaultSize;
            }

            try
            {
                GameData =  GameDataProvider.GetGameDataFromFiles(game.Fgds.Select(f => f.Path));
            }
            catch(ProviderException)
            {
                // TODO: Error logging
                GameData = new GameData();
            }

            TextureCollection = TextureProvider.CreateCollection(game.Wads.Select(x => x.Path).Distinct());
            var texList = Map.GetAllTextures();
            var items = TextureCollection.GetItems(texList);
            TextureCollection.LoadTextureItems(items);

            Map.PostLoadProcess(GameData, GetTexture, SettingsManager.GetSpecialTextureOpacity);

            HelperManager = new HelperManager(this);
            Renderer = new RenderManager(this);

            if (MapFile != null) Mediator.Publish(EditorMediator.FileOpened, MapFile);

            // Autosaving
            if (Game.Autosave)
            {
                var at = Math.Max(1, Game.AutosaveTime);
                Scheduler.Schedule(this, Autosave, TimeSpan.FromMinutes(at));
            }
        }
コード例 #2
0
ファイル: Document.cs プロジェクト: ChristopherHaws/sledge
 private Document()
 {
     Selection = new SelectionManager(this);
     History = new HistoryManager(this);
     HelperManager = new HelperManager(this);
     TextureCollection = new TextureCollection(new List<TexturePackage>());
 }