2014-01-10 15:08:39 +00:00
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
|
|
|
{
|
|
|
|
|
//mxd. Encapsulates boring stuff
|
|
|
|
|
internal class BaseFindThing : FindReplaceType
|
|
|
|
|
{
|
|
|
|
|
#region ================== Methods
|
|
|
|
|
|
|
|
|
|
// This is called when a specific object is selected from the list
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public override void ObjectSelected(FindReplaceObject[] selection)
|
|
|
|
|
{
|
|
|
|
|
if(selection.Length == 1)
|
|
|
|
|
{
|
2014-01-10 15:08:39 +00:00
|
|
|
|
ZoomToSelection(selection);
|
|
|
|
|
General.Interface.ShowThingInfo(selection[0].Thing);
|
2014-12-03 23:15:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2014-01-10 15:08:39 +00:00
|
|
|
|
General.Interface.HideInfo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
General.Map.Map.ClearAllSelected();
|
|
|
|
|
foreach(FindReplaceObject obj in selection) obj.Thing.Selected = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Render selection
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public override void RenderThingsSelection(IRenderer2D renderer, FindReplaceObject[] selection)
|
|
|
|
|
{
|
|
|
|
|
foreach(FindReplaceObject o in selection)
|
2016-04-01 10:49:19 +00:00
|
|
|
|
renderer.RenderThing(o.Thing, General.Colors.Selection, General.Settings.ActiveThingsAlpha);
|
2014-01-10 15:08:39 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Edit objects
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public override void EditObjects(FindReplaceObject[] selection)
|
|
|
|
|
{
|
2015-12-29 11:44:32 +00:00
|
|
|
|
HashSet<Thing> things = new HashSet<Thing>();
|
|
|
|
|
foreach(FindReplaceObject o in selection)
|
|
|
|
|
if(!things.Contains(o.Thing)) things.Add(o.Thing);
|
2014-01-10 15:08:39 +00:00
|
|
|
|
General.Interface.ShowEditThings(things);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|