Unstable v0.9.707.0

This commit is contained in:
Juan Pablo Arce
2020-02-11 16:07:21 -03:00
parent 8324d20464
commit 2783125162
68 changed files with 1460 additions and 1219 deletions
@@ -133,7 +133,6 @@ 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; }
@@ -163,8 +162,6 @@ namespace Barotrauma
get { return arrow; }
}
public static Sprite InfoAreaBackground;
public static bool SettingsMenuOpen
{
get { return settingsMenuOpen; }
@@ -260,7 +257,6 @@ namespace Barotrauma
arrow = new Sprite("Content/UI/MainIconsAtlas.png", new Rectangle(392, 393, 49, 45), new Vector2(0.5f, 0.5f));
SpeechBubbleIcon = new Sprite("Content/UI/MainIconsAtlas.png", new Rectangle(385, 449, 66, 60), new Vector2(0.5f, 0.5f));
BrokenIcon = new Sprite("Content/UI/MainIconsAtlas.png", new Rectangle(898, 386, 123, 123), new Vector2(0.5f, 0.5f));
InfoAreaBackground = new Sprite("Content/UI/InventoryUIAtlas.png", new Rectangle(290, 320, 400, 300), new Vector2(0.0f, 0.0f));
}
/// <summary>
@@ -782,9 +778,21 @@ namespace Barotrauma
if (GUIScrollBar.DraggingBar != null) { return GUIScrollBar.DraggingBar.Bar.HoverCursor; }
// Wire cursors
if (ConnectionPanel.HighlightedWire != null) { return CursorState.Hand; }
if (Wire.DraggingWire != null) { return CursorState.Dragging; }
if (Connection.DraggingConnected != null) { return CursorState.Dragging; }
if (Character.Controlled != null)
{
if (Character.Controlled.SelectedConstruction?.GetComponent<ConnectionPanel>() != null)
{
if (Connection.DraggingConnected != null)
{
return CursorState.Dragging;
}
else if (ConnectionPanel.HighlightedWire != null)
{
return CursorState.Hand;
}
}
if (Wire.DraggingWire != null) { return CursorState.Dragging; }
}
if (c == null || c is GUICustomComponent)
{
@@ -794,7 +802,7 @@ namespace Barotrauma
case CharacterEditorScreen editor:
return editor.GetMouseCursorState();
// Portrait area during gameplay
case GameScreen _ when HUDLayoutSettings.PortraitArea.Contains(PlayerInput.MousePosition):
case GameScreen _ when HUDLayoutSettings.PortraitArea.Contains(PlayerInput.MousePosition) && !(Character.Controlled?.ShouldLockHud() ?? true):
return CursorState.Hand;
// Sub editor drag and highlight
case SubEditorScreen editor:
@@ -989,7 +997,6 @@ namespace Barotrauma
Debug.Assert(updateList.Count == updateListSet.Count);
updateList.ForEach(c => c.UpdateAuto(deltaTime));
UpdateMessages(deltaTime);
UpdateInput();
}
private static void UpdateMessages(float deltaTime)
@@ -1029,32 +1036,6 @@ 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)
@@ -1860,50 +1841,6 @@ 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;
@@ -2102,6 +2039,12 @@ namespace Barotrauma
sounds[soundIndex]?.Play(null, "ui");
}
public static bool IsFourByThree()
{
float aspectRatio = HorizontalAspectRatio;
return aspectRatio > 1.3f && aspectRatio < 1.4f;
}
#endregion
}
}