Unstable 1.2.4.0
This commit is contained in:
@@ -101,13 +101,36 @@ namespace Barotrauma.Steam
|
||||
{
|
||||
Color = GUIStyle.Green
|
||||
};
|
||||
var textShadow = new GUITextBlock(new RectTransform(Vector2.One, itemDownloadProgress.RectTransform) { AbsoluteOffset = new Point(GUI.IntScale(3)) }, "",
|
||||
textColor: Color.Black, textAlignment: Alignment.Center);
|
||||
var text = new GUITextBlock(new RectTransform(Vector2.One, itemDownloadProgress.RectTransform), "",
|
||||
textAlignment: Alignment.Center);
|
||||
var itemDownloadProgressUpdater = new GUICustomComponent(
|
||||
new RectTransform(Vector2.Zero, msgBox.Content.RectTransform),
|
||||
onUpdate: (f, component) =>
|
||||
{
|
||||
float progress = 0.0f;
|
||||
if (item.IsDownloading) { progress = item.DownloadAmount; }
|
||||
else if (itemDownloadProgress.BarSize > 0.0f) { progress = 1.0f; }
|
||||
if (item.IsDownloading)
|
||||
{
|
||||
progress = item.DownloadAmount;
|
||||
text.Text = textShadow.Text = TextManager.GetWithVariable(
|
||||
"PublishPopupDownload",
|
||||
"[percentage]",
|
||||
((int)MathF.Round(item.DownloadAmount * 100)).ToString());
|
||||
}
|
||||
else if (itemDownloadProgress.BarSize > 0.0f)
|
||||
{
|
||||
if (!item.IsInstalled && !SteamManager.Workshop.CanBeInstalled(item.Id))
|
||||
{
|
||||
itemDownloadProgress.Color = GUIStyle.Red;
|
||||
text.Text = textShadow.Text = TextManager.Get("workshopiteminstallfailed");
|
||||
}
|
||||
else
|
||||
{
|
||||
text.Text = textShadow.Text = TextManager.Get(item.IsInstalled ? "workshopiteminstalled" : "PublishPopupInstall");
|
||||
}
|
||||
progress = 1.0f;
|
||||
}
|
||||
|
||||
itemDownloadProgress.BarSize = Math.Max(itemDownloadProgress.BarSize,
|
||||
MathHelper.Lerp(itemDownloadProgress.BarSize, progress, 0.1f));
|
||||
@@ -134,9 +157,16 @@ namespace Barotrauma.Steam
|
||||
{
|
||||
foreach (var item in itemsToDownload)
|
||||
{
|
||||
DebugConsole.Log($"Reinstalling {item.Title}...");
|
||||
await SteamManager.Workshop.Reinstall(item);
|
||||
if (!GUIMessageBox.MessageBoxes.Contains(msgBox)) { break; }
|
||||
DebugConsole.Log($"Finished installing {item.Title}...");
|
||||
if (!GUIMessageBox.MessageBoxes.Contains(msgBox))
|
||||
{
|
||||
DebugConsole.Log($"Download prompt closed, interrupting {nameof(DownloadItems)}.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
DebugConsole.Log($"{nameof(DownloadItems)} finished.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace Barotrauma.Steam
|
||||
|
||||
public static void OnItemDownloadComplete(ulong id, bool forceInstall = false)
|
||||
{
|
||||
if (!(Screen.Selected is MainMenuScreen) && !forceInstall)
|
||||
if (Screen.Selected is not MainMenuScreen && !forceInstall)
|
||||
{
|
||||
if (!MainMenuScreen.WorkshopItemsToUpdate.Contains(id))
|
||||
{
|
||||
@@ -306,13 +306,26 @@ namespace Barotrauma.Steam
|
||||
}
|
||||
return;
|
||||
}
|
||||
else if (CanBeInstalled(id)
|
||||
&& !ContentPackageManager.WorkshopPackages.Any(p =>
|
||||
else if (!CanBeInstalled(id))
|
||||
{
|
||||
DebugConsole.Log($"Cannot install {id}");
|
||||
InstallWaiter.StopWaiting(id);
|
||||
}
|
||||
else if (ContentPackageManager.WorkshopPackages.Any(p =>
|
||||
p.UgcId.TryUnwrap(out var ugcId)
|
||||
&& ugcId is SteamWorkshopId workshopId
|
||||
&& workshopId.Value == id)
|
||||
&& !InstallTaskCounter.IsInstalling(id))
|
||||
&& workshopId.Value == id))
|
||||
{
|
||||
DebugConsole.Log($"Already installed {id}.");
|
||||
InstallWaiter.StopWaiting(id);
|
||||
}
|
||||
else if (InstallTaskCounter.IsInstalling(id))
|
||||
{
|
||||
DebugConsole.Log($"Already installing {id}.");
|
||||
}
|
||||
else
|
||||
{
|
||||
DebugConsole.Log($"Finished downloading {id}, installing...");
|
||||
TaskPool.Add($"InstallItem{id}", InstallMod(id), t => InstallWaiter.StopWaiting(id));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user