(98ad00fa2) v0.9.1.0
This commit is contained in:
@@ -34,7 +34,8 @@ namespace Barotrauma.Items.Components
|
||||
private GUITickBox directionalTickBox;
|
||||
private GUIScrollBar directionalSlider;
|
||||
|
||||
private GUIComponent activeControlsContainer;
|
||||
private GUILayoutGroup activeControlsContainer;
|
||||
private GUIFrame controlContainer;
|
||||
|
||||
private GUICustomComponent sonarView;
|
||||
|
||||
@@ -76,12 +77,11 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
sonarBlips = new List<SonarBlip>();
|
||||
|
||||
int viewSize = (int)Math.Min(GuiFrame.Rect.Width - 150, GuiFrame.Rect.Height * 0.9f);
|
||||
sonarView = new GUICustomComponent(new RectTransform(new Point(viewSize), GuiFrame.RectTransform, Anchor.CenterLeft),
|
||||
sonarView = new GUICustomComponent(new RectTransform(Point.Zero, GuiFrame.RectTransform, Anchor.CenterLeft),
|
||||
(spriteBatch, guiCustomComponent) => { DrawSonar(spriteBatch, guiCustomComponent.Rect); }, null);
|
||||
|
||||
var controlContainer = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.35f), GuiFrame.RectTransform, Anchor.TopLeft)
|
||||
{ MinSize = new Point(150, 0), AbsoluteOffset = new Point((int)(viewSize * 0.9f), 0) }, "SonarFrame");
|
||||
controlContainer = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.35f), GuiFrame.RectTransform, Anchor.TopLeft)
|
||||
{ MinSize = new Point(150, 0) }, "SonarFrame");
|
||||
|
||||
controlContainer.RectTransform.SetAsFirstChild();
|
||||
|
||||
@@ -200,6 +200,18 @@ namespace Barotrauma.Items.Components
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
SetUILayout();
|
||||
|
||||
GameMain.Instance.OnResolutionChanged += SetUILayout;
|
||||
GameMain.Config.OnHUDScaleChanged += SetUILayout;
|
||||
}
|
||||
|
||||
private void SetUILayout()
|
||||
{
|
||||
int viewSize = (int)Math.Min(GuiFrame.Rect.Width - 150, GuiFrame.Rect.Height * 0.9f);
|
||||
sonarView.RectTransform.NonScaledSize = new Point(viewSize);
|
||||
controlContainer.RectTransform.AbsoluteOffset = new Point((int)(viewSize * 0.9f), 0);
|
||||
}
|
||||
|
||||
public override void OnItemLoaded()
|
||||
@@ -612,6 +624,16 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (Level.Loaded != null && dockingPort.Item.Submarine.WorldPosition.Y > Level.Loaded.Size.Y) { continue; }
|
||||
|
||||
//don't show the docking ports of the opposing team on the sonar
|
||||
if (item.Submarine != null && dockingPort.Item.Submarine != null)
|
||||
{
|
||||
if ((dockingPort.Item.Submarine.TeamID == Character.TeamType.Team1 && item.Submarine.TeamID == Character.TeamType.Team2) ||
|
||||
(dockingPort.Item.Submarine.TeamID == Character.TeamType.Team2 && item.Submarine.TeamID == Character.TeamType.Team1))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
Vector2 offset = (dockingPort.Item.WorldPosition - transducerCenter) * scale;
|
||||
offset.Y = -offset.Y;
|
||||
if (offset.LengthSquared() > DisplayRadius * DisplayRadius) { continue; }
|
||||
|
||||
Reference in New Issue
Block a user