Unstable 1.8.4.0
This commit is contained in:
@@ -144,9 +144,9 @@ namespace Barotrauma.Networking
|
||||
|
||||
var pingLocation = NetPingLocation.TryParseFromString(pingLocationStr);
|
||||
|
||||
if (pingLocation.HasValue && Steamworks.SteamNetworkingUtils.LocalPingLocation.HasValue)
|
||||
if (pingLocation.HasValue)
|
||||
{
|
||||
int ping = Steamworks.SteamNetworkingUtils.LocalPingLocation.Value.EstimatePingTo(pingLocation.Value);
|
||||
int ping = Steamworks.SteamNetworkingUtils.EstimatePingTo(pingLocation.Value);
|
||||
if (ping < 0) { return Result.Failure(SteamLobbyPingError.PingEstimationFailed); }
|
||||
return Result.Success(ping);
|
||||
}
|
||||
|
||||
@@ -385,14 +385,24 @@ namespace Barotrauma.Networking
|
||||
{ MinSize = new Point(0, 15) },
|
||||
package.Name)
|
||||
{
|
||||
CanBeFocused = false
|
||||
Enabled = false
|
||||
};
|
||||
packageText.Box.DisabledColor = packageText.Box.Color;
|
||||
packageText.TextBlock.DisabledTextColor = packageText.TextBlock.TextColor;
|
||||
if (!string.IsNullOrEmpty(package.Hash))
|
||||
{
|
||||
if (ContentPackageManager.AllPackages.Any(contentPackage => contentPackage.Hash.StringRepresentation == package.Hash))
|
||||
if (ContentPackageManager.AllPackages.FirstOrDefault(contentPackage => contentPackage.Hash.StringRepresentation == package.Hash) is { } matchingPackage)
|
||||
{
|
||||
packageText.TextColor = GUIStyle.Green;
|
||||
packageText.Selected = true;
|
||||
matchingPackage.TryFetchUgcDescription(onFinished: (string? description) =>
|
||||
{
|
||||
if (packageText.ToolTip.IsNullOrEmpty() &&
|
||||
!string.IsNullOrEmpty(description))
|
||||
{
|
||||
packageText.ToolTip = description + "...";
|
||||
}
|
||||
});
|
||||
}
|
||||
//workshop download link found
|
||||
else if (package.Id.TryUnwrap(out var ugcId) && ugcId is SteamWorkshopId)
|
||||
@@ -437,7 +447,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
public void UpdateInfo(Func<string, string?> valueGetter)
|
||||
{
|
||||
ServerMessage = valueGetter("message") ?? "";
|
||||
ServerMessage = ExtractServerMessage(valueGetter);
|
||||
if (Version.TryParse(valueGetter("version"), out var version))
|
||||
{
|
||||
GameVersion = version;
|
||||
@@ -477,6 +487,22 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
private static string ExtractServerMessage(Func<string, string?> valueGetter)
|
||||
{
|
||||
string msg = valueGetter("message") ?? string.Empty;
|
||||
if (!msg.IsNullOrEmpty()) { return msg; }
|
||||
|
||||
int messageIndex = 0;
|
||||
string splitMessage;
|
||||
do
|
||||
{
|
||||
splitMessage = valueGetter($"message{messageIndex}") ?? string.Empty;
|
||||
msg += splitMessage;
|
||||
messageIndex++;
|
||||
} while (!splitMessage.IsNullOrEmpty());
|
||||
return msg;
|
||||
}
|
||||
|
||||
private static ServerListContentPackageInfo[] ExtractContentPackageInfo(string serverName, Func<string, string?> valueGetter)
|
||||
{
|
||||
//workaround to ServerRules queries truncating the values to 255 bytes
|
||||
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
#nullable enable
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
@@ -67,6 +67,7 @@ namespace Barotrauma
|
||||
return null;
|
||||
});
|
||||
serverInfo.Checked = true;
|
||||
serverInfo.HasPassword |= entry.Passworded;
|
||||
|
||||
onServerDataReceived(serverInfo, this);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user