(aa84bc3c8) Fixed: UI Scaling issues in 4k

This commit is contained in:
Joonas Rikkonen
2019-05-18 17:36:15 +03:00
parent 30eed1ed7c
commit be4db3ee12
5 changed files with 89 additions and 98 deletions
@@ -31,8 +31,6 @@ namespace Barotrauma
private bool masterServerResponded;
private IRestResponse masterServerResponse;
private GUIButton refreshButton;
private float[] columnRelativeWidth;
//filters
@@ -142,7 +140,7 @@ namespace Barotrauma
OnClicked = GameMain.MainMenuScreen.ReturnToMainMenu
};
refreshButton = new GUIButton(new RectTransform(new Vector2(buttonContainer.Rect.Height / (float)buttonContainer.Rect.Width, 0.9f), buttonContainer.RectTransform, Anchor.Center),
var refreshButton = new GUIButton(new RectTransform(new Vector2(buttonContainer.Rect.Height / (float)buttonContainer.Rect.Width, 0.9f), buttonContainer.RectTransform, Anchor.Center),
"", style: "GUIButtonRefresh") {
ToolTip = TextManager.Get("ServerListRefresh"),
@@ -222,6 +220,22 @@ namespace Barotrauma
return true;
}
private bool RefreshJoinButtonState(GUIComponent component, object obj)
{
if (obj == null || waitingForRefresh) return false;
if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text))
{
joinButton.Enabled = true;
}
else
{
joinButton.Enabled = false;
}
return true;
}
private bool SelectServer(GUIComponent component, object obj)
{
if (obj == null || waitingForRefresh) { return false; }
@@ -236,6 +250,16 @@ namespace Barotrauma
joinButton.Enabled = false;
}
if (!string.IsNullOrWhiteSpace(clientNameBox.Text))
{
joinButton.Enabled = true;
}
else
{
clientNameBox.Flash();
joinButton.Enabled = false;
}
ServerInfo serverInfo;
try
{
@@ -260,11 +284,8 @@ namespace Barotrauma
ipBox.Text = null;
joinButton.Enabled = false;
new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform),
TextManager.Get("RefreshingServerList"), textAlignment: Alignment.Center)
{
CanBeFocused = false
};
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform),
TextManager.Get("RefreshingServerList"));
CoroutineManager.StartCoroutine(WaitForRefresh());
@@ -285,19 +306,17 @@ namespace Barotrauma
if (!SteamManager.GetServers(AddToServerList, UpdateServerInfo, ServerQueryFinished))
{
serverList.ClearChildren();
new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform),
TextManager.Get("ServerListNoSteamConnection"), textAlignment: Alignment.Center)
{
CanBeFocused = false
};
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform),
TextManager.Get("ServerListNoSteamConnection"));
}
}
else
{
CoroutineManager.StartCoroutine(SendMasterServerRequest());
waitingForRefresh = false;
}
waitingForRefresh = false;
refreshDisableTimer = DateTime.Now + AllowedRefreshInterval;
yield return CoroutineStatus.Success;
@@ -362,11 +381,8 @@ namespace Barotrauma
serverList.Content.ClearChildren();
if (serverInfos.Count() == 0)
{
new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform),
TextManager.Get("NoServers"), textAlignment: Alignment.Center)
{
CanBeFocused = false
};
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform),
TextManager.Get("NoServers"));
return;
}
foreach (ServerInfo serverInfo in serverInfos)
@@ -506,7 +522,6 @@ namespace Barotrauma
UserData = "noresults"
};
}
waitingForRefresh = false;
}
private IEnumerable<object> SendMasterServerRequest()