Exemplo n.º 1
0
        private void ApplyGlobalTilesetSelection(SelectionChangeReason changeReason)
        {
            Tileset tileset = TilemapsEditorSelectionParser.QuerySelectedTileset().Res;

            if (this.tilesetView.TargetTileset != tileset)
            {
                TilesetSelectionChangedEventArgs args = new TilesetSelectionChangedEventArgs(
                    this.tilesetView.TargetTileset,
                    tileset,
                    changeReason);
                this.OnTilesetSelectionChanging(args);
                this.tilesetView.TargetTileset = tileset;
                this.OnTilesetSelectionChanged(args);
            }
        }
Exemplo n.º 2
0
        private void SelectTilesetFromCurrentScene()
        {
            // Search the newly entered Scene for available tilesets
            IEnumerable <ContentRef <Tileset> > tilesets = TilemapsEditorSelectionParser.GetTilesetsInScene(Scene.Current);

            // If the currently selected tileset is not available, select one of the available ones.
            if (this.SelectedTileset == null || !tilesets.Contains(this.SelectedTileset))
            {
                ContentRef <Tileset> availableTileset = tilesets.FirstOrDefault();

                if (availableTileset == null)
                {
                    availableTileset = TilemapsEditorSelectionParser.QuerySelectedTileset();
                }

                this.SelectedTileset = availableTileset;
            }
        }
Exemplo n.º 3
0
        private void ApplySelectedTileset()
        {
            // Query the selected tileset...
            ContentRef <Tileset> lastTileset = this.SelectedTileset;
            ContentRef <Tileset> tileset     = TilemapsEditorSelectionParser.QuerySelectedTileset();

            // ...or just use the last one (for editing continuity reasons) if none is selected.
            if (tileset == null && TilemapsEditorSelectionParser.SceneContainsTileset(Scene.Current, lastTileset))
            {
                tileset = lastTileset;
            }

            // If the selected tileset is no longer available, deselect it.
            if (!tileset.IsAvailable)
            {
                tileset = null;
            }

            this.SelectedTileset = tileset;
        }