Unstable 0.1300.0.3
This commit is contained in:
@@ -381,15 +381,11 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private void DrawOutputOverLay(SpriteBatch spriteBatch, GUICustomComponent overlayComponent)
|
||||
{
|
||||
if (!outputContainer.Inventory.IsEmpty()) { return; }
|
||||
|
||||
overlayComponent.RectTransform.SetAsLastChild();
|
||||
|
||||
FabricationRecipe targetItem = fabricatedItem ?? selectedItem;
|
||||
if (targetItem != null)
|
||||
{
|
||||
var itemIcon = targetItem.TargetItem.InventoryIcon ?? targetItem.TargetItem.sprite;
|
||||
|
||||
Rectangle slotRect = outputContainer.Inventory.visualSlots[0].Rect;
|
||||
|
||||
if (fabricatedItem != null)
|
||||
@@ -402,11 +398,15 @@ namespace Barotrauma.Items.Components
|
||||
GUI.Style.Green * 0.5f, isFilled: true);
|
||||
}
|
||||
|
||||
itemIcon.Draw(
|
||||
spriteBatch,
|
||||
slotRect.Center.ToVector2(),
|
||||
color: targetItem.TargetItem.InventoryIconColor * 0.4f,
|
||||
scale: Math.Min(slotRect.Width / itemIcon.size.X, slotRect.Height / itemIcon.size.Y) * 0.9f);
|
||||
if (outputContainer.Inventory.IsEmpty())
|
||||
{
|
||||
var itemIcon = targetItem.TargetItem.InventoryIcon ?? targetItem.TargetItem.sprite;
|
||||
itemIcon.Draw(
|
||||
spriteBatch,
|
||||
slotRect.Center.ToVector2(),
|
||||
color: targetItem.TargetItem.InventoryIconColor * 0.4f,
|
||||
scale: Math.Min(slotRect.Width / itemIcon.size.X, slotRect.Height / itemIcon.size.Y) * 0.9f);
|
||||
}
|
||||
}
|
||||
|
||||
if (tooltip != null)
|
||||
|
||||
@@ -16,7 +16,8 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
Default,
|
||||
Disruption,
|
||||
Destructible
|
||||
Destructible,
|
||||
LongRange
|
||||
}
|
||||
|
||||
private PathFinder pathFinder;
|
||||
@@ -69,6 +70,9 @@ namespace Barotrauma.Items.Components
|
||||
private const float DisruptionUpdateInterval = 0.2f;
|
||||
private float disruptionUpdateTimer;
|
||||
|
||||
private const float LongRangeUpdateInterval = 10.0f;
|
||||
private float longRangeUpdateTimer;
|
||||
|
||||
private float showDirectionalIndicatorTimer;
|
||||
|
||||
private readonly List<LevelObject> nearbyObjects = new List<LevelObject>();
|
||||
@@ -122,6 +126,10 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
BlipType.Destructible,
|
||||
new Color[] { Color.TransparentBlack, new Color(74, 113, 75) * 0.8f, new Color(151, 236, 172) * 0.8f, new Color(153, 217, 234) * 0.8f }
|
||||
},
|
||||
{
|
||||
BlipType.LongRange,
|
||||
new Color[] { Color.TransparentBlack, Color.TransparentBlack, new Color(254, 68, 19) * 0.8f, Color.TransparentBlack }
|
||||
}
|
||||
};
|
||||
|
||||
@@ -674,7 +682,6 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
|
||||
disruptionUpdateTimer -= deltaTime;
|
||||
|
||||
for (var pingIndex = 0; pingIndex < activePingsCount; ++pingIndex)
|
||||
{
|
||||
var activePing = activePings[pingIndex];
|
||||
@@ -684,12 +691,44 @@ namespace Barotrauma.Items.Components
|
||||
pingRadius, activePing.PrevPingRadius, displayScale, range / zoom, passive: false, pingStrength: 2.0f);
|
||||
activePing.PrevPingRadius = pingRadius;
|
||||
}
|
||||
|
||||
if (disruptionUpdateTimer <= 0.0f)
|
||||
{
|
||||
disruptionUpdateTimer = DisruptionUpdateInterval;
|
||||
}
|
||||
|
||||
longRangeUpdateTimer -= deltaTime;
|
||||
if (longRangeUpdateTimer <= 0.0f)
|
||||
{
|
||||
foreach (Character c in Character.CharacterList)
|
||||
{
|
||||
if (c.AnimController.CurrentHull != null || !c.Enabled) { continue; }
|
||||
if (c.Params.HideInSonar) { continue; }
|
||||
|
||||
if (!c.IsUnconscious && c.Params.DistantSonarRange > 0.0f &&
|
||||
((c.WorldPosition - transducerCenter) * displayScale).LengthSquared() > DisplayRadius * DisplayRadius)
|
||||
{
|
||||
float dist = Vector2.Distance(c.WorldPosition, transducerCenter);
|
||||
Vector2 targetDir = (c.WorldPosition - transducerCenter) / dist;
|
||||
int blipCount = (int)MathHelper.Clamp(c.Mass, 50, 200);
|
||||
for (int i = 0; i < blipCount; i++)
|
||||
{
|
||||
float angle = Rand.Range(-0.5f, 0.5f);
|
||||
Vector2 blipDir = MathUtils.RotatePoint(targetDir, angle);
|
||||
Vector2 invBlipDir = MathUtils.RotatePoint(targetDir, -angle);
|
||||
var longRangeBlip = new SonarBlip(transducerCenter + blipDir * Range * 0.9f, Rand.Range(1.9f, 2.1f), Rand.Range(1.0f, 1.5f), BlipType.LongRange)
|
||||
{
|
||||
Velocity = -invBlipDir * (MathUtils.Round(Rand.Range(8000.0f, 15000.0f), 2000.0f) - Math.Abs(angle * angle * 10000.0f)),
|
||||
Rotation = (float)Math.Atan2(-invBlipDir.Y, invBlipDir.X),
|
||||
Alpha = MathUtils.Pow2((c.Params.DistantSonarRange - dist) / c.Params.DistantSonarRange)
|
||||
};
|
||||
longRangeBlip.Size.Y *= 5.0f;
|
||||
sonarBlips.Add(longRangeBlip);
|
||||
}
|
||||
}
|
||||
}
|
||||
longRangeUpdateTimer = LongRangeUpdateInterval;
|
||||
}
|
||||
|
||||
if (currentMode == Mode.Active && currentPingIndex != -1)
|
||||
{
|
||||
return;
|
||||
@@ -946,6 +985,19 @@ namespace Barotrauma.Items.Components
|
||||
if (connectedSubs.Contains(sub)) { continue; }
|
||||
if (sub.WorldPosition.Y > Level.Loaded.Size.Y) { continue; }
|
||||
|
||||
if (item.Submarine != null)
|
||||
{
|
||||
//hide enemy team
|
||||
if (sub.TeamID == CharacterTeamType.Team1 && (item.Submarine.TeamID == CharacterTeamType.Team2 || Character.Controlled?.TeamID == CharacterTeamType.Team2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (sub.TeamID == CharacterTeamType.Team2 && (item.Submarine.TeamID == CharacterTeamType.Team1 || Character.Controlled?.TeamID == CharacterTeamType.Team1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
DrawMarker(spriteBatch,
|
||||
sub.Info.DisplayName,
|
||||
sub.Info.HasTag(SubmarineTag.Shuttle) ? "shuttle" : "submarine",
|
||||
@@ -1045,15 +1097,17 @@ namespace Barotrauma.Items.Components
|
||||
foreach (DockingPort dockingPort in DockingPort.List)
|
||||
{
|
||||
if (Level.Loaded != null && dockingPort.Item.Submarine.WorldPosition.Y > Level.Loaded.Size.Y) { continue; }
|
||||
|
||||
if (dockingPort.Item.Submarine == null) { continue; }
|
||||
if (dockingPort.Item.Submarine.Info.IsWreck) { continue; }
|
||||
|
||||
//don't show the docking ports of the opposing team on the sonar
|
||||
if (item.Submarine != null)
|
||||
{
|
||||
if ((dockingPort.Item.Submarine.TeamID == CharacterTeamType.Team1 && item.Submarine.TeamID == CharacterTeamType.Team2) ||
|
||||
(dockingPort.Item.Submarine.TeamID == CharacterTeamType.Team2 && item.Submarine.TeamID == CharacterTeamType.Team1))
|
||||
if (dockingPort.Item.Submarine.TeamID == CharacterTeamType.Team1 && (item.Submarine.TeamID == CharacterTeamType.Team2 || Character.Controlled?.TeamID == CharacterTeamType.Team2))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (dockingPort.Item.Submarine.TeamID == CharacterTeamType.Team2 && (item.Submarine.TeamID == CharacterTeamType.Team1 || Character.Controlled?.TeamID == CharacterTeamType.Team1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -1555,12 +1609,12 @@ namespace Barotrauma.Items.Components
|
||||
float scale = (strength + 3.0f) * blip.Scale * blipScale;
|
||||
Color color = ToolBox.GradientLerp(strength, blipColorGradient[blip.BlipType]);
|
||||
|
||||
sonarBlip.Draw(spriteBatch, center + pos, color, sonarBlip.Origin, blip.Rotation ?? MathUtils.VectorToAngle(pos),
|
||||
sonarBlip.Draw(spriteBatch, center + pos, color * blip.Alpha, sonarBlip.Origin, blip.Rotation ?? MathUtils.VectorToAngle(pos),
|
||||
blip.Size * scale * 0.5f, SpriteEffects.None, 0);
|
||||
|
||||
pos += Rand.Range(0.0f, 1.0f) * dir + Rand.Range(-scale, scale) * normal;
|
||||
|
||||
sonarBlip.Draw(spriteBatch, center + pos, color * 0.5f, sonarBlip.Origin, 0, scale, SpriteEffects.None, 0);
|
||||
sonarBlip.Draw(spriteBatch, center + pos, color * 0.5f * blip.Alpha, sonarBlip.Origin, 0, scale, SpriteEffects.None, 0);
|
||||
}
|
||||
|
||||
private void DrawMarker(SpriteBatch spriteBatch, string label, string iconIdentifier, object targetIdentifier, Vector2 worldPosition, Vector2 transducerPosition, float scale, Vector2 center, float radius,
|
||||
@@ -1778,6 +1832,7 @@ namespace Barotrauma.Items.Components
|
||||
public float? Rotation;
|
||||
public Vector2 Size;
|
||||
public Sonar.BlipType BlipType;
|
||||
public float Alpha = 1.0f;
|
||||
|
||||
public SonarBlip(Vector2 pos, float fadeTimer, float scale, Sonar.BlipType blipType = Sonar.BlipType.Default)
|
||||
{
|
||||
|
||||
@@ -727,7 +727,19 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
pressureWarningText.Visible = item.Submarine != null && item.Submarine.AtDamageDepth && Timing.TotalTime % 1.0f < 0.8f;
|
||||
pressureWarningText.Visible = item.Submarine != null && Timing.TotalTime % 1.0f < 0.8f;
|
||||
float depthEffectThreshold = 500.0f;
|
||||
if (Level.Loaded != null && pressureWarningText.Visible &&
|
||||
item.Submarine.RealWorldDepth > Level.Loaded.RealWorldCrushDepth - depthEffectThreshold && item.Submarine.RealWorldDepth > item.Submarine.RealWorldCrushDepth - depthEffectThreshold)
|
||||
{
|
||||
pressureWarningText.Visible = true;
|
||||
pressureWarningText.Text = item.Submarine.AtDamageDepth ? TextManager.Get("SteeringDepthWarning") : TextManager.Get("SteeringDepthWarningLow").Replace("[crushdepth]", ((int)item.Submarine.RealWorldCrushDepth).ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
pressureWarningText.Visible = false;
|
||||
}
|
||||
|
||||
iceSpireWarningText.Visible = item.Submarine != null && !pressureWarningText.Visible && showIceSpireWarning && Timing.TotalTime % 1.0f < 0.8f;
|
||||
|
||||
if (Vector2.DistanceSquared(PlayerInput.MousePosition, steerArea.Rect.Center.ToVector2()) < steerRadius * steerRadius)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Barotrauma.Networking;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -28,15 +27,7 @@ namespace Barotrauma.Items.Components
|
||||
int x = panelRect.X, y = panelRect.Y;
|
||||
int width = panelRect.Width, height = panelRect.Height;
|
||||
|
||||
Vector2 scale = new Vector2(GUI.Scale);
|
||||
if (panel.GuiFrame.RectTransform.MaxSize.X < int.MaxValue)
|
||||
{
|
||||
scale.X = panel.GuiFrame.RectTransform.MaxSize.X / panel.GuiFrame.Rect.Width;
|
||||
}
|
||||
if (panel.GuiFrame.RectTransform.MaxSize.Y < int.MaxValue)
|
||||
{
|
||||
scale.Y = panel.GuiFrame.RectTransform.MaxSize.Y / panel.GuiFrame.Rect.Height;
|
||||
}
|
||||
Vector2 scale = GetScale(panel.GuiFrame.RectTransform.MaxSize, panel.GuiFrame.Rect.Size);
|
||||
|
||||
bool mouseInRect = panelRect.Contains(PlayerInput.MousePosition);
|
||||
|
||||
@@ -66,15 +57,15 @@ namespace Barotrauma.Items.Components
|
||||
//two passes: first the connector, then the wires to get the wires to render in front
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
Vector2 rightPos = new Vector2(x + width - 80 * scale.X, y + 60 * scale.Y);
|
||||
Vector2 leftPos = new Vector2(x + 80 * scale.X, y + 60 * scale.Y);
|
||||
Vector2 rightPos = GetRightPos(x, y, width, scale);
|
||||
Vector2 leftPos = GetLeftPos(x, y, scale);
|
||||
|
||||
Vector2 rightWirePos = new Vector2(x + width - 5 * scale.X, y + 30 * scale.Y);
|
||||
Vector2 leftWirePos = new Vector2(x + 5 * scale.X, y + 30 * scale.Y);
|
||||
|
||||
int wireInterval = (height - (int)(20 * scale.Y)) / Math.Max(totalWireCount, 1);
|
||||
int connectorIntervalLeft = (height - (int)(100 * scale.Y)) / Math.Max(panel.Connections.Count(c => c.IsOutput), 1);
|
||||
int connectorIntervalRight = (height - (int)(100 * scale.Y)) / Math.Max(panel.Connections.Count(c => !c.IsOutput), 1);
|
||||
int connectorIntervalLeft = GetConnectorIntervalLeft(height, scale, panel);
|
||||
int connectorIntervalRight = GetConnectorIntervalRight(height, scale, panel);
|
||||
|
||||
foreach (Connection c in panel.Connections)
|
||||
{
|
||||
@@ -101,15 +92,12 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
c.DrawConnection(spriteBatch, panel, rightPos,
|
||||
new Vector2(rightPos.X - GUI.SmallFont.MeasureString(c.DisplayName.ToUpper()).X - 25 * panel.Scale, rightPos.Y + 5 * panel.Scale),
|
||||
scale);
|
||||
c.DrawConnection(spriteBatch, panel, rightPos, GetOutputLabelPosition(rightPos, panel, c), scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
c.DrawWires(spriteBatch, panel, rightPos, rightWirePos, mouseInRect, equippedWire, wireInterval);
|
||||
}
|
||||
|
||||
rightPos.Y += connectorIntervalLeft;
|
||||
rightWirePos.Y += c.Wires.Count(w => w != null) * wireInterval;
|
||||
}
|
||||
@@ -117,15 +105,12 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
c.DrawConnection(spriteBatch, panel, leftPos,
|
||||
new Vector2(leftPos.X + 25 * panel.Scale, leftPos.Y - 5 * panel.Scale - GUI.SmallFont.MeasureString(c.DisplayName.ToUpper()).Y),
|
||||
scale);
|
||||
c.DrawConnection(spriteBatch, panel, leftPos, GetInputLabelPosition(leftPos, panel, c), scale);
|
||||
}
|
||||
else
|
||||
{
|
||||
c.DrawWires(spriteBatch, panel, leftPos, leftWirePos, mouseInRect, equippedWire, wireInterval);
|
||||
}
|
||||
|
||||
leftPos.Y += connectorIntervalRight;
|
||||
leftWirePos.Y += c.Wires.Count(w => w != null) * wireInterval;
|
||||
}
|
||||
@@ -215,14 +200,11 @@ namespace Barotrauma.Items.Components
|
||||
private void DrawConnection(SpriteBatch spriteBatch, ConnectionPanel panel, Vector2 position, Vector2 labelPos, Vector2 scale)
|
||||
{
|
||||
string text = DisplayName.ToUpper();
|
||||
Vector2 textSize = GUI.SmallFont.MeasureString(text);
|
||||
|
||||
//nasty
|
||||
var labelSprite = GUI.Style.GetComponentStyle("ConnectionPanelLabel")?.Sprites.Values.First().First();
|
||||
if (labelSprite != null)
|
||||
if (GUI.Style.GetComponentStyle("ConnectionPanelLabel")?.Sprites.Values.First().First() is UISprite labelSprite)
|
||||
{
|
||||
Rectangle labelArea = new Rectangle(labelPos.ToPoint(), textSize.ToPoint());
|
||||
labelArea.Inflate(10 * scale.X, 3 * scale.Y);
|
||||
Rectangle labelArea = GetLabelArea(labelPos, text, scale);
|
||||
labelSprite.Draw(spriteBatch, labelArea, IsPower ? GUI.Style.Red : Color.SteelBlue);
|
||||
}
|
||||
|
||||
@@ -390,5 +372,115 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static bool CheckConnectionLabelOverlap(ConnectionPanel panel, out Point newRectSize)
|
||||
{
|
||||
Rectangle panelRect = panel.GuiFrame.Rect;
|
||||
int x = panelRect.X, y = panelRect.Y;
|
||||
Vector2 scale = GetScale(panel.GuiFrame.RectTransform.MaxSize, panel.GuiFrame.Rect.Size);
|
||||
Vector2 rightPos = GetRightPos(x, y, panelRect.Width, scale);
|
||||
Vector2 leftPos = GetLeftPos(x, y, scale);
|
||||
int connectorIntervalLeft = GetConnectorIntervalLeft(panelRect.Height, scale, panel);
|
||||
int connectorIntervalRight = GetConnectorIntervalRight(panelRect.Height, scale, panel);
|
||||
newRectSize = panelRect.Size;
|
||||
var labelAreas = new List<Rectangle>();
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
labelAreas.Clear();
|
||||
foreach (var c in panel.Connections)
|
||||
{
|
||||
if (c.IsOutput)
|
||||
{
|
||||
var labelArea = GetLabelArea(GetOutputLabelPosition(rightPos, panel, c), c.DisplayName.ToUpper(), scale);
|
||||
labelAreas.Add(labelArea);
|
||||
rightPos.Y += connectorIntervalLeft;
|
||||
}
|
||||
else
|
||||
{
|
||||
var labelArea = GetLabelArea(GetInputLabelPosition(leftPos, panel, c), c.DisplayName.ToUpper(), scale);
|
||||
labelAreas.Add(labelArea);
|
||||
leftPos.Y += connectorIntervalRight;
|
||||
}
|
||||
}
|
||||
bool foundOverlap = false;
|
||||
for (int j = 0; j < labelAreas.Count; j++)
|
||||
{
|
||||
for (int k = 0; k < labelAreas.Count; k++)
|
||||
{
|
||||
if (k == j) { continue; }
|
||||
if (!labelAreas[j].Intersects(labelAreas[k])) { continue; }
|
||||
newRectSize += new Point(10);
|
||||
Point maxSize = new Point(
|
||||
Math.Max(panel.GuiFrame.RectTransform.MaxSize.X, newRectSize.X),
|
||||
Math.Max(panel.GuiFrame.RectTransform.MaxSize.Y, newRectSize.Y));
|
||||
scale = GetScale(maxSize, newRectSize);
|
||||
rightPos = GetRightPos(x, y, newRectSize.X, scale);
|
||||
leftPos = GetLeftPos(x, y, scale);
|
||||
connectorIntervalLeft = GetConnectorIntervalLeft(newRectSize.Y, scale, panel);
|
||||
connectorIntervalRight = GetConnectorIntervalRight(newRectSize.Y, scale, panel);
|
||||
foundOverlap = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!foundOverlap) { break; }
|
||||
}
|
||||
return newRectSize.X != panel.GuiFrame.Rect.Width || newRectSize.Y > panel.GuiFrame.Rect.Height;
|
||||
}
|
||||
|
||||
private static Vector2 GetScale(Point maxSize, Point size)
|
||||
{
|
||||
Vector2 scale = new Vector2(GUI.Scale);
|
||||
if (maxSize.X < int.MaxValue)
|
||||
{
|
||||
scale.X = maxSize.X / size.X;
|
||||
}
|
||||
if (maxSize.Y < int.MaxValue)
|
||||
{
|
||||
scale.Y = maxSize.Y / size.Y;
|
||||
}
|
||||
return scale;
|
||||
}
|
||||
|
||||
private static Vector2 GetInputLabelPosition(Vector2 connectorPosition, ConnectionPanel panel, Connection connection)
|
||||
{
|
||||
return new Vector2(
|
||||
connectorPosition.X + 25 * panel.Scale,
|
||||
connectorPosition.Y - 5 * panel.Scale - GUI.SmallFont.MeasureString(connection.DisplayName.ToUpper()).Y);
|
||||
}
|
||||
|
||||
private static Vector2 GetOutputLabelPosition(Vector2 connectorPosition, ConnectionPanel panel, Connection connection)
|
||||
{
|
||||
return new Vector2(
|
||||
connectorPosition.X - 25 * panel.Scale - GUI.SmallFont.MeasureString(connection.DisplayName.ToUpper()).X,
|
||||
connectorPosition.Y + 5 * panel.Scale);
|
||||
}
|
||||
|
||||
private static Rectangle GetLabelArea(Vector2 labelPos, string text, Vector2 scale)
|
||||
{
|
||||
Vector2 textSize = GUI.SmallFont.MeasureString(text);
|
||||
Rectangle labelArea = new Rectangle(labelPos.ToPoint(), textSize.ToPoint());
|
||||
labelArea.Inflate(10 * scale.X, 3 * scale.Y);
|
||||
return labelArea;
|
||||
}
|
||||
|
||||
private static Vector2 GetLeftPos(int x, int y, Vector2 scale)
|
||||
{
|
||||
return new Vector2(x + 80 * scale.X, y + 60 * scale.Y);
|
||||
}
|
||||
|
||||
private static Vector2 GetRightPos(int x, int y, int width, Vector2 scale)
|
||||
{
|
||||
return new Vector2(x + width - 80 * scale.X, y + 60 * scale.Y);
|
||||
}
|
||||
|
||||
private static int GetConnectorIntervalLeft(int height, Vector2 scale, ConnectionPanel panel)
|
||||
{
|
||||
return (height - (int)(100 * scale.Y)) / Math.Max(panel.Connections.Count(c => c.IsOutput), 1);
|
||||
}
|
||||
|
||||
private static int GetConnectorIntervalRight(int height, Vector2 scale, ConnectionPanel panel)
|
||||
{
|
||||
return (height - (int)(100 * scale.Y)) / Math.Max(panel.Connections.Count(c => !c.IsOutput), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+34
-2
@@ -24,9 +24,15 @@ namespace Barotrauma.Items.Components
|
||||
get { return GuiFrame.Rect.Width / 400.0f; }
|
||||
}
|
||||
|
||||
partial void InitProjSpecific(XElement element)
|
||||
private Point originalMaxSize;
|
||||
private Vector2 originalRelativeSize;
|
||||
|
||||
partial void InitProjSpecific()
|
||||
{
|
||||
if (GuiFrame == null) { return; }
|
||||
originalMaxSize = GuiFrame.RectTransform.MaxSize;
|
||||
originalRelativeSize = GuiFrame.RectTransform.RelativeSize;
|
||||
CheckForLabelOverlap();
|
||||
new GUICustomComponent(new RectTransform(Vector2.One, GuiFrame.RectTransform), DrawConnections, null)
|
||||
{
|
||||
UserData = this
|
||||
@@ -40,7 +46,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
partial void UpdateProjSpecific(float deltaTime)
|
||||
{
|
||||
foreach (Wire wire in DisconnectedWires)
|
||||
foreach (var _ in DisconnectedWires)
|
||||
{
|
||||
if (Rand.Range(0.0f, 500.0f) < 1.0f)
|
||||
{
|
||||
@@ -112,6 +118,32 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnResolutionChanged()
|
||||
{
|
||||
base.OnResolutionChanged();
|
||||
if (GuiFrame == null) { return; }
|
||||
CheckForLabelOverlap();
|
||||
}
|
||||
|
||||
private void CheckForLabelOverlap()
|
||||
{
|
||||
GuiFrame.RectTransform.MaxSize = originalMaxSize;
|
||||
GuiFrame.RectTransform.Resize(originalRelativeSize);
|
||||
if (Connection.CheckConnectionLabelOverlap(this, out Point newRectSize))
|
||||
{
|
||||
int xCenter = (int)(GameMain.GraphicsWidth / 2.0f);
|
||||
int maxNewWidth = 2 * Math.Min(xCenter - HUDLayoutSettings.CrewArea.Right, xCenter - HUDLayoutSettings.ChatBoxArea.Right);
|
||||
int yCenter = (int)(GameMain.GraphicsHeight / 2.0f);
|
||||
int maxNewHeight = 2 * Math.Min(yCenter - HUDLayoutSettings.MessageAreaTop.Bottom, HUDLayoutSettings.InventoryTopY - yCenter);
|
||||
// Make sure we don't expand the panel interface too much
|
||||
newRectSize = new Point(Math.Min(newRectSize.X, maxNewWidth), Math.Min(newRectSize.Y, maxNewHeight));
|
||||
GuiFrame.RectTransform.MaxSize = new Point(
|
||||
Math.Max(GuiFrame.RectTransform.MaxSize.X, newRectSize.X),
|
||||
Math.Max(GuiFrame.RectTransform.MaxSize.Y, newRectSize.Y));
|
||||
GuiFrame.RectTransform.Resize(newRectSize);
|
||||
}
|
||||
}
|
||||
|
||||
public void ClientRead(ServerNetObject type, IReadMessage msg, float sendingTime)
|
||||
{
|
||||
if (GameMain.Client.MidRoundSyncing)
|
||||
|
||||
@@ -67,17 +67,19 @@ namespace Barotrauma.Items.Components
|
||||
item.SendSignal(input, "signal_out");
|
||||
}
|
||||
|
||||
partial void ShowOnDisplay(string input)
|
||||
partial void ShowOnDisplay(string input, bool addToHistory = true)
|
||||
{
|
||||
messageHistory.Add(input);
|
||||
while (messageHistory.Count > MaxMessages)
|
||||
if (addToHistory)
|
||||
{
|
||||
messageHistory.RemoveAt(0);
|
||||
}
|
||||
|
||||
while (historyBox.Content.CountChildren > MaxMessages)
|
||||
{
|
||||
historyBox.RemoveChild(historyBox.Content.Children.First());
|
||||
messageHistory.Add(input);
|
||||
while (messageHistory.Count > MaxMessages)
|
||||
{
|
||||
messageHistory.RemoveAt(0);
|
||||
}
|
||||
while (historyBox.Content.CountChildren > MaxMessages)
|
||||
{
|
||||
historyBox.RemoveChild(historyBox.Content.Children.First());
|
||||
}
|
||||
}
|
||||
|
||||
GUITextBlock newBlock = new GUITextBlock(
|
||||
|
||||
@@ -156,7 +156,8 @@ namespace Barotrauma.Items.Components
|
||||
drawOffset = sub.DrawPosition + sub.HiddenSubPosition;
|
||||
}
|
||||
|
||||
float depth = item.IsSelected ? 0.0f : SubEditorScreen.IsWiringMode() ? 0.02f : wireSprite.Depth + (item.ID % 100) * 0.000001f;// item.GetDrawDepth(wireSprite.Depth, wireSprite);
|
||||
float baseDepth = UseSpriteDepth ? item.SpriteDepth : wireSprite.Depth;
|
||||
float depth = item.IsSelected ? 0.0f : SubEditorScreen.IsWiringMode() ? 0.02f : baseDepth + (item.ID % 100) * 0.000001f;// item.GetDrawDepth(wireSprite.Depth, wireSprite);
|
||||
|
||||
if (item.IsHighlighted)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user