(8d282f4cc) Hide the crew area and the chat box when using a controller (= aiming with a turret or similar item).

This commit is contained in:
Joonas Rikkonen
2019-04-10 15:13:25 +03:00
parent 488fded57f
commit 9f55da3677
4 changed files with 107 additions and 33 deletions
@@ -26,7 +26,21 @@ namespace Barotrauma
private bool isSinglePlayer;
public bool IsSinglePlayer => isSinglePlayer;
private bool toggleOpen = true;
private bool _toggleOpen = true;
public bool ToggleOpen
{
get { return _toggleOpen; }
set
{
if (_toggleOpen == value) { return; }
_toggleOpen = value;
foreach (GUIComponent child in ToggleButton.Children)
{
child.SpriteEffects = _toggleOpen == (HUDLayoutSettings.ChatBoxAlignment == Alignment.Right) ?
SpriteEffects.FlipHorizontally : SpriteEffects.None;
}
}
}
private float openState;
private float prevUIScale;
@@ -81,12 +95,7 @@ namespace Barotrauma
toggleButton.OnClicked += (GUIButton btn, object userdata) =>
{
toggleOpen = !toggleOpen;
foreach (GUIComponent child in btn.Children)
{
child.SpriteEffects = toggleOpen == (HUDLayoutSettings.ChatBoxAlignment == Alignment.Right) ?
SpriteEffects.FlipHorizontally : SpriteEffects.None;
}
ToggleOpen = !ToggleOpen;
return true;
};
@@ -228,7 +237,7 @@ namespace Barotrauma
chatBox.UpdateScrollBarSize();
if (!toggleOpen)
if (!ToggleOpen)
{
var popupMsg = new GUIFrame(new RectTransform(Vector2.One, guiFrame.RectTransform), style: "GUIToolTip")
{
@@ -315,7 +324,7 @@ namespace Barotrauma
if (toggleOpen || (inputBox != null && inputBox.Selected))
if (ToggleOpen || (inputBox != null && inputBox.Selected))
{
openState += deltaTime * 5.0f;
//delete all popup messages when the chatbox is open