Bunch of editor improvements/bugfixes: free node positioning when placing wires, options to hide hulls, gaps & links, hidden entities can't be selected, more accurate stair selecting, disabled UImessages, camera position fixes
This commit is contained in:
@@ -55,7 +55,19 @@ namespace Barotrauma.Items.Components
|
||||
linkedGap = e as Gap;
|
||||
if (linkedGap != null) return linkedGap;
|
||||
}
|
||||
linkedGap = new Gap(item.Rect, Item.Submarine);
|
||||
Rectangle rect = item.Rect;
|
||||
if (isHorizontal)
|
||||
{
|
||||
rect.Y += 5;
|
||||
rect.Height += 10;
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.X -= 5;
|
||||
rect.Width += 10;
|
||||
}
|
||||
|
||||
linkedGap = new Gap(rect, Item.Submarine);
|
||||
linkedGap.Submarine = item.Submarine;
|
||||
linkedGap.Open = openState;
|
||||
item.linkedTo.Add(linkedGap);
|
||||
@@ -341,7 +353,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
doorSprite.Remove();
|
||||
|
||||
convexHull.Remove();
|
||||
if (convexHull!=null) convexHull.Remove();
|
||||
if (convexHull2 != null) convexHull2.Remove();
|
||||
}
|
||||
|
||||
|
||||
@@ -173,18 +173,19 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
item.FindHull();
|
||||
|
||||
Vector2 position = item.Position;
|
||||
position.X = MathUtils.Round(item.Position.X, nodeDistance);
|
||||
if (item.CurrentHull == null)
|
||||
{
|
||||
position.Y = MathUtils.Round(item.Position.Y, nodeDistance);
|
||||
}
|
||||
else
|
||||
{
|
||||
position.Y -= item.CurrentHull.Rect.Y - item.CurrentHull.Rect.Height;
|
||||
position.Y = Math.Max(MathUtils.Round(position.Y, nodeDistance), heightFromFloor);
|
||||
position.Y += item.CurrentHull.Rect.Y - item.CurrentHull.Rect.Height;
|
||||
}
|
||||
//Vector2 position = item.Position;
|
||||
|
||||
//position.X = MathUtils.Round(item.Position.X, nodeDistance);
|
||||
//if (item.CurrentHull == null)
|
||||
//{
|
||||
// position.Y = MathUtils.Round(item.Position.Y, nodeDistance);
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
// position.Y -= item.CurrentHull.Rect.Y - item.CurrentHull.Rect.Height;
|
||||
// position.Y = Math.Max(MathUtils.Round(position.Y, nodeDistance), heightFromFloor);
|
||||
// position.Y += item.CurrentHull.Rect.Y - item.CurrentHull.Rect.Height;
|
||||
//}
|
||||
|
||||
newNodePos = RoundNode(item.Position, item.CurrentHull)-Submarine.HiddenSubPosition;
|
||||
|
||||
@@ -249,16 +250,26 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private Vector2 RoundNode(Vector2 position, Hull hull)
|
||||
{
|
||||
position.X = MathUtils.Round(position.X, nodeDistance);
|
||||
if (hull == null)
|
||||
if (Screen.Selected == GameMain.EditMapScreen)
|
||||
{
|
||||
position.Y = MathUtils.Round(position.Y, nodeDistance);
|
||||
//position = GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition) - Submarine.Loaded.Position;// Nodes[(int)selectedNodeIndex];
|
||||
|
||||
position.X = MathUtils.Round(position.X, Submarine.GridSize.X / 2.0f);
|
||||
position.Y = MathUtils.Round(position.Y, Submarine.GridSize.Y / 2.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
position.Y -= hull.Rect.Y - hull.Rect.Height;
|
||||
position.Y = Math.Max(MathUtils.Round(position.Y, nodeDistance), heightFromFloor);
|
||||
position.Y += hull.Rect.Y -hull.Rect.Height;
|
||||
position.X = MathUtils.Round(position.X, nodeDistance);
|
||||
if (hull == null)
|
||||
{
|
||||
position.Y = MathUtils.Round(position.Y, nodeDistance);
|
||||
}
|
||||
else
|
||||
{
|
||||
position.Y -= hull.Rect.Y - hull.Rect.Height;
|
||||
position.Y = Math.Max(MathUtils.Round(position.Y, nodeDistance), heightFromFloor);
|
||||
position.Y += hull.Rect.Y -hull.Rect.Height;
|
||||
}
|
||||
}
|
||||
|
||||
return position;
|
||||
@@ -322,11 +333,13 @@ namespace Barotrauma.Items.Components
|
||||
for (int i = 0; i < Nodes.Count; i++)
|
||||
{
|
||||
Vector2 worldPos = Nodes[i];
|
||||
if (item.Submarine != null) worldPos += item.Submarine.Position + Submarine.HiddenSubPosition;
|
||||
if (Submarine.Loaded != null) worldPos += Submarine.Loaded.Position + Submarine.HiddenSubPosition;
|
||||
worldPos.Y = -worldPos.Y;
|
||||
|
||||
GUI.DrawRectangle(spriteBatch, worldPos + new Vector2(-3, -3), new Vector2(6, 6), item.Color, true, 0.0f);
|
||||
|
||||
if (IsActive) continue;
|
||||
|
||||
if (GUIComponent.MouseOn != null ||
|
||||
Vector2.Distance(GameMain.EditMapScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), new Vector2(worldPos.X, -worldPos.Y)) > 10.0f)
|
||||
{
|
||||
@@ -382,10 +395,10 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
private void DrawSection(SpriteBatch spriteBatch, Vector2 start, Vector2 end, Color color)
|
||||
{
|
||||
if (item.Submarine!=null)
|
||||
if (Submarine.Loaded!=null)
|
||||
{
|
||||
start += item.Submarine.DrawPosition+Submarine.HiddenSubPosition;
|
||||
end += item.Submarine.DrawPosition+Submarine.HiddenSubPosition;
|
||||
start += Submarine.Loaded.DrawPosition + Submarine.HiddenSubPosition;
|
||||
end += Submarine.Loaded.DrawPosition + Submarine.HiddenSubPosition;
|
||||
}
|
||||
|
||||
start.Y = -start.Y;
|
||||
|
||||
@@ -29,6 +29,8 @@ namespace Barotrauma
|
||||
public static ItemSpawner Spawner = new ItemSpawner();
|
||||
public static ItemRemover Remover = new ItemRemover();
|
||||
|
||||
public static bool ShowLinks = true;
|
||||
|
||||
private List<string> tags;
|
||||
|
||||
public Hull CurrentHull;
|
||||
@@ -698,6 +700,8 @@ namespace Barotrauma
|
||||
Color.Green);
|
||||
}
|
||||
|
||||
if (!ShowLinks) return;
|
||||
|
||||
foreach (MapEntity e in linkedTo)
|
||||
{
|
||||
GUI.DrawLine(spriteBatch,
|
||||
@@ -727,7 +731,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (entity == this || !entity.IsHighlighted) continue;
|
||||
if (linkedTo.Contains(entity)) continue;
|
||||
if (!entity.Contains(position)) continue;
|
||||
if (!entity.IsMouseOn(position)) continue;
|
||||
|
||||
linkedTo.Add(entity);
|
||||
if (entity.IsLinkable && entity.linkedTo != null) entity.linkedTo.Add(this);
|
||||
@@ -790,7 +794,7 @@ namespace Barotrauma
|
||||
|
||||
foreach (var objectProperty in editableProperties)
|
||||
{
|
||||
new GUITextBlock(new Rectangle(0, y, 100, 20), objectProperty.Name, Color.Transparent, Color.White, Alignment.Left, null, editingHUD);
|
||||
new GUITextBlock(new Rectangle(0, y, 100, 20), objectProperty.Name, Color.Transparent, Color.White, Alignment.Left, GUI.Style, editingHUD);
|
||||
|
||||
int height = 20;
|
||||
var editable = objectProperty.Attributes.OfType<Editable>().FirstOrDefault<Editable>();
|
||||
@@ -905,11 +909,9 @@ namespace Barotrauma
|
||||
transformedTrigger.Y - transformedTrigger.Height / 2.0f);
|
||||
|
||||
dist = MathHelper.Min(Math.Abs(triggerCenter.X - displayPos.X), Math.Abs(triggerCenter.Y-displayPos.Y));
|
||||
dist = ConvertUnits.ToSimUnits(dist);
|
||||
if (dist > closestDist && closest!=null) continue;
|
||||
|
||||
dist = MathHelper.Min(Math.Abs(triggerCenter.X - displayPickPos.X), Math.Abs(triggerCenter.Y - displayPickPos.Y));
|
||||
dist = ConvertUnits.ToSimUnits(dist);
|
||||
if (closest == null || dist < closestDist)
|
||||
{
|
||||
closest = item;
|
||||
@@ -993,7 +995,8 @@ namespace Barotrauma
|
||||
|
||||
if (tempRequiredSkill != null) requiredSkill = tempRequiredSkill;
|
||||
|
||||
if (!ignoreRequiredItems && !ic.HasRequiredItems(picker, picker == Character.Controlled)) continue;
|
||||
bool showUiMsg = picker == Character.Controlled && Screen.Selected != GameMain.EditMapScreen;
|
||||
if (!ignoreRequiredItems && !ic.HasRequiredItems(picker, showUiMsg)) continue;
|
||||
if ((ic.CanBePicked && pickHit && ic.Pick(picker)) ||
|
||||
(ic.CanBeSelected && selectHit && ic.Select(picker)))
|
||||
{
|
||||
@@ -1133,7 +1136,7 @@ namespace Barotrauma
|
||||
|
||||
private bool EnterProperty(GUITextBox textBox, string text)
|
||||
{
|
||||
textBox.Color = Color.White;
|
||||
textBox.Color = Color.DarkGreen;
|
||||
|
||||
var objectProperty = textBox.UserData as ObjectProperty;
|
||||
if (objectProperty == null) return false;
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace Barotrauma
|
||||
var item = new Item(new Rectangle((int)position.X, (int)position.Y, (int)sprite.size.X, (int)sprite.size.Y), this, Submarine.Loaded);
|
||||
//constructor.Invoke(lobject);
|
||||
item.Submarine = Submarine.Loaded;
|
||||
item.SetTransform(ConvertUnits.ToSimUnits(item.Position - Submarine.Loaded.Position), 0.0f);
|
||||
item.SetTransform(ConvertUnits.ToSimUnits(Submarine.Loaded==null ? item.Position : item.Position - Submarine.Loaded.Position), 0.0f);
|
||||
item.FindHull();
|
||||
|
||||
placePosition = Vector2.Zero;
|
||||
|
||||
@@ -13,6 +13,8 @@ namespace Barotrauma
|
||||
{
|
||||
public static List<Gap> GapList = new List<Gap>();
|
||||
|
||||
public static bool ShowGaps = true;
|
||||
|
||||
public bool isHorizontal;
|
||||
|
||||
//private Sound waterSound;
|
||||
@@ -65,6 +67,10 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public Gap(Rectangle rectangle)
|
||||
: this (rectangle, Submarine.Loaded)
|
||||
{ }
|
||||
|
||||
public Gap(Rectangle newRect, Submarine submarine)
|
||||
: this(newRect, newRect.Width < newRect.Height, submarine)
|
||||
{ }
|
||||
@@ -102,9 +108,9 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Contains(Vector2 position)
|
||||
public override bool IsMouseOn(Vector2 position)
|
||||
{
|
||||
return (Submarine.RectContains(WorldRect, position) &&
|
||||
return (ShowGaps && Submarine.RectContains(WorldRect, position) &&
|
||||
!Submarine.RectContains(MathUtils.ExpandRect(WorldRect, -5), position));
|
||||
}
|
||||
|
||||
@@ -162,10 +168,11 @@ namespace Barotrauma
|
||||
|
||||
GUI.DrawLine(sb, center + Vector2.One * 5.0f, center + lerpedFlowForce / 10.0f + Vector2.One * 5.0f, Color.Orange);
|
||||
}
|
||||
|
||||
if (!editing) return;
|
||||
|
||||
if (!editing || !ShowGaps) return;
|
||||
|
||||
Color clr = (open == 0.0f) ? Color.Red : Color.Cyan;
|
||||
if (isHighlighted) clr = Color.Gold;
|
||||
|
||||
GUI.DrawRectangle(sb, new Rectangle(WorldRect.X, -WorldRect.Y, rect.Width, rect.Height), clr * 0.5f, true);
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace Barotrauma
|
||||
public static List<Hull> hullList = new List<Hull>();
|
||||
private static EntityGrid entityGrid;
|
||||
|
||||
public static bool ShowHulls = true;
|
||||
|
||||
public static bool EditWater, EditFire;
|
||||
|
||||
public static WaterRenderer renderer;
|
||||
@@ -186,8 +188,10 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public override bool Contains(Vector2 position)
|
||||
public override bool IsMouseOn(Vector2 position)
|
||||
{
|
||||
if (!GameMain.DebugDraw && !ShowHulls) return false;
|
||||
|
||||
return (Submarine.RectContains(WorldRect, position) &&
|
||||
!Submarine.RectContains(MathUtils.ExpandRect(WorldRect, -8), position));
|
||||
}
|
||||
@@ -228,7 +232,7 @@ namespace Barotrauma
|
||||
|
||||
//renderer.Dispose();
|
||||
|
||||
entityGrid.RemoveEntity(this);
|
||||
if (entityGrid!=null) entityGrid.RemoveEntity(this);
|
||||
|
||||
hullList.Remove(this);
|
||||
}
|
||||
@@ -371,6 +375,8 @@ namespace Barotrauma
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true)
|
||||
{
|
||||
if (!ShowHulls && !GameMain.DebugDraw) return;
|
||||
|
||||
if (!editing && !GameMain.DebugDraw) return;
|
||||
|
||||
Rectangle drawRect =
|
||||
|
||||
@@ -152,7 +152,7 @@ namespace Barotrauma
|
||||
rect.Y += (int)amount.Y;
|
||||
}
|
||||
|
||||
public virtual bool Contains(Vector2 position)
|
||||
public virtual bool IsMouseOn(Vector2 position)
|
||||
{
|
||||
return (Submarine.RectContains(WorldRect, position));
|
||||
}
|
||||
@@ -268,7 +268,7 @@ namespace Barotrauma
|
||||
if (highLightedEntity == null || e.Sprite == null ||
|
||||
(highLightedEntity.Sprite!=null && e.Sprite.Depth < highLightedEntity.Sprite.Depth))
|
||||
{
|
||||
if (e.Contains(position)) highLightedEntity = e;
|
||||
if (e.IsMouseOn(position)) highLightedEntity = e;
|
||||
}
|
||||
e.isSelected = false;
|
||||
}
|
||||
@@ -359,7 +359,7 @@ namespace Barotrauma
|
||||
//if clicking a selected entity, start moving it
|
||||
foreach (MapEntity e in selectedList)
|
||||
{
|
||||
if (e.Contains(position)) startMovingPos = position;
|
||||
if (e.IsMouseOn(position)) startMovingPos = position;
|
||||
}
|
||||
|
||||
selectionPos = position;
|
||||
@@ -415,6 +415,16 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
if (editingHUD == null) return;
|
||||
|
||||
foreach (GUIComponent component in editingHUD.children)
|
||||
{
|
||||
var textBox = component as GUITextBox;
|
||||
if (textBox == null) continue;
|
||||
|
||||
textBox.Deselect();
|
||||
}
|
||||
|
||||
editingHUD = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,8 +117,13 @@ namespace Barotrauma
|
||||
|
||||
if (placePosition == Vector2.Zero)
|
||||
{
|
||||
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed)
|
||||
placePosition = Submarine.MouseToWorldGrid(cam);
|
||||
Vector2 position = Submarine.MouseToWorldGrid(cam);
|
||||
|
||||
GUI.DrawLine(spriteBatch, new Vector2(position.X-GameMain.GraphicsWidth, -position.Y), new Vector2(position.X+GameMain.GraphicsWidth, -position.Y), Color.White);
|
||||
|
||||
GUI.DrawLine(spriteBatch, new Vector2(position.X, position.Y - GameMain.GraphicsHeight), new Vector2(position.X, position.Y+GameMain.GraphicsHeight), Color.White);
|
||||
|
||||
if (PlayerInput.GetMouseState.LeftButton == ButtonState.Pressed) placePosition = position;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -268,6 +268,27 @@ namespace Barotrauma
|
||||
|
||||
InsertToList();
|
||||
}
|
||||
|
||||
public override bool IsMouseOn(Vector2 position)
|
||||
{
|
||||
if (StairDirection == Direction.None)
|
||||
{
|
||||
return base.IsMouseOn(position);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!base.IsMouseOn(position)) return false;
|
||||
|
||||
if (StairDirection == Direction.Left)
|
||||
{
|
||||
return MathUtils.LineToPointDistance(new Vector2(rect.X, rect.Y), new Vector2(rect.Right, rect.Y - rect.Height), position)< 40.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
return MathUtils.LineToPointDistance(new Vector2(rect.X,rect.Y-rect.Height), new Vector2(rect.Right, rect.Y), position) <40.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Remove()
|
||||
{
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Barotrauma
|
||||
{
|
||||
public static List<WayPoint> WayPointList = new List<WayPoint>();
|
||||
|
||||
public static bool ShowWayPoints, ShowSpawnPoints;
|
||||
public static bool ShowWayPoints = true, ShowSpawnPoints = true;
|
||||
|
||||
private SpawnType spawnType;
|
||||
|
||||
@@ -75,6 +75,10 @@ namespace Barotrauma
|
||||
ConnectedGap = gap;
|
||||
}
|
||||
|
||||
public WayPoint(Rectangle rectangle)
|
||||
: this (rectangle, Submarine.Loaded)
|
||||
{ }
|
||||
|
||||
public WayPoint(Rectangle newRect, Submarine submarine)
|
||||
: base (submarine)
|
||||
{
|
||||
@@ -88,18 +92,18 @@ namespace Barotrauma
|
||||
currentHull = Hull.FindHull(WorldPosition);
|
||||
}
|
||||
|
||||
public override bool IsMouseOn(Vector2 position)
|
||||
{
|
||||
if (IsHidden()) return false;
|
||||
|
||||
return base.IsMouseOn(position);
|
||||
}
|
||||
|
||||
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back=true)
|
||||
{
|
||||
if (!editing && !GameMain.DebugDraw) return;
|
||||
|
||||
if (spawnType == SpawnType.Path)
|
||||
{
|
||||
if (!GameMain.DebugDraw && !ShowWayPoints) return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!GameMain.DebugDraw && !ShowSpawnPoints) return;
|
||||
}
|
||||
if (IsHidden()) return;
|
||||
|
||||
Rectangle drawRect =
|
||||
Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height);
|
||||
@@ -119,6 +123,18 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsHidden()
|
||||
{
|
||||
if (spawnType == SpawnType.Path)
|
||||
{
|
||||
return (!GameMain.DebugDraw && !ShowWayPoints);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (!GameMain.DebugDraw && !ShowSpawnPoints);
|
||||
}
|
||||
}
|
||||
|
||||
public override void DrawEditing(SpriteBatch spriteBatch, Camera cam)
|
||||
{
|
||||
if (editingHUD == null || editingHUD.UserData != this)
|
||||
@@ -247,6 +263,8 @@ namespace Barotrauma
|
||||
|
||||
foreach (Hull hull in Hull.hullList)
|
||||
{
|
||||
if (hull.Rect.Height < 150) continue;
|
||||
|
||||
WayPoint prevWaypoint = null;
|
||||
|
||||
if (hull.Rect.Width<minDist*3.0f)
|
||||
|
||||
@@ -33,10 +33,10 @@ namespace Barotrauma
|
||||
get { return selectedTab; }
|
||||
}
|
||||
|
||||
//public string GetSubName()
|
||||
//{
|
||||
// return ((Submarine.Loaded == null) ? "" : Submarine.Loaded.Name);
|
||||
//}
|
||||
public string GetSubName()
|
||||
{
|
||||
return ((Submarine.Loaded == null) ? "" : Submarine.Loaded.Name);
|
||||
}
|
||||
|
||||
private string GetItemCount()
|
||||
{
|
||||
@@ -57,7 +57,7 @@ namespace Barotrauma
|
||||
public EditMapScreen()
|
||||
{
|
||||
cam = new Camera();
|
||||
cam.Translate(new Vector2(-10.0f, 50.0f));
|
||||
//cam.Translate(new Vector2(-10.0f, 50.0f));
|
||||
|
||||
selectedTab = -1;
|
||||
|
||||
@@ -69,10 +69,10 @@ namespace Barotrauma
|
||||
|
||||
|
||||
|
||||
new GUITextBlock(new Rectangle(0, 20, 0, 20), "Submarine:", GUI.Style, GUIpanel);
|
||||
nameBox = new GUITextBox(new Rectangle(0, 40, 0, 20), GUI.Style, GUIpanel);
|
||||
nameBox.OnEnterPressed = ChangeSubName;
|
||||
//nameBlock.TextGetter = GetSubName;
|
||||
var nameBlock =new GUITextBlock(new Rectangle(0, 20, 0, 20), "Submarine:", GUI.Style, GUIpanel);
|
||||
//nameBox = new GUITextBox(new Rectangle(0, 40, 0, 20), GUI.Style, GUIpanel);
|
||||
//nameBox.OnEnterPressed = ChangeSubName;
|
||||
nameBlock.TextGetter = GetSubName;
|
||||
|
||||
GUIButton button = new GUIButton(new Rectangle(0,70,0,20), "Save", GUI.Style, GUIpanel);
|
||||
button.OnClicked = SaveSub;
|
||||
@@ -162,11 +162,24 @@ namespace Barotrauma
|
||||
|
||||
new GUITextBlock(new Rectangle(0, y, 0, 20), "Show:", GUI.Style, GUIpanel);
|
||||
|
||||
|
||||
|
||||
var tickBox = new GUITickBox(new Rectangle(0,y+20,20,20), "Waypoints", Alignment.TopLeft, GUIpanel);
|
||||
tickBox.OnSelected = (GUITickBox obj) => { WayPoint.ShowWayPoints = !WayPoint.ShowWayPoints; return true; };
|
||||
tickBox = new GUITickBox(new Rectangle(0, y + 40, 20, 20), "Spawnpoints", Alignment.TopLeft, GUIpanel);
|
||||
tickBox.Selected = true;
|
||||
tickBox = new GUITickBox(new Rectangle(0, y + 45, 20, 20), "Spawnpoints", Alignment.TopLeft, GUIpanel);
|
||||
tickBox.OnSelected = (GUITickBox obj) => { WayPoint.ShowSpawnPoints = !WayPoint.ShowSpawnPoints; return true; };
|
||||
|
||||
tickBox.Selected = true;
|
||||
tickBox = new GUITickBox(new Rectangle(0, y + 70, 20, 20), "Links", Alignment.TopLeft, GUIpanel);
|
||||
tickBox.OnSelected = (GUITickBox obj) => { Item.ShowLinks = !Item.ShowLinks; return true; };
|
||||
tickBox.Selected = true;
|
||||
tickBox = new GUITickBox(new Rectangle(0, y + 95, 20, 20), "Hulls", Alignment.TopLeft, GUIpanel);
|
||||
tickBox.OnSelected = (GUITickBox obj) => { Hull.ShowHulls = !Hull.ShowHulls; return true; };
|
||||
tickBox.Selected = true;
|
||||
tickBox = new GUITickBox(new Rectangle(0, y + 120, 20, 20), "Gaps", Alignment.TopLeft, GUIpanel);
|
||||
tickBox.OnSelected = (GUITickBox obj) => { Gap.ShowGaps = !Gap.ShowGaps; return true; };
|
||||
tickBox.Selected = true;
|
||||
|
||||
}
|
||||
|
||||
public void StartTutorial()
|
||||
@@ -186,9 +199,14 @@ namespace Barotrauma
|
||||
if (Submarine.Loaded != null)
|
||||
{
|
||||
cam.Position = Submarine.Loaded.Position + Submarine.HiddenSubPosition;
|
||||
nameBox.Text = Submarine.Loaded.Name;
|
||||
//nameBox.Text = Submarine.Loaded.Name;
|
||||
}
|
||||
//CreateDummyCharacter();
|
||||
else
|
||||
{
|
||||
cam.Position = Submarine.HiddenSubPosition;
|
||||
}
|
||||
|
||||
cam.UpdateTransform();
|
||||
}
|
||||
|
||||
public override void Deselect()
|
||||
@@ -354,7 +372,7 @@ namespace Barotrauma
|
||||
MapEntity.UpdateSelecting(cam);
|
||||
}
|
||||
|
||||
|
||||
GUIComponent.MouseOn = null;
|
||||
GUIpanel.Update((float)deltaTime);
|
||||
if (selectedTab > -1)
|
||||
{
|
||||
|
||||
@@ -188,6 +188,12 @@ namespace Barotrauma
|
||||
return (r >= 0 && r <= 1) && (s >= 0 && s <= 1);
|
||||
}
|
||||
|
||||
public static float LineToPointDistance(Vector2 lineA, Vector2 lineB, Vector2 point)
|
||||
{
|
||||
return (float)(Math.Abs((lineB.X-lineA.X)*(lineA.Y - point.Y) - (lineA.X - point.X)*(lineB.Y-lineA.Y)) /
|
||||
Math.Sqrt(Math.Pow(lineB.X - lineA.X, 2) + Math.Pow(lineB.Y - lineA.Y, 2)));
|
||||
}
|
||||
|
||||
public static bool CircleIntersectsRectangle(Vector2 circlePos, float radius, Rectangle rect)
|
||||
{
|
||||
Vector2 circleDistance = new Vector2(Math.Abs(circlePos.X - rect.Center.X), Math.Abs(circlePos.Y -rect.Center.Y));
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user