示例#1
0
        public void OpenGameObjectEditor(GameObject gameObject, Palette palette = null)
        {
            var existingTab = OpenedTabs.Where(t => t.DataContext == _gameObjectService).FirstOrDefault();

            if (existingTab != null)
            {
                ((GameObjectEditor)existingTab.Content).SelectObject(gameObject, palette);
                TabsOpen.SelectedItem = SelectedTabItem = existingTab;
                return;
            }

            TabItem          tabItem      = new TabItem();
            GameObjectEditor objectEditor = new GameObjectEditor(_projectService, _palettesService, _graphicsService, _gameObjectService);

            tabItem.Header      = "Object Editor";
            tabItem.Content     = objectEditor;
            tabItem.DataContext = _gameObjectService;

            objectEditor.SelectObject(gameObject, palette);

            TabsOpen.Items.Add(tabItem);
            OpenedTabs.Add(tabItem);
            TabsOpen.Visibility   = Visibility.Visible;
            TabsOpen.SelectedItem = SelectedTabItem = tabItem;
        }
示例#2
0
        public void OpenTileBlockEditor(Guid levelId, int tileBlockValue)
        {
            var existingTab = OpenedTabs.Where(t => t.DataContext == _tileService).FirstOrDefault();

            if (existingTab != null)
            {
                if (levelId != Guid.Empty && tileBlockValue > -1)
                {
                    ((TileBlockEditor)existingTab.Content).SelectTileBlock(levelId, tileBlockValue);
                }

                TabsOpen.SelectedItem = SelectedTabItem = existingTab;
                return;
            }

            TabItem         tabItem       = new TabItem();
            TileBlockEditor tileSetEditor = new TileBlockEditor(_projectService, _worldService, _levelService, _graphicsService, _palettesService, _tileService, _textService);

            tabItem.Header      = "Tile Set Editor";
            tabItem.Content     = tileSetEditor;
            tabItem.DataContext = _tileService;

            TabsOpen.Items.Add(tabItem);
            OpenedTabs.Add(tabItem);
            TabsOpen.Visibility   = Visibility.Visible;
            TabsOpen.SelectedItem = SelectedTabItem = tabItem;

            if (levelId != Guid.Empty && tileBlockValue > -1)
            {
                tileSetEditor.SelectTileBlock(levelId, tileBlockValue);
            }
        }
示例#3
0
        private void _levelService_LevelUpdated(LevelInfo levelInfo)
        {
            var existingTab = OpenedTabs.Where(t => t.DataContext == levelInfo).FirstOrDefault();

            if (existingTab != null)
            {
                existingTab.Header = levelInfo.Name;
            }
        }
示例#4
0
        private void _worldService_WorldUpdated(WorldInfo worldInfo)
        {
            var existingTab = OpenedTabs.Where(t => t.DataContext == worldInfo).FirstOrDefault();

            if (existingTab != null)
            {
                existingTab.Header = worldInfo.Name;
            }
        }
示例#5
0
        private void _ProjectPanel_TextEditorOpened()
        {
            var existingTab = OpenedTabs.Where(t => t.DataContext == _textService).FirstOrDefault();

            if (existingTab != null)
            {
                TabsOpen.SelectedItem = SelectedTabItem = existingTab;
                return;
            }

            TabItem   tabItem   = new TabItem();
            TextPanel textPanel = new TextPanel(_projectService, _textService);

            tabItem.Header      = "Text Editor";
            tabItem.Content     = textPanel;
            tabItem.DataContext = _textService;

            TabsOpen.Items.Add(tabItem);
            OpenedTabs.Add(tabItem);
            TabsOpen.Visibility   = Visibility.Visible;
            TabsOpen.SelectedItem = SelectedTabItem = tabItem;
        }