Fixed highlighting items when highlighting a wire in a connection panel

This commit is contained in:
Regalis
2016-11-12 18:26:47 +02:00
parent 7fa660d38e
commit 0353732e7e
5 changed files with 30 additions and 12 deletions
@@ -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)