using Barotrauma.Extensions;
using Barotrauma.Networking;
using FarseerPhysics;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace Barotrauma.Items.Components
{
partial class Sonar : Powered, IServerSerializable, IClientSerializable
{
public enum BlipType
{
Default,
Disruption,
Destructible,
Door,
LongRange
}
private PathFinder pathFinder;
private readonly bool dynamicDockingIndicator = true;
private bool unsentChanges;
private float networkUpdateTimer;
public GUIButton SonarModeSwitch { get; private set; }
private GUITickBox activeTickBox, passiveTickBox;
private GUITextBlock signalWarningText;
private GUIFrame lowerAreaFrame;
private GUIScrollBar zoomSlider;
private GUIButton directionalModeSwitch;
private Vector2? pingDragDirection = null;
///
/// Can be null if the property HasMineralScanner is false
///
private GUIButton mineralScannerSwitch;
private GUIFrame controlContainer;
private GUICustomComponent sonarView;
private Sprite directionalPingBackground;
private Sprite[] directionalPingButton;
private Sprite pingCircle, directionalPingCircle;
private Sprite screenOverlay, screenBackground;
private Sprite sonarBlip;
private Sprite lineSprite;
private readonly Dictionary> targetIcons = new Dictionary>();
private float displayBorderSize;
private List sonarBlips;
private float prevPassivePingRadius;
private Vector2 center;
///
/// Current scale of the display, taking zoom into account. In other words, the scaling factor of world coordinates to coordinates on the display.
///
public float DisplayScale
{
get;
private set;
} = 1.0f;
private const float DisruptionUpdateInterval = 0.2f;
private float disruptionUpdateTimer;
private const float LongRangeUpdateInterval = 10.0f;
private float longRangeUpdateTimer;
private float showDirectionalIndicatorTimer;
private readonly List nearbyObjects = new List();
private const float NearbyObjectUpdateInterval = 1.0f;
float nearbyObjectUpdateTimer;
private readonly List connectedSubs = new List();
private const float ConnectedSubUpdateInterval = 1.0f;
float connectedSubUpdateTimer;
private readonly List<(Vector2 pos, float strength)> disruptedDirections = new List<(Vector2 pos, float strength)>();
private readonly Dictionary