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 BaseFindSector : 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.ShowSectorInfo(selection[0].Sector);
|
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.Sector.Selected = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Render selection
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public override void PlotSelection(IRenderer2D renderer, FindReplaceObject[] selection)
|
|
|
|
|
{
|
|
|
|
|
foreach(FindReplaceObject o in selection)
|
|
|
|
|
{
|
|
|
|
|
foreach(Sidedef sd in o.Sector.Sidedefs)
|
2014-01-10 15:08:39 +00:00
|
|
|
|
renderer.PlotLinedef(sd.Line, General.Colors.Selection);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//mxd. Render selection highlight
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public override void RenderOverlaySelection(IRenderer2D renderer, FindReplaceObject[] selection)
|
|
|
|
|
{
|
2014-01-10 15:08:39 +00:00
|
|
|
|
if(!BuilderPlug.Me.UseHighlight) return;
|
|
|
|
|
|
|
|
|
|
int color = General.Colors.Selection.WithAlpha(64).ToInt();
|
2014-12-03 23:15:26 +00:00
|
|
|
|
foreach(FindReplaceObject o in selection)
|
2014-01-10 15:08:39 +00:00
|
|
|
|
renderer.RenderHighlight(o.Sector.FlatVertices, color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Edit objects
|
2014-12-03 23:15:26 +00:00
|
|
|
|
public override void EditObjects(FindReplaceObject[] selection)
|
|
|
|
|
{
|
2014-01-10 15:08:39 +00:00
|
|
|
|
List<Sector> sectors = new List<Sector>(selection.Length);
|
|
|
|
|
foreach(FindReplaceObject o in selection) sectors.Add(o.Sector);
|
|
|
|
|
General.Interface.ShowEditSectors(sectors);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|