(99feac023) Unstable 0.9.704.0
This commit is contained in:
@@ -37,6 +37,8 @@ namespace Barotrauma
|
||||
}
|
||||
private float openState;
|
||||
|
||||
public bool CloseAfterMessageSent;
|
||||
|
||||
private float prevUIScale;
|
||||
|
||||
//individual message texts that pop up when the chatbox is hidden
|
||||
@@ -286,6 +288,10 @@ namespace Barotrauma
|
||||
public void SetVisibility(bool visible)
|
||||
{
|
||||
GUIFrame.Parent.Visible = visible;
|
||||
if (GameMain.GameSession?.CrewManager?.ReportButtonFrame != null)
|
||||
{
|
||||
GameMain.GameSession.CrewManager.ReportButtonFrame.Visible = visible;
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<object> UpdateMessageAnimation(GUIComponent message, float animDuration)
|
||||
@@ -330,6 +336,17 @@ namespace Barotrauma
|
||||
prevUIScale = GUI.Scale;
|
||||
}
|
||||
|
||||
//hide chatbox when accessing the inventory of another character to prevent overlaps
|
||||
if (Character.Controlled?.SelectedCharacter?.Inventory != null &&
|
||||
Character.Controlled.SelectedCharacter.CanInventoryBeAccessed)
|
||||
{
|
||||
SetVisibility(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetVisibility(true);
|
||||
}
|
||||
|
||||
if (showNewMessagesButton.Visible && chatBox.ScrollBar.BarScroll == 1f)
|
||||
{
|
||||
showNewMessagesButton.Visible = false;
|
||||
|
||||
@@ -59,11 +59,15 @@ namespace Barotrauma
|
||||
|
||||
public readonly GUIStyle Style;
|
||||
|
||||
public readonly string Name;
|
||||
|
||||
public int? Width { get; private set; }
|
||||
public int? Height { get; private set; }
|
||||
|
||||
public GUIComponentStyle(XElement element, GUIStyle style)
|
||||
{
|
||||
Name = element.Name.LocalName;
|
||||
|
||||
Style = style;
|
||||
Element = element;
|
||||
|
||||
|
||||
@@ -133,6 +133,7 @@ namespace Barotrauma
|
||||
public static ScalableFont LargeFont => Style?.LargeFont;
|
||||
public static ScalableFont SubHeadingFont => Style?.SubHeadingFont;
|
||||
public static ScalableFont DigitalFont => Style?.DigitalFont;
|
||||
public static ScalableFont HotkeyFont => Style?.HotkeyFont;
|
||||
|
||||
public static ScalableFont CJKFont { get; private set; }
|
||||
|
||||
@@ -988,6 +989,7 @@ namespace Barotrauma
|
||||
Debug.Assert(updateList.Count == updateListSet.Count);
|
||||
updateList.ForEach(c => c.UpdateAuto(deltaTime));
|
||||
UpdateMessages(deltaTime);
|
||||
UpdateInput();
|
||||
}
|
||||
|
||||
private static void UpdateMessages(float deltaTime)
|
||||
@@ -1027,6 +1029,32 @@ namespace Barotrauma
|
||||
messages.RemoveAll(m => m.Timer <= 0.0f);
|
||||
}
|
||||
|
||||
private static void UpdateInput()
|
||||
{
|
||||
if (PlayerInput.KeyHit(InputType.ToggleInventory))
|
||||
{
|
||||
if (Character.Controlled?.Inventory != null)
|
||||
{
|
||||
Character.Controlled.Inventory.ToggleInventory();
|
||||
}
|
||||
}
|
||||
|
||||
if (PlayerInput.KeyHit(Keys.Escape) && GameMain.WindowActive)
|
||||
{
|
||||
HandleEscFunctionality();
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
if (GameMain.NetworkMember == null)
|
||||
{
|
||||
if (PlayerInput.KeyHit(Keys.P) && !(KeyboardDispatcher.Subscriber is GUITextBox))
|
||||
{
|
||||
DebugConsole.Paused = !DebugConsole.Paused;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#region Element drawing
|
||||
|
||||
public static void DrawIndicator(SpriteBatch spriteBatch, Vector2 worldPosition, Camera cam, float hideDist, Sprite sprite, Color color)
|
||||
@@ -1760,32 +1788,30 @@ namespace Barotrauma
|
||||
if (!rect1.Intersects(rect2)) continue;
|
||||
|
||||
intersections = true;
|
||||
int rect1Area = rect1.Width * rect1.Height;
|
||||
int rect2Area = rect2.Width * rect2.Height;
|
||||
Point centerDiff = rect1.Center - rect2.Center;
|
||||
//move the interfaces away from each other, in a random direction if they're at the same position
|
||||
Vector2 moveAmount = centerDiff == Point.Zero ? Rand.Vector(1.0f) : Vector2.Normalize(centerDiff.ToVector2());
|
||||
|
||||
//if the horizontal move amount is much larger than vertical, only move horizontally
|
||||
//(= attempt to place the elements side-by-side if they're more apart horizontally than vertically)
|
||||
if (Math.Abs(moveAmount.X) > Math.Abs(moveAmount.Y) * 5.0f)
|
||||
if (Math.Abs(moveAmount.X) > Math.Abs(moveAmount.Y) * 8.0f)
|
||||
{
|
||||
moveAmount.Y = 0.0f;
|
||||
}
|
||||
//same for the y-axis
|
||||
else if (Math.Abs(moveAmount.Y) > Math.Abs(moveAmount.X) * 5.0f)
|
||||
else if (Math.Abs(moveAmount.Y) > Math.Abs(moveAmount.X) * 8.0f)
|
||||
{
|
||||
moveAmount.X = 0.0f;
|
||||
}
|
||||
|
||||
//make sure we don't move the interfaces out of the screen
|
||||
Vector2 moveAmount1 = ClampMoveAmount(rect1, area, moveAmount * 20.0f * rect1Area / (rect1Area + rect2Area));
|
||||
Vector2 moveAmount2 = ClampMoveAmount(rect2, area, -moveAmount * 20.0f * rect1Area / (rect1Area + rect2Area));
|
||||
Vector2 moveAmount1 = ClampMoveAmount(rect1, area, moveAmount * 10.0f);
|
||||
Vector2 moveAmount2 = ClampMoveAmount(rect2, area, -moveAmount * 10.0f);
|
||||
|
||||
//move by 10 units in the desired direction and repeat until nothing overlaps
|
||||
//(or after 100 iterations, in which case we'll just give up and let them overlap)
|
||||
elements[i].RectTransform.ScreenSpaceOffset += (moveAmount1).ToPoint();
|
||||
elements[j].RectTransform.ScreenSpaceOffset += (moveAmount2).ToPoint();
|
||||
elements[i].RectTransform.ScreenSpaceOffset += moveAmount1.ToPoint();
|
||||
elements[j].RectTransform.ScreenSpaceOffset += moveAmount2.ToPoint();
|
||||
}
|
||||
|
||||
if (disallowedAreas == null) continue;
|
||||
@@ -1834,6 +1860,50 @@ namespace Barotrauma
|
||||
#endregion
|
||||
|
||||
#region Misc
|
||||
private static void HandleEscFunctionality()
|
||||
{
|
||||
// Check if a text input is selected.
|
||||
if (KeyboardDispatcher.Subscriber != null)
|
||||
{
|
||||
if (KeyboardDispatcher.Subscriber is GUITextBox textBox)
|
||||
{
|
||||
textBox.Deselect();
|
||||
}
|
||||
KeyboardDispatcher.Subscriber = null;
|
||||
}
|
||||
//if a verification prompt (are you sure you want to x) is open, close it
|
||||
else if (GUIMessageBox.VisibleBox as GUIMessageBox != null &&
|
||||
GUIMessageBox.VisibleBox.UserData as string == "verificationprompt")
|
||||
{
|
||||
((GUIMessageBox)GUIMessageBox.VisibleBox).Close();
|
||||
}
|
||||
else if (Tutorials.Tutorial.Initialized && Tutorials.Tutorial.ContentRunning)
|
||||
{
|
||||
(GameMain.GameSession.GameMode as TutorialMode).Tutorial.CloseActiveContentGUI();
|
||||
}
|
||||
else if (PauseMenuOpen)
|
||||
{
|
||||
TogglePauseMenu();
|
||||
}
|
||||
//open the pause menu if not controlling a character OR if the character has no UIs active that can be closed with ESC
|
||||
else if ((Character.Controlled == null || !itemHudActive())
|
||||
//TODO: do we need to check Inventory.SelectedSlot?
|
||||
&& Inventory.SelectedSlot == null && CharacterHealth.OpenHealthWindow == null
|
||||
&& !CrewManager.IsCommandInterfaceOpen)
|
||||
{
|
||||
// Otherwise toggle pausing, unless another window/interface is open.
|
||||
TogglePauseMenu();
|
||||
}
|
||||
|
||||
bool itemHudActive()
|
||||
{
|
||||
if (Character.Controlled?.SelectedConstruction == null) { return false; }
|
||||
return
|
||||
Character.Controlled.SelectedConstruction.ActiveHUDs.Any(ic => ic.GuiFrame != null) ||
|
||||
((Character.Controlled.ViewTarget as Item)?.Prefab?.FocusOnSelected ?? false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void TogglePauseMenu()
|
||||
{
|
||||
if (Screen.Selected == GameMain.MainMenuScreen) return;
|
||||
|
||||
@@ -5,22 +5,23 @@ namespace Barotrauma
|
||||
public class GUIColorSettings
|
||||
{
|
||||
// Inventory
|
||||
public static Color InventorySlotColor = new Color(78, 114, 88);
|
||||
public static Color EquipmentSlotColor = new Color(72, 58, 25);
|
||||
public static Color EquipmentSlotIconColor = new Color(99, 70, 64);
|
||||
public static readonly Color InventorySlotColor = new Color(27, 140, 132);
|
||||
public static readonly Color InventorySlotEquippedColor = new Color(211, 227, 217);
|
||||
public static readonly Color EquipmentSlotEmptyColor = new Color(152, 148, 128);
|
||||
public static readonly Color EquipmentSlotColor = new Color(225, 211, 189);
|
||||
public static readonly Color EquipmentSlotIconColor = new Color(99, 70, 64);
|
||||
|
||||
// Health HUD
|
||||
public static Color BuffColorLow = Color.LightGreen;
|
||||
public static Color BuffColorMedium = Color.Green;
|
||||
public static Color BuffColorHigh = Color.DarkGreen;
|
||||
public static readonly Color BuffColorLow = Color.LightGreen;
|
||||
public static readonly Color BuffColorMedium = Color.Green;
|
||||
public static readonly Color BuffColorHigh = Color.DarkGreen;
|
||||
|
||||
public static Color DebuffColorLow = Color.DarkSalmon;
|
||||
public static Color DebuffColorMedium = Color.Red;
|
||||
public static Color DebuffColorHigh = Color.DarkRed;
|
||||
|
||||
public static Color HealthBarColorLow = Color.Red;
|
||||
public static Color HealthBarColorMedium = Color.Orange;
|
||||
public static Color HealthBarColorHigh = new Color(78, 114, 88);
|
||||
public static readonly Color DebuffColorLow = Color.DarkSalmon;
|
||||
public static readonly Color DebuffColorMedium = Color.Red;
|
||||
public static readonly Color DebuffColorHigh = Color.DarkRed;
|
||||
|
||||
public static readonly Color HealthBarColorLow = Color.Red;
|
||||
public static readonly Color HealthBarColorMedium = Color.Orange;
|
||||
public static readonly Color HealthBarColorHigh = new Color(78, 114, 88);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -517,6 +517,7 @@ namespace Barotrauma
|
||||
return state switch
|
||||
{
|
||||
ComponentState.Hover => HoverColor,
|
||||
ComponentState.HoverSelected => HoverColor,
|
||||
ComponentState.Pressed => PressedColor,
|
||||
ComponentState.Selected => SelectedColor,
|
||||
_ => Color,
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace Barotrauma
|
||||
get { return floatValue; }
|
||||
set
|
||||
{
|
||||
if (value == floatValue) return;
|
||||
if (MathUtils.NearlyEqual(value, floatValue)) return;
|
||||
floatValue = value;
|
||||
ClampFloatValue();
|
||||
float newValue = floatValue;
|
||||
@@ -134,7 +134,6 @@ namespace Barotrauma
|
||||
if (value == intValue) return;
|
||||
intValue = value;
|
||||
UpdateText();
|
||||
OnValueChanged?.Invoke(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ namespace Barotrauma
|
||||
public ScalableFont LargeFont { get; private set; }
|
||||
public ScalableFont SubHeadingFont { get; private set; }
|
||||
public ScalableFont DigitalFont { get; private set; }
|
||||
public ScalableFont HotkeyFont { get; private set; }
|
||||
|
||||
public Dictionary<ScalableFont, bool> ForceFontUpperCase
|
||||
{
|
||||
@@ -63,8 +64,8 @@ namespace Barotrauma
|
||||
public Color TextColorDark { get; private set; } = Color.Black * 0.9f;
|
||||
public Color TextColorDim { get; private set; } = Color.White * 0.6f;
|
||||
|
||||
public static Point ItemFrameMargin = new Point(50, 56).Multiply(GUI.SlicedSpriteScale);
|
||||
public static Point ItemFrameOffset = new Point(0, 3).Multiply(GUI.SlicedSpriteScale);
|
||||
public static Point ItemFrameMargin => new Point(50, 56).Multiply(GUI.SlicedSpriteScale);
|
||||
public static Point ItemFrameOffset => new Point(0, 3).Multiply(GUI.SlicedSpriteScale);
|
||||
|
||||
public GUIStyle(XElement element, GraphicsDevice graphicsDevice)
|
||||
{
|
||||
@@ -148,6 +149,10 @@ namespace Barotrauma
|
||||
DigitalFont = LoadFont(subElement, graphicsDevice);
|
||||
ForceFontUpperCase[DigitalFont] = subElement.GetAttributeBool("forceuppercase", false);
|
||||
break;
|
||||
case "hotkeyfont":
|
||||
HotkeyFont = LoadFont(subElement, graphicsDevice);
|
||||
ForceFontUpperCase[HotkeyFont] = subElement.GetAttributeBool("forceuppercase", false);
|
||||
break;
|
||||
case "objectivetitle":
|
||||
case "subheading":
|
||||
SubHeadingFont = LoadFont(subElement, graphicsDevice);
|
||||
@@ -236,8 +241,20 @@ namespace Barotrauma
|
||||
return new ScalableFont(file, size, graphicsDevice, dynamicLoading, isCJK);
|
||||
}
|
||||
|
||||
private uint GetFontSize(XElement element)
|
||||
private uint GetFontSize(XElement element, uint defaultSize = 14)
|
||||
{
|
||||
//check if any of the language override fonts want to override the font size as well
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "override") { continue; }
|
||||
string language = subElement.GetAttributeString("language", "").ToLowerInvariant();
|
||||
if (GameMain.Config.Language.ToLowerInvariant() == language)
|
||||
{
|
||||
uint overrideFontSize = GetFontSize(subElement, 0);
|
||||
if (overrideFontSize > 0) { return overrideFontSize; }
|
||||
}
|
||||
}
|
||||
|
||||
foreach (XElement subElement in element.Elements())
|
||||
{
|
||||
if (subElement.Name.ToString().ToLowerInvariant() != "size") { continue; }
|
||||
@@ -247,7 +264,7 @@ namespace Barotrauma
|
||||
return (uint)subElement.GetAttributeInt("size", 14);
|
||||
}
|
||||
}
|
||||
return 14;
|
||||
return defaultSize;
|
||||
}
|
||||
|
||||
private string GetFontFilePath(XElement element)
|
||||
|
||||
@@ -6,14 +6,18 @@ using System.Collections.Generic;
|
||||
using System.Xml.Linq;
|
||||
using Barotrauma.Media;
|
||||
using System.Linq;
|
||||
using Barotrauma.Extensions;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
class LoadingScreen
|
||||
{
|
||||
private Texture2D backgroundTexture;
|
||||
private readonly Texture2D defaultBackgroundTexture, overlay;
|
||||
private readonly SpriteSheet decorativeGraph, decorativeMap;
|
||||
private Texture2D currentBackgroundTexture;
|
||||
private Sprite noiseSprite;
|
||||
|
||||
private RenderTarget2D renderTarget;
|
||||
private string randText = "";
|
||||
|
||||
private Sprite languageSelectionCursor;
|
||||
private ScalableFont languageSelectionFont, languageSelectionFontCJK;
|
||||
@@ -65,15 +69,9 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private float state;
|
||||
|
||||
private string selectedTip;
|
||||
|
||||
public Vector2 BackgroundPosition;
|
||||
|
||||
public Vector2 TitlePosition;
|
||||
|
||||
private object loadMutex = new object();
|
||||
private readonly object loadMutex = new object();
|
||||
private float? loadState;
|
||||
|
||||
public float? LoadState
|
||||
@@ -109,15 +107,13 @@ namespace Barotrauma
|
||||
|
||||
public LoadingScreen(GraphicsDevice graphics)
|
||||
{
|
||||
backgroundTexture = TextureLoader.FromFile("Content/UI/titleBackground.png");
|
||||
defaultBackgroundTexture = TextureLoader.FromFile("Content/Map/LocationPortraits/AlienRuins.png");
|
||||
|
||||
renderTarget = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
GameMain.Instance.OnResolutionChanged += () =>
|
||||
{
|
||||
renderTarget?.Dispose();
|
||||
renderTarget = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
};
|
||||
decorativeMap = new SpriteSheet("Content/Map/MapHUD.png", 6, 5, Vector2.Zero, sourceRect: new Rectangle(0, 0, 2048, 640));
|
||||
decorativeGraph = new SpriteSheet("Content/Map/MapHUD.png", 4, 10, Vector2.Zero, sourceRect: new Rectangle(1025, 1259, 1024, 732));
|
||||
|
||||
overlay = TextureLoader.FromFile("Content/UI/LoadingScreenOverlay.png");
|
||||
noiseSprite = new Sprite("Content/UI/noise.png", Vector2.Zero);
|
||||
DrawLoadingText = true;
|
||||
selectedTip = TextManager.Get("LoadingScreenTip", true);
|
||||
}
|
||||
@@ -147,41 +143,35 @@ namespace Barotrauma
|
||||
|
||||
drawn = true;
|
||||
|
||||
graphics.SetRenderTarget(renderTarget);
|
||||
|
||||
float backgroundScale = GameMain.GraphicsHeight / 1500.0f;
|
||||
float titleScale = MathHelper.SmoothStep(0.8f, 1.0f, state / 10.0f) * GameMain.GraphicsHeight / 1000.0f;
|
||||
|
||||
state += deltaTime;
|
||||
|
||||
if (DrawLoadingText)
|
||||
{
|
||||
BackgroundPosition = new Vector2(GameMain.GraphicsWidth * 0.3f, GameMain.GraphicsHeight * 0.45f);
|
||||
TitlePosition = new Vector2(GameMain.GraphicsWidth * 0.5f, GameMain.GraphicsHeight * 0.45f);
|
||||
}
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, samplerState: GUI.SamplerState);
|
||||
graphics.Clear(Color.Black);
|
||||
|
||||
spriteBatch.Draw(backgroundTexture, BackgroundPosition, null, Color.White * Math.Min(state / 5.0f, 1.0f), 0.0f,
|
||||
new Vector2(backgroundTexture.Width / 2.0f, backgroundTexture.Height / 2.0f),
|
||||
backgroundScale * 1.5f, SpriteEffects.None, 0.2f);
|
||||
|
||||
titleSprite?.Draw(spriteBatch, TitlePosition, Color.White * Math.Min((state - 1.0f) / 5.0f, 1.0f), scale: titleScale);
|
||||
|
||||
spriteBatch.End();
|
||||
|
||||
graphics.SetRenderTarget(null);
|
||||
|
||||
if (WaterRenderer.Instance != null)
|
||||
{
|
||||
WaterRenderer.Instance.ScrollWater(Vector2.One * 10.0f, deltaTime);
|
||||
WaterRenderer.Instance.RenderWater(spriteBatch, renderTarget, null);
|
||||
}
|
||||
currentBackgroundTexture ??= defaultBackgroundTexture;
|
||||
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, samplerState: GUI.SamplerState);
|
||||
|
||||
titleSprite?.Draw(spriteBatch, TitlePosition, Color.White * Math.Min((state - 1.0f) / 5.0f, 1.0f), scale: titleScale);
|
||||
float scale = (GameMain.GraphicsWidth / (float)currentBackgroundTexture.Width) * 1.2f;
|
||||
float paddingX = currentBackgroundTexture.Width * scale - GameMain.GraphicsWidth;
|
||||
float paddingY = currentBackgroundTexture.Height * scale - GameMain.GraphicsHeight;
|
||||
|
||||
double noiseT = (Timing.TotalTime * 0.02f);
|
||||
Vector2 pos = new Vector2((float)PerlinNoise.CalculatePerlin(noiseT, noiseT, 0) - 0.5f, (float)PerlinNoise.CalculatePerlin(noiseT, noiseT, 0.5f) - 0.5f);
|
||||
pos = new Vector2(pos.X * paddingX, pos.Y * paddingY);
|
||||
|
||||
spriteBatch.Draw(currentBackgroundTexture,
|
||||
new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight) / 2 + pos,
|
||||
null, Color.White, 0.0f, new Vector2(currentBackgroundTexture.Width / 2, currentBackgroundTexture.Height / 2),
|
||||
scale, SpriteEffects.None, 0.0f);
|
||||
|
||||
spriteBatch.Draw(overlay, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), null, Color.White, 0.0f, Vector2.Zero, SpriteEffects.None, 0.0f);
|
||||
|
||||
float noiseStrength = (float)PerlinNoise.CalculatePerlin(noiseT, noiseT, 0);
|
||||
float noiseScale = (float)PerlinNoise.CalculatePerlin(noiseT * 5.0f, noiseT * 2.0f, 0) * 4.0f;
|
||||
noiseSprite.DrawTiled(spriteBatch, Vector2.Zero, new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight),
|
||||
startOffset: new Point(Rand.Range(0, noiseSprite.SourceRect.Width), Rand.Range(0, noiseSprite.SourceRect.Height)),
|
||||
color: Color.White * noiseStrength * 0.1f,
|
||||
textureScale: Vector2.One * noiseScale);
|
||||
|
||||
titleSprite?.Draw(spriteBatch, new Vector2(GameMain.GraphicsWidth * 0.05f, GameMain.GraphicsHeight * 0.125f),
|
||||
Color.White, origin: new Vector2(0.0f, titleSprite.SourceRect.Height / 2.0f),
|
||||
scale: GameMain.GraphicsHeight / 2000.0f);
|
||||
|
||||
if (WaitForLanguageSelection)
|
||||
{
|
||||
@@ -218,7 +208,7 @@ namespace Barotrauma
|
||||
if (GUI.LargeFont != null)
|
||||
{
|
||||
GUI.LargeFont.DrawString(spriteBatch, loadText.ToUpper(),
|
||||
new Vector2(GameMain.GraphicsWidth / 2.0f - GUI.LargeFont.MeasureString(loadText).X / 2.0f, GameMain.GraphicsHeight * 0.7f),
|
||||
new Vector2(GameMain.GraphicsWidth / 2.0f - GUI.LargeFont.MeasureString(loadText.ToUpper()).X / 2.0f, GameMain.GraphicsHeight * 0.75f),
|
||||
Color.White);
|
||||
}
|
||||
}
|
||||
@@ -232,12 +222,49 @@ namespace Barotrauma
|
||||
for (int i = 0; i < lines.Length; i++)
|
||||
{
|
||||
GUI.Font.DrawString(spriteBatch, lines[i],
|
||||
new Vector2((int)(GameMain.GraphicsWidth / 2.0f - GUI.Font.MeasureString(lines[i]).X / 2.0f), (int)(GameMain.GraphicsHeight * 0.78f + i * lineHeight)), Color.White);
|
||||
new Vector2((int)(GameMain.GraphicsWidth / 2.0f - GUI.Font.MeasureString(lines[i]).X / 2.0f), (int)(GameMain.GraphicsHeight * 0.8f + i * lineHeight)), Color.White);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
spriteBatch.End();
|
||||
|
||||
spriteBatch.Begin(blendState: BlendState.Additive);
|
||||
|
||||
Vector2 decorativeScale = new Vector2(GameMain.GraphicsHeight / 1080.0f);
|
||||
|
||||
float noiseVal = (float)PerlinNoise.CalculatePerlin(Timing.TotalTime * 0.25f, Timing.TotalTime * 0.5f, 0);
|
||||
decorativeGraph.Draw(spriteBatch, (int)(decorativeGraph.FrameCount * noiseVal),
|
||||
new Vector2(GameMain.GraphicsWidth * 0.001f, GameMain.GraphicsHeight * 0.24f),
|
||||
Color.White, Vector2.Zero, 0.0f, decorativeScale, SpriteEffects.FlipVertically);
|
||||
|
||||
decorativeMap.Draw(spriteBatch, (int)(decorativeMap.FrameCount * noiseVal),
|
||||
new Vector2(GameMain.GraphicsWidth * 0.99f, GameMain.GraphicsHeight * 0.66f),
|
||||
Color.White, decorativeMap.FrameSize.ToVector2(), 0.0f, decorativeScale);
|
||||
|
||||
if (noiseVal < 0.2f)
|
||||
{
|
||||
//SCP-CB reference
|
||||
randText = (new string[] { "NIL", "black white gray", "Sometimes we would have had time to scream", "e8m106]af", "NO" }).GetRandom();
|
||||
}
|
||||
else if (noiseVal < 0.3f)
|
||||
{
|
||||
randText = ToolBox.RandomSeed(9);
|
||||
}
|
||||
else if (noiseVal < 0.5f)
|
||||
{
|
||||
randText =
|
||||
Rand.Int(100).ToString().PadLeft(2, '0') + " " +
|
||||
Rand.Int(100).ToString().PadLeft(2, '0') + " " +
|
||||
Rand.Int(100).ToString().PadLeft(2, '0') + " " +
|
||||
Rand.Int(100).ToString().PadLeft(2, '0');
|
||||
}
|
||||
|
||||
GUI.LargeFont?.DrawString(spriteBatch, randText,
|
||||
new Vector2(GameMain.GraphicsWidth - decorativeMap.FrameSize.X * decorativeScale.X * 0.8f, GameMain.GraphicsHeight * 0.57f),
|
||||
Color.White * (1.0f - noiseVal));
|
||||
|
||||
spriteBatch.End();
|
||||
}
|
||||
|
||||
private void DrawLanguageSelectionPrompt(SpriteBatch spriteBatch, GraphicsDevice graphicsDevice)
|
||||
@@ -336,6 +363,7 @@ namespace Barotrauma
|
||||
drawn = false;
|
||||
LoadState = null;
|
||||
selectedTip = TextManager.Get("LoadingScreenTip", true);
|
||||
currentBackgroundTexture = LocationType.List.GetRandom()?.GetPortrait(Rand.Int(int.MaxValue))?.Texture;
|
||||
|
||||
while (!drawn)
|
||||
{
|
||||
|
||||
@@ -701,8 +701,16 @@ namespace Barotrauma
|
||||
|
||||
public void MatchPivotToAnchor() => MatchPivotToAnchor(Anchor);
|
||||
|
||||
|
||||
private Point? animTargetPos;
|
||||
public Point AnimTargetPos
|
||||
{
|
||||
get { return animTargetPos ?? AbsoluteOffset; }
|
||||
}
|
||||
|
||||
public void MoveOverTime(Point targetPos, float duration)
|
||||
{
|
||||
animTargetPos = targetPos;
|
||||
CoroutineManager.StartCoroutine(DoMoveAnimation(targetPos, duration));
|
||||
}
|
||||
public void ScaleOverTime(Point targetSize, float duration)
|
||||
@@ -721,6 +729,7 @@ namespace Barotrauma
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
AbsoluteOffset = targetPos;
|
||||
animTargetPos = null;
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
private IEnumerable<object> DoScaleAnimation(Point targetSize, float duration)
|
||||
|
||||
@@ -37,6 +37,12 @@ namespace Barotrauma
|
||||
private set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// How much the borders of a sliced sprite are allowed to scale
|
||||
/// You may for example want to prevent a 1-pixel border from scaling down (and disappearing) on small resolutions
|
||||
/// </summary>
|
||||
private float minBorderScale = 0.1f, maxBorderScale = 10.0f;
|
||||
|
||||
public bool CrossFadeIn { get; private set; } = true;
|
||||
public bool CrossFadeOut { get; private set; } = true;
|
||||
|
||||
@@ -58,6 +64,9 @@ namespace Barotrauma
|
||||
Vector4 sliceVec = element.GetAttributeVector4("slice", Vector4.Zero);
|
||||
if (sliceVec != Vector4.Zero)
|
||||
{
|
||||
minBorderScale = element.GetAttributeFloat("minborderscale", 0.1f);
|
||||
maxBorderScale = element.GetAttributeFloat("minborderscale", 10.0f);
|
||||
|
||||
Rectangle slice = new Rectangle((int)sliceVec.X, (int)sliceVec.Y, (int)(sliceVec.Z - sliceVec.X), (int)(sliceVec.W - sliceVec.Y));
|
||||
|
||||
Slice = true;
|
||||
@@ -103,7 +112,8 @@ namespace Barotrauma
|
||||
scale.Y = MathHelper.Clamp((float)rect.Height / (Slices[0].Height + Slices[6].Height), 0, 1);
|
||||
scale.X = MathHelper.Clamp((float)rect.Width / (Slices[0].Width + Slices[2].Width), 0, 1);
|
||||
|
||||
scale.X = scale.Y = Math.Min(Math.Min(scale.X, scale.Y), GUI.SlicedSpriteScale);
|
||||
scale.X = scale.Y =
|
||||
MathHelper.Clamp(Math.Min(Math.Min(scale.X, scale.Y), GUI.SlicedSpriteScale), minBorderScale, maxBorderScale);
|
||||
int centerHeight = rect.Height - (int)((Slices[0].Height + Slices[6].Height) * scale.Y);
|
||||
int centerWidth = rect.Width - (int)((Slices[0].Width + Slices[2].Width) * scale.X);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user