2014-09-12 21:08:11 +00:00
|
|
|
|
#region ================== Namespaces
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
using CodeImp.DoomBuilder.Map;
|
2012-08-29 10:09:02 +00:00
|
|
|
|
using CodeImp.DoomBuilder.Rendering;
|
|
|
|
|
|
2014-09-12 21:08:11 +00:00
|
|
|
|
#endregion
|
|
|
|
|
|
2014-09-30 12:02:41 +00:00
|
|
|
|
namespace CodeImp.DoomBuilder.BuilderModes
|
|
|
|
|
{
|
2014-09-12 21:08:11 +00:00
|
|
|
|
public class ResultUnknownThing : ErrorResult
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
#region ================== Variables
|
|
|
|
|
|
|
|
|
|
private readonly Thing thing;
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Properties
|
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
|
public override int Buttons { get { return 1; } }
|
|
|
|
|
public override string Button1Text { get { return "Delete Thing"; } }
|
2012-08-29 10:09:02 +00:00
|
|
|
|
|
2014-09-12 21:08:11 +00:00
|
|
|
|
#endregion
|
2012-08-29 10:09:02 +00:00
|
|
|
|
|
2014-09-12 21:08:11 +00:00
|
|
|
|
#region ================== Constructor / Destructor
|
|
|
|
|
|
|
|
|
|
public ResultUnknownThing(Thing t)
|
|
|
|
|
{
|
2012-08-29 10:09:02 +00:00
|
|
|
|
// Initialize
|
2014-09-12 21:08:11 +00:00
|
|
|
|
thing = t;
|
|
|
|
|
viewobjects.Add(t);
|
|
|
|
|
hidden = t.IgnoredErrorChecks.Contains(this.GetType()); //mxd
|
|
|
|
|
description = "This thing has unknown type (eg. it's not defined in DECORATE or current game configuration).";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region ================== Methods
|
|
|
|
|
|
|
|
|
|
// This sets if this result is displayed in ErrorCheckForm (mxd)
|
|
|
|
|
internal override void Hide(bool hide)
|
|
|
|
|
{
|
|
|
|
|
hidden = hide;
|
|
|
|
|
Type t = this.GetType();
|
|
|
|
|
if(hide) thing.IgnoredErrorChecks.Add(t);
|
|
|
|
|
else if(thing.IgnoredErrorChecks.Contains(t)) thing.IgnoredErrorChecks.Remove(t);
|
2012-08-29 10:09:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
2013-09-11 09:47:53 +00:00
|
|
|
|
// This must return the string that is displayed in the listbox
|
2014-09-12 21:08:11 +00:00
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
2015-12-28 15:01:53 +00:00
|
|
|
|
return "Thing " + thing.Index + " has unknown type (" + thing.Type + ").";
|
2012-08-29 10:09:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Rendering
|
2014-09-12 21:08:11 +00:00
|
|
|
|
public override void RenderOverlaySelection(IRenderer2D renderer)
|
|
|
|
|
{
|
2016-04-01 10:49:19 +00:00
|
|
|
|
renderer.RenderThing(thing, General.Colors.Selection, General.Settings.ActiveThingsAlpha);
|
2012-08-29 10:09:02 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// This removes the thing
|
2014-09-12 21:08:11 +00:00
|
|
|
|
public override bool Button1Click(bool batchMode)
|
|
|
|
|
{
|
2013-06-04 14:43:26 +00:00
|
|
|
|
if(!batchMode) General.Map.UndoRedo.CreateUndo("Delete thing");
|
2012-08-29 10:09:02 +00:00
|
|
|
|
thing.Dispose();
|
|
|
|
|
General.Map.IsChanged = true;
|
|
|
|
|
General.Map.ThingsFilter.Update();
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2014-09-12 21:08:11 +00:00
|
|
|
|
|
|
|
|
|
#endregion
|
2013-09-11 09:47:53 +00:00
|
|
|
|
}
|
2012-08-29 10:09:02 +00:00
|
|
|
|
}
|