Add delete button to the map editor

(cherry picked from commit f820adab51734020600d9758c4b78a1f6585b133)
This commit is contained in:
Gustas
2024-12-20 18:16:53 +02:00
committed by Pavel Penev
parent 0566b6f787
commit c561509c82
7 changed files with 149 additions and 9 deletions

View File

@@ -33,7 +33,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
public LabelWidget DiagonalLabel;
public LabelWidget ResourceCounterLabel;
MapBlitFilters copyFilters = MapBlitFilters.All;
MapBlitFilters selectionFilters = MapBlitFilters.All;
EditorBlitSource? clipboard;
[ObjectCreator.UseCtor]
@@ -81,12 +81,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic
worldRenderer,
clipboard.Value,
resourceLayer,
() => copyFilters));
() => selectionFilters));
};
pasteButton.IsDisabled = () => clipboard == null;
pasteButton.IsHighlighted = () => editor.CurrentBrush is EditorCopyPasteBrush;
var deleteAreaSelectionButton = areaEditPanel.Get<ButtonWidget>("SELECTION_DELETE_BUTTON");
deleteAreaSelectionButton.OnClick = () => editor.DefaultBrush.DeleteSelection(selectionFilters);
var closeAreaSelectionButton = areaEditPanel.Get<ButtonWidget>("SELECTION_CANCEL_BUTTON");
closeAreaSelectionButton.OnClick = () => editor.DefaultBrush.ClearSelection(updateSelectedTab: true);
@@ -102,15 +105,15 @@ namespace OpenRA.Mods.Common.Widgets.Logic
editorActorLayer,
resourceLayer,
editor.DefaultBrush.Selection.Area,
copyFilters);
selectionFilters);
}
void CreateCategoryPanel(MapBlitFilters copyFilter, CheckboxWidget checkbox)
{
checkbox.GetText = () => copyFilter.ToString();
checkbox.IsChecked = () => copyFilters.HasFlag(copyFilter);
checkbox.IsChecked = () => selectionFilters.HasFlag(copyFilter);
checkbox.IsVisible = () => true;
checkbox.OnClick = () => copyFilters ^= copyFilter;
checkbox.OnClick = () => selectionFilters ^= copyFilter;
}
protected override void Dispose(bool disposing)