Merge branch 'master' of https://github.com/Regalis11/Barotrauma into develop
This commit is contained in:
@@ -199,19 +199,15 @@ namespace Barotrauma
|
||||
|
||||
public static bool PauseMenuOpen { get; private set; }
|
||||
|
||||
public static bool InputBlockingMenuOpen
|
||||
{
|
||||
get
|
||||
{
|
||||
return PauseMenuOpen ||
|
||||
SettingsMenuOpen ||
|
||||
DebugConsole.IsOpen ||
|
||||
GameSession.IsTabMenuOpen ||
|
||||
GameMain.GameSession?.GameMode is { Paused: true } ||
|
||||
CharacterHUD.IsCampaignInterfaceOpen ||
|
||||
GameMain.GameSession?.Campaign is { SlideshowPlayer: { Finished: false, Visible: true } };
|
||||
}
|
||||
}
|
||||
public static bool InputBlockingMenuOpen =>
|
||||
PauseMenuOpen
|
||||
|| SettingsMenuOpen
|
||||
|| SocialOverlay.Instance is { IsOpen: true }
|
||||
|| DebugConsole.IsOpen
|
||||
|| GameSession.IsTabMenuOpen
|
||||
|| GameMain.GameSession?.GameMode is { Paused: true }
|
||||
|| CharacterHUD.IsCampaignInterfaceOpen
|
||||
|| GameMain.GameSession?.Campaign is { SlideshowPlayer: { Finished: false, Visible: true } };
|
||||
|
||||
public static bool PreventPauseMenuToggle = false;
|
||||
|
||||
@@ -882,25 +878,30 @@ namespace Barotrauma
|
||||
|
||||
private static void HandlePersistingElements(float deltaTime)
|
||||
{
|
||||
lock (mutex)
|
||||
bool currentMessageBoxIsVerificationPrompt = GUIMessageBox.VisibleBox is GUIMessageBox { DrawOnTop: true };
|
||||
|
||||
if (!currentMessageBoxIsVerificationPrompt)
|
||||
{
|
||||
GUIMessageBox.AddActiveToGUIUpdateList();
|
||||
GUIContextMenu.AddActiveToGUIUpdateList();
|
||||
}
|
||||
|
||||
if (PauseMenuOpen)
|
||||
{
|
||||
PauseMenu.AddToGUIUpdateList();
|
||||
}
|
||||
if (SettingsMenuOpen)
|
||||
{
|
||||
SettingsMenuContainer.AddToGUIUpdateList();
|
||||
}
|
||||
if (SettingsMenuOpen)
|
||||
{
|
||||
SettingsMenuContainer.AddToGUIUpdateList();
|
||||
}
|
||||
else if (PauseMenuOpen)
|
||||
{
|
||||
PauseMenu.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
//the "are you sure you want to quit" prompts are drawn on top of everything else
|
||||
if (GUIMessageBox.VisibleBox?.UserData as string == "verificationprompt" || GUIMessageBox.VisibleBox?.UserData as string == "bugreporter")
|
||||
{
|
||||
GUIMessageBox.VisibleBox.AddToGUIUpdateList();
|
||||
}
|
||||
SocialOverlay.Instance?.AddToGuiUpdateList();
|
||||
|
||||
GUIContextMenu.AddActiveToGUIUpdateList();
|
||||
|
||||
//the "are you sure you want to quit" prompts are drawn on top of everything else
|
||||
if (currentMessageBoxIsVerificationPrompt)
|
||||
{
|
||||
GUIMessageBox.VisibleBox.AddToGUIUpdateList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2560,7 +2561,8 @@ namespace Barotrauma
|
||||
var msgBox = new GUIMessageBox("", TextManager.Get(textTag),
|
||||
new LocalizedString[] { TextManager.Get("Yes"), TextManager.Get("No") })
|
||||
{
|
||||
UserData = "verificationprompt"
|
||||
UserData = "verificationprompt",
|
||||
DrawOnTop = true
|
||||
};
|
||||
msgBox.Buttons[0].OnClicked = (_, __) =>
|
||||
{
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace Barotrauma
|
||||
|
||||
public override bool PlaySoundOnSelect { get; set; } = true;
|
||||
|
||||
public GUIButton(RectTransform rectT, Alignment textAlignment = Alignment.Center, string style = "", Color? color = null) : this(rectT, new RawLString(""), textAlignment, style, color) { }
|
||||
public GUIButton(RectTransform rectT, Alignment textAlignment = Alignment.Center, string style = "", Color? color = null) : this(rectT, LocalizedString.EmptyString, textAlignment, style, color) { }
|
||||
|
||||
public GUIButton(RectTransform rectT, LocalizedString text, Alignment textAlignment = Alignment.Center, string style = "", Color? color = null) : base(style, rectT)
|
||||
{
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace Barotrauma
|
||||
SelectedValue = Math.Clamp(1f - (y / mainArea.Height), 0, 1);
|
||||
}
|
||||
|
||||
CurrentColor = ToolBox.HSVToRGB(SelectedHue, SelectedSaturation, SelectedValue);
|
||||
CurrentColor = ToolBoxCore.HSVToRGB(SelectedHue, SelectedSaturation, SelectedValue);
|
||||
|
||||
OnColorSelected?.Invoke(this, CurrentColor);
|
||||
}
|
||||
@@ -201,7 +201,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private Color DrawHVArea(float x, float y) => ToolBox.HSVToRGB(SelectedHue, x, 1.0f - y);
|
||||
private Color DrawHueArea(float x, float y) => ToolBox.HSVToRGB(y * 360f, 1f, 1f);
|
||||
private Color DrawHVArea(float x, float y) => ToolBoxCore.HSVToRGB(SelectedHue, x, 1.0f - y);
|
||||
private Color DrawHueArea(float x, float y) => ToolBoxCore.HSVToRGB(y * 360f, 1f, 1f);
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,7 @@ using System.Xml.Linq;
|
||||
using Barotrauma.IO;
|
||||
using RestSharp;
|
||||
using System.Net;
|
||||
using System.Collections.Immutable;
|
||||
using Barotrauma.Tutorials;
|
||||
using Barotrauma.Steam;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -1174,11 +1173,14 @@ namespace Barotrauma
|
||||
{
|
||||
try
|
||||
{
|
||||
#if USE_STEAM
|
||||
Steam.SteamManager.OverlayCustomUrl(url);
|
||||
#else
|
||||
ToolBox.OpenFileWithShell(url);
|
||||
#endif
|
||||
if (SteamManager.IsInitialized)
|
||||
{
|
||||
SteamManager.OverlayCustomUrl(url);
|
||||
}
|
||||
else
|
||||
{
|
||||
ToolBox.OpenFileWithShell(url);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
@@ -76,12 +76,12 @@ namespace Barotrauma
|
||||
|
||||
if (hasHeader)
|
||||
{
|
||||
InflateSize(ref estimatedSize, header, headerFont);
|
||||
InflateSize(ref estimatedSize, header, headerFont!);
|
||||
}
|
||||
|
||||
foreach (ContextMenuOption option in options)
|
||||
{
|
||||
Vector2 optionSize = InflateSize(ref estimatedSize, option.Label, font);
|
||||
Vector2 optionSize = InflateSize(ref estimatedSize, option.Label, font!);
|
||||
optionsAndSizes.Add(option, optionSize);
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Barotrauma
|
||||
if (hasHeader)
|
||||
{
|
||||
Point sz = Point.Zero;
|
||||
InflateSize(ref sz, header, headerFont);
|
||||
InflateSize(ref sz, header, headerFont!);
|
||||
listSize.Y -= sz.Y;
|
||||
HeaderLabel = new GUITextBlock(new RectTransform(sz, background.RectTransform), header, font: headerFont) { Padding = headerPadding };
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace Barotrauma
|
||||
|
||||
public GUIDropDown(RectTransform rectT, LocalizedString text = null, int elementCount = 4, string style = "", bool selectMultiple = false, bool dropAbove = false, Alignment textAlignment = Alignment.CenterLeft) : base(style, rectT)
|
||||
{
|
||||
text ??= new RawLString("");
|
||||
text ??= LocalizedString.EmptyString;
|
||||
|
||||
HoverCursor = CursorState.Hand;
|
||||
CanBeFocused = true;
|
||||
|
||||
@@ -205,5 +205,11 @@ namespace Barotrauma
|
||||
Recalculate();
|
||||
}
|
||||
}
|
||||
|
||||
public override void ForceLayoutRecalculation()
|
||||
{
|
||||
Recalculate();
|
||||
base.ForceLayoutRecalculation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,6 +86,11 @@ namespace Barotrauma
|
||||
|
||||
public Type MessageBoxType => type;
|
||||
|
||||
/// <summary>
|
||||
/// If enabled, the box is always drawn in front of all other elements.
|
||||
/// </summary>
|
||||
public bool DrawOnTop;
|
||||
|
||||
public static GUIComponent VisibleBox => MessageBoxes.LastOrDefault();
|
||||
|
||||
public GUIMessageBox(LocalizedString headerText, LocalizedString text, Vector2? relativeSize = null, Point? minSize = null, Type type = Type.Default)
|
||||
@@ -477,13 +482,13 @@ namespace Barotrauma
|
||||
for (int i = 0; i < MessageBoxes.Count; i++)
|
||||
{
|
||||
if (MessageBoxes[i] == null) { continue; }
|
||||
if (!(MessageBoxes[i] is GUIMessageBox messageBox))
|
||||
if (MessageBoxes[i] is not GUIMessageBox messageBox)
|
||||
{
|
||||
if (type == Type.Default)
|
||||
{
|
||||
// Message box not of type GUIMessageBox is likely the round summary
|
||||
MessageBoxes[i].AddToGUIUpdateList();
|
||||
if (!(MessageBoxes[i].UserData is RoundSummary)) { break; }
|
||||
if (MessageBoxes[i].UserData is not RoundSummary) { break; }
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -494,8 +499,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
// These are handled separately in GUI.HandlePersistingElements()
|
||||
if (MessageBoxes[i].UserData as string == "verificationprompt") { continue; }
|
||||
if (MessageBoxes[i].UserData as string == "bugreporter") { continue; }
|
||||
if (messageBox.DrawOnTop) { continue; }
|
||||
|
||||
messageBox.AddToGUIUpdateList();
|
||||
break;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Barotrauma.Extensions;
|
||||
#nullable enable
|
||||
using Barotrauma.Extensions;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
@@ -54,8 +55,8 @@ namespace Barotrauma
|
||||
public class GUIFontPrefab : GUIPrefab
|
||||
{
|
||||
private readonly ContentXElement element;
|
||||
private ScalableFont font;
|
||||
public ScalableFont Font
|
||||
private ScalableFont? font;
|
||||
public ScalableFont? Font
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -64,11 +65,13 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
private ImmutableDictionary<TextManager.SpeciallyHandledCharCategory, ScalableFont> specialHandlingFonts;
|
||||
private ImmutableDictionary<TextManager.SpeciallyHandledCharCategory, ScalableFont>? specialHandlingFonts;
|
||||
|
||||
public ScalableFont GetFontForCategory(TextManager.SpeciallyHandledCharCategory category)
|
||||
public ScalableFont? GetFontForCategory(TextManager.SpeciallyHandledCharCategory category)
|
||||
{
|
||||
if (Language != GameSettings.CurrentConfig.Language) { LoadFont(); }
|
||||
if (font is null) { return null; }
|
||||
if (specialHandlingFonts is null) { return font; }
|
||||
if (font.SpeciallyHandledCharCategory.HasFlag(category)) { return font; }
|
||||
return specialHandlingFonts.TryGetValue(category, out var resultFont)
|
||||
? resultFont
|
||||
@@ -87,7 +90,7 @@ namespace Barotrauma
|
||||
|
||||
public void LoadFont()
|
||||
{
|
||||
string fontPath = GetFontFilePath(element);
|
||||
string? fontPath = GetFontFilePath(element);
|
||||
uint size = GetFontSize(element);
|
||||
bool dynamicLoading = GetFontDynamicLoading(element);
|
||||
var shcc = GetShcc(element);
|
||||
@@ -125,21 +128,21 @@ namespace Barotrauma
|
||||
specialHandlingFonts = null;
|
||||
}
|
||||
|
||||
private ScalableFont ExtractFont(TextManager.SpeciallyHandledCharCategory flag, ContentXElement element)
|
||||
private ScalableFont? ExtractFont(TextManager.SpeciallyHandledCharCategory flag, ContentXElement element)
|
||||
{
|
||||
foreach (var subElement in element.Elements().Reverse())
|
||||
{
|
||||
if (subElement.NameAsIdentifier() != "override") { continue; }
|
||||
if (ScalableFont.ExtractShccFromXElement(subElement).HasFlag(flag))
|
||||
{
|
||||
return new ScalableFont(subElement, font.Size, GameMain.Instance.GraphicsDevice);
|
||||
return new ScalableFont(subElement, font?.Size ?? 14, GameMain.Instance.GraphicsDevice);
|
||||
}
|
||||
}
|
||||
|
||||
ScalableFont hardcodedFallback(string path)
|
||||
=> new ScalableFont(
|
||||
path,
|
||||
font.Size,
|
||||
font?.Size ?? 0,
|
||||
GameMain.Instance.GraphicsDevice,
|
||||
dynamicLoading: true,
|
||||
speciallyHandledCharCategory: flag);
|
||||
@@ -154,7 +157,7 @@ namespace Barotrauma
|
||||
};
|
||||
}
|
||||
|
||||
private string GetFontFilePath(ContentXElement element)
|
||||
private string? GetFontFilePath(ContentXElement element)
|
||||
{
|
||||
foreach (var subElement in element.Elements())
|
||||
{
|
||||
@@ -227,20 +230,20 @@ namespace Barotrauma
|
||||
{
|
||||
public GUIFont(string identifier) : base(identifier) { }
|
||||
|
||||
public bool HasValue => !Prefabs.IsEmpty;
|
||||
|
||||
public ScalableFont Value => Prefabs.ActivePrefab.Font;
|
||||
public bool HasValue => Value is not null;
|
||||
|
||||
public static implicit operator ScalableFont(GUIFont reference) => reference.Value;
|
||||
public ScalableFont? Value => Prefabs.ActivePrefab?.Font;
|
||||
|
||||
public static implicit operator ScalableFont?(GUIFont reference) => reference.Value;
|
||||
|
||||
public bool ForceUpperCase => Prefabs.ActivePrefab?.Font is { ForceUpperCase: true };
|
||||
|
||||
public uint Size => HasValue ? Value.Size : 0;
|
||||
public uint Size => Value?.Size ?? 0;
|
||||
|
||||
private ScalableFont GetFontForStr(LocalizedString str) => GetFontForStr(str.Value);
|
||||
private ScalableFont? GetFontForStr(LocalizedString str) => GetFontForStr(str.Value);
|
||||
|
||||
public ScalableFont GetFontForStr(string str) =>
|
||||
Prefabs.ActivePrefab.GetFontForCategory(TextManager.GetSpeciallyHandledCategories(str));
|
||||
public ScalableFont? GetFontForStr(string str) =>
|
||||
Prefabs.ActivePrefab?.GetFontForCategory(TextManager.GetSpeciallyHandledCategories(str));
|
||||
|
||||
public void DrawString(SpriteBatch sb, LocalizedString text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects spriteEffects, float layerDepth)
|
||||
{
|
||||
@@ -249,7 +252,7 @@ namespace Barotrauma
|
||||
|
||||
public void DrawString(SpriteBatch sb, string text, Vector2 position, Color color, float rotation, Vector2 origin, Vector2 scale, SpriteEffects spriteEffects, float layerDepth)
|
||||
{
|
||||
GetFontForStr(text).DrawString(sb, text, position, color, rotation, origin, scale, spriteEffects, layerDepth);
|
||||
GetFontForStr(text)?.DrawString(sb, text, position, color, rotation, origin, scale, spriteEffects, layerDepth);
|
||||
}
|
||||
|
||||
public void DrawString(SpriteBatch sb, LocalizedString text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects spriteEffects, float layerDepth, Alignment alignment = Alignment.TopLeft)
|
||||
@@ -259,7 +262,7 @@ namespace Barotrauma
|
||||
|
||||
public void DrawString(SpriteBatch sb, string text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects spriteEffects, float layerDepth, Alignment alignment = Alignment.TopLeft, ForceUpperCase forceUpperCase = Barotrauma.ForceUpperCase.Inherit)
|
||||
{
|
||||
GetFontForStr(text).DrawString(sb, text, position, color, rotation, origin, scale, spriteEffects, layerDepth, alignment, forceUpperCase);
|
||||
GetFontForStr(text)?.DrawString(sb, text, position, color, rotation, origin, scale, spriteEffects, layerDepth, alignment, forceUpperCase);
|
||||
}
|
||||
|
||||
public void DrawString(SpriteBatch sb, LocalizedString text, Vector2 position, Color color, ForceUpperCase forceUpperCase = Barotrauma.ForceUpperCase.Inherit, bool italics = false)
|
||||
@@ -269,34 +272,46 @@ namespace Barotrauma
|
||||
|
||||
public void DrawString(SpriteBatch sb, string text, Vector2 position, Color color, ForceUpperCase forceUpperCase = Barotrauma.ForceUpperCase.Inherit, bool italics = false)
|
||||
{
|
||||
GetFontForStr(text).DrawString(sb, text, position, color, forceUpperCase, italics);
|
||||
GetFontForStr(text)?.DrawString(sb, text, position, color, forceUpperCase, italics);
|
||||
}
|
||||
|
||||
public void DrawStringWithColors(SpriteBatch sb, string text, Vector2 position, Color color, float rotation, Vector2 origin, float scale, SpriteEffects spriteEffects, float layerDepth, in ImmutableArray<RichTextData>? richTextData, int rtdOffset = 0, Alignment alignment = Alignment.TopLeft, ForceUpperCase forceUpperCase = Barotrauma.ForceUpperCase.Inherit)
|
||||
{
|
||||
GetFontForStr(text).DrawStringWithColors(sb, text, position, color, rotation, origin, scale, spriteEffects, layerDepth, richTextData, rtdOffset, alignment, forceUpperCase);
|
||||
GetFontForStr(text)?.DrawStringWithColors(sb, text, position, color, rotation, origin, scale, spriteEffects, layerDepth, richTextData, rtdOffset, alignment, forceUpperCase);
|
||||
}
|
||||
|
||||
public Vector2 MeasureString(LocalizedString str, bool removeExtraSpacing = false)
|
||||
{
|
||||
return GetFontForStr(str).MeasureString(str, removeExtraSpacing);
|
||||
return GetFontForStr(str)?.MeasureString(str, removeExtraSpacing) ?? Vector2.Zero;
|
||||
}
|
||||
|
||||
public Vector2 MeasureChar(char c)
|
||||
{
|
||||
return GetFontForStr($"{c}").MeasureChar(c);
|
||||
return GetFontForStr($"{c}")?.MeasureChar(c) ?? Vector2.Zero;
|
||||
}
|
||||
|
||||
public string WrapText(string text, float width)
|
||||
=> GetFontForStr(text).WrapText(text, width);
|
||||
=> GetFontForStr(text)?.WrapText(text, width) ?? text;
|
||||
|
||||
public string WrapText(string text, float width, int requestCharPos, out Vector2 requestedCharPos)
|
||||
=> GetFontForStr(text).WrapText(text, width, requestCharPos, out requestedCharPos);
|
||||
|
||||
public string WrapText(string text, float width, out Vector2[] allCharPositions)
|
||||
=> GetFontForStr(text).WrapText(text, width, out allCharPositions);
|
||||
{
|
||||
requestedCharPos = default;
|
||||
return GetFontForStr(text)?.WrapText(text, width, requestCharPos, out requestedCharPos) ?? text;
|
||||
}
|
||||
|
||||
public float LineHeight => Value.LineHeight;
|
||||
public string WrapText(string text, float width, out Vector2[] allCharPositions)
|
||||
{
|
||||
var scalableFont = GetFontForStr(text);
|
||||
if (scalableFont != null)
|
||||
{
|
||||
return scalableFont.WrapText(text, width, out allCharPositions);
|
||||
}
|
||||
|
||||
allCharPositions = Enumerable.Range(0, text.Length + 1).Select(_ => Vector2.Zero).ToArray();
|
||||
return text;
|
||||
}
|
||||
|
||||
public float LineHeight => Value?.LineHeight ?? 0;
|
||||
}
|
||||
|
||||
public class GUIColorPrefab : GUIPrefab
|
||||
@@ -355,19 +370,19 @@ namespace Barotrauma
|
||||
{
|
||||
public GUISprite(string identifier) : base(identifier) { }
|
||||
|
||||
public UISprite Value
|
||||
public UISprite? Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return Prefabs.ActivePrefab.Sprite;
|
||||
return Prefabs.ActivePrefab?.Sprite;
|
||||
}
|
||||
}
|
||||
|
||||
public static implicit operator UISprite(GUISprite reference) => reference.Value;
|
||||
public static implicit operator UISprite?(GUISprite reference) => reference.Value;
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, Rectangle rect, Color color, SpriteEffects spriteEffects = SpriteEffects.None)
|
||||
{
|
||||
Value.Draw(spriteBatch, rect, color, spriteEffects);
|
||||
Value?.Draw(spriteBatch, rect, color, spriteEffects);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -390,33 +405,33 @@ namespace Barotrauma
|
||||
{
|
||||
public GUISpriteSheet(string identifier) : base(identifier) { }
|
||||
|
||||
public SpriteSheet Value
|
||||
public SpriteSheet? Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return Prefabs.ActivePrefab.SpriteSheet;
|
||||
return Prefabs.ActivePrefab?.SpriteSheet;
|
||||
}
|
||||
}
|
||||
|
||||
public int FrameCount => Value.FrameCount;
|
||||
public Point FrameSize => Value.FrameSize;
|
||||
public int FrameCount => Value?.FrameCount ?? 1;
|
||||
public Point FrameSize => Value?.FrameSize ?? Point.Zero;
|
||||
|
||||
public void Draw(ISpriteBatch spriteBatch, Vector2 pos, float rotate = 0, float scale = 1, SpriteEffects spriteEffects = SpriteEffects.None)
|
||||
{
|
||||
Value.Draw(spriteBatch, pos, rotate, scale, spriteEffects);
|
||||
Value?.Draw(spriteBatch, pos, rotate, scale, spriteEffects);
|
||||
}
|
||||
|
||||
public void Draw(ISpriteBatch spriteBatch, Vector2 pos, Color color, Vector2 origin, float rotate = 0, float scale = 1, SpriteEffects spriteEffects = SpriteEffects.None, float? depth = null)
|
||||
{
|
||||
Value.Draw(spriteBatch, pos, color, origin, rotate, scale, spriteEffects, depth);
|
||||
Value?.Draw(spriteBatch, pos, color, origin, rotate, scale, spriteEffects, depth);
|
||||
}
|
||||
|
||||
public void Draw(ISpriteBatch spriteBatch, int spriteIndex, Vector2 pos, Color color, Vector2 origin, float rotate, Vector2 scale, SpriteEffects spriteEffects = SpriteEffects.None, float? depth = null)
|
||||
{
|
||||
Value.Draw(spriteBatch, spriteIndex, pos, color, origin, rotate, scale, spriteEffects, depth);
|
||||
Value?.Draw(spriteBatch, spriteIndex, pos, color, origin, rotate, scale, spriteEffects, depth);
|
||||
}
|
||||
|
||||
public static implicit operator SpriteSheet(GUISpriteSheet reference) => reference.Value;
|
||||
public static implicit operator SpriteSheet?(GUISpriteSheet reference) => reference.Value;
|
||||
}
|
||||
|
||||
public class GUICursorPrefab : GUIPrefab
|
||||
@@ -446,6 +461,6 @@ namespace Barotrauma
|
||||
{
|
||||
public GUICursor(string identifier) : base(identifier) { }
|
||||
|
||||
public Sprite this[CursorState k] => Prefabs.ActivePrefab.Sprites[(int)k];
|
||||
public Sprite? this[CursorState k] => Prefabs.ActivePrefab?.Sprites[(int)k];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -433,14 +433,7 @@ namespace Barotrauma
|
||||
return Font.MeasureString(" ");
|
||||
}
|
||||
|
||||
Vector2 size = Vector2.Zero;
|
||||
while (size == Vector2.Zero)
|
||||
{
|
||||
try { size = Font.MeasureString(string.IsNullOrEmpty(text) ? " " : text); }
|
||||
catch { text = text.Length > 0 ? text.Substring(0, text.Length - 1) : ""; }
|
||||
}
|
||||
|
||||
return size;
|
||||
return Font.MeasureString(string.IsNullOrEmpty(text) ? " " : text);
|
||||
}
|
||||
|
||||
protected override void SetAlpha(float a)
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace Barotrauma
|
||||
|
||||
public void LoadContent(string contentPath, VideoSettings videoSettings, TextSettings textSettings, Identifier contentId, bool startPlayback)
|
||||
{
|
||||
LoadContent(contentPath, videoSettings, textSettings, contentId, startPlayback, new RawLString(""), null);
|
||||
LoadContent(contentPath, videoSettings, textSettings, contentId, startPlayback, LocalizedString.EmptyString, null);
|
||||
}
|
||||
|
||||
public void LoadContent(string contentPath, VideoSettings videoSettings, TextSettings textSettings, Identifier contentId, bool startPlayback, LocalizedString objective, Action onStop = null)
|
||||
|
||||
Reference in New Issue
Block a user