Example #1
0
        public void BindController(PropertyListPresenter controller)
        {
            if (_controller == controller) {
                return;
            }

            if (_controller != null) {
                _controller.SyncPropertyContainer -= SyncPropertyContainerHandler;
                _controller.SyncPropertyActions -= SyncPropertyActionsHandler;
                _controller.SyncPropertyList -= SyncPropertyListHandler;
            }

            _controller = controller;

            if (_controller != null) {
                _controller.SyncPropertyContainer += SyncPropertyContainerHandler;
                _controller.SyncPropertyActions += SyncPropertyActionsHandler;
                _controller.SyncPropertyList += SyncPropertyListHandler;

                _controller.RefreshPropertyList();
            }
            else {
                ResetComponent();
            }
        }
Example #2
0
        public void New()
        {
            SelectLevel(Guid.Empty);

            Project project = EmptyProject();

            Program.CurrentProject = project;

            NewLevel form = new NewLevel(project);

            if (form.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            Project prevProject = _project;

            if (_project != null)
            {
                _project.Modified -= ProjectModifiedHandler;
            }

            _project           = project;
            _project.Modified += ProjectModifiedHandler;

            OnSyncCurrentProject(new SyncProjectEventArgs(prevProject));

            _project.ObjectPoolManager.Pools.Add(new ObjectPool("Default"));

            PropertyListPresenter propList = _presentation.PropertyList as PropertyListPresenter;

            foreach (Level level in _project.Levels)
            {
                _content.OpenContent(level.Uid);

                if (_currentLevel == Guid.Empty)
                {
                    SelectLevel(level.Uid);
                    propList.Provider = level; // Initial Property Provider
                }
            }

            ContentInfoArbitrationPresenter info = _presentation.ContentInfo as ContentInfoArbitrationPresenter;

            info.BindInfoPresenter(CurrentLevel.InfoPresenter);

            Modified = false;
            Project.ResetModified();



            RefreshEditor();
        }
Example #3
0
        public void Open(Project project)
        {
            if (PromptCancelIfModified())
            {
                return;
            }

            Program.CurrentProject = project;

            Project prevProject = _project;

            if (_project != null)
            {
                _project.Modified -= ProjectModifiedHandler;
            }

            _project           = project;
            _project.Modified += ProjectModifiedHandler;

            OnSyncCurrentProject(new SyncProjectEventArgs(prevProject));

            _currentLevel = Guid.Empty;

            PropertyListPresenter propList = _presentation.PropertyList as PropertyListPresenter;

            foreach (Level level in _project.Levels)
            {
                _levelContentController.OpenContent(level.Uid);

                if (_currentLevel == Guid.Empty)
                {
                    SelectLevel(level.Uid);
                    propList.Provider = level; // Initial Property Provider
                }
            }

            if (CurrentLevel != null)
            {
                ContentInfoArbitrationPresenter info = _presentation.ContentInfo as ContentInfoArbitrationPresenter;
                info.BindInfoPresenter(CurrentLevel.InfoPresenter);
            }

            Modified = false;
            Project.ResetModified();

            RefreshEditor();
        }
Example #4
0
        public void NewDefault()
        {
            Project prevProject = _project;

            if (_project != null)
            {
                _project.Modified -= ProjectModifiedHandler;
            }

            _project = EmptyProject();
            _project.ObjectPoolManager.Pools.Add(new ObjectPool("Default"));

            _project.Modified += ProjectModifiedHandler;

            Program.CurrentProject = _project;

            OnSyncCurrentProject(new SyncProjectEventArgs(prevProject));

            Level level = new Level("Level 1", 0, 0, 800, 480);

            level.Project = _project;
            level.Layers.Add(new MultiTileGridLayer("Tile Layer 1", 16, 16, 50, 30));

            _project.Levels.Add(level);

            SelectLevel(level.Uid);

            PropertyListPresenter propList = _presentation.PropertyList as PropertyListPresenter;

            propList.Provider = level;

            ContentInfoArbitrationPresenter info = _presentation.ContentInfo as ContentInfoArbitrationPresenter;

            info.BindInfoPresenter(CurrentLevel.InfoPresenter);

            Modified = false;
            Project.ResetModified();

            _content.OpenContent(level.Uid);

            RefreshEditor();
        }
Example #5
0
        public Presentation(EditorPresenter editor)
        {
            _editor = editor;

            _stdTools = new StandardToolsPresenter(_editor);
            _docTools = new DocumentToolsPresenter(_editor);
            _contentInfo = new ContentInfoArbitrationPresenter(_editor);

            _tilePoolList = new TilePoolListPresenter(_editor);
            _objectPoolCollection = new ObjectPoolCollectionPresenter(_editor);
            _tileBrushManager = new TileBrushManagerPresenter(_editor);
            _propertyList = new PropertyListPresenter();
            _projectExplorer = new ProjectExplorerPresenter(_editor);
        }