Skip to content

Commit c619a64

Browse files
committed
Improve WireVisibility setting
Update build version
1 parent 04ed03f commit c619a64

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

UI/ElectronicsVisionUI.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ public class ElectronicsVisionUI : UIState
1414

1515
public const int Thickness = 4;
1616

17-
public static float DeviceVisibility { get; set; } = 1f;
18-
public static float WireVisibility { get; set; } = 0.5f;
17+
public const float DeviceVisibility = 1f;
18+
public const float WireVisibility = 0.5f;
1919

2020
protected override void DrawSelf(SpriteBatch spriteBatch)
2121
{
@@ -55,16 +55,16 @@ private static void DrawWires(SpriteBatch spriteBatch)
5555
foreach (var p in ((PinOut)pin).ConnectedPins)
5656
{
5757
var pinWire = pin.Wires.FirstOrDefault(w => w.StartPin == p || w.EndPin == p);
58-
5958
if (pinWire == null) continue;
6059

60+
var vis = WireVisibility;
6161
if (HoverDebuggerUI.Visible)
6262
{
6363
var hoverDevice = ((HoverDebuggerUI)WireMod.Instance.DebuggerHoverUserInterface.CurrentState).Device;
64-
WireVisibility = pin.Device == hoverDevice || p.Device == hoverDevice ? 1f : 0.5f;
64+
if (pin.Device == hoverDevice || p.Device == hoverDevice) vis = 1f;
6565
}
6666

67-
DrawWire(spriteBatch, pinWire);
67+
DrawWire(spriteBatch, pinWire, vis);
6868
}
6969
}
7070

@@ -101,7 +101,7 @@ private static void DrawWireDot(SpriteBatch spriteBatch, Vector2 position, int s
101101
spriteBatch.Draw(Helpers.CreateRectangle(size, size), position - new Vector2(size / 2, size / 2), Color.White * 0.5f * WireVisibility);
102102
}
103103

104-
private static void DrawWire(SpriteBatch spriteBatch, Wire wire)
104+
private static void DrawWire(SpriteBatch spriteBatch, Wire wire, float visibility = WireVisibility)
105105
{
106106
var screenRect = Helpers.GetScreenRect();
107107
var points = wire.GetPoints();
@@ -137,7 +137,7 @@ private static void DrawWire(SpriteBatch spriteBatch, Wire wire)
137137
end.Y -= (Thickness / 2);
138138
}
139139

140-
DrawLine(spriteBatch, start, end, GetWireColor(wire.StartPin.Type == "Out" ? wire.StartPin : wire.EndPin));
140+
DrawLine(spriteBatch, start, end, GetWireColor(wire.StartPin.Type == "Out" ? wire.StartPin : wire.EndPin) * visibility);
141141
}
142142

143143
DrawWireDot(spriteBatch, wire.StartPin.Location.ToWorldCoordinates() - Main.screenPosition - Helpers.Drift);
@@ -150,7 +150,7 @@ private static void DrawLine(SpriteBatch spriteBatch, Vector2 start, Vector2 end
150150
var angle = (float)Math.Atan2(edge.Y, edge.X);
151151

152152
var line = new Rectangle((int)start.X + (Thickness / 2), (int)start.Y, (int)edge.Length(), Thickness);
153-
spriteBatch.Draw(Main.magicPixel, line, null, color * WireVisibility, angle, new Vector2(0, 0), SpriteEffects.None, 1f);
153+
spriteBatch.Draw(Main.magicPixel, line, null, color, angle, new Vector2(0, 0), SpriteEffects.None, 1f);
154154
}
155155

156156
private static Color GetWireColor(Pin pin)

build.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
author = matlomax
2-
version = 0.9.4
2+
version = 0.9.5
33
displayName = WireMod
44
homepage = https://github.com/MatLomax/WireMod/wiki

0 commit comments

Comments
 (0)