Add copy/paste to the map editor.
This commit is contained in:
@@ -21,6 +21,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
[ObjectCreator.UseCtor]
|
||||
public MapEditorLogic(Widget widget, World world, WorldRenderer worldRenderer)
|
||||
{
|
||||
var editorViewport = widget.Get<EditorViewportControllerWidget>("MAP_EDITOR");
|
||||
|
||||
var gridButton = widget.GetOrNull<ButtonWidget>("GRID_BUTTON");
|
||||
var terrainGeometryTrait = world.WorldActor.Trait<TerrainGeometryOverlay>();
|
||||
|
||||
@@ -63,6 +65,13 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
};
|
||||
}
|
||||
|
||||
var copypasteButton = widget.GetOrNull<ButtonWidget>("COPYPASTE_BUTTON");
|
||||
if (copypasteButton != null)
|
||||
{
|
||||
copypasteButton.OnClick = () => editorViewport.SetBrush(new EditorCopyPasteBrush(editorViewport, worldRenderer));
|
||||
copypasteButton.IsHighlighted = () => editorViewport.CurrentBrush is EditorCopyPasteBrush;
|
||||
}
|
||||
|
||||
var coordinateLabel = widget.GetOrNull<LabelWidget>("COORDINATE_LABEL");
|
||||
if (coordinateLabel != null)
|
||||
coordinateLabel.GetText = () => worldRenderer.Viewport.ViewToWorld(Viewport.LastMousePos).ToString();
|
||||
|
||||
Reference in New Issue
Block a user