Unstable 0.1400.0.0

This commit is contained in:
Markus Isberg
2021-05-11 15:47:47 +03:00
parent 3f324b14e8
commit 92f0264af2
247 changed files with 8238 additions and 1911 deletions
@@ -97,6 +97,8 @@ namespace Barotrauma
{
get { return selectedList.Contains(this); }
}
public bool IsIncludedInSelection { get; set; }
public virtual bool IsVisible(Rectangle worldView)
{
@@ -360,6 +362,11 @@ namespace Barotrauma
selectionSize.X = position.X - selectionPos.X;
selectionSize.Y = selectionPos.Y - position.Y;
foreach (MapEntity entity in mapEntityList)
{
entity.IsIncludedInSelection = false;
}
List<MapEntity> newSelection = new List<MapEntity>();// FindSelectedEntities(selectionPos, selectionSize);
if (Math.Abs(selectionSize.X) > Submarine.GridSize.X || Math.Abs(selectionSize.Y) > Submarine.GridSize.Y)
{
@@ -372,10 +379,15 @@ namespace Barotrauma
if (SelectionGroups.TryGetValue(highLightedEntity, out List<MapEntity> group))
{
newSelection.AddRange(group);
foreach (MapEntity entity in group)
{
entity.IsIncludedInSelection = true;
}
}
else
{
newSelection.Add(highLightedEntity);
highLightedEntity.IsIncludedInSelection = true;
}
}
}
@@ -443,6 +455,10 @@ namespace Barotrauma
selectionPos = Vector2.Zero;
selectionSize = Vector2.Zero;
foreach (MapEntity entity in mapEntityList)
{
entity.IsIncludedInSelection = false;
}
}
}
//default, not doing anything specific yet
@@ -800,7 +816,32 @@ namespace Barotrauma
}
if (selectionPos != null && selectionPos != Vector2.Zero)
{
GUI.DrawRectangle(spriteBatch, new Vector2(selectionPos.X, -selectionPos.Y), selectionSize, Color.DarkRed, false, 0, 2f / GameScreen.Selected.Cam.Zoom);
var (sizeX, sizeY) = selectionSize;
var (posX, posY) = selectionPos;
posY = -posY;
Vector2[] corners =
{
new Vector2(posX, posY),
new Vector2(posX + sizeX, posY),
new Vector2(posX + sizeX, posY + sizeY),
new Vector2(posX, posY + sizeY)
};
Color selectionColor = GUI.Style.Blue;
float thickness = Math.Max(2f, 2f / Screen.Selected.Cam.Zoom);
GUI.DrawFilledRectangle(spriteBatch, corners[0], selectionSize, selectionColor * 0.1f);
Vector2 offset = new Vector2(0f, thickness / 2f);
if (sizeY < 0) { offset.Y = -offset.Y; }
spriteBatch.DrawLine(corners[0], corners[1], selectionColor, thickness);
spriteBatch.DrawLine(corners[1] - offset, corners[2] + offset, selectionColor, thickness);
spriteBatch.DrawLine(corners[2], corners[3], selectionColor, thickness);
spriteBatch.DrawLine(corners[3] + offset, corners[0] - offset, selectionColor, thickness);
}
}
@@ -1141,7 +1182,11 @@ namespace Barotrauma
{
if (!e.SelectableInEditor) continue;
if (Submarine.RectsOverlap(selectionRect, e.rect)) foundEntities.Add(e);
if (Submarine.RectsOverlap(selectionRect, e.rect))
{
foundEntities.Add(e);
e.IsIncludedInSelection = true;
}
}
return foundEntities;
@@ -127,7 +127,11 @@ namespace Barotrauma
ToolTip = TextManager.Get("MirrorEntityXToolTip"),
OnClicked = (button, data) =>
{
FlipX(relativeToSub: false);
foreach (MapEntity me in SelectedList)
{
me.FlipX(relativeToSub: false);
}
if (!SelectedList.Contains(this)) { FlipX(relativeToSub: false); }
return true;
}
};
@@ -136,7 +140,11 @@ namespace Barotrauma
ToolTip = TextManager.Get("MirrorEntityYToolTip"),
OnClicked = (button, data) =>
{
FlipY(relativeToSub: false);
foreach (MapEntity me in SelectedList)
{
me.FlipY(relativeToSub: false);
}
if (!SelectedList.Contains(this)) { FlipY(relativeToSub: false); }
return true;
}
};
@@ -153,7 +161,12 @@ namespace Barotrauma
{
OnClicked = (button, data) =>
{
Reset();
foreach (MapEntity me in SelectedList)
{
(me as Item)?.Reset();
(me as Structure)?.Reset();
}
if (!SelectedList.Contains(this)) { Reset(); }
CreateEditingHUD();
return true;
}
@@ -247,7 +260,7 @@ namespace Barotrauma
}
else if (HiddenInGame) { return; }
Color color = IsHighlighted ? GUI.Style.Orange : spriteColor;
Color color = IsIncludedInSelection && editing ? GUI.Style.Blue : IsHighlighted ? GUI.Style.Orange * Math.Max(spriteColor.A / (float) byte.MaxValue, 0.1f) : spriteColor;
if (IsSelected && editing)
{
@@ -114,7 +114,6 @@ namespace Barotrauma
if (realWorldDimensions != Vector2.Zero)
{
string dimensionsStr = TextManager.GetWithVariables("DimensionsFormat", new string[2] { "[width]", "[height]" }, new string[2] { ((int)realWorldDimensions.X).ToString(), ((int)realWorldDimensions.Y).ToString() });
var dimensionsText = new GUITextBlock(new RectTransform(new Vector2(leftPanelWidth, 0), parent.Content.RectTransform),
TextManager.Get("Dimensions"), textAlignment: Alignment.TopLeft, font: font, wrap: true)
{ CanBeFocused = false };
@@ -124,6 +123,15 @@ namespace Barotrauma
dimensionsText.RectTransform.MinSize = new Point(0, dimensionsText.Children.First().Rect.Height);
}
string cargoCapacityStr = CargoCapacity < 0 ? TextManager.Get("unknown") : TextManager.GetWithVariables("cargocapacityformat", new string[1] { "[cratecount]" }, new string[1] {CargoCapacity.ToString() });
var cargoCapacityText = new GUITextBlock(new RectTransform(new Vector2(leftPanelWidth, 0), parent.Content.RectTransform),
TextManager.Get("cargocapacity"), textAlignment: Alignment.TopLeft, font: font, wrap: true)
{ CanBeFocused = false };
new GUITextBlock(new RectTransform(new Vector2(rightPanelWidth, 0.0f), cargoCapacityText.RectTransform, Anchor.TopRight, Pivot.TopLeft),
cargoCapacityStr, textAlignment: Alignment.TopLeft, font: font, wrap: true)
{ CanBeFocused = false };
cargoCapacityText.RectTransform.MinSize = new Point(0, cargoCapacityText.Children.First().Rect.Height);
if (RecommendedCrewSizeMax > 0)
{
var crewSizeText = new GUITextBlock(new RectTransform(new Vector2(leftPanelWidth, 0), parent.Content.RectTransform),
@@ -46,7 +46,10 @@ namespace Barotrauma
if (IsHighlighted || IsHighlighted) { clr = Color.Lerp(clr, Color.White, 0.8f); }
int iconSize = spawnType == SpawnType.Path ? WaypointSize : SpawnPointSize;
if (ConnectedDoor != 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)
{
@@ -98,10 +101,32 @@ namespace Barotrauma
GUI.Style.Green * 0.5f, width: 1);
}
var color = Color.WhiteSmoke;
if (spawnType == SpawnType.Path)
{
if (linkedTo.Count < 2)
{
if (linkedTo.Count == 0)
{
color = Color.Red;
}
else
{
if (CurrentHull == null)
{
color = Ladders == null ? Color.Red : Color.Yellow;
}
else
{
color = Color.Yellow;
}
}
}
}
GUI.SmallFont.DrawString(spriteBatch,
ID.ToString(),
new Vector2(DrawPosition.X - 10, -DrawPosition.Y - 30),
Color.WhiteSmoke);
color);
}
public override bool IsMouseOn(Vector2 position)