(8313e2529) Fixed server list being possible to re-refresh immediately after a server query has been sent to Steam, causing an extra "refreshing" text to appear in the list, minor layout changes
This commit is contained in:
@@ -31,6 +31,8 @@ namespace Barotrauma
|
|||||||
private bool masterServerResponded;
|
private bool masterServerResponded;
|
||||||
private IRestResponse masterServerResponse;
|
private IRestResponse masterServerResponse;
|
||||||
|
|
||||||
|
private GUIButton refreshButton;
|
||||||
|
|
||||||
private float[] columnRelativeWidth;
|
private float[] columnRelativeWidth;
|
||||||
|
|
||||||
//filters
|
//filters
|
||||||
@@ -140,7 +142,7 @@ namespace Barotrauma
|
|||||||
OnClicked = GameMain.MainMenuScreen.ReturnToMainMenu
|
OnClicked = GameMain.MainMenuScreen.ReturnToMainMenu
|
||||||
};
|
};
|
||||||
|
|
||||||
var refreshButton = new GUIButton(new RectTransform(new Vector2(buttonContainer.Rect.Height / (float)buttonContainer.Rect.Width, 0.9f), buttonContainer.RectTransform, Anchor.Center),
|
refreshButton = new GUIButton(new RectTransform(new Vector2(buttonContainer.Rect.Height / (float)buttonContainer.Rect.Width, 0.9f), buttonContainer.RectTransform, Anchor.Center),
|
||||||
"", style: "GUIButtonRefresh") {
|
"", style: "GUIButtonRefresh") {
|
||||||
|
|
||||||
ToolTip = TextManager.Get("ServerListRefresh"),
|
ToolTip = TextManager.Get("ServerListRefresh"),
|
||||||
@@ -200,7 +202,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private bool RefreshJoinButtonState(GUIComponent component, object obj)
|
private bool RefreshJoinButtonState(GUIComponent component, object obj)
|
||||||
{
|
{
|
||||||
if (obj == null || waitingForRefresh) return false;
|
if (obj == null || waitingForRefresh) { return false; }
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text))
|
if (!string.IsNullOrWhiteSpace(clientNameBox.Text) && !string.IsNullOrWhiteSpace(ipBox.Text))
|
||||||
{
|
{
|
||||||
@@ -216,7 +218,17 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private bool SelectServer(GUIComponent component, object obj)
|
private bool SelectServer(GUIComponent component, object obj)
|
||||||
{
|
{
|
||||||
if (obj == null || waitingForRefresh) return false;
|
if (obj == null || waitingForRefresh) { return false; }
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(clientNameBox.Text))
|
||||||
|
{
|
||||||
|
joinButton.Enabled = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
clientNameBox.Flash();
|
||||||
|
joinButton.Enabled = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(clientNameBox.Text))
|
if (!string.IsNullOrWhiteSpace(clientNameBox.Text))
|
||||||
{
|
{
|
||||||
@@ -245,15 +257,18 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private bool RefreshServers(GUIButton button, object obj)
|
private bool RefreshServers(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
if (waitingForRefresh) return false;
|
if (waitingForRefresh) { return false; }
|
||||||
serverList.ClearChildren();
|
serverList.ClearChildren();
|
||||||
serverPreview.ClearChildren();
|
serverPreview.ClearChildren();
|
||||||
|
|
||||||
ipBox.Text = null;
|
ipBox.Text = null;
|
||||||
joinButton.Enabled = false;
|
joinButton.Enabled = false;
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform),
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform),
|
||||||
TextManager.Get("RefreshingServerList"));
|
TextManager.Get("RefreshingServerList"), textAlignment: Alignment.Center)
|
||||||
|
{
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
|
|
||||||
CoroutineManager.StartCoroutine(WaitForRefresh());
|
CoroutineManager.StartCoroutine(WaitForRefresh());
|
||||||
|
|
||||||
@@ -274,17 +289,19 @@ namespace Barotrauma
|
|||||||
if (!SteamManager.GetServers(AddToServerList, UpdateServerInfo, ServerQueryFinished))
|
if (!SteamManager.GetServers(AddToServerList, UpdateServerInfo, ServerQueryFinished))
|
||||||
{
|
{
|
||||||
serverList.ClearChildren();
|
serverList.ClearChildren();
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform),
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform),
|
||||||
TextManager.Get("ServerListNoSteamConnection"));
|
TextManager.Get("ServerListNoSteamConnection"), textAlignment: Alignment.Center)
|
||||||
|
{
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CoroutineManager.StartCoroutine(SendMasterServerRequest());
|
CoroutineManager.StartCoroutine(SendMasterServerRequest());
|
||||||
|
waitingForRefresh = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
waitingForRefresh = false;
|
|
||||||
|
|
||||||
refreshDisableTimer = DateTime.Now + AllowedRefreshInterval;
|
refreshDisableTimer = DateTime.Now + AllowedRefreshInterval;
|
||||||
|
|
||||||
yield return CoroutineStatus.Success;
|
yield return CoroutineStatus.Success;
|
||||||
@@ -349,8 +366,11 @@ namespace Barotrauma
|
|||||||
serverList.Content.ClearChildren();
|
serverList.Content.ClearChildren();
|
||||||
if (serverInfos.Count() == 0)
|
if (serverInfos.Count() == 0)
|
||||||
{
|
{
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.05f), serverList.Content.RectTransform),
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), serverList.Content.RectTransform),
|
||||||
TextManager.Get("NoServers"));
|
TextManager.Get("NoServers"), textAlignment: Alignment.Center)
|
||||||
|
{
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
foreach (ServerInfo serverInfo in serverInfos)
|
foreach (ServerInfo serverInfo in serverInfos)
|
||||||
@@ -490,6 +510,7 @@ namespace Barotrauma
|
|||||||
UserData = "noresults"
|
UserData = "noresults"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
waitingForRefresh = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<object> SendMasterServerRequest()
|
private IEnumerable<object> SendMasterServerRequest()
|
||||||
|
|||||||
@@ -821,6 +821,54 @@ namespace Barotrauma
|
|||||||
VoiceSetting = voiceSetting;
|
VoiceSetting = voiceSetting;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!SelectedContentPackages.Any())
|
||||||
|
{
|
||||||
|
var availablePackage = ContentPackage.List.FirstOrDefault(cp => cp.IsCompatible() && cp.CorePackage);
|
||||||
|
if (availablePackage != null)
|
||||||
|
{
|
||||||
|
SelectedContentPackages.Add(availablePackage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//save to get rid of the invalid selected packages in the config file
|
||||||
|
if (missingPackagePaths.Count > 0 || incompatiblePackages.Count > 0) { SaveNewPlayerConfig(); }
|
||||||
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Save DefaultConfig
|
||||||
|
private void SaveNewDefaultConfig()
|
||||||
|
{
|
||||||
|
XDocument doc = new XDocument();
|
||||||
|
|
||||||
|
if (doc.Root == null)
|
||||||
|
{
|
||||||
|
doc.Add(new XElement("config"));
|
||||||
|
}
|
||||||
|
|
||||||
|
doc.Root.Add(
|
||||||
|
new XAttribute("language", TextManager.Language),
|
||||||
|
new XAttribute("masterserverurl", MasterServerUrl),
|
||||||
|
new XAttribute("autocheckupdates", AutoCheckUpdates),
|
||||||
|
new XAttribute("musicvolume", musicVolume),
|
||||||
|
new XAttribute("soundvolume", soundVolume),
|
||||||
|
new XAttribute("voicechatvolume", voiceChatVolume),
|
||||||
|
new XAttribute("verboselogging", VerboseLogging),
|
||||||
|
new XAttribute("savedebugconsolelogs", SaveDebugConsoleLogs),
|
||||||
|
new XAttribute("enablesplashscreen", EnableSplashScreen),
|
||||||
|
new XAttribute("usesteammatchmaking", useSteamMatchmaking),
|
||||||
|
new XAttribute("quickstartsub", QuickStartSubmarineName),
|
||||||
|
new XAttribute("requiresteamauthentication", requireSteamAuthentication),
|
||||||
|
new XAttribute("aimassistamount", aimAssistAmount));
|
||||||
|
|
||||||
|
if (!ShowUserStatisticsPrompt)
|
||||||
|
{
|
||||||
|
doc.Root.Add(new XAttribute("senduserstatistics", sendUserStatistics));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (WasGameUpdated)
|
||||||
|
{
|
||||||
|
doc.Root.Add(new XAttribute("wasgameupdated", true));
|
||||||
|
}
|
||||||
|
|
||||||
useSteamMatchmaking = doc.Root.GetAttributeBool("usesteammatchmaking", useSteamMatchmaking);
|
useSteamMatchmaking = doc.Root.GetAttributeBool("usesteammatchmaking", useSteamMatchmaking);
|
||||||
requireSteamAuthentication = doc.Root.GetAttributeBool("requiresteamauthentication", requireSteamAuthentication);
|
requireSteamAuthentication = doc.Root.GetAttributeBool("requiresteamauthentication", requireSteamAuthentication);
|
||||||
|
|||||||
Reference in New Issue
Block a user