Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop
This commit is contained in:
@@ -61,7 +61,24 @@ namespace Barotrauma
|
||||
//the position and dimensions of the entity
|
||||
protected Rectangle rect;
|
||||
|
||||
public bool ExternalHighlight = false;
|
||||
protected static readonly HashSet<MapEntity> highlightedEntities = new HashSet<MapEntity>();
|
||||
|
||||
public static IEnumerable<MapEntity> HighlightedEntities => highlightedEntities;
|
||||
|
||||
|
||||
private bool externalHighlight = false;
|
||||
public bool ExternalHighlight
|
||||
{
|
||||
get { return externalHighlight; }
|
||||
set
|
||||
{
|
||||
if (value != externalHighlight)
|
||||
{
|
||||
externalHighlight = value;
|
||||
CheckIsHighlighted();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//is the mouse inside the rect
|
||||
private bool isHighlighted;
|
||||
@@ -69,7 +86,14 @@ namespace Barotrauma
|
||||
public bool IsHighlighted
|
||||
{
|
||||
get { return isHighlighted || ExternalHighlight; }
|
||||
set { isHighlighted = value; }
|
||||
set
|
||||
{
|
||||
if (value != IsHighlighted)
|
||||
{
|
||||
isHighlighted = value;
|
||||
CheckIsHighlighted();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public virtual Rectangle Rect
|
||||
@@ -160,7 +184,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (!float.IsNaN(value))
|
||||
{
|
||||
_spriteOverrideDepth = MathHelper.Clamp(value, 0.001f, 0.999f);
|
||||
_spriteOverrideDepth = MathHelper.Clamp(value, 0.001f, 0.999999f);
|
||||
if (this is Item) { _spriteOverrideDepth = Math.Min(_spriteOverrideDepth, 0.9f); }
|
||||
SpriteDepthOverrideIsSet = true;
|
||||
}
|
||||
@@ -364,6 +388,31 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
|
||||
protected virtual void CheckIsHighlighted()
|
||||
{
|
||||
if (IsHighlighted || ExternalHighlight)
|
||||
{
|
||||
highlightedEntities.Add(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
highlightedEntities.Remove(this);
|
||||
}
|
||||
}
|
||||
|
||||
private static readonly List<MapEntity> tempHighlightedEntities = new List<MapEntity>();
|
||||
public static void ClearHighlightedEntities()
|
||||
{
|
||||
highlightedEntities.RemoveWhere(e => e.Removed);
|
||||
tempHighlightedEntities.Clear();
|
||||
tempHighlightedEntities.AddRange(highlightedEntities);
|
||||
foreach (var entity in tempHighlightedEntities)
|
||||
{
|
||||
entity.IsHighlighted = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public abstract MapEntity Clone();
|
||||
|
||||
public static List<MapEntity> Clone(List<MapEntity> entitiesToClone)
|
||||
@@ -675,6 +724,9 @@ namespace Barotrauma
|
||||
List<MapEntity> entities = new List<MapEntity>();
|
||||
foreach (var element in parentElement.Elements())
|
||||
{
|
||||
#if CLIENT
|
||||
GameMain.GameSession?.Campaign?.ThrowIfStartRoundCancellationRequested();
|
||||
#endif
|
||||
string typeName = element.Name.ToString();
|
||||
|
||||
Type t;
|
||||
|
||||
Reference in New Issue
Block a user