Exemple #1
0
        private void OnTilesetSelectionChanged(TilesetSelectionChangedEventArgs args)
        {
            Tileset nextTileset = args.Next.Res;

            this.StartRecordTilesetChanges();

            // Update the label that tells us which tileset is selected
            this.labelSelectedTileset.Text = (nextTileset != null) ?
                                             string.Format(TilemapsRes.TilesetEditor_SelectedTileset, nextTileset.Name) :
                                             TilemapsRes.TilesetEditor_NoTilesetSelected;

            // Update the displayed visual layer index
            if (nextTileset == null)
            {
                this.tilesetView.DisplayedConfigIndex = 0;
            }
            else if (nextTileset.RenderConfig.Count <= this.tilesetView.DisplayedConfigIndex)
            {
                this.tilesetView.DisplayedConfigIndex = 0;
            }

            // Inform the currently active editing mode of this change
            if (this.activeMode != null)
            {
                this.activeMode.RaiseOnTilesetSelectionChanged(args);
            }

            // Update the enabled state of Add and Remove buttons
            this.buttonAddLayer.Enabled    = (nextTileset != null);
            this.buttonRemoveLayer.Enabled = (nextTileset != null && this.layerView.SelectedNode != null);
        }
Exemple #2
0
 private void OnTilesetSelectionChanging(TilesetSelectionChangedEventArgs args)
 {
     // When switching to a different tileset, either apply or revert what we did to the current one
     if (args.ChangeReason != SelectionChangeReason.ObjectDisposing)
     {
         this.AskApplyOrResetTilesetChanges(false);
     }
 }
Exemple #3
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);
            }
        }