Fixed highlighting items when highlighting a wire in a connection panel
This commit is contained in:
@@ -24,7 +24,7 @@ namespace Barotrauma.Items.Components
|
||||
private Item item;
|
||||
|
||||
public readonly bool IsOutput;
|
||||
|
||||
|
||||
private static Wire draggingConnected;
|
||||
|
||||
private List<StatusEffect> effects;
|
||||
@@ -423,8 +423,7 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (mouseOn)
|
||||
{
|
||||
item.IsHighlighted = true;
|
||||
wire.Item.IsHighlighted = true;
|
||||
ConnectionPanel.HighlightedWire = wire;
|
||||
|
||||
if (!wire.Locked)
|
||||
{
|
||||
|
||||
@@ -7,7 +7,9 @@ using System.Xml.Linq;
|
||||
namespace Barotrauma.Items.Components
|
||||
{
|
||||
class ConnectionPanel : ItemComponent
|
||||
{
|
||||
{
|
||||
public static Wire HighlightedWire;
|
||||
|
||||
public List<Connection> Connections;
|
||||
|
||||
Character user;
|
||||
@@ -33,15 +35,29 @@ namespace Barotrauma.Items.Components
|
||||
IsActive = true;
|
||||
}
|
||||
|
||||
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
|
||||
public override void UpdateHUD(Character character)
|
||||
{
|
||||
if (character != Character.Controlled || character != user) return;
|
||||
|
||||
if (Screen.Selected != GameMain.EditMapScreen &&
|
||||
character.IsKeyHit(InputType.Select) &&
|
||||
character.SelectedConstruction==this.item) character.SelectedConstruction = null;
|
||||
|
||||
character.IsKeyHit(InputType.Select) &&
|
||||
character.SelectedConstruction == this.item) character.SelectedConstruction = null;
|
||||
|
||||
if (HighlightedWire != null)
|
||||
{
|
||||
HighlightedWire.Item.IsHighlighted = true;
|
||||
if (HighlightedWire.Connections[0].Item != null) HighlightedWire.Connections[0].Item.IsHighlighted = true;
|
||||
if (HighlightedWire.Connections[1].Item != null) HighlightedWire.Connections[1].Item.IsHighlighted = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawHUD(SpriteBatch spriteBatch, Character character)
|
||||
{
|
||||
if (character != Character.Controlled || character != user) return;
|
||||
|
||||
HighlightedWire = null;
|
||||
Connection.DrawConnections(spriteBatch, this, character);
|
||||
|
||||
}
|
||||
|
||||
public override XElement Save(XElement parentElement)
|
||||
|
||||
@@ -398,14 +398,14 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
foreach (WireSection section in sections)
|
||||
{
|
||||
section.Draw(spriteBatch, Color.Gold, drawOffset, depth, 0.5f);
|
||||
section.Draw(spriteBatch, Color.Gold, drawOffset, depth + 0.00001f, 0.7f);
|
||||
}
|
||||
}
|
||||
else if (item.IsSelected)
|
||||
{
|
||||
foreach (WireSection section in sections)
|
||||
{
|
||||
section.Draw(spriteBatch, Color.Red, drawOffset, depth, 0.5f);
|
||||
section.Draw(spriteBatch, Color.Red, drawOffset, depth + 0.00001f, 0.7f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -768,8 +768,6 @@ namespace Barotrauma
|
||||
inWater = IsInWater();
|
||||
if (inWater) ApplyStatusEffects(ActionType.InWater, deltaTime);
|
||||
|
||||
isHighlighted = false;
|
||||
|
||||
if (body == null || !body.Enabled) return;
|
||||
|
||||
if (Math.Abs(body.LinearVelocity.X) > 0.01f || Math.Abs(body.LinearVelocity.Y) > 0.01f)
|
||||
|
||||
@@ -115,6 +115,11 @@ namespace Barotrauma
|
||||
}
|
||||
#endif
|
||||
|
||||
foreach (MapEntity e in MapEntity.mapEntityList)
|
||||
{
|
||||
e.IsHighlighted = false;
|
||||
}
|
||||
|
||||
if (GameMain.GameSession != null) GameMain.GameSession.Update((float)deltaTime);
|
||||
|
||||
if (Level.Loaded != null) Level.Loaded.Update((float)deltaTime);
|
||||
|
||||
Reference in New Issue
Block a user