Added Undo Redo to editor

This commit is contained in:
teinarss
2019-07-13 18:21:01 +02:00
committed by abcdefg30
parent 1f78b3a425
commit 76034c198e
19 changed files with 1155 additions and 164 deletions

View File

@@ -128,6 +128,21 @@ namespace OpenRA.Mods.Common.Widgets.Logic
if (reslayer != null)
cashLabel.GetText = () => "$ {0}".F(reslayer.NetWorth);
}
var actionManager = world.WorldActor.Trait<EditorActionManager>();
var undoButton = widget.GetOrNull<ButtonWidget>("UNDO_BUTTON");
if (undoButton != null)
{
undoButton.IsDisabled = () => !actionManager.HasUndos();
undoButton.OnClick = () => actionManager.Undo();
}
var redoButton = widget.GetOrNull<ButtonWidget>("REDO_BUTTON");
if (redoButton != null)
{
redoButton.IsDisabled = () => !actionManager.HasRedos();
redoButton.OnClick = () => actionManager.Redo();
}
}
Widget CreateCategoriesPanel()