Build 0.20.0.0

This commit is contained in:
Markus Isberg
2022-10-27 17:54:57 +03:00
parent 05c7b1f869
commit edaf4b09fe
197 changed files with 4344 additions and 1773 deletions
@@ -93,7 +93,7 @@ namespace Barotrauma.Steam
return (left, center, right);
}
private void HandleDraggingAcrossModLists(GUIListBox from, GUIListBox to)
private static void HandleDraggingAcrossModLists(GUIListBox from, GUIListBox to)
{
if (to.Rect.Contains(PlayerInput.MousePosition) && from.DraggedElement != null)
{
@@ -197,7 +197,11 @@ namespace Barotrauma.Steam
out onInstalledInfoButtonHit, out var deselect);
GUILayoutGroup mainLayout =
new GUILayoutGroup(new RectTransform(Vector2.One, outerContainer.Content.RectTransform), childAnchor: Anchor.TopCenter);
new GUILayoutGroup(new RectTransform(Vector2.One, outerContainer.Content.RectTransform), childAnchor: Anchor.TopCenter)
{
Stretch = true,
AbsoluteSpacing = GUI.IntScale(5)
};
mainLayout.RectTransform.SetAsFirstChild();
var (topLeft, _, topRight) = CreateSidebars(mainLayout, centerWidth: 0.05f, leftWidth: 0.475f, rightWidth: 0.475f, height: 0.13f);
@@ -257,7 +261,12 @@ namespace Barotrauma.Steam
right.ChildAnchor = Anchor.TopRight;
//enabled mods
Label(left, TextManager.Get("enabledregular"), GUIStyle.SubHeadingFont);
var label = Label(left, TextManager.Get("enabledregular"), GUIStyle.SubHeadingFont);
new GUIImage(new RectTransform(new Point(label.Rect.Height), label.RectTransform, Anchor.CenterRight), style: "GUIButtonInfo")
{
ToolTip = TextManager.Get("ModLoadOrderExplanation")
};
var enabledModsList = new GUIListBox(new RectTransform((1.0f, 0.93f), left.RectTransform))
{
CurrentDragMode = GUIListBox.DragMode.DragOutsideBox,
@@ -478,7 +487,7 @@ namespace Barotrauma.Steam
{
string str = modsListFilter.Text;
enabledRegularModsList.Content.Children.Concat(disabledRegularModsList.Content.Children)
.ForEach(c => c.Visible = !(c.UserData is ContentPackage p)
.ForEach(c => c.Visible = c.UserData is not ContentPackage p
|| ModNameMatches(p, str) && ModMatchesTickboxes(p, c));
}
@@ -504,12 +513,12 @@ namespace Barotrauma.Steam
//are enabled, and all files match either of them so show this mod
}
else if (modsListFilterTickboxes[Filter.ShowOnlySubs].Selected
&& p.Files.Any(f => !(f is BaseSubFile)))
&& p.Files.Any(f => f is not BaseSubFile))
{
matches = false;
}
else if (modsListFilterTickboxes[Filter.ShowOnlyItemAssemblies].Selected
&& p.Files.Any(f => !(f is ItemAssemblyFile)))
&& p.Files.Any(f => f is not ItemAssemblyFile))
{
matches = false;
}
@@ -520,7 +529,7 @@ namespace Barotrauma.Steam
private void PrepareToShowModInfo(ContentPackage mod)
{
if (!mod.UgcId.TryUnwrap(out var ugcId)
|| !(ugcId is SteamWorkshopId workshopId)) { return; }
|| ugcId is not SteamWorkshopId workshopId) { return; }
TaskPool.Add($"PrepareToShow{mod.UgcId}Info", SteamManager.Workshop.GetItem(workshopId.Value),
t =>
{
@@ -598,13 +598,14 @@ namespace Barotrauma.Steam
bool reinstallAction(GUIButton button, object o)
{
SettingsMenu.Instance?.ApplyInstalledModChanges();
int prevIndex = ContentPackageManager.EnabledPackages.Regular.IndexOf(contentPackage);
TaskPool.AddIfNotFound($"Reinstall{workshopItem.Id}",
SteamManager.Workshop.Reinstall(workshopItem), t =>
{
ContentPackageManager.WorkshopPackages.Refresh();
ContentPackageManager.EnabledPackages.RefreshUpdatedMods();
if (SettingsMenu.Instance?.WorkshopMenu is MutableWorkshopMenu mutableWorkshopMenu)
if (SettingsMenu.Instance?.WorkshopMenu is MutableWorkshopMenu mutableWorkshopMenu && !mutableWorkshopMenu.ViewingItemDetails)
{
mutableWorkshopMenu.PopulateInstalledModLists(forceRefreshEnabled: true);
}
@@ -44,12 +44,26 @@ namespace Barotrauma.Steam
public MutableWorkshopMenu(GUIFrame parent) : base(parent)
{
var mainLayout
= new GUILayoutGroup(new RectTransform(Vector2.One, parent.RectTransform), isHorizontal: false);
= new GUILayoutGroup(new RectTransform(Vector2.One, parent.RectTransform), isHorizontal: false)
{
Stretch = true,
AbsoluteSpacing = GUI.IntScale(4)
};
tabber = new GUILayoutGroup(new RectTransform((1.0f, 0.05f), mainLayout.RectTransform), isHorizontal: true)
{ Stretch = true };
tabContents = new Dictionary<Tab, (GUIButton Button, GUIFrame Content)>();
new GUIButton(new RectTransform((1.0f, 0.05f), mainLayout.RectTransform, Anchor.BottomLeft),
style: "GUIButtonSmall", text: TextManager.Get("FindModsButton"))
{
OnClicked = (button, o) =>
{
SteamManager.OverlayCustomUrl($"https://steamcommunity.com/app/{SteamManager.AppID}/workshop/");
return false;
}
};
contentFrame = new GUIFrame(new RectTransform((1.0f, 0.95f), mainLayout.RectTransform), style: null);
new GUICustomComponent(new RectTransform(Vector2.Zero, mainLayout.RectTransform),
@@ -130,17 +144,8 @@ namespace Barotrauma.Steam
{
tabContents[Tab.PopularMods].Button.Enabled = false;
}
GUIFrame listFrame = new GUIFrame(new RectTransform((1.0f, 0.95f), content.RectTransform), style: null);
GUIFrame listFrame = new GUIFrame(new RectTransform(Vector2.One, content.RectTransform), style: null);
CreateWorkshopItemList(listFrame, out _, out popularModsList, onSelected: PopulateFrameWithItemInfo);
new GUIButton(new RectTransform((1.0f, 0.05f), content.RectTransform, Anchor.BottomLeft),
style: "GUIButtonSmall", text: TextManager.Get("FindModsButton"))
{
OnClicked = (button, o) =>
{
SteamManager.OverlayCustomUrl($"https://steamcommunity.com/app/{SteamManager.AppID}/workshop/");
return false;
}
};
}
private void CreatePublishTab(out GUIListBox selfModsList)
@@ -543,7 +543,8 @@ namespace Barotrauma.Steam
var localModProject = new ModProject(localPackage)
{
UgcId = Option<ContentPackageId>.Some(new SteamWorkshopId(resultId))
UgcId = Option<ContentPackageId>.Some(new SteamWorkshopId(resultId)),
ModVersion = modVersion
};
localModProject.DiscardHashAndInstallTime();
localModProject.Save(localPackage.Path);