v1.0.13.1 (first post-1.0 patch)
This commit is contained in:
@@ -94,7 +94,7 @@ namespace Barotrauma.Steam
|
||||
CanBeFocused = false
|
||||
};
|
||||
var itemTitle = new GUITextBlock(new RectTransform(Vector2.One, itemFrame.RectTransform),
|
||||
text: item.Title);
|
||||
text: item.Title ?? "");
|
||||
var itemDownloadProgress
|
||||
= new GUIProgressBar(new RectTransform((0.5f, 0.75f),
|
||||
itemFrame.RectTransform, Anchor.CenterRight), 0.0f)
|
||||
|
||||
@@ -105,7 +105,8 @@ namespace Barotrauma.Steam
|
||||
|
||||
currentLobby?.SetData("contentpackage", string.Join(",", contentPackages.Select(cp => cp.Name)));
|
||||
currentLobby?.SetData("contentpackagehash", string.Join(",", contentPackages.Select(cp => cp.Hash.StringRepresentation)));
|
||||
currentLobby?.SetData("contentpackageid", string.Join(",", contentPackages.Select(cp => cp.UgcId)));
|
||||
currentLobby?.SetData("contentpackageid", string.Join(",", contentPackages.Select(cp
|
||||
=> cp.UgcId.TryUnwrap(out var ugcId) ? ugcId.StringRepresentation : "")));
|
||||
currentLobby?.SetData("modeselectionmode", serverSettings.ModeSelectionMode.ToString());
|
||||
currentLobby?.SetData("subselectionmode", serverSettings.SubSelectionMode.ToString());
|
||||
currentLobby?.SetData("voicechatenabled", serverSettings.VoiceChatEnabled.ToString());
|
||||
|
||||
@@ -16,6 +16,9 @@ namespace Barotrauma.Steam
|
||||
private static readonly List<Identifier> initializationErrors = new List<Identifier>();
|
||||
public static IReadOnlyList<Identifier> InitializationErrors => initializationErrors;
|
||||
|
||||
private static bool IsInitializedProjectSpecific
|
||||
=> Steamworks.SteamClient.IsValid && Steamworks.SteamClient.IsLoggedOn;
|
||||
|
||||
private static void InitializeProjectSpecific()
|
||||
{
|
||||
if (IsInitialized) { return; }
|
||||
@@ -23,7 +26,6 @@ namespace Barotrauma.Steam
|
||||
try
|
||||
{
|
||||
Steamworks.SteamClient.Init(AppID, false);
|
||||
IsInitialized = Steamworks.SteamClient.IsLoggedOn && Steamworks.SteamClient.IsValid;
|
||||
|
||||
if (IsInitialized)
|
||||
{
|
||||
@@ -43,13 +45,11 @@ namespace Barotrauma.Steam
|
||||
}
|
||||
catch (DllNotFoundException)
|
||||
{
|
||||
IsInitialized = false;
|
||||
initializationErrors.Add("SteamDllNotFound".ToIdentifier());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("SteamManager initialization threw an exception", e);
|
||||
IsInitialized = false;
|
||||
initializationErrors.Add("SteamClientInitFailed".ToIdentifier());
|
||||
}
|
||||
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace Barotrauma.Steam
|
||||
{
|
||||
await Task.Yield();
|
||||
|
||||
string thumbnailUrl = item.PreviewImageUrl;
|
||||
string? thumbnailUrl = item.PreviewImageUrl;
|
||||
if (thumbnailUrl.IsNullOrWhiteSpace()) { return null; }
|
||||
var client = new RestClient(thumbnailUrl);
|
||||
var request = new RestRequest(".", Method.GET);
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Barotrauma.Steam
|
||||
private string ExtractTitle(ItemOrPackage itemOrPackage)
|
||||
=> itemOrPackage.TryGet(out ContentPackage package)
|
||||
? package.Name
|
||||
: ((Steamworks.Ugc.Item)itemOrPackage).Title;
|
||||
: (((Steamworks.Ugc.Item)itemOrPackage).Title ?? "");
|
||||
|
||||
private void CreateWorkshopItemDetailContainer(
|
||||
GUIFrame parent,
|
||||
@@ -340,6 +340,8 @@ namespace Barotrauma.Steam
|
||||
|
||||
subscribeButton.OnClicked = (button, o) =>
|
||||
{
|
||||
if (!SteamManager.IsInitialized) { return false; }
|
||||
|
||||
if (!workshopItem.IsSubscribed)
|
||||
{
|
||||
workshopItem.Subscribe();
|
||||
@@ -360,6 +362,8 @@ namespace Barotrauma.Steam
|
||||
new RectTransform(Vector2.Zero, subscribeButton.RectTransform),
|
||||
onUpdate: (deltaTime, component) =>
|
||||
{
|
||||
if (!SteamManager.IsInitialized) { return; }
|
||||
|
||||
if (subscribeButtonSprite.Style is { Identifier: { } styleId })
|
||||
{
|
||||
if (workshopItem.IsSubscribed && styleId != minusButton)
|
||||
@@ -380,6 +384,8 @@ namespace Barotrauma.Steam
|
||||
new RectTransform((1.22f, 1.22f), subscribeButtonSprite.RectTransform, Anchor.Center),
|
||||
onDraw: (spriteBatch, component) =>
|
||||
{
|
||||
if (!SteamManager.IsInitialized) { return; }
|
||||
|
||||
bool visible = workshopItem.IsSubscribed
|
||||
&& (workshopItem.IsDownloading
|
||||
|| workshopItem.IsDownloadPending
|
||||
@@ -407,6 +413,8 @@ namespace Barotrauma.Steam
|
||||
},
|
||||
onUpdate: (deltaTime, component) =>
|
||||
{
|
||||
if (!SteamManager.IsInitialized) { return; }
|
||||
|
||||
displayedDownloadAmount = Math.Min(
|
||||
workshopItem.DownloadAmount,
|
||||
MathHelper.Lerp(displayedDownloadAmount, workshopItem.DownloadAmount, 0.05f));
|
||||
@@ -450,7 +458,7 @@ namespace Barotrauma.Steam
|
||||
|
||||
var title = new GUITextBlock(
|
||||
new RectTransform(Vector2.One, itemLayout.RectTransform),
|
||||
workshopItem.Title, font: GUIStyle.Font)
|
||||
workshopItem.Title ?? "", font: GUIStyle.Font)
|
||||
{
|
||||
CanBeFocused = false
|
||||
};
|
||||
@@ -570,7 +578,7 @@ namespace Barotrauma.Steam
|
||||
var titleAndAuthorLayout = new GUILayoutGroup(new RectTransform(Vector2.One, headerLayout.RectTransform));
|
||||
|
||||
var selectedTitle =
|
||||
new GUITextBlock(new RectTransform((1.0f, 0.5f), titleAndAuthorLayout.RectTransform), workshopItem.Title,
|
||||
new GUITextBlock(new RectTransform((1.0f, 0.5f), titleAndAuthorLayout.RectTransform), workshopItem.Title ?? "",
|
||||
font: GUIStyle.LargeFont);
|
||||
|
||||
var author = workshopItem.Owner;
|
||||
@@ -682,9 +690,9 @@ namespace Barotrauma.Steam
|
||||
|
||||
TaskPool.Add($"Request username for {author.Id}", author.RequestInfoAsync(), (t) =>
|
||||
{
|
||||
authorButton.Text = author.Name;
|
||||
authorButton.Text = author.Name ?? "";
|
||||
authorButton.RectTransform.NonScaledSize =
|
||||
((int)(authorButton.Font.MeasureString(author.Name).X + authorPadding.X + authorPadding.Z),
|
||||
((int)(authorButton.Font.MeasureString(author.Name ?? "").X + authorPadding.X + authorPadding.Z),
|
||||
authorButton.RectTransform.NonScaledSize.Y);
|
||||
});
|
||||
|
||||
@@ -769,7 +777,7 @@ namespace Barotrauma.Steam
|
||||
|
||||
var tagsLabel = new GUITextBlock(new RectTransform((1.0f, 0.12f), statsVertical0.RectTransform),
|
||||
TextManager.Get("WorkshopItemTags"), font: GUIStyle.SubHeadingFont);
|
||||
CreateTagsList(workshopItem.Tags.ToIdentifiers(), new RectTransform((0.97f, 0.3f), statsVertical0.RectTransform), canBeFocused: false);
|
||||
CreateTagsList((workshopItem.Tags ?? Array.Empty<string>()).ToIdentifiers(), new RectTransform((0.97f, 0.3f), statsVertical0.RectTransform), canBeFocused: false);
|
||||
#endregion
|
||||
|
||||
var descriptionListBox = new GUIListBox(new RectTransform((1.0f, 0.38f), verticalLayout.RectTransform));
|
||||
|
||||
Reference in New Issue
Block a user