Fix editor area/actor deselection bugs
@@ -1,4 +1,15 @@
|
|||||||
using System.Collections.Generic;
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright (c) The OpenRA Developers and Contributors
|
||||||
|
* This file is part of OpenRA, which is free software. It is made
|
||||||
|
* available to you under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation, either version 3 of
|
||||||
|
* the License, or (at your option) any later version. For more
|
||||||
|
* information, see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
using OpenRA.Mods.Common.Traits;
|
using OpenRA.Mods.Common.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.EditorBrushes
|
namespace OpenRA.Mods.Common.EditorBrushes
|
||||||
@@ -7,10 +18,10 @@ namespace OpenRA.Mods.Common.EditorBrushes
|
|||||||
{
|
{
|
||||||
public readonly TerrainTile TerrainTile;
|
public readonly TerrainTile TerrainTile;
|
||||||
public readonly ResourceTile ResourceTile;
|
public readonly ResourceTile ResourceTile;
|
||||||
public readonly ResourceLayerContents ResourceLayerContents;
|
public readonly ResourceLayerContents? ResourceLayerContents;
|
||||||
public readonly byte Height;
|
public readonly byte Height;
|
||||||
|
|
||||||
public ClipboardTile(TerrainTile terrainTile, ResourceTile resourceTile, ResourceLayerContents resourceLayerContents, byte height)
|
public ClipboardTile(TerrainTile terrainTile, ResourceTile resourceTile, ResourceLayerContents? resourceLayerContents, byte height)
|
||||||
{
|
{
|
||||||
TerrainTile = terrainTile;
|
TerrainTile = terrainTile;
|
||||||
ResourceTile = resourceTile;
|
ResourceTile = resourceTile;
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
if (!mapTiles.Contains(cell))
|
if (!mapTiles.Contains(cell))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
var resourceLayerContents = resourceLayer.GetResource(cell);
|
var resourceLayerContents = resourceLayer?.GetResource(cell);
|
||||||
tiles.Add(cell, new ClipboardTile(mapTiles[cell], mapResources[cell], resourceLayerContents, mapHeight[cell]));
|
tiles.Add(cell, new ClipboardTile(mapTiles[cell], mapResources[cell], resourceLayerContents, mapHeight[cell]));
|
||||||
|
|
||||||
if (copyFilters.HasFlag(MapCopyFilters.Actors))
|
if (copyFilters.HasFlag(MapCopyFilters.Actors))
|
||||||
@@ -189,7 +189,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Clear any existing resources.
|
// Clear any existing resources.
|
||||||
if (copyFilters.HasFlag(MapCopyFilters.Resources))
|
if (resourceLayer != null && copyFilters.HasFlag(MapCopyFilters.Resources))
|
||||||
resourceLayer.ClearResources(position);
|
resourceLayer.ClearResources(position);
|
||||||
|
|
||||||
var tile = tileKeyValuePair.Value;
|
var tile = tileKeyValuePair.Value;
|
||||||
@@ -201,33 +201,38 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
map.Height[position] = tile.Height;
|
map.Height[position] = tile.Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (copyFilters.HasFlag(MapCopyFilters.Resources) && !string.IsNullOrWhiteSpace(resourceLayerContents.Type))
|
if (copyFilters.HasFlag(MapCopyFilters.Resources) &&
|
||||||
resourceLayer.AddResource(resourceLayerContents.Type, position, resourceLayerContents.Density);
|
resourceLayerContents.HasValue &&
|
||||||
|
!string.IsNullOrWhiteSpace(resourceLayerContents.Value.Type))
|
||||||
|
resourceLayer.AddResource(resourceLayerContents.Value.Type, position, resourceLayerContents.Value.Density);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear any existing actors in the paste cells.
|
if (copyFilters.HasFlag(MapCopyFilters.Actors))
|
||||||
var selectionSize = clipboard.CellRegion.BottomRight - clipboard.CellRegion.TopLeft;
|
|
||||||
var pasteRegion = new CellRegion(map.Grid.Type, pastePosition, pastePosition + selectionSize);
|
|
||||||
foreach (var regionActor in pasteRegion.SelectMany(editorActorLayer.PreviewsAt).ToHashSet())
|
|
||||||
editorActorLayer.Remove(regionActor);
|
|
||||||
|
|
||||||
// Now place actors.
|
|
||||||
foreach (var actorKeyValuePair in clipboard.Actors)
|
|
||||||
{
|
{
|
||||||
var selection = clipboard.CellRegion;
|
// Clear any existing actors in the paste cells.
|
||||||
var copy = actorKeyValuePair.Value.Export();
|
var selectionSize = clipboard.CellRegion.BottomRight - clipboard.CellRegion.TopLeft;
|
||||||
var locationInit = copy.GetOrDefault<LocationInit>();
|
var pasteRegion = new CellRegion(map.Grid.Type, pastePosition, pastePosition + selectionSize);
|
||||||
if (locationInit != null)
|
foreach (var regionActor in pasteRegion.SelectMany(editorActorLayer.PreviewsAt).ToHashSet())
|
||||||
|
editorActorLayer.Remove(regionActor);
|
||||||
|
|
||||||
|
// Now place actors.
|
||||||
|
foreach (var actorKeyValuePair in clipboard.Actors)
|
||||||
{
|
{
|
||||||
var actorPosition = locationInit.Value + new CVec(pastePosition.X - selection.TopLeft.X, pastePosition.Y - selection.TopLeft.Y);
|
var selection = clipboard.CellRegion;
|
||||||
if (!map.Contains(actorPosition))
|
var copy = actorKeyValuePair.Value.Export();
|
||||||
continue;
|
var locationInit = copy.GetOrDefault<LocationInit>();
|
||||||
|
if (locationInit != null)
|
||||||
|
{
|
||||||
|
var actorPosition = locationInit.Value + new CVec(pastePosition.X - selection.TopLeft.X, pastePosition.Y - selection.TopLeft.Y);
|
||||||
|
if (!map.Contains(actorPosition))
|
||||||
|
continue;
|
||||||
|
|
||||||
copy.RemoveAll<LocationInit>();
|
copy.RemoveAll<LocationInit>();
|
||||||
copy.Add(new LocationInit(actorPosition));
|
copy.Add(new LocationInit(actorPosition));
|
||||||
|
}
|
||||||
|
|
||||||
|
editorActorLayer.Add(copy);
|
||||||
}
|
}
|
||||||
|
|
||||||
editorActorLayer.Add(copy);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +245,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
var resourceLayerContents = tile.ResourceLayerContents;
|
var resourceLayerContents = tile.ResourceLayerContents;
|
||||||
|
|
||||||
// Clear any existing resources.
|
// Clear any existing resources.
|
||||||
if (copyFilters.HasFlag(MapCopyFilters.Resources))
|
if (resourceLayer != null && copyFilters.HasFlag(MapCopyFilters.Resources))
|
||||||
resourceLayer.ClearResources(position);
|
resourceLayer.ClearResources(position);
|
||||||
|
|
||||||
if (copyFilters.HasFlag(MapCopyFilters.Terrain))
|
if (copyFilters.HasFlag(MapCopyFilters.Terrain))
|
||||||
@@ -249,18 +254,22 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
map.Height[position] = tile.Height;
|
map.Height[position] = tile.Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (copyFilters.HasFlag(MapCopyFilters.Resources) && !string.IsNullOrWhiteSpace(resourceLayerContents.Type))
|
if (copyFilters.HasFlag(MapCopyFilters.Resources) &&
|
||||||
resourceLayer.AddResource(resourceLayerContents.Type, position, resourceLayerContents.Density);
|
resourceLayerContents.HasValue &&
|
||||||
|
!string.IsNullOrWhiteSpace(resourceLayerContents.Value.Type))
|
||||||
|
resourceLayer.AddResource(resourceLayerContents.Value.Type, position, resourceLayerContents.Value.Density);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear existing actors.
|
|
||||||
foreach (var regionActor in undoClipboard.CellRegion.SelectMany(editorActorLayer.PreviewsAt).Distinct().ToList())
|
|
||||||
editorActorLayer.Remove(regionActor);
|
|
||||||
|
|
||||||
// Place actors back again.
|
|
||||||
if (copyFilters.HasFlag(MapCopyFilters.Actors))
|
if (copyFilters.HasFlag(MapCopyFilters.Actors))
|
||||||
|
{
|
||||||
|
// Clear existing actors.
|
||||||
|
foreach (var regionActor in undoClipboard.CellRegion.SelectMany(editorActorLayer.PreviewsAt).Distinct().ToList())
|
||||||
|
editorActorLayer.Remove(regionActor);
|
||||||
|
|
||||||
|
// Place actors back again.
|
||||||
foreach (var actor in undoClipboard.Actors.Values)
|
foreach (var actor in undoClipboard.Actors.Values)
|
||||||
editorActorLayer.Add(actor);
|
editorActorLayer.Add(actor);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,8 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
{
|
{
|
||||||
public CellRegion Area;
|
public CellRegion Area;
|
||||||
public EditorActorPreview Actor;
|
public EditorActorPreview Actor;
|
||||||
|
|
||||||
|
public bool HasSelection => Area != null || Actor != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class EditorDefaultBrush : IEditorBrush
|
public sealed class EditorDefaultBrush : IEditorBrush
|
||||||
@@ -33,6 +35,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
const int MinMouseMoveBeforeDrag = 32;
|
const int MinMouseMoveBeforeDrag = 32;
|
||||||
|
|
||||||
public event Action SelectionChanged;
|
public event Action SelectionChanged;
|
||||||
|
public event Action UpdateSelectedTab;
|
||||||
|
|
||||||
readonly WorldRenderer worldRenderer;
|
readonly WorldRenderer worldRenderer;
|
||||||
readonly World world;
|
readonly World world;
|
||||||
@@ -43,7 +46,8 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
public CellRegion CurrentDragBounds => selectionBounds ?? Selection.Area;
|
public CellRegion CurrentDragBounds => selectionBounds ?? Selection.Area;
|
||||||
|
|
||||||
public EditorSelection Selection = new();
|
public EditorSelection Selection { get; private set; } = new();
|
||||||
|
|
||||||
EditorSelection previousSelection;
|
EditorSelection previousSelection;
|
||||||
CellRegion selectionBounds;
|
CellRegion selectionBounds;
|
||||||
int2? selectionStartLocation;
|
int2? selectionStartLocation;
|
||||||
@@ -73,17 +77,34 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
return ((long)pixelDistance << 32) + worldZPosition;
|
return ((long)pixelDistance << 32) + worldZPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearSelection()
|
public void ClearSelection(bool updateSelectedTab = false)
|
||||||
{
|
{
|
||||||
if (Selection.Area != null || Selection.Actor != null)
|
if (Selection.HasSelection)
|
||||||
{
|
{
|
||||||
previousSelection = Selection;
|
previousSelection = Selection;
|
||||||
Selection = new EditorSelection();
|
SetSelection(new EditorSelection());
|
||||||
editorActionManager.Add(new ChangeSelectionAction(this, Selection, previousSelection));
|
editorActionManager.Add(new ChangeSelectionAction(this, Selection, previousSelection));
|
||||||
SelectionChanged?.Invoke();
|
|
||||||
|
if (updateSelectedTab)
|
||||||
|
UpdateSelectedTab?.Invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetSelection(EditorSelection selection)
|
||||||
|
{
|
||||||
|
if (Selection == selection)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Selection.Actor != null)
|
||||||
|
Selection.Actor.Selected = false;
|
||||||
|
|
||||||
|
Selection = selection;
|
||||||
|
if (Selection.Actor != null)
|
||||||
|
Selection.Actor.Selected = true;
|
||||||
|
|
||||||
|
SelectionChanged?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
public bool HandleMouseInput(MouseInput mi)
|
public bool HandleMouseInput(MouseInput mi)
|
||||||
{
|
{
|
||||||
// Exclusively uses mouse wheel and both mouse buttons, but nothing else.
|
// Exclusively uses mouse wheel and both mouse buttons, but nothing else.
|
||||||
@@ -155,14 +176,14 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
{
|
{
|
||||||
// Set this as the editor selection.
|
// Set this as the editor selection.
|
||||||
previousSelection = Selection;
|
previousSelection = Selection;
|
||||||
Selection = new EditorSelection
|
SetSelection(new EditorSelection
|
||||||
{
|
{
|
||||||
Area = selectionBounds
|
Area = selectionBounds
|
||||||
};
|
});
|
||||||
|
|
||||||
editorActionManager.Add(new ChangeSelectionAction(this, Selection, previousSelection));
|
|
||||||
selectionBounds = null;
|
selectionBounds = null;
|
||||||
SelectionChanged?.Invoke();
|
editorActionManager.Add(new ChangeSelectionAction(this, Selection, previousSelection));
|
||||||
|
UpdateSelectedTab?.Invoke();
|
||||||
}
|
}
|
||||||
else if (underCursor != null)
|
else if (underCursor != null)
|
||||||
{
|
{
|
||||||
@@ -170,48 +191,32 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
if (Selection.Actor != underCursor)
|
if (Selection.Actor != underCursor)
|
||||||
{
|
{
|
||||||
previousSelection = Selection;
|
previousSelection = Selection;
|
||||||
Selection = new EditorSelection
|
SetSelection(new EditorSelection
|
||||||
{
|
{
|
||||||
Actor = underCursor,
|
Actor = underCursor,
|
||||||
};
|
});
|
||||||
|
|
||||||
editorActionManager.Add(new ChangeSelectionAction(this, Selection, previousSelection));
|
editorActionManager.Add(new ChangeSelectionAction(this, Selection, previousSelection));
|
||||||
SelectionChanged?.Invoke();
|
UpdateSelectedTab?.Invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Selection.Area != null || Selection.Actor != null)
|
else if (Selection.HasSelection)
|
||||||
{
|
{
|
||||||
// Released left mouse without dragging or selecting an actor - deselect current.
|
// Released left mouse without dragging or selecting an actor - deselect current.
|
||||||
previousSelection = Selection;
|
ClearSelection(updateSelectedTab: true);
|
||||||
Selection = new EditorSelection();
|
|
||||||
|
|
||||||
editorActionManager.Add(new ChangeSelectionAction(this, Selection, previousSelection));
|
|
||||||
SelectionChanged?.Invoke();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (mi.Button == MouseButton.Right)
|
||||||
if (mi.Button == MouseButton.Right)
|
|
||||||
{
|
{
|
||||||
editorWidget.SetTooltip(null);
|
editorWidget.SetTooltip(null);
|
||||||
|
|
||||||
if (Selection.Area != null)
|
// Delete actor.
|
||||||
{
|
if (underCursor != null && underCursor != Selection.Actor)
|
||||||
// Release right mouse button with a selection - clear selection.
|
editorActionManager.Add(new RemoveActorAction(editorLayer, underCursor));
|
||||||
previousSelection = Selection;
|
|
||||||
Selection = new EditorSelection();
|
|
||||||
|
|
||||||
editorActionManager.Add(new ChangeSelectionAction(this, Selection, previousSelection));
|
// Or delete resource if found under cursor.
|
||||||
}
|
if (resourceUnderCursor != null)
|
||||||
else
|
editorActionManager.Add(new RemoveResourceAction(resourceLayer, cell, resourceUnderCursor));
|
||||||
{
|
|
||||||
// Release right mouse button with no selection and over an actor - delete actor.
|
|
||||||
if (underCursor != null && underCursor != Selection.Actor)
|
|
||||||
editorActionManager.Add(new RemoveActorAction(editorLayer, underCursor));
|
|
||||||
|
|
||||||
// Or delete resource if found under cursor.
|
|
||||||
if (resourceUnderCursor != null)
|
|
||||||
editorActionManager.Add(new RemoveResourceAction(resourceLayer, cell, resourceUnderCursor));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,6 +224,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Tick() { }
|
public void Tick() { }
|
||||||
|
|
||||||
public void Dispose() { }
|
public void Dispose() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -271,12 +277,59 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
public void Do()
|
public void Do()
|
||||||
{
|
{
|
||||||
defaultBrush.Selection = selection;
|
defaultBrush.SetSelection(selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Undo()
|
public void Undo()
|
||||||
{
|
{
|
||||||
defaultBrush.Selection = previousSelection;
|
defaultBrush.SetSelection(previousSelection);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sealed class RemoveSelectedActorAction : IEditorAction
|
||||||
|
{
|
||||||
|
[TranslationReference("name", "id")]
|
||||||
|
const string RemovedActor = "notification-removed-actor";
|
||||||
|
|
||||||
|
public string Text { get; }
|
||||||
|
|
||||||
|
readonly EditorSelection selection;
|
||||||
|
readonly EditorDefaultBrush defaultBrush;
|
||||||
|
readonly EditorActorLayer editorActorLayer;
|
||||||
|
readonly EditorActorPreview actor;
|
||||||
|
|
||||||
|
public RemoveSelectedActorAction(
|
||||||
|
EditorDefaultBrush defaultBrush,
|
||||||
|
EditorActorLayer editorActorLayer,
|
||||||
|
EditorActorPreview actor)
|
||||||
|
{
|
||||||
|
this.defaultBrush = defaultBrush;
|
||||||
|
this.editorActorLayer = editorActorLayer;
|
||||||
|
this.actor = actor;
|
||||||
|
selection = new EditorSelection
|
||||||
|
{
|
||||||
|
Actor = defaultBrush.Selection.Actor
|
||||||
|
};
|
||||||
|
|
||||||
|
Text = TranslationProvider.GetString(RemovedActor,
|
||||||
|
Translation.Arguments("name", actor.Info.Name, "id", actor.ID));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Execute()
|
||||||
|
{
|
||||||
|
Do();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Do()
|
||||||
|
{
|
||||||
|
defaultBrush.SetSelection(new EditorSelection());
|
||||||
|
editorActorLayer.Remove(actor);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Undo()
|
||||||
|
{
|
||||||
|
editorActorLayer.Add(actor);
|
||||||
|
defaultBrush.SetSelection(selection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public void Execute()
|
public void Execute()
|
||||||
{
|
{
|
||||||
|
Do();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Do()
|
public void Do()
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
IEnumerable<IRenderable> IRenderAnnotations.RenderAnnotations(Actor self, WorldRenderer wr)
|
IEnumerable<IRenderable> IRenderAnnotations.RenderAnnotations(Actor self, WorldRenderer wr)
|
||||||
{
|
{
|
||||||
if (editor.CurrentBrush == editor.DefaultBrush && editor.DefaultBrush.CurrentDragBounds != null)
|
if (editor.DefaultBrush.CurrentDragBounds != null)
|
||||||
{
|
{
|
||||||
yield return new EditorSelectionAnnotationRenderable(editor.DefaultBrush.CurrentDragBounds, info.AltColor, info.AltPixelOffset, null);
|
yield return new EditorSelectionAnnotationRenderable(editor.DefaultBrush.CurrentDragBounds, info.AltColor, info.AltPixelOffset, null);
|
||||||
yield return new EditorSelectionAnnotationRenderable(editor.DefaultBrush.CurrentDragBounds, info.MainColor, int2.Zero, null);
|
yield return new EditorSelectionAnnotationRenderable(editor.DefaultBrush.CurrentDragBounds, info.MainColor, int2.Zero, null);
|
||||||
|
|||||||
@@ -42,7 +42,8 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
public void ClearBrush() { SetBrush(null); }
|
public void ClearBrush() { SetBrush(null); }
|
||||||
public void SetBrush(IEditorBrush brush)
|
public void SetBrush(IEditorBrush brush)
|
||||||
{
|
{
|
||||||
CurrentBrush?.Dispose();
|
if (CurrentBrush != DefaultBrush)
|
||||||
|
CurrentBrush?.Dispose();
|
||||||
|
|
||||||
CurrentBrush = brush ?? DefaultBrush;
|
CurrentBrush = brush ?? DefaultBrush;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,29 +55,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
ActorIDStatus nextActorIDStatus = ActorIDStatus.Normal;
|
ActorIDStatus nextActorIDStatus = ActorIDStatus.Normal;
|
||||||
string initialActorID;
|
string initialActorID;
|
||||||
|
|
||||||
EditorActorPreview currentActorInner;
|
|
||||||
EditActorPreview editActorPreview;
|
EditActorPreview editActorPreview;
|
||||||
|
|
||||||
EditorActorPreview CurrentActor
|
EditorActorPreview SelectedActor => editor.DefaultBrush.Selection.Actor;
|
||||||
{
|
|
||||||
get => currentActorInner;
|
|
||||||
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (currentActorInner == value)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (currentActorInner != null)
|
|
||||||
{
|
|
||||||
Reset();
|
|
||||||
currentActorInner.Selected = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
currentActorInner = value;
|
|
||||||
if (currentActorInner != null)
|
|
||||||
currentActorInner.Selected = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public ActorEditLogic(Widget widget, World world, WorldRenderer worldRenderer, Dictionary<string, MiniYaml> logicArgs)
|
public ActorEditLogic(Widget widget, World world, WorldRenderer worldRenderer, Dictionary<string, MiniYaml> logicArgs)
|
||||||
@@ -88,8 +68,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
editorActionManager = world.WorldActor.Trait<EditorActionManager>();
|
editorActionManager = world.WorldActor.Trait<EditorActionManager>();
|
||||||
|
|
||||||
editor = widget.Parent.Parent.Get<EditorViewportControllerWidget>("MAP_EDITOR");
|
editor = widget.Parent.Parent.Get<EditorViewportControllerWidget>("MAP_EDITOR");
|
||||||
var selectTabContainer = widget.Parent.Parent.Get<ContainerWidget>("SELECT_WIDGETS");
|
editor.DefaultBrush.SelectionChanged += HandleSelectionChanged;
|
||||||
|
|
||||||
|
var selectTabContainer = widget.Parent.Parent.Get<ContainerWidget>("SELECT_WIDGETS");
|
||||||
actorEditPanel = selectTabContainer.Get<ContainerWidget>("ACTOR_EDIT_PANEL");
|
actorEditPanel = selectTabContainer.Get<ContainerWidget>("ACTOR_EDIT_PANEL");
|
||||||
|
|
||||||
typeLabel = actorEditPanel.Get<LabelWidget>("ACTOR_TYPE_LABEL");
|
typeLabel = actorEditPanel.Get<LabelWidget>("ACTOR_TYPE_LABEL");
|
||||||
@@ -118,8 +99,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
okButton.OnClick = Save;
|
okButton.OnClick = Save;
|
||||||
cancelButton.OnClick = Cancel;
|
cancelButton.OnClick = Cancel;
|
||||||
deleteButton.OnClick = Delete;
|
deleteButton.OnClick = Delete;
|
||||||
actorEditPanel.IsVisible = () => CurrentActor != null
|
actorEditPanel.IsVisible = () => editor.CurrentBrush == editor.DefaultBrush && SelectedActor != null;
|
||||||
&& editor.CurrentBrush == editor.DefaultBrush;
|
|
||||||
|
|
||||||
actorIDField.OnEscKey = _ => actorIDField.YieldKeyboardFocus();
|
actorIDField.OnEscKey = _ => actorIDField.YieldKeyboardFocus();
|
||||||
|
|
||||||
@@ -133,7 +113,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check for duplicate actor ID
|
// Check for duplicate actor ID
|
||||||
if (!CurrentActor.ID.Equals(actorId, StringComparison.OrdinalIgnoreCase) && editorActorLayer[actorId] != null)
|
if (!SelectedActor.ID.Equals(actorId, StringComparison.OrdinalIgnoreCase) && editorActorLayer[actorId] != null)
|
||||||
{
|
{
|
||||||
nextActorIDStatus = ActorIDStatus.Duplicate;
|
nextActorIDStatus = ActorIDStatus.Duplicate;
|
||||||
actorIDErrorLabel.Visible = true;
|
actorIDErrorLabel.Visible = true;
|
||||||
@@ -164,6 +144,185 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
return nextActorIDStatus == ActorIDStatus.Normal;
|
return nextActorIDStatus == ActorIDStatus.Normal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Dispose(bool disposing)
|
||||||
|
{
|
||||||
|
editor.DefaultBrush.SelectionChanged -= HandleSelectionChanged;
|
||||||
|
|
||||||
|
base.Dispose(disposing);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HandleSelectionChanged()
|
||||||
|
{
|
||||||
|
if (SelectedActor != null)
|
||||||
|
{
|
||||||
|
Reset();
|
||||||
|
|
||||||
|
editActorPreview = new EditActorPreview(SelectedActor);
|
||||||
|
|
||||||
|
initialActorID = actorIDField.Text = SelectedActor.ID;
|
||||||
|
|
||||||
|
var font = Game.Renderer.Fonts[typeLabel.Font];
|
||||||
|
var truncatedType = WidgetUtils.TruncateText(TranslationProvider.GetString(SelectedActor.DescriptiveName), typeLabel.Bounds.Width, font);
|
||||||
|
typeLabel.GetText = () => truncatedType;
|
||||||
|
|
||||||
|
actorIDField.CursorPosition = SelectedActor.ID.Length;
|
||||||
|
nextActorIDStatus = ActorIDStatus.Normal;
|
||||||
|
|
||||||
|
// Remove old widgets
|
||||||
|
var oldInitHeight = initContainer.Bounds.Height;
|
||||||
|
initContainer.Bounds.Height = 0;
|
||||||
|
initContainer.RemoveChildren();
|
||||||
|
|
||||||
|
// Add owner dropdown
|
||||||
|
var ownerContainer = dropdownOptionTemplate.Clone();
|
||||||
|
var owner = TranslationProvider.GetString(Owner);
|
||||||
|
ownerContainer.Get<LabelWidget>("LABEL").GetText = () => owner;
|
||||||
|
var ownerDropdown = ownerContainer.Get<DropDownButtonWidget>("OPTION");
|
||||||
|
var selectedOwner = SelectedActor.Owner;
|
||||||
|
|
||||||
|
void UpdateOwner(EditorActorPreview preview, PlayerReference reference)
|
||||||
|
{
|
||||||
|
preview.Owner = reference;
|
||||||
|
preview.ReplaceInit(new OwnerInit(reference.Name));
|
||||||
|
}
|
||||||
|
|
||||||
|
var ownerHandler = new EditorActorOptionActionHandle<PlayerReference>(UpdateOwner, SelectedActor.Owner);
|
||||||
|
editActorPreview.Add(ownerHandler);
|
||||||
|
|
||||||
|
ScrollItemWidget SetupItem(PlayerReference option, ScrollItemWidget template)
|
||||||
|
{
|
||||||
|
var item = ScrollItemWidget.Setup(template, () => selectedOwner == option, () =>
|
||||||
|
{
|
||||||
|
selectedOwner = option;
|
||||||
|
UpdateOwner(SelectedActor, selectedOwner);
|
||||||
|
ownerHandler.OnChange(option);
|
||||||
|
});
|
||||||
|
|
||||||
|
item.Get<LabelWidget>("LABEL").GetText = () => option.Name;
|
||||||
|
item.GetColor = () => option.Color;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
ownerDropdown.GetText = () => selectedOwner.Name;
|
||||||
|
ownerDropdown.GetColor = () => selectedOwner.Color;
|
||||||
|
ownerDropdown.OnClick = () =>
|
||||||
|
{
|
||||||
|
var owners = editorActorLayer.Players.Players.Values.OrderBy(p => p.Name);
|
||||||
|
ownerDropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 270, owners, SetupItem);
|
||||||
|
};
|
||||||
|
|
||||||
|
initContainer.Bounds.Height += ownerContainer.Bounds.Height;
|
||||||
|
initContainer.AddChild(ownerContainer);
|
||||||
|
|
||||||
|
// Add new children for inits
|
||||||
|
var options = SelectedActor.Info.TraitInfos<IEditorActorOptions>()
|
||||||
|
.SelectMany(t => t.ActorOptions(SelectedActor.Info, worldRenderer.World))
|
||||||
|
.OrderBy(o => o.DisplayOrder);
|
||||||
|
|
||||||
|
foreach (var o in options)
|
||||||
|
{
|
||||||
|
if (o is EditorActorCheckbox co)
|
||||||
|
{
|
||||||
|
var checkboxContainer = checkboxOptionTemplate.Clone();
|
||||||
|
checkboxContainer.Bounds.Y = initContainer.Bounds.Height;
|
||||||
|
initContainer.Bounds.Height += checkboxContainer.Bounds.Height;
|
||||||
|
|
||||||
|
var checkbox = checkboxContainer.Get<CheckboxWidget>("OPTION");
|
||||||
|
checkbox.GetText = () => co.Name;
|
||||||
|
|
||||||
|
var editorActionHandle = new EditorActorOptionActionHandle<bool>(co.OnChange, co.GetValue(SelectedActor));
|
||||||
|
editActorPreview.Add(editorActionHandle);
|
||||||
|
|
||||||
|
checkbox.IsChecked = () => co.GetValue(SelectedActor);
|
||||||
|
checkbox.OnClick = () =>
|
||||||
|
{
|
||||||
|
var newValue = co.GetValue(SelectedActor) ^ true;
|
||||||
|
co.OnChange(SelectedActor, newValue);
|
||||||
|
editorActionHandle.OnChange(newValue);
|
||||||
|
};
|
||||||
|
|
||||||
|
initContainer.AddChild(checkboxContainer);
|
||||||
|
}
|
||||||
|
else if (o is EditorActorSlider so)
|
||||||
|
{
|
||||||
|
var sliderContainer = sliderOptionTemplate.Clone();
|
||||||
|
sliderContainer.Bounds.Y = initContainer.Bounds.Height;
|
||||||
|
initContainer.Bounds.Height += sliderContainer.Bounds.Height;
|
||||||
|
sliderContainer.Get<LabelWidget>("LABEL").GetText = () => so.Name;
|
||||||
|
|
||||||
|
var slider = sliderContainer.Get<SliderWidget>("OPTION");
|
||||||
|
slider.MinimumValue = so.MinValue;
|
||||||
|
slider.MaximumValue = so.MaxValue;
|
||||||
|
slider.Ticks = so.Ticks;
|
||||||
|
|
||||||
|
var editorActionHandle = new EditorActorOptionActionHandle<float>(so.OnChange, so.GetValue(SelectedActor));
|
||||||
|
editActorPreview.Add(editorActionHandle);
|
||||||
|
|
||||||
|
slider.GetValue = () => so.GetValue(SelectedActor);
|
||||||
|
slider.OnChange += value => so.OnChange(SelectedActor, value);
|
||||||
|
slider.OnChange += value => editorActionHandle.OnChange(value);
|
||||||
|
|
||||||
|
var valueField = sliderContainer.GetOrNull<TextFieldWidget>("VALUE");
|
||||||
|
if (valueField != null)
|
||||||
|
{
|
||||||
|
void UpdateValueField(float f) => valueField.Text = ((int)f).ToString(NumberFormatInfo.CurrentInfo);
|
||||||
|
UpdateValueField(so.GetValue(SelectedActor));
|
||||||
|
slider.OnChange += UpdateValueField;
|
||||||
|
|
||||||
|
valueField.OnTextEdited = () =>
|
||||||
|
{
|
||||||
|
if (float.TryParse(valueField.Text, out var result))
|
||||||
|
slider.UpdateValue(result);
|
||||||
|
};
|
||||||
|
|
||||||
|
valueField.OnEscKey = _ => { valueField.YieldKeyboardFocus(); return true; };
|
||||||
|
valueField.OnEnterKey = _ => { valueField.YieldKeyboardFocus(); return true; };
|
||||||
|
typableFields.Add(valueField);
|
||||||
|
}
|
||||||
|
|
||||||
|
initContainer.AddChild(sliderContainer);
|
||||||
|
}
|
||||||
|
else if (o is EditorActorDropdown ddo)
|
||||||
|
{
|
||||||
|
var dropdownContainer = dropdownOptionTemplate.Clone();
|
||||||
|
dropdownContainer.Bounds.Y = initContainer.Bounds.Height;
|
||||||
|
initContainer.Bounds.Height += dropdownContainer.Bounds.Height;
|
||||||
|
dropdownContainer.Get<LabelWidget>("LABEL").GetText = () => ddo.Name;
|
||||||
|
|
||||||
|
var editorActionHandle = new EditorActorOptionActionHandle<string>(ddo.OnChange, ddo.GetValue(SelectedActor));
|
||||||
|
editActorPreview.Add(editorActionHandle);
|
||||||
|
|
||||||
|
var dropdown = dropdownContainer.Get<DropDownButtonWidget>("OPTION");
|
||||||
|
ScrollItemWidget DropdownSetup(KeyValuePair<string, string> option, ScrollItemWidget template)
|
||||||
|
{
|
||||||
|
var item = ScrollItemWidget.Setup(template,
|
||||||
|
() => ddo.GetValue(SelectedActor) == option.Key,
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
ddo.OnChange(SelectedActor, option.Key);
|
||||||
|
editorActionHandle.OnChange(option.Key);
|
||||||
|
});
|
||||||
|
|
||||||
|
item.Get<LabelWidget>("LABEL").GetText = () => option.Value;
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
dropdown.GetText = () => ddo.Labels[ddo.GetValue(SelectedActor)];
|
||||||
|
dropdown.OnClick = () => dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 270, ddo.Labels, DropdownSetup);
|
||||||
|
|
||||||
|
initContainer.AddChild(dropdownContainer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buttonContainer.Bounds.Y += initContainer.Bounds.Height - oldInitHeight;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Selected actor is null, hide the border and edit panel.
|
||||||
|
Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void Tick()
|
public override void Tick()
|
||||||
{
|
{
|
||||||
if (actorIDStatus != nextActorIDStatus)
|
if (actorIDStatus != nextActorIDStatus)
|
||||||
@@ -180,188 +339,17 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
actorIDStatus = nextActorIDStatus;
|
actorIDStatus = nextActorIDStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
var actor = editor.DefaultBrush.Selection.Actor;
|
|
||||||
if (actor != null)
|
|
||||||
{
|
|
||||||
// If we changed actor, update details
|
|
||||||
if (CurrentActor != actor)
|
|
||||||
{
|
|
||||||
CurrentActor = actor;
|
|
||||||
|
|
||||||
editActorPreview = new EditActorPreview(CurrentActor);
|
|
||||||
|
|
||||||
initialActorID = actorIDField.Text = actor.ID;
|
|
||||||
|
|
||||||
var font = Game.Renderer.Fonts[typeLabel.Font];
|
|
||||||
var truncatedType = WidgetUtils.TruncateText(actor.DescriptiveName, typeLabel.Bounds.Width, font);
|
|
||||||
typeLabel.GetText = () => truncatedType;
|
|
||||||
|
|
||||||
actorIDField.CursorPosition = actor.ID.Length;
|
|
||||||
nextActorIDStatus = ActorIDStatus.Normal;
|
|
||||||
|
|
||||||
// Remove old widgets
|
|
||||||
var oldInitHeight = initContainer.Bounds.Height;
|
|
||||||
initContainer.Bounds.Height = 0;
|
|
||||||
initContainer.RemoveChildren();
|
|
||||||
|
|
||||||
// Add owner dropdown
|
|
||||||
var ownerContainer = dropdownOptionTemplate.Clone();
|
|
||||||
var owner = TranslationProvider.GetString(Owner);
|
|
||||||
ownerContainer.Get<LabelWidget>("LABEL").GetText = () => owner;
|
|
||||||
var ownerDropdown = ownerContainer.Get<DropDownButtonWidget>("OPTION");
|
|
||||||
var selectedOwner = actor.Owner;
|
|
||||||
|
|
||||||
void UpdateOwner(EditorActorPreview preview, PlayerReference reference)
|
|
||||||
{
|
|
||||||
preview.Owner = reference;
|
|
||||||
preview.ReplaceInit(new OwnerInit(reference.Name));
|
|
||||||
}
|
|
||||||
|
|
||||||
var ownerHandler = new EditorActorOptionActionHandle<PlayerReference>(UpdateOwner, actor.Owner);
|
|
||||||
editActorPreview.Add(ownerHandler);
|
|
||||||
|
|
||||||
ScrollItemWidget SetupItem(PlayerReference option, ScrollItemWidget template)
|
|
||||||
{
|
|
||||||
var item = ScrollItemWidget.Setup(template, () => selectedOwner == option, () =>
|
|
||||||
{
|
|
||||||
selectedOwner = option;
|
|
||||||
UpdateOwner(CurrentActor, selectedOwner);
|
|
||||||
ownerHandler.OnChange(option);
|
|
||||||
});
|
|
||||||
|
|
||||||
item.Get<LabelWidget>("LABEL").GetText = () => option.Name;
|
|
||||||
item.GetColor = () => option.Color;
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
ownerDropdown.GetText = () => selectedOwner.Name;
|
|
||||||
ownerDropdown.GetColor = () => selectedOwner.Color;
|
|
||||||
ownerDropdown.OnClick = () =>
|
|
||||||
{
|
|
||||||
var owners = editorActorLayer.Players.Players.Values.OrderBy(p => p.Name);
|
|
||||||
ownerDropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 270, owners, SetupItem);
|
|
||||||
};
|
|
||||||
|
|
||||||
initContainer.Bounds.Height += ownerContainer.Bounds.Height;
|
|
||||||
initContainer.AddChild(ownerContainer);
|
|
||||||
|
|
||||||
// Add new children for inits
|
|
||||||
var options = actor.Info.TraitInfos<IEditorActorOptions>()
|
|
||||||
.SelectMany(t => t.ActorOptions(actor.Info, worldRenderer.World))
|
|
||||||
.OrderBy(o => o.DisplayOrder);
|
|
||||||
|
|
||||||
foreach (var o in options)
|
|
||||||
{
|
|
||||||
if (o is EditorActorCheckbox co)
|
|
||||||
{
|
|
||||||
var checkboxContainer = checkboxOptionTemplate.Clone();
|
|
||||||
checkboxContainer.Bounds.Y = initContainer.Bounds.Height;
|
|
||||||
initContainer.Bounds.Height += checkboxContainer.Bounds.Height;
|
|
||||||
|
|
||||||
var checkbox = checkboxContainer.Get<CheckboxWidget>("OPTION");
|
|
||||||
checkbox.GetText = () => co.Name;
|
|
||||||
|
|
||||||
var editorActionHandle = new EditorActorOptionActionHandle<bool>(co.OnChange, co.GetValue(actor));
|
|
||||||
editActorPreview.Add(editorActionHandle);
|
|
||||||
|
|
||||||
checkbox.IsChecked = () => co.GetValue(actor);
|
|
||||||
checkbox.OnClick = () =>
|
|
||||||
{
|
|
||||||
var newValue = co.GetValue(actor) ^ true;
|
|
||||||
co.OnChange(actor, newValue);
|
|
||||||
editorActionHandle.OnChange(newValue);
|
|
||||||
};
|
|
||||||
|
|
||||||
initContainer.AddChild(checkboxContainer);
|
|
||||||
}
|
|
||||||
else if (o is EditorActorSlider so)
|
|
||||||
{
|
|
||||||
var sliderContainer = sliderOptionTemplate.Clone();
|
|
||||||
sliderContainer.Bounds.Y = initContainer.Bounds.Height;
|
|
||||||
initContainer.Bounds.Height += sliderContainer.Bounds.Height;
|
|
||||||
sliderContainer.Get<LabelWidget>("LABEL").GetText = () => so.Name;
|
|
||||||
|
|
||||||
var slider = sliderContainer.Get<SliderWidget>("OPTION");
|
|
||||||
slider.MinimumValue = so.MinValue;
|
|
||||||
slider.MaximumValue = so.MaxValue;
|
|
||||||
slider.Ticks = so.Ticks;
|
|
||||||
|
|
||||||
var editorActionHandle = new EditorActorOptionActionHandle<float>(so.OnChange, so.GetValue(actor));
|
|
||||||
editActorPreview.Add(editorActionHandle);
|
|
||||||
|
|
||||||
slider.GetValue = () => so.GetValue(actor);
|
|
||||||
slider.OnChange += value => so.OnChange(actor, value);
|
|
||||||
slider.OnChange += value => editorActionHandle.OnChange(value);
|
|
||||||
|
|
||||||
var valueField = sliderContainer.GetOrNull<TextFieldWidget>("VALUE");
|
|
||||||
if (valueField != null)
|
|
||||||
{
|
|
||||||
void UpdateValueField(float f) => valueField.Text = ((int)f).ToString(NumberFormatInfo.CurrentInfo);
|
|
||||||
UpdateValueField(so.GetValue(actor));
|
|
||||||
slider.OnChange += UpdateValueField;
|
|
||||||
|
|
||||||
valueField.OnTextEdited = () =>
|
|
||||||
{
|
|
||||||
if (float.TryParse(valueField.Text, out var result))
|
|
||||||
slider.UpdateValue(result);
|
|
||||||
};
|
|
||||||
|
|
||||||
valueField.OnEscKey = _ => { valueField.YieldKeyboardFocus(); return true; };
|
|
||||||
valueField.OnEnterKey = _ => { valueField.YieldKeyboardFocus(); return true; };
|
|
||||||
typableFields.Add(valueField);
|
|
||||||
}
|
|
||||||
|
|
||||||
initContainer.AddChild(sliderContainer);
|
|
||||||
}
|
|
||||||
else if (o is EditorActorDropdown ddo)
|
|
||||||
{
|
|
||||||
var dropdownContainer = dropdownOptionTemplate.Clone();
|
|
||||||
dropdownContainer.Bounds.Y = initContainer.Bounds.Height;
|
|
||||||
initContainer.Bounds.Height += dropdownContainer.Bounds.Height;
|
|
||||||
dropdownContainer.Get<LabelWidget>("LABEL").GetText = () => ddo.Name;
|
|
||||||
|
|
||||||
var editorActionHandle = new EditorActorOptionActionHandle<string>(ddo.OnChange, ddo.GetValue(actor));
|
|
||||||
editActorPreview.Add(editorActionHandle);
|
|
||||||
|
|
||||||
var dropdown = dropdownContainer.Get<DropDownButtonWidget>("OPTION");
|
|
||||||
ScrollItemWidget DropdownSetup(KeyValuePair<string, string> option, ScrollItemWidget template)
|
|
||||||
{
|
|
||||||
var item = ScrollItemWidget.Setup(template,
|
|
||||||
() => ddo.GetValue(actor) == option.Key,
|
|
||||||
() =>
|
|
||||||
{
|
|
||||||
ddo.OnChange(actor, option.Key);
|
|
||||||
editorActionHandle.OnChange(option.Key);
|
|
||||||
});
|
|
||||||
|
|
||||||
item.Get<LabelWidget>("LABEL").GetText = () => option.Value;
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
|
|
||||||
dropdown.GetText = () => ddo.Labels[ddo.GetValue(actor)];
|
|
||||||
dropdown.OnClick = () => dropdown.ShowDropDown("LABEL_DROPDOWN_TEMPLATE", 270, ddo.Labels, DropdownSetup);
|
|
||||||
|
|
||||||
initContainer.AddChild(dropdownContainer);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
buttonContainer.Bounds.Y += initContainer.Bounds.Height - oldInitHeight;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (CurrentActor != null)
|
|
||||||
{
|
|
||||||
// Selected actor is null, hide the border and edit panel.
|
|
||||||
Close();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Delete()
|
void Delete()
|
||||||
{
|
{
|
||||||
if (CurrentActor != null)
|
YieldFocus();
|
||||||
editorActionManager.Add(new RemoveActorAction(editorActorLayer, CurrentActor));
|
|
||||||
|
|
||||||
Close();
|
if (SelectedActor != null)
|
||||||
|
editorActionManager.Add(new RemoveSelectedActorAction(
|
||||||
|
editor.DefaultBrush,
|
||||||
|
editorActorLayer,
|
||||||
|
SelectedActor));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Cancel()
|
void Cancel()
|
||||||
@@ -375,19 +363,26 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
editActorPreview?.Reset();
|
editActorPreview?.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Close()
|
void YieldFocus()
|
||||||
{
|
{
|
||||||
actorIDField.YieldKeyboardFocus();
|
actorIDField.YieldKeyboardFocus();
|
||||||
foreach (var f in typableFields)
|
foreach (var f in typableFields)
|
||||||
f.YieldKeyboardFocus();
|
f.YieldKeyboardFocus();
|
||||||
|
}
|
||||||
|
|
||||||
editor.DefaultBrush.Selection.Actor = null;
|
void Close()
|
||||||
CurrentActor = null;
|
{
|
||||||
|
YieldFocus();
|
||||||
|
|
||||||
|
if (SelectedActor != null)
|
||||||
|
{
|
||||||
|
editor.DefaultBrush.ClearSelection(updateSelectedTab: true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Save()
|
void Save()
|
||||||
{
|
{
|
||||||
editorActionManager.Add(new EditActorEditorAction(editorActorLayer, CurrentActor, editActorPreview.GetDirtyHandles()));
|
editorActionManager.Add(new EditActorEditorAction(editorActorLayer, SelectedActor, editActorPreview.GetDirtyHandles()));
|
||||||
editActorPreview = null;
|
editActorPreview = null;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
public class MapEditorSelectionLogic : ChromeLogic
|
public class MapEditorSelectionLogic : ChromeLogic
|
||||||
{
|
{
|
||||||
|
[TranslationReference]
|
||||||
|
const string AreaSelection = "label-area-selection";
|
||||||
|
|
||||||
readonly EditorViewportControllerWidget editor;
|
readonly EditorViewportControllerWidget editor;
|
||||||
readonly WorldRenderer worldRenderer;
|
readonly WorldRenderer worldRenderer;
|
||||||
|
|
||||||
@@ -31,27 +34,24 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
readonly CheckboxWidget copyResourcesCheckbox;
|
readonly CheckboxWidget copyResourcesCheckbox;
|
||||||
readonly CheckboxWidget copyActorsCheckbox;
|
readonly CheckboxWidget copyActorsCheckbox;
|
||||||
readonly EditorActorLayer editorActorLayer;
|
readonly EditorActorLayer editorActorLayer;
|
||||||
|
readonly EditorResourceLayer editorResourceLayer;
|
||||||
|
readonly IResourceLayer resourceLayer;
|
||||||
|
|
||||||
public LabelWidget RegionLabel;
|
public LabelWidget AreaEditTitle;
|
||||||
public LabelWidget DimensionsLabel;
|
|
||||||
public LabelWidget DiagonalLabel;
|
public LabelWidget DiagonalLabel;
|
||||||
public LabelWidget ResourceCounterLabel;
|
public LabelWidget ResourceCounterLabel;
|
||||||
|
|
||||||
MapCopyFilters copyFilters = MapCopyFilters.All;
|
MapCopyFilters copyFilters = MapCopyFilters.All;
|
||||||
EditorClipboard? clipboard;
|
EditorClipboard? clipboard;
|
||||||
|
|
||||||
readonly IResourceLayer resourceLayer;
|
|
||||||
|
|
||||||
readonly EditorResourceLayer editorResourceLayer;
|
|
||||||
|
|
||||||
[ObjectCreator.UseCtor]
|
[ObjectCreator.UseCtor]
|
||||||
public MapEditorSelectionLogic(Widget widget, World world, WorldRenderer worldRenderer)
|
public MapEditorSelectionLogic(Widget widget, World world, WorldRenderer worldRenderer)
|
||||||
{
|
{
|
||||||
this.worldRenderer = worldRenderer;
|
this.worldRenderer = worldRenderer;
|
||||||
|
|
||||||
editorActorLayer = world.WorldActor.Trait<EditorActorLayer>();
|
editorActorLayer = world.WorldActor.Trait<EditorActorLayer>();
|
||||||
resourceLayer = world.WorldActor.Trait<IResourceLayer>();
|
resourceLayer = world.WorldActor.TraitOrDefault<IResourceLayer>();
|
||||||
editorResourceLayer = world.WorldActor.Trait<EditorResourceLayer>();
|
editorResourceLayer = world.WorldActor.TraitOrDefault<EditorResourceLayer>();
|
||||||
|
|
||||||
editor = widget.Get<EditorViewportControllerWidget>("MAP_EDITOR");
|
editor = widget.Get<EditorViewportControllerWidget>("MAP_EDITOR");
|
||||||
editor.DefaultBrush.SelectionChanged += HandleSelectionChanged;
|
editor.DefaultBrush.SelectionChanged += HandleSelectionChanged;
|
||||||
@@ -59,8 +59,8 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
actorEditPanel = selectTabContainer.Get<ContainerWidget>("ACTOR_EDIT_PANEL");
|
actorEditPanel = selectTabContainer.Get<ContainerWidget>("ACTOR_EDIT_PANEL");
|
||||||
areaEditPanel = selectTabContainer.Get<ContainerWidget>("AREA_EDIT_PANEL");
|
areaEditPanel = selectTabContainer.Get<ContainerWidget>("AREA_EDIT_PANEL");
|
||||||
|
|
||||||
actorEditPanel.IsVisible = () => editor.CurrentBrush == editor.DefaultBrush && editor.DefaultBrush.Selection.Actor != null;
|
actorEditPanel.IsVisible = () => editor.DefaultBrush.Selection.Actor != null;
|
||||||
areaEditPanel.IsVisible = () => !actorEditPanel.IsVisible();
|
areaEditPanel.IsVisible = () => editor.DefaultBrush.Selection.Area != null;
|
||||||
|
|
||||||
copyTerrainCheckbox = areaEditPanel.Get<CheckboxWidget>("COPY_FILTER_TERRAIN_CHECKBOX");
|
copyTerrainCheckbox = areaEditPanel.Get<CheckboxWidget>("COPY_FILTER_TERRAIN_CHECKBOX");
|
||||||
copyResourcesCheckbox = areaEditPanel.Get<CheckboxWidget>("COPY_FILTER_RESOURCES_CHECKBOX");
|
copyResourcesCheckbox = areaEditPanel.Get<CheckboxWidget>("COPY_FILTER_RESOURCES_CHECKBOX");
|
||||||
@@ -74,8 +74,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
copyButton.OnClick = () => clipboard = CopySelectionContents();
|
copyButton.OnClick = () => clipboard = CopySelectionContents();
|
||||||
copyButton.IsDisabled = () => editor.DefaultBrush.Selection.Area == null;
|
copyButton.IsDisabled = () => editor.DefaultBrush.Selection.Area == null;
|
||||||
|
|
||||||
RegionLabel = areaEditPanel.Get<LabelWidget>("REGION_COUNTER_LABEL");
|
AreaEditTitle = areaEditPanel.Get<LabelWidget>("AREA_EDIT_TITLE");
|
||||||
DimensionsLabel = areaEditPanel.Get<LabelWidget>("DIMENSION_COUNTER_LABEL");
|
|
||||||
DiagonalLabel = areaEditPanel.Get<LabelWidget>("DIAGONAL_COUNTER_LABEL");
|
DiagonalLabel = areaEditPanel.Get<LabelWidget>("DIAGONAL_COUNTER_LABEL");
|
||||||
ResourceCounterLabel = areaEditPanel.Get<LabelWidget>("RESOURCES_COUNTER_LABEL");
|
ResourceCounterLabel = areaEditPanel.Get<LabelWidget>("RESOURCES_COUNTER_LABEL");
|
||||||
|
|
||||||
@@ -97,7 +96,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
pasteButton.IsHighlighted = () => editor.CurrentBrush is EditorCopyPasteBrush;
|
pasteButton.IsHighlighted = () => editor.CurrentBrush is EditorCopyPasteBrush;
|
||||||
|
|
||||||
var closeAreaSelectionButton = areaEditPanel.Get<ButtonWidget>("SELECTION_CANCEL_BUTTON");
|
var closeAreaSelectionButton = areaEditPanel.Get<ButtonWidget>("SELECTION_CANCEL_BUTTON");
|
||||||
closeAreaSelectionButton.OnClick = () => editor.DefaultBrush.ClearSelection();
|
closeAreaSelectionButton.OnClick = () => editor.DefaultBrush.ClearSelection(updateSelectedTab: true);
|
||||||
|
|
||||||
CreateCategoryPanel(MapCopyFilters.Terrain, copyTerrainCheckbox);
|
CreateCategoryPanel(MapCopyFilters.Terrain, copyTerrainCheckbox);
|
||||||
CreateCategoryPanel(MapCopyFilters.Resources, copyResourcesCheckbox);
|
CreateCategoryPanel(MapCopyFilters.Resources, copyResourcesCheckbox);
|
||||||
@@ -121,7 +120,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
if (!mapTiles.Contains(cell))
|
if (!mapTiles.Contains(cell))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
tiles.Add(cell, new ClipboardTile(mapTiles[cell], mapResources[cell], resourceLayer.GetResource(cell), mapHeight[cell]));
|
tiles.Add(cell, new ClipboardTile(mapTiles[cell], mapResources[cell], resourceLayer?.GetResource(cell), mapHeight[cell]));
|
||||||
|
|
||||||
if (copyFilters.HasFlag(MapCopyFilters.Actors))
|
if (copyFilters.HasFlag(MapCopyFilters.Actors))
|
||||||
foreach (var preview in selection.SelectMany(editorActorLayer.PreviewsAt).Distinct())
|
foreach (var preview in selection.SelectMany(editorActorLayer.PreviewsAt).Distinct())
|
||||||
@@ -150,18 +149,22 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var selectedRegion = editor.DefaultBrush.Selection.Area;
|
var selectedRegion = editor.DefaultBrush.Selection.Area;
|
||||||
if (selectedRegion == null)
|
if (selectedRegion == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (editorResourceLayer == null)
|
||||||
|
return;
|
||||||
|
|
||||||
var selectionSize = selectedRegion.BottomRight - selectedRegion.TopLeft + new CPos(1, 1);
|
var selectionSize = selectedRegion.BottomRight - selectedRegion.TopLeft + new CPos(1, 1);
|
||||||
var diagonalLength = Math.Round(Math.Sqrt(Math.Pow(selectionSize.X, 2) + Math.Pow(selectionSize.Y, 2)), 3);
|
var diagonalLength = Math.Round(Math.Sqrt(Math.Pow(selectionSize.X, 2) + Math.Pow(selectionSize.Y, 2)), 3);
|
||||||
var resourceValueInRegion = editorResourceLayer.CalculateRegionValue(selectedRegion);
|
var resourceValueInRegion = editorResourceLayer.CalculateRegionValue(selectedRegion);
|
||||||
RegionLabel.GetText = () => $"{PositionAsString(selectedRegion.TopLeft)} : {PositionAsString(selectedRegion.BottomRight)}";
|
|
||||||
DimensionsLabel.GetText = () => PositionAsString(selectionSize);
|
var areaSelectionLabel = $"{TranslationProvider.GetString(AreaSelection)} ({DimensionsAsString(selectionSize)}) {PositionAsString(selectedRegion.TopLeft)} : {PositionAsString(selectedRegion.BottomRight)}";
|
||||||
|
|
||||||
|
AreaEditTitle.GetText = () => areaSelectionLabel;
|
||||||
DiagonalLabel.GetText = () => $"{diagonalLength}";
|
DiagonalLabel.GetText = () => $"{diagonalLength}";
|
||||||
ResourceCounterLabel.GetText = () => $"{resourceValueInRegion}$";
|
ResourceCounterLabel.GetText = () => $"${resourceValueInRegion:N0}";
|
||||||
}
|
}
|
||||||
|
|
||||||
static string PositionAsString(CPos cell)
|
static string PositionAsString(CPos cell) => $"{cell.X},{cell.Y}";
|
||||||
{
|
static string DimensionsAsString(CPos cell) => $"{cell.X}x{cell.Y}";
|
||||||
return $"{cell.X},{cell.Y}";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,11 +29,11 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
this.widget = widget;
|
this.widget = widget;
|
||||||
editor = widget.Parent.Parent.Get<EditorViewportControllerWidget>("MAP_EDITOR");
|
editor = widget.Parent.Parent.Get<EditorViewportControllerWidget>("MAP_EDITOR");
|
||||||
editor.DefaultBrush.SelectionChanged += HandleSelectionChanged;
|
editor.DefaultBrush.UpdateSelectedTab += HandleUpdateSelectedTab;
|
||||||
|
|
||||||
tabContainer = widget.Get("MAP_EDITOR_TAB_CONTAINER");
|
tabContainer = widget.Get("MAP_EDITOR_TAB_CONTAINER");
|
||||||
|
|
||||||
SetupTab(null, "SELECT_WIDGETS", MenuType.Select);
|
SetupTab("SELECT_TAB", "SELECT_WIDGETS", MenuType.Select);
|
||||||
SetupTab("TILES_TAB", "TILE_WIDGETS", MenuType.Tiles);
|
SetupTab("TILES_TAB", "TILE_WIDGETS", MenuType.Tiles);
|
||||||
SetupTab("OVERLAYS_TAB", "LAYER_WIDGETS", MenuType.Layers);
|
SetupTab("OVERLAYS_TAB", "LAYER_WIDGETS", MenuType.Layers);
|
||||||
SetupTab("ACTORS_TAB", "ACTOR_WIDGETS", MenuType.Actors);
|
SetupTab("ACTORS_TAB", "ACTOR_WIDGETS", MenuType.Actors);
|
||||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
protected override void Dispose(bool disposing)
|
protected override void Dispose(bool disposing)
|
||||||
{
|
{
|
||||||
editor.DefaultBrush.SelectionChanged -= HandleSelectionChanged;
|
editor.DefaultBrush.UpdateSelectedTab -= HandleUpdateSelectedTab;
|
||||||
|
|
||||||
base.Dispose(disposing);
|
base.Dispose(disposing);
|
||||||
}
|
}
|
||||||
@@ -55,6 +55,9 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var tab = tabContainer.Get<ButtonWidget>(buttonId);
|
var tab = tabContainer.Get<ButtonWidget>(buttonId);
|
||||||
tab.IsHighlighted = () => menuType == tabType;
|
tab.IsHighlighted = () => menuType == tabType;
|
||||||
tab.OnClick = () => menuType = SelectTab(tabType);
|
tab.OnClick = () => menuType = SelectTab(tabType);
|
||||||
|
|
||||||
|
if (tabType == MenuType.Select)
|
||||||
|
tab.IsDisabled = () => !editor.DefaultBrush.Selection.HasSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
var container = widget.Parent.Get<ContainerWidget>(tabId);
|
var container = widget.Parent.Get<ContainerWidget>(tabId);
|
||||||
@@ -63,26 +66,19 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
MenuType SelectTab(MenuType newMenuType)
|
MenuType SelectTab(MenuType newMenuType)
|
||||||
{
|
{
|
||||||
if (menuType == MenuType.Select)
|
|
||||||
{
|
|
||||||
editor.SetBrush(editor.DefaultBrush);
|
|
||||||
editor.DefaultBrush.ClearSelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (newMenuType != MenuType.Select)
|
if (newMenuType != MenuType.Select)
|
||||||
lastSelectedTab = newMenuType;
|
lastSelectedTab = newMenuType;
|
||||||
|
|
||||||
return newMenuType;
|
return newMenuType;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HandleSelectionChanged()
|
void HandleUpdateSelectedTab()
|
||||||
{
|
{
|
||||||
var actor = editor.DefaultBrush.Selection.Actor;
|
var hasSelection = editor.DefaultBrush.Selection.HasSelection;
|
||||||
var area = editor.DefaultBrush.Selection.Area;
|
|
||||||
|
|
||||||
if (menuType != MenuType.Select && (actor != null || area != null))
|
if (menuType != MenuType.Select && hasSelection)
|
||||||
menuType = MenuType.Select;
|
menuType = MenuType.Select;
|
||||||
else if (menuType == MenuType.Select && actor == null && area == null)
|
else if (menuType == MenuType.Select && !hasSelection)
|
||||||
menuType = lastSelectedTab;
|
menuType = lastSelectedTab;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -753,6 +753,9 @@ chrome-radar-gdi:
|
|||||||
editor:
|
editor:
|
||||||
Inherits: ^Chrome
|
Inherits: ^Chrome
|
||||||
Regions:
|
Regions:
|
||||||
|
select: 802, 170, 16, 16
|
||||||
tiles: 768, 170, 16, 16
|
tiles: 768, 170, 16, 16
|
||||||
overlays: 785, 170, 16, 16
|
overlays: 785, 170, 16, 16
|
||||||
|
actors: 802, 68, 16, 16
|
||||||
tools: 904, 68, 16, 16
|
tools: 904, 68, 16, 16
|
||||||
|
history: 904, 51, 16, 16
|
||||||
|
|||||||
@@ -506,7 +506,7 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Label@AREA_EDIT_TITLE:
|
Label@AREA_EDIT_TITLE:
|
||||||
X: 6
|
X: 6
|
||||||
Y: 7
|
Y: 7
|
||||||
Width: 265
|
Width: 278
|
||||||
Height: 24
|
Height: 24
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Bold
|
Font: Bold
|
||||||
@@ -539,71 +539,43 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Text: label-filter-actors
|
Text: label-filter-actors
|
||||||
Label@AREA_INFO_TITLE:
|
Label@AREA_INFO_TITLE:
|
||||||
X: 15
|
X: 15
|
||||||
Y: 150
|
Y: 139
|
||||||
Width: 281
|
Width: 281
|
||||||
Height: 24
|
Height: 24
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Text: label-area-info
|
Text: label-area-info
|
||||||
Label@REGION_LABEL:
|
Label@DIAGONAL_LABEL:
|
||||||
X: 15
|
X: 6
|
||||||
Y: 175
|
Y: 171
|
||||||
Width: 55
|
Width: 55
|
||||||
Height: 20
|
Height: 20
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Align: Left
|
Align: Left
|
||||||
Text: label-selected-area-selected-region
|
|
||||||
Label@DIMENSION_LABEL:
|
|
||||||
X: 15
|
|
||||||
Y: 200
|
|
||||||
Width: 55
|
|
||||||
Height: 25
|
|
||||||
Font: Bold
|
|
||||||
Align: Left
|
|
||||||
Text: label-selected-area-dimension
|
|
||||||
Label@DIAGONAL_LABEL:
|
|
||||||
X: 15
|
|
||||||
Y: 225
|
|
||||||
Width: 55
|
|
||||||
Height: 25
|
|
||||||
Font: Bold
|
|
||||||
Align: Left
|
|
||||||
Text: label-selected-area-diagonal
|
Text: label-selected-area-diagonal
|
||||||
Label@RESOURCE_LABEL:
|
Label@RESOURCE_LABEL:
|
||||||
X: 15
|
X: 6
|
||||||
Y: 250
|
Y: 193
|
||||||
Width: 55
|
Width: 55
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Align: Left
|
Align: Left
|
||||||
Text: label-selected-area-resources
|
Text: label-selected-area-resources
|
||||||
Label@REGION_COUNTER_LABEL:
|
|
||||||
X: 150
|
|
||||||
Y: 175
|
|
||||||
Width: 55
|
|
||||||
Height: 22
|
|
||||||
Align: Left
|
|
||||||
Label@DIMENSION_COUNTER_LABEL:
|
|
||||||
X: 150
|
|
||||||
Y: 200
|
|
||||||
Width: 55
|
|
||||||
Height: 22
|
|
||||||
Align: Left
|
|
||||||
Label@DIAGONAL_COUNTER_LABEL:
|
Label@DIAGONAL_COUNTER_LABEL:
|
||||||
X: 150
|
X: 150
|
||||||
Y: 225
|
Y: 170
|
||||||
Width: 55
|
Width: 55
|
||||||
Height: 22
|
Height: 22
|
||||||
Align: Left
|
Align: Left
|
||||||
Label@RESOURCES_COUNTER_LABEL:
|
Label@RESOURCES_COUNTER_LABEL:
|
||||||
X: 150
|
X: 150
|
||||||
Y: 250
|
Y: 195
|
||||||
Width: 55
|
Width: 55
|
||||||
Height: 22
|
Height: 22
|
||||||
Align: Left
|
Align: Left
|
||||||
Button@SELECTION_CANCEL_BUTTON:
|
Button@SELECTION_CANCEL_BUTTON:
|
||||||
X: 107
|
X: 211
|
||||||
Y: 275
|
Y: 222
|
||||||
Width: 75
|
Width: 75
|
||||||
Height: 25
|
Height: 25
|
||||||
Text: button-selection-cancel
|
Text: button-selection-cancel
|
||||||
@@ -618,7 +590,7 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Label@ACTOR_TYPE_LABEL:
|
Label@ACTOR_TYPE_LABEL:
|
||||||
X: 6
|
X: 6
|
||||||
Y: 2
|
Y: 2
|
||||||
Width: 265
|
Width: 278
|
||||||
Height: 24
|
Height: 24
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Bold
|
Font: Bold
|
||||||
@@ -720,8 +692,22 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Height: 25
|
Height: 25
|
||||||
ClickThrough: false
|
ClickThrough: false
|
||||||
Children:
|
Children:
|
||||||
|
Button@SELECT_TAB:
|
||||||
|
Width: 49
|
||||||
|
Height: 25
|
||||||
|
Key: EditorSelectTab
|
||||||
|
TooltipTemplate: BUTTON_TOOLTIP
|
||||||
|
TooltipText: button-map-editor-tab-container-select.tooltip
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
Children:
|
||||||
|
Image@ICON:
|
||||||
|
X: 20
|
||||||
|
Y: 5
|
||||||
|
ImageCollection: editor
|
||||||
|
ImageName: select
|
||||||
Button@TILES_TAB:
|
Button@TILES_TAB:
|
||||||
Width: 59
|
X: 49
|
||||||
|
Width: 48
|
||||||
Height: 25
|
Height: 25
|
||||||
Key: EditorTilesTab
|
Key: EditorTilesTab
|
||||||
TooltipTemplate: BUTTON_TOOLTIP
|
TooltipTemplate: BUTTON_TOOLTIP
|
||||||
@@ -729,13 +715,13 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
X: 21
|
X: 16
|
||||||
Y: 5
|
Y: 5
|
||||||
ImageCollection: editor
|
ImageCollection: editor
|
||||||
ImageName: tiles
|
ImageName: tiles
|
||||||
Button@OVERLAYS_TAB:
|
Button@OVERLAYS_TAB:
|
||||||
X: 58
|
X: 97
|
||||||
Width: 59
|
Width: 48
|
||||||
Height: 25
|
Height: 25
|
||||||
Key: EditorOverlaysTab
|
Key: EditorOverlaysTab
|
||||||
TooltipTemplate: BUTTON_TOOLTIP
|
TooltipTemplate: BUTTON_TOOLTIP
|
||||||
@@ -743,13 +729,13 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
X: 21
|
X: 16
|
||||||
Y: 5
|
Y: 5
|
||||||
ImageCollection: editor
|
ImageCollection: editor
|
||||||
ImageName: overlays
|
ImageName: overlays
|
||||||
Button@ACTORS_TAB:
|
Button@ACTORS_TAB:
|
||||||
X: 116
|
X: 145
|
||||||
Width: 58
|
Width: 48
|
||||||
Height: 25
|
Height: 25
|
||||||
Key: EditorActorsTab
|
Key: EditorActorsTab
|
||||||
TooltipTemplate: BUTTON_TOOLTIP
|
TooltipTemplate: BUTTON_TOOLTIP
|
||||||
@@ -757,13 +743,13 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
X: 21
|
X: 16
|
||||||
Y: 5
|
Y: 5
|
||||||
ImageCollection: production-icons
|
ImageCollection: editor
|
||||||
ImageName: infantry
|
ImageName: actors
|
||||||
Button@TOOLS_TAB:
|
Button@TOOLS_TAB:
|
||||||
X: 173
|
X: 193
|
||||||
Width: 59
|
Width: 48
|
||||||
Height: 25
|
Height: 25
|
||||||
Key: EditorToolsTab
|
Key: EditorToolsTab
|
||||||
TooltipTemplate: BUTTON_TOOLTIP
|
TooltipTemplate: BUTTON_TOOLTIP
|
||||||
@@ -771,13 +757,13 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
X: 21
|
X: 16
|
||||||
Y: 5
|
Y: 5
|
||||||
ImageCollection: editor
|
ImageCollection: editor
|
||||||
ImageName: tools
|
ImageName: tools
|
||||||
Button@HISTORY_TAB:
|
Button@HISTORY_TAB:
|
||||||
X: 231
|
X: 241
|
||||||
Width: 59
|
Width: 49
|
||||||
Height: 25
|
Height: 25
|
||||||
Key: EditorHistoryTab
|
Key: EditorHistoryTab
|
||||||
TooltipTemplate: BUTTON_TOOLTIP
|
TooltipTemplate: BUTTON_TOOLTIP
|
||||||
@@ -785,10 +771,10 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
X: 21
|
X: 16
|
||||||
Y: 5
|
Y: 5
|
||||||
ImageCollection: sidebar-bits
|
ImageCollection: editor
|
||||||
ImageName: production-tooltip-time
|
ImageName: history
|
||||||
Button@UNDO_BUTTON:
|
Button@UNDO_BUTTON:
|
||||||
X: WINDOW_RIGHT - 764
|
X: WINDOW_RIGHT - 764
|
||||||
Y: 5
|
Y: 5
|
||||||
|
|||||||
@@ -74,8 +74,6 @@ label-actors-bg-categories = Filter:
|
|||||||
label-actors-bg-owners = Owner:
|
label-actors-bg-owners = Owner:
|
||||||
label-area-selection = Area Selection
|
label-area-selection = Area Selection
|
||||||
label-area-info = Area Info
|
label-area-info = Area Info
|
||||||
label-selected-area-selected-region = Region:
|
|
||||||
label-selected-area-dimension = Dimensions:
|
|
||||||
label-selected-area-diagonal = Diagonal:
|
label-selected-area-diagonal = Diagonal:
|
||||||
label-selected-area-resources= Resources:
|
label-selected-area-resources= Resources:
|
||||||
label-copy-filters = Copy Filters
|
label-copy-filters = Copy Filters
|
||||||
@@ -86,6 +84,9 @@ button-selection-cancel = Cancel
|
|||||||
label-show-tile-grid = Show Tile Grid
|
label-show-tile-grid = Show Tile Grid
|
||||||
label-show-buildable-area = Show Buildable Area
|
label-show-buildable-area = Show Buildable Area
|
||||||
|
|
||||||
|
button-map-editor-tab-container-select =
|
||||||
|
.tooltip = Select
|
||||||
|
|
||||||
button-map-editor-tab-container-tiles =
|
button-map-editor-tab-container-tiles =
|
||||||
.tooltip = Tiles
|
.tooltip = Tiles
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 464 KiB After Width: | Height: | Size: 406 KiB |
|
Before Width: | Height: | Size: 853 KiB After Width: | Height: | Size: 1017 KiB |
|
Before Width: | Height: | Size: 178 KiB After Width: | Height: | Size: 166 KiB |
@@ -448,9 +448,9 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Height: WINDOW_BOTTOM - 458
|
Height: WINDOW_BOTTOM - 458
|
||||||
Children:
|
Children:
|
||||||
Label@AREA_EDIT_TITLE:
|
Label@AREA_EDIT_TITLE:
|
||||||
X: 15
|
X: 6
|
||||||
Y: 16
|
Y: 16
|
||||||
Width: 281
|
Width: 298
|
||||||
Height: 24
|
Height: 24
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Bold
|
Font: Bold
|
||||||
@@ -482,72 +482,44 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Height: 20
|
Height: 20
|
||||||
Text: label-filter-actors
|
Text: label-filter-actors
|
||||||
Label@AREA_INFO_TITLE:
|
Label@AREA_INFO_TITLE:
|
||||||
X: 15
|
X: 6
|
||||||
Y: 150
|
Y: 139
|
||||||
Width: 281
|
Width: 298
|
||||||
Height: 24
|
Height: 24
|
||||||
Align: Center
|
Align: Center
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Text: label-area-info
|
Text: label-area-info
|
||||||
Label@REGION_LABEL:
|
|
||||||
X: 15
|
|
||||||
Y: 175
|
|
||||||
Width: 55
|
|
||||||
Height: 20
|
|
||||||
Font: Bold
|
|
||||||
Align: Left
|
|
||||||
Text: label-selected-area-selected-region
|
|
||||||
Label@DIMENSION_LABEL:
|
|
||||||
X: 15
|
|
||||||
Y: 200
|
|
||||||
Width: 55
|
|
||||||
Height: 25
|
|
||||||
Font: Bold
|
|
||||||
Align: Left
|
|
||||||
Text: label-selected-area-dimension
|
|
||||||
Label@DIAGONAL_LABEL:
|
Label@DIAGONAL_LABEL:
|
||||||
X: 15
|
X: 15
|
||||||
Y: 225
|
Y: 171
|
||||||
Width: 55
|
Width: 55
|
||||||
Height: 25
|
Height: 20
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Align: Left
|
Align: Left
|
||||||
Text: label-selected-area-diagonal
|
Text: label-selected-area-diagonal
|
||||||
Label@RESOURCE_LABEL:
|
Label@RESOURCE_LABEL:
|
||||||
X: 15
|
X: 15
|
||||||
Y: 250
|
Y: 193
|
||||||
Width: 55
|
Width: 55
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: Bold
|
Font: Bold
|
||||||
Align: Left
|
Align: Left
|
||||||
Text: label-selected-area-resources
|
Text: label-selected-area-resources
|
||||||
Label@REGION_COUNTER_LABEL:
|
|
||||||
X: 150
|
|
||||||
Y: 175
|
|
||||||
Width: 55
|
|
||||||
Height: 22
|
|
||||||
Align: Left
|
|
||||||
Label@DIMENSION_COUNTER_LABEL:
|
|
||||||
X: 150
|
|
||||||
Y: 200
|
|
||||||
Width: 55
|
|
||||||
Height: 22
|
|
||||||
Align: Left
|
|
||||||
Label@DIAGONAL_COUNTER_LABEL:
|
Label@DIAGONAL_COUNTER_LABEL:
|
||||||
X: 150
|
X: 150
|
||||||
Y: 225
|
Y: 170
|
||||||
Width: 55
|
Width: 55
|
||||||
Height: 22
|
Height: 22
|
||||||
Align: Left
|
Align: Left
|
||||||
Label@RESOURCES_COUNTER_LABEL:
|
Label@RESOURCES_COUNTER_LABEL:
|
||||||
X: 150
|
X: 150
|
||||||
Y: 250
|
Y: 195
|
||||||
Width: 55
|
Width: 55
|
||||||
Height: 22
|
Height: 22
|
||||||
Align: Left
|
Align: Left
|
||||||
Button@SELECTION_CANCEL_BUTTON:
|
Button@SELECTION_CANCEL_BUTTON:
|
||||||
X: 117
|
X: 222
|
||||||
Y: 275
|
Y: 222
|
||||||
Width: 75
|
Width: 75
|
||||||
Height: 25
|
Height: 25
|
||||||
Text: button-selection-cancel
|
Text: button-selection-cancel
|
||||||
@@ -660,9 +632,23 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
Width: 292
|
Width: 292
|
||||||
Height: 25
|
Height: 25
|
||||||
Children:
|
Children:
|
||||||
Button@TILES_TAB:
|
Button@SELECT_TAB:
|
||||||
X: 0
|
X: 0
|
||||||
Width: 58
|
Width: 49
|
||||||
|
Height: 25
|
||||||
|
Key: EditorSelectTab
|
||||||
|
TooltipTemplate: BUTTON_TOOLTIP
|
||||||
|
TooltipText: button-map-editor-tab-container-select.tooltip
|
||||||
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
|
Children:
|
||||||
|
Image@ICON:
|
||||||
|
X: 20
|
||||||
|
Y: 5
|
||||||
|
ImageCollection: editor
|
||||||
|
ImageName: select
|
||||||
|
Button@TILES_TAB:
|
||||||
|
X: 49
|
||||||
|
Width: 49
|
||||||
Height: 25
|
Height: 25
|
||||||
Key: EditorTilesTab
|
Key: EditorTilesTab
|
||||||
TooltipTemplate: BUTTON_TOOLTIP
|
TooltipTemplate: BUTTON_TOOLTIP
|
||||||
@@ -670,13 +656,13 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
X: 21
|
X: 17
|
||||||
Y: 5
|
Y: 5
|
||||||
ImageCollection: editor
|
ImageCollection: editor
|
||||||
ImageName: tiles
|
ImageName: tiles
|
||||||
Button@OVERLAYS_TAB:
|
Button@OVERLAYS_TAB:
|
||||||
X: 58
|
X: 98
|
||||||
Width: 58
|
Width: 49
|
||||||
Height: 25
|
Height: 25
|
||||||
Key: EditorOverlaysTab
|
Key: EditorOverlaysTab
|
||||||
TooltipTemplate: BUTTON_TOOLTIP
|
TooltipTemplate: BUTTON_TOOLTIP
|
||||||
@@ -684,13 +670,13 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
X: 21
|
X: 17
|
||||||
Y: 5
|
Y: 5
|
||||||
ImageCollection: editor
|
ImageCollection: editor
|
||||||
ImageName: overlays
|
ImageName: overlays
|
||||||
Button@ACTORS_TAB:
|
Button@ACTORS_TAB:
|
||||||
X: 116
|
X: 147
|
||||||
Width: 59
|
Width: 48
|
||||||
Height: 25
|
Height: 25
|
||||||
Key: EditorActorsTab
|
Key: EditorActorsTab
|
||||||
TooltipTemplate: BUTTON_TOOLTIP
|
TooltipTemplate: BUTTON_TOOLTIP
|
||||||
@@ -698,13 +684,13 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
X: 21
|
X: 16
|
||||||
Y: 5
|
Y: 5
|
||||||
ImageCollection: production-icons
|
ImageCollection: editor
|
||||||
ImageName: infantry
|
ImageName: actors
|
||||||
Button@TOOLS_TAB:
|
Button@TOOLS_TAB:
|
||||||
X: 175
|
X: 195
|
||||||
Width: 58
|
Width: 48
|
||||||
Height: 25
|
Height: 25
|
||||||
Key: EditorToolsTab
|
Key: EditorToolsTab
|
||||||
TooltipTemplate: BUTTON_TOOLTIP
|
TooltipTemplate: BUTTON_TOOLTIP
|
||||||
@@ -712,13 +698,13 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
X: 21
|
X: 16
|
||||||
Y: 5
|
Y: 5
|
||||||
ImageCollection: editor
|
ImageCollection: editor
|
||||||
ImageName: tools
|
ImageName: tools
|
||||||
Button@HISTORY_TAB:
|
Button@HISTORY_TAB:
|
||||||
X: 233
|
X: 243
|
||||||
Width: 58
|
Width: 49
|
||||||
Height: 25
|
Height: 25
|
||||||
Key: EditorHistoryTab
|
Key: EditorHistoryTab
|
||||||
TooltipTemplate: BUTTON_TOOLTIP
|
TooltipTemplate: BUTTON_TOOLTIP
|
||||||
@@ -726,10 +712,10 @@ Container@EDITOR_WORLD_ROOT:
|
|||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
Children:
|
Children:
|
||||||
Image@ICON:
|
Image@ICON:
|
||||||
X: 21
|
X: 17
|
||||||
Y: 5
|
Y: 5
|
||||||
ImageCollection: sidebar-bits
|
ImageCollection: editor
|
||||||
ImageName: production-tooltip-time
|
ImageName: history
|
||||||
MenuButton@OPTIONS_BUTTON:
|
MenuButton@OPTIONS_BUTTON:
|
||||||
Logic: MenuButtonsChromeLogic
|
Logic: MenuButtonsChromeLogic
|
||||||
MenuContainer: INGAME_MENU
|
MenuContainer: INGAME_MENU
|
||||||
|
|||||||
@@ -34,32 +34,37 @@ EditorPaste: V Ctrl
|
|||||||
Platform:
|
Platform:
|
||||||
OSX: V Meta
|
OSX: V Meta
|
||||||
|
|
||||||
EditorTilesTab: E
|
EditorSelectTab: E
|
||||||
|
Description: Select Tab
|
||||||
|
Types: Editor
|
||||||
|
Contexts: Editor
|
||||||
|
|
||||||
|
EditorTilesTab: R
|
||||||
Description: Tiles Tab
|
Description: Tiles Tab
|
||||||
Types: Editor
|
Types: Editor
|
||||||
Contexts: Editor
|
Contexts: Editor
|
||||||
|
|
||||||
EditorOverlaysTab: R
|
EditorOverlaysTab: T
|
||||||
Description: Overlays Tab
|
Description: Overlays Tab
|
||||||
Types: Editor
|
Types: Editor
|
||||||
Contexts: Editor
|
Contexts: Editor
|
||||||
|
|
||||||
EditorActorsTab: T
|
EditorActorsTab: Y
|
||||||
Description: Actors Tab
|
Description: Actors Tab
|
||||||
Types: Editor
|
Types: Editor
|
||||||
Contexts: Editor
|
Contexts: Editor
|
||||||
|
|
||||||
EditorToolsTab: Y
|
EditorToolsTab: U
|
||||||
Description: Tools Tab
|
Description: Tools Tab
|
||||||
Types: Editor
|
Types: Editor
|
||||||
Contexts: Editor
|
Contexts: Editor
|
||||||
|
|
||||||
EditorHistoryTab: U
|
EditorHistoryTab: I
|
||||||
Description: History Tab
|
Description: History Tab
|
||||||
Types: Editor
|
Types: Editor
|
||||||
Contexts: Editor
|
Contexts: Editor
|
||||||
|
|
||||||
EditorSettingsTab: I
|
EditorSettingsTab: O
|
||||||
Description: Settings Tab
|
Description: Settings Tab
|
||||||
Types: Editor
|
Types: Editor
|
||||||
Contexts: Editor
|
Contexts: Editor
|
||||||
|
|||||||
@@ -74,8 +74,6 @@ label-actors-bg-categories = Filter:
|
|||||||
label-actors-bg-owners = Owner:
|
label-actors-bg-owners = Owner:
|
||||||
label-area-selection = Area Selection
|
label-area-selection = Area Selection
|
||||||
label-area-info = Area Info
|
label-area-info = Area Info
|
||||||
label-selected-area-selected-region = Region:
|
|
||||||
label-selected-area-dimension = Dimensions:
|
|
||||||
label-selected-area-diagonal = Diagonal:
|
label-selected-area-diagonal = Diagonal:
|
||||||
label-selected-area-resources= Resources:
|
label-selected-area-resources= Resources:
|
||||||
label-copy-filters = Copy Filters
|
label-copy-filters = Copy Filters
|
||||||
@@ -86,6 +84,9 @@ button-selection-cancel = Cancel
|
|||||||
label-show-tile-grid = Show Tile Grid
|
label-show-tile-grid = Show Tile Grid
|
||||||
label-show-buildable-area = Show Buildable Area
|
label-show-buildable-area = Show Buildable Area
|
||||||
|
|
||||||
|
button-map-editor-tab-container-select =
|
||||||
|
.tooltip = Select
|
||||||
|
|
||||||
button-map-editor-tab-container-tiles =
|
button-map-editor-tab-container-tiles =
|
||||||
.tooltip = Tiles
|
.tooltip = Tiles
|
||||||
|
|
||||||
|
|||||||
@@ -515,6 +515,9 @@ loadscreen-stripe:
|
|||||||
editor:
|
editor:
|
||||||
Inherits: ^Glyphs
|
Inherits: ^Glyphs
|
||||||
Regions:
|
Regions:
|
||||||
|
select: 51, 144, 16, 16
|
||||||
tiles: 0, 144, 16, 16
|
tiles: 0, 144, 16, 16
|
||||||
overlays: 17, 144, 16, 16
|
overlays: 17, 144, 16, 16
|
||||||
|
actors: 34, 68, 16, 16
|
||||||
tools: 34, 144, 16, 16
|
tools: 34, 144, 16, 16
|
||||||
|
history: 136, 51, 16, 16
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 82 KiB After Width: | Height: | Size: 89 KiB |
|
Before Width: | Height: | Size: 28 KiB After Width: | Height: | Size: 26 KiB |
@@ -659,6 +659,9 @@ separator:
|
|||||||
editor:
|
editor:
|
||||||
Inherits: ^Glyphs
|
Inherits: ^Glyphs
|
||||||
Regions:
|
Regions:
|
||||||
|
select: 34, 187, 16, 16
|
||||||
tiles: 0, 187, 16, 16
|
tiles: 0, 187, 16, 16
|
||||||
overlays: 17, 187, 16, 16
|
overlays: 17, 187, 16, 16
|
||||||
|
actors: 34, 68, 16, 16
|
||||||
tools: 136, 68, 16, 16
|
tools: 136, 68, 16, 16
|
||||||
|
history: 136, 51, 16, 16
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 74 KiB |
|
Before Width: | Height: | Size: 134 KiB After Width: | Height: | Size: 154 KiB |
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 34 KiB |
@@ -790,6 +790,9 @@ loadscreen-stripe:
|
|||||||
editor:
|
editor:
|
||||||
Inherits: ^Glyphs
|
Inherits: ^Glyphs
|
||||||
Regions:
|
Regions:
|
||||||
|
select: 51, 144, 16, 16
|
||||||
tiles: 0, 144, 16, 16
|
tiles: 0, 144, 16, 16
|
||||||
overlays: 17, 144, 16, 16
|
overlays: 17, 144, 16, 16
|
||||||
|
actors: 34, 68, 16, 16
|
||||||
tools: 34, 144, 16, 16
|
tools: 34, 144, 16, 16
|
||||||
|
history: 136, 51, 16, 16
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 72 KiB |
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |