2f107db...5202af9

This commit is contained in:
Joonas Rikkonen
2019-03-18 21:42:26 +02:00
parent 58c92888b7
commit 044fd3344b
395 changed files with 27417 additions and 19754 deletions
+19 -18
View File
@@ -13,7 +13,8 @@ namespace Barotrauma
{
public enum GUISoundType
{
Message,
UIMessage,
ChatMessage,
RadioMessage,
DeadMessage,
Click,
@@ -58,7 +59,7 @@ namespace Barotrauma
private static GUIFrame pauseMenu;
private static Sprite arrow, lockIcon, checkmarkIcon, timerIcon;
public static KeyboardDispatcher KeyboardDispatcher { get; private set; }
public static KeyboardDispatcher KeyboardDispatcher { get; set; }
/// <summary>
/// Has the selected Screen changed since the last time the GUI was drawn.
@@ -131,12 +132,11 @@ namespace Barotrauma
set;
}
public static bool DisableHUD;
public static bool DisableHUD, DisableUpperHUD, DisableItemHighlights, DisableCharacterNames;
public static void Init(GameWindow window, IEnumerable<ContentPackage> selectedContentPackages, GraphicsDevice graphicsDevice)
{
GUI.graphicsDevice = graphicsDevice;
KeyboardDispatcher = new KeyboardDispatcher(window);
var uiStyles = ContentPackage.GetFilesOfType(selectedContentPackages, ContentType.UIStyle).ToList();
if (uiStyles.Count == 0)
{
@@ -157,14 +157,15 @@ namespace Barotrauma
{
sounds = new Sound[Enum.GetValues(typeof(GUISoundType)).Length];
sounds[(int)GUISoundType.Message] = GameMain.SoundManager.LoadSound("Content/Sounds/UI/UImsg.ogg", false);
sounds[(int)GUISoundType.RadioMessage] = GameMain.SoundManager.LoadSound("Content/Sounds/UI/radiomsg.ogg", false);
sounds[(int)GUISoundType.DeadMessage] = GameMain.SoundManager.LoadSound("Content/Sounds/UI/deadmsg.ogg", false);
sounds[(int)GUISoundType.Click] = GameMain.SoundManager.LoadSound("Content/Sounds/UI/beep-shinymetal.ogg", false);
sounds[(int)GUISoundType.UIMessage] = GameMain.SoundManager.LoadSound("Content/Sounds/UI/UImsg.ogg", false);
sounds[(int)GUISoundType.ChatMessage] = GameMain.SoundManager.LoadSound("Content/Sounds/UI/ChatMsg.ogg", false);
sounds[(int)GUISoundType.RadioMessage] = GameMain.SoundManager.LoadSound("Content/Sounds/UI/RadioMsg.ogg", false);
sounds[(int)GUISoundType.DeadMessage] = GameMain.SoundManager.LoadSound("Content/Sounds/UI/DeadMsg.ogg", false);
sounds[(int)GUISoundType.Click] = GameMain.SoundManager.LoadSound("Content/Sounds/UI/Click.ogg", false);
sounds[(int)GUISoundType.PickItem] = GameMain.SoundManager.LoadSound("Content/Sounds/pickItem.ogg", false);
sounds[(int)GUISoundType.PickItemFail] = GameMain.SoundManager.LoadSound("Content/Sounds/pickItemFail.ogg", false);
sounds[(int)GUISoundType.DropItem] = GameMain.SoundManager.LoadSound("Content/Sounds/dropItem.ogg", false);
sounds[(int)GUISoundType.PickItem] = GameMain.SoundManager.LoadSound("Content/Sounds/PickItem.ogg", false);
sounds[(int)GUISoundType.PickItemFail] = GameMain.SoundManager.LoadSound("Content/Sounds/PickItemFail.ogg", false);
sounds[(int)GUISoundType.DropItem] = GameMain.SoundManager.LoadSound("Content/Sounds/DropItem.ogg", false);
}
// create 1x1 texture for line drawing
t = new Texture2D(GraphicsDevice, 1, 1);
@@ -290,7 +291,7 @@ namespace Barotrauma
{
Color clr = Color.White;
string soundStr = i + ": ";
SoundChannel playingSoundChannel = GameMain.SoundManager.GetSoundChannelFromIndex(i);
SoundChannel playingSoundChannel = GameMain.SoundManager.GetSoundChannelFromIndex(SoundManager.SourcePoolIndex.Default, i);
if (playingSoundChannel == null)
{
soundStr += "none";
@@ -363,7 +364,7 @@ namespace Barotrauma
if (HUDLayoutSettings.DebugDraw) HUDLayoutSettings.Draw(spriteBatch);
if (GameMain.NetworkMember != null) GameMain.NetworkMember.Draw(spriteBatch);
if (GameMain.Client != null) GameMain.Client.Draw(spriteBatch);
if (Character.Controlled?.Inventory != null)
{
@@ -1527,10 +1528,10 @@ namespace Barotrauma
SaveUtil.SaveGame(GameMain.GameSession.SavePath);
}
if (GameMain.NetworkMember != null)
if (GameMain.Client != null)
{
GameMain.NetworkMember.Disconnect();
GameMain.NetworkMember = null;
GameMain.Client.Disconnect();
GameMain.Client = null;
}
CoroutineManager.StopCoroutines("EndCinematic");
@@ -1563,13 +1564,13 @@ namespace Barotrauma
{
if (messages.Any(msg => msg.Text == message)) { return; }
messages.Add(new GUIMessage(message, color, lifeTime ?? MathHelper.Clamp(message.Length / 5.0f, 3.0f, 10.0f), font ?? LargeFont));
if (playSound) PlayUISound(GUISoundType.Message);
if (playSound) PlayUISound(GUISoundType.UIMessage);
}
public static void AddMessage(string message, Color color, Vector2 worldPos, Vector2 velocity, float lifeTime = 3.0f, bool playSound = true)
{
messages.Add(new GUIMessage(message, color, worldPos, velocity, lifeTime, Alignment.Center, LargeFont));
if (playSound) PlayUISound(GUISoundType.Message);
if (playSound) PlayUISound(GUISoundType.UIMessage);
}
public static void ClearMessages()