(965c31410a) Unstable v0.10.4.0

This commit is contained in:
Juan Pablo Arce
2020-07-21 08:57:50 -03:00
parent 4f8bd39789
commit 33d3a41104
546 changed files with 45952 additions and 25762 deletions
@@ -4,6 +4,7 @@ using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Barotrauma
{
@@ -22,7 +23,6 @@ namespace Barotrauma
get { return !IsHidden(); }
}
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true)
{
if (!editing && (!GameMain.DebugDraw || Screen.Selected.Cam.Zoom < 0.1f)) { return; }
@@ -37,7 +37,7 @@ namespace Barotrauma
public void Draw(SpriteBatch spriteBatch, Vector2 drawPos)
{
Color clr = currentHull == null ? Color.CadetBlue : GUI.Style.Green;
Color clr = CurrentHull == null ? Color.DodgerBlue : GUI.Style.Green;
if (spawnType != SpawnType.Path) { clr = Color.Gray; }
if (isObstructed)
{
@@ -46,7 +46,7 @@ namespace Barotrauma
if (IsHighlighted || IsHighlighted) { clr = Color.Lerp(clr, Color.White, 0.8f); }
int iconSize = spawnType == SpawnType.Path ? WaypointSize : SpawnPointSize;
if (ConnectedGap != null || Ladders != null || Stairs != null || SpawnType != SpawnType.Path) { iconSize = (int)(iconSize * 1.5f); }
if (ConnectedDoor != null || Ladders != null || Stairs != null || SpawnType != SpawnType.Path) { iconSize = (int)(iconSize * 1.5f); }
if (IsSelected || IsHighlighted)
{
@@ -83,6 +83,20 @@ namespace Barotrauma
new Vector2(e.DrawPosition.X, -e.DrawPosition.Y),
(isObstructed ? Color.Gray : GUI.Style.Green) * 0.7f, width: 5, depth: 0.002f);
}
if (ConnectedGap != null)
{
GUI.DrawLine(spriteBatch,
drawPos,
new Vector2(ConnectedGap.WorldPosition.X, -ConnectedGap.WorldPosition.Y),
GUI.Style.Green * 0.5f, width: 1);
}
if (Ladders != null)
{
GUI.DrawLine(spriteBatch,
drawPos,
new Vector2(Ladders.Item.WorldPosition.X, -Ladders.Item.WorldPosition.Y),
GUI.Style.Green * 0.5f, width: 1);
}
GUI.SmallFont.DrawString(spriteBatch,
ID.ToString(),
@@ -117,7 +131,7 @@ namespace Barotrauma
editingHUD = CreateEditingHUD();
}
if (IsSelected && PlayerInput.PrimaryMouseButtonClicked())
if (IsSelected && PlayerInput.PrimaryMouseButtonClicked() && GUI.MouseOn == null)
{
Vector2 position = cam.ScreenToWorld(PlayerInput.MousePosition);
@@ -144,6 +158,7 @@ namespace Barotrauma
}
else
{
FindHull();
// Update gaps, ladders, and stairs
UpdateLinkedEntity(position, Gap.GapList, gap => ConnectedGap = gap, gap =>
{
@@ -170,6 +185,7 @@ namespace Barotrauma
}
}
}, inflate: 5);
FindStairs();
// TODO: Cannot check the rectangle, since the rectangle is not rotated -> Need to use the collider.
//var stairList = mapEntityList.Where(me => me is Structure s && s.StairDirection != Direction.None).Select(me => me as Structure);
//UpdateLinkedEntity(position, stairList, s =>
@@ -240,7 +256,16 @@ namespace Barotrauma
textBox.Deselect();
return true;
}
private bool EnterTags(GUITextBox textBox, string text)
{
tags = text.Split(',').ToList();
textBox.Text = string.Join(",", Tags);
textBox.Flash(GUI.Style.Green);
textBox.Deselect();
return true;
}
private bool TextBoxChanged(GUITextBox textBox, string text)
{
textBox.Color = GUI.Style.Red;
@@ -298,7 +323,7 @@ namespace Barotrauma
var descText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), paddedFrame.RectTransform),
TextManager.Get("IDCardDescription"), font: GUI.SmallFont);
GUITextBox propertyBox = new GUITextBox(new RectTransform(new Vector2(0.5f, 1.0f), descText.RectTransform, Anchor.CenterRight), idCardDesc)
GUITextBox propertyBox = new GUITextBox(new RectTransform(new Vector2(0.5f, 1.0f), descText.RectTransform, Anchor.CenterRight), IdCardDesc)
{
MaxTextLength = 150,
OnEnterPressed = EnterIDCardDesc,
@@ -306,9 +331,9 @@ namespace Barotrauma
};
propertyBox.OnTextChanged += TextBoxChanged;
var tagsText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), paddedFrame.RectTransform),
var idCardTagsText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), paddedFrame.RectTransform),
TextManager.Get("IDCardTags"), font: GUI.SmallFont);
propertyBox = new GUITextBox(new RectTransform(new Vector2(0.5f, 1.0f), tagsText.RectTransform, Anchor.CenterRight), string.Join(", ", idCardTags))
propertyBox = new GUITextBox(new RectTransform(new Vector2(0.5f, 1.0f), idCardTagsText.RectTransform, Anchor.CenterRight), string.Join(", ", idCardTags))
{
MaxTextLength = 60,
OnEnterPressed = EnterIDCardTags,
@@ -327,7 +352,7 @@ namespace Barotrauma
ToolTip = TextManager.Get("SpawnpointJobsTooltip"),
OnSelected = (selected, userdata) =>
{
assignedJob = userdata as JobPrefab;
AssignedJob = userdata as JobPrefab;
return true;
}
};
@@ -336,7 +361,17 @@ namespace Barotrauma
{
jobDropDown.AddItem(jobPrefab.Name, jobPrefab);
}
jobDropDown.SelectItem(assignedJob);
jobDropDown.SelectItem(AssignedJob);
var tagsText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.2f), paddedFrame.RectTransform),
TextManager.Get("spawnpointtags"), font: GUI.SmallFont);
propertyBox = new GUITextBox(new RectTransform(new Vector2(0.5f, 1.0f), tagsText.RectTransform, Anchor.CenterRight), string.Join(", ", tags))
{
MaxTextLength = 60,
OnEnterPressed = EnterTags,
ToolTip = TextManager.Get("spawnpointtagstooltip")
};
propertyBox.OnTextChanged += TextBoxChanged;
}
PositionEditingHUD();