(d9829ac) v0.9.4.0

This commit is contained in:
Regalis
2019-10-24 18:05:42 +02:00
parent 9aa12bcac2
commit b39922a074
319 changed files with 12516 additions and 6815 deletions
+33 -11
View File
@@ -1,3 +1,4 @@
using Barotrauma.CharacterEditor;
using Barotrauma.Extensions;
using Barotrauma.Sounds;
using Barotrauma.Tutorials;
@@ -8,6 +9,7 @@ using Microsoft.Xna.Framework.Input;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
namespace Barotrauma
{
@@ -154,19 +156,38 @@ namespace Barotrauma
public static void Init(GameWindow window, IEnumerable<ContentPackage> selectedContentPackages, GraphicsDevice graphicsDevice)
{
GUI.graphicsDevice = graphicsDevice;
var uiStyles = ContentPackage.GetFilesOfType(selectedContentPackages, ContentType.UIStyle).ToList();
if (uiStyles.Count == 0)
var files = ContentPackage.GetFilesOfType(selectedContentPackages, ContentType.UIStyle);
XElement selectedStyle = null;
foreach (var file in files)
{
XDocument doc = XMLExtensions.TryLoadXml(file);
if (doc == null) { continue; }
var mainElement = doc.Root;
if (doc.Root.IsOverride())
{
mainElement = doc.Root.FirstElement();
if (selectedStyle != null)
{
DebugConsole.NewMessage($"Overriding the ui styles with '{file}'", Color.Yellow);
}
}
else if (selectedStyle != null)
{
DebugConsole.ThrowError("Another ui style already loaded! Use <override></override> tags to override it.");
break;
}
selectedStyle = mainElement;
}
if (selectedStyle == null)
{
DebugConsole.ThrowError("No UI styles defined in the selected content package!");
return;
}
else if (uiStyles.Count > 1)
else
{
DebugConsole.ThrowError("Multiple UI styles defined in the selected content package! Selecting the first one.");
Style = new GUIStyle(selectedStyle, graphicsDevice);
}
Style = new GUIStyle(uiStyles[0], graphicsDevice);
if (CJKFont == null)
{
CJKFont = new ScalableFont("Content/Fonts/NotoSans/NotoSansCJKsc-Bold.otf",
@@ -407,6 +428,10 @@ namespace Barotrauma
{
debugDrawEvents = !debugDrawEvents;
}
if (MouseOn != null)
{
DrawString(spriteBatch, new Vector2(GameMain.GraphicsWidth - 500, 20), $"Selected UI Element: {MouseOn.GetType().ToString()}", Color.LightGreen, Color.Black * 0.5f, 0, SmallFont);
}
}
if (HUDLayoutSettings.DebugDraw) HUDLayoutSettings.Draw(spriteBatch);
@@ -601,10 +626,7 @@ namespace Barotrauma
private static void HandlePersistingElements(float deltaTime)
{
if (GUIMessageBox.VisibleBox != null && GUIMessageBox.VisibleBox.UserData as string != "verificationprompt" && GUIMessageBox.VisibleBox.UserData as string != "bugreporter")
{
GUIMessageBox.VisibleBox.AddToGUIUpdateList();
}
GUIMessageBox.AddActiveToGUIUpdateList();
if (pauseMenuOpen)
{
@@ -1570,7 +1592,7 @@ namespace Barotrauma
button.OnClicked += (btn, userData) =>
{
var quitButton = button;
if (GameMain.GameSession != null || (Screen.Selected is CharacterEditorScreen charEditScreen || Screen.Selected is SubEditorScreen subEditScreen))
if (GameMain.GameSession != null || (Screen.Selected is CharacterEditorScreen || Screen.Selected is SubEditorScreen))
{
string text = GameMain.GameSession == null ? "PauseMenuQuitVerificationEditor" : "PauseMenuQuitVerification";
var msgBox = new GUIMessageBox("", TextManager.Get(text), new string[] { TextManager.Get("Yes"), TextManager.Get("Cancel") })