Unstable 1.8.4.0
This commit is contained in:
@@ -378,17 +378,24 @@ namespace Barotrauma
|
||||
|
||||
bool showReputation = hudVisibility > 0.0f && location.Type.HasOutpost && location.Reputation != null;
|
||||
|
||||
LocationType locationTypeToDisplay = location.GetLocationTypeToDisplay(out Identifier overrideDescriptionIdentifier);
|
||||
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), location.DisplayName, font: GUIStyle.LargeFont) { Padding = Vector4.Zero };
|
||||
if (!location.Type.Name.IsNullOrEmpty())
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), location.Type.Name, font: GUIStyle.SubHeadingFont) { Padding = Vector4.Zero };
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), content.RectTransform), locationTypeToDisplay.Name, font: GUIStyle.SubHeadingFont) { Padding = Vector4.Zero };
|
||||
}
|
||||
|
||||
CreateSpacing(10);
|
||||
|
||||
if (!location.Type.Description.IsNullOrEmpty())
|
||||
var description = locationTypeToDisplay.Description;
|
||||
if (!overrideDescriptionIdentifier.IsEmpty)
|
||||
{
|
||||
CreateTextWithIcon(location.Type.Description, location.Type.Sprite);
|
||||
description = TextManager.Get(overrideDescriptionIdentifier);
|
||||
}
|
||||
if (!description.IsNullOrEmpty())
|
||||
{
|
||||
CreateTextWithIcon(description, locationTypeToDisplay.Sprite);
|
||||
}
|
||||
|
||||
int highestSubTier = location.HighestSubmarineTierAvailable();
|
||||
@@ -699,6 +706,7 @@ namespace Barotrauma
|
||||
CurrentLocation.CreateStores();
|
||||
ProgressWorld(campaign);
|
||||
Radiation?.OnStep(1);
|
||||
mapAnimQueue.Clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -828,7 +836,7 @@ namespace Barotrauma
|
||||
|
||||
if (!rect.Intersects(drawRect)) { continue; }
|
||||
|
||||
Color color = location.Type.SpriteColor;
|
||||
Color color = location.OverrideIconColor ?? location.Type.SpriteColor;
|
||||
if (!location.Visited) { color = Color.White; }
|
||||
if (location.Connections.Find(c => c.Locations.Contains(currentDisplayLocation)) == null)
|
||||
{
|
||||
@@ -850,6 +858,27 @@ namespace Barotrauma
|
||||
iconScale *= notificationPulseAmount;
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
if (generationParams.ShowStoreInfo)
|
||||
{
|
||||
if (location.Stores == null || location.Stores.None())
|
||||
{
|
||||
color = Color.DarkBlue;
|
||||
}
|
||||
//stores created, but nothing in stock
|
||||
else if (location.Stores.Values.None(s => s.Stock.Any()))
|
||||
{
|
||||
color = Color.Yellow;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = Color.Green;
|
||||
}
|
||||
|
||||
GUI.DrawString(spriteBatch, pos + Vector2.One * 20, "Time since visited: " +location.WorldStepsSinceVisited, Color.Yellow);
|
||||
}
|
||||
#endif
|
||||
|
||||
locationSprite.Draw(spriteBatch, pos, color,
|
||||
scale: generationParams.LocationIconSize / locationSprite.size.X * iconScale * zoom);
|
||||
|
||||
@@ -923,31 +952,32 @@ namespace Barotrauma
|
||||
|
||||
if (GameMain.DebugDraw)
|
||||
{
|
||||
Vector2 dPos = pos;
|
||||
//move the debug texts upwards so they don't go under the info panel that appears when highlighted
|
||||
Vector2 dPos = pos + new Vector2(15, -100);
|
||||
if (location == HighlightedLocation)
|
||||
{
|
||||
dPos.Y -= 80;
|
||||
GUI.DrawString(spriteBatch, dPos + new Vector2(15, 32), "Faction: " + (location.Faction?.Prefab.Name ?? "none"), Color.White, Color.Black, font: GUIStyle.SubHeadingFont);
|
||||
GUI.DrawString(spriteBatch, dPos + new Vector2(15, 50), "Secondary Faction: " + (location.SecondaryFaction?.Prefab.Name ?? "none"), Color.White, Color.Black, font: GUIStyle.SubHeadingFont);
|
||||
dPos.Y += 48;
|
||||
GUI.DrawString(spriteBatch, dPos, "Faction: " + (location.Faction?.Prefab.Name ?? "none"), Color.White, Color.Black, font: GUIStyle.SubHeadingFont);
|
||||
GUI.DrawString(spriteBatch, dPos + new Vector2(0, 18), "Secondary Faction: " + (location.SecondaryFaction?.Prefab.Name ?? "none"), Color.White, Color.Black, font: GUIStyle.SubHeadingFont);
|
||||
dPos.Y += 50;
|
||||
|
||||
if (PlayerInput.KeyDown(Keys.LeftShift))
|
||||
{
|
||||
GUI.DrawString(spriteBatch, new Vector2(150,150), "Dist: " +
|
||||
GUI.DrawString(spriteBatch, new Vector2(150, 150), "Dist: " +
|
||||
GetDistanceToClosestLocationOrConnection(CurrentLocation, int.MaxValue, loc => loc == location), Color.White, Color.Black, font: GUIStyle.SubHeadingFont);
|
||||
|
||||
}
|
||||
GUI.DrawString(spriteBatch, dPos, $"Difficulty: {location.LevelData.Difficulty.FormatSingleDecimal()}",
|
||||
ToolBox.GradientLerp(location.LevelData.Difficulty / 100.0f, GUIStyle.Blue, GUIStyle.Yellow, GUIStyle.Red), Color.Black * 0.8f, 4, font: GUIStyle.SmallFont);
|
||||
|
||||
dPos.Y += 25;
|
||||
GUI.DrawString(spriteBatch, dPos, $"Biome: {location.LevelData.Biome.DisplayName} ({location.LevelData.GenerationParams.Identifier})", Color.White, Color.Black, font: GUIStyle.SmallFont);
|
||||
}
|
||||
dPos.Y += 48;
|
||||
GUI.DrawString(spriteBatch, dPos, $"Difficulty: {location.LevelData.Difficulty.FormatSingleDecimal()}", Color.White, Color.Black * 0.8f, 4, font: GUIStyle.SmallFont);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DrawDecorativeHUD(spriteBatch, rect);
|
||||
|
||||
bool drawRadiationTooltip = true;
|
||||
|
||||
bool drawRadiationTooltip = HighlightedLocation == null;
|
||||
if (tooltip != null)
|
||||
{
|
||||
GUIComponent.DrawToolTip(spriteBatch, tooltip.Value.tip, tooltip.Value.targetArea);
|
||||
@@ -1056,7 +1086,7 @@ namespace Barotrauma
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MathUtils.GetLineRectangleIntersection(start, end, new Rectangle(viewArea.X, viewArea.Y + viewArea.Height, viewArea.Width, viewArea.Height), out Vector2 intersection))
|
||||
if (MathUtils.GetLineWorldRectangleIntersection(start, end, new Rectangle(viewArea.X, viewArea.Y + viewArea.Height, viewArea.Width, viewArea.Height), out Vector2 intersection))
|
||||
{
|
||||
if (!viewArea.Contains(start))
|
||||
{
|
||||
@@ -1196,7 +1226,9 @@ namespace Barotrauma
|
||||
Vector2 center = rectCenter + (connection.CenterPos + viewOffset) * zoom;
|
||||
if (viewArea.Contains(center) && connection.Biome != null)
|
||||
{
|
||||
GUI.DrawString(spriteBatch, center, (connection.LevelData?.GenerationParams?.Identifier ?? connection.Biome.Identifier) + " (" + connection.Difficulty.FormatSingleDecimal() + ")", Color.White);
|
||||
GUI.DrawString(spriteBatch, center - Vector2.UnitX * 50,
|
||||
$"{(connection.LevelData?.GenerationParams?.Identifier ?? connection.Biome.Identifier)} ({connection.Difficulty.FormatSingleDecimal()})",
|
||||
ToolBox.GradientLerp(connection.Difficulty / 100.0f, GUIStyle.Blue, GUIStyle.Yellow, GUIStyle.Red), backgroundColor: Color.Black * 0.7f, font: GUIStyle.SmallFont);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,18 +7,18 @@ namespace Barotrauma
|
||||
{
|
||||
internal partial class Radiation
|
||||
{
|
||||
private static readonly LocalizedString radiationTooltip = TextManager.Get("RadiationTooltip");
|
||||
private int? radiationMultiplier;
|
||||
private static float spriteIndex;
|
||||
private readonly SpriteSheet? sheet = GUIStyle.RadiationAnimSpriteSheet;
|
||||
private int maxFrames => (sheet?.FrameCount ?? 0) + 1;
|
||||
private readonly SpriteSheet? radiationEdgeAnimSheet = GUIStyle.RadiationAnimSpriteSheet;
|
||||
private int maxFrames => (radiationEdgeAnimSheet?.FrameCount ?? 0) + 1;
|
||||
|
||||
private bool isHovingOver;
|
||||
private bool isHoveringOver;
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, Rectangle container, float zoom)
|
||||
{
|
||||
if (!Enabled) { return; }
|
||||
|
||||
UISprite? uiSprite = GUIStyle.Radiation;
|
||||
UISprite? radiationMainSprite = GUIStyle.Radiation;
|
||||
var (offsetX, offsetY) = Map.DrawOffset * zoom;
|
||||
var (centerX, centerY) = container.Center.ToVector2();
|
||||
var (halfSizeX, halfSizeY) = new Vector2(container.Width / 2f, container.Height / 2f) * zoom;
|
||||
@@ -29,31 +29,41 @@ namespace Barotrauma
|
||||
|
||||
Vector2 spriteScale = new Vector2(zoom);
|
||||
|
||||
uiSprite?.Sprite.DrawTiled(spriteBatch, topLeft, size, color: Params.RadiationAreaColor, startOffset: Vector2.Zero, textureScale: spriteScale);
|
||||
radiationMainSprite?.Sprite.DrawTiled(spriteBatch, topLeft, size, color: Params.RadiationAreaColor, startOffset: Vector2.Zero, textureScale: spriteScale);
|
||||
|
||||
Vector2 topRight = topLeft + Vector2.UnitX * size.X;
|
||||
|
||||
int index = 0;
|
||||
if (sheet != null)
|
||||
if (radiationEdgeAnimSheet != null)
|
||||
{
|
||||
for (float i = 0; i <= size.Y; i += sheet.FrameSize.Y / 2f * zoom)
|
||||
for (float i = 0; i <= size.Y; i += radiationEdgeAnimSheet.FrameSize.Y / 2f * zoom)
|
||||
{
|
||||
bool isEven = ++index % 2 == 0;
|
||||
Vector2 origin = new Vector2(0.5f, 0) * sheet.FrameSize.X;
|
||||
Vector2 origin = new Vector2(0.5f, 0) * radiationEdgeAnimSheet.FrameSize.X;
|
||||
// every other sprite's animation is reversed to make it seem more chaotic
|
||||
int sprite = (int) MathF.Floor(isEven ? spriteIndex : maxFrames - spriteIndex);
|
||||
sheet.Draw(spriteBatch, sprite, topRight + new Vector2(0, i), Params.RadiationBorderTint, origin, 0f, spriteScale);
|
||||
radiationEdgeAnimSheet.Draw(spriteBatch, sprite, topRight + new Vector2(0, i), Params.RadiationBorderTint, origin, 0f, spriteScale);
|
||||
}
|
||||
}
|
||||
|
||||
isHovingOver = container.Contains(PlayerInput.MousePosition) && PlayerInput.MousePosition.X < topLeft.X + size.X;
|
||||
radiationMultiplier = null;
|
||||
if (container.Contains(PlayerInput.MousePosition))
|
||||
{
|
||||
float rightEdge = topLeft.X + size.X;
|
||||
float distanceFromRight = rightEdge - PlayerInput.MousePosition.X;
|
||||
if (distanceFromRight >= 0)
|
||||
{
|
||||
radiationMultiplier = Math.Min(4, (int)(distanceFromRight / (Params.RadiationEffectMultipliedPerPixelDistance * zoom)) + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DrawFront(SpriteBatch spriteBatch)
|
||||
{
|
||||
if (isHovingOver)
|
||||
if (radiationMultiplier is int multiplier)
|
||||
{
|
||||
GUIComponent.DrawToolTip(spriteBatch, radiationTooltip, PlayerInput.MousePosition + new Vector2(18 * GUI.Scale));
|
||||
var tooltip = TextManager.GetWithVariable("RadiationTooltip", "[jovianmultiplier]", multiplier.ToString());
|
||||
GUIComponent.DrawToolTip(spriteBatch, tooltip, PlayerInput.MousePosition + new Vector2(18 * GUI.Scale));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user