Skip to content

Commit

Permalink
Added missing Page.AddCategory overload to allow control over collaps…
Browse files Browse the repository at this point in the history
…ible in playerselect and misc pages
  • Loading branch information
ddakebono committed Dec 30, 2023
1 parent 6ee4ceb commit 0749686
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion BTKUILib.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal static class BuildInfo
public const string Name = "BTKUILib";
public const string Author = "BTK Development Team";
public const string Company = "BTK Development";
public const string Version = "2.0.2";
public const string Version = "2.0.3";
}

internal class BTKUILib : MelonMod
Expand Down
19 changes: 18 additions & 1 deletion UIObjects/Page.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,24 @@ public Category AddCategory(string categoryName, bool showHeader)
/// <returns></returns>
public Category AddCategory(string categoryName, bool showHeader, bool canCollapse = true, bool collapsed = false)
{
var category = new Category(categoryName, this, showHeader, null, canCollapse, collapsed);
return AddCategory(categoryName, null, showHeader, canCollapse, collapsed);
}

/// <summary>
/// Add a new category to this page, modName should be null unless this is a protected page (PlayerSelectPage or Misc page)
/// </summary>
/// <param name="categoryName">Name of the category, displayed at the top</param>
/// <param name="modName">Name of the mod creating the category, this must match your prepared icon modname to use icons</param>
/// <param name="showHeader">Sets if the header of this category is visible</param>
/// <param name="canCollapse">Sets if this category can be collapsed</param>
/// <param name="collapsed">Sets if this category should be created as collapsed</param>
/// <returns></returns>
public Category AddCategory(string categoryName, string modName, bool showHeader, bool canCollapse, bool collapsed)
{
if(!Protected && modName != null)
BTKUILib.Log.Warning("You should not be using AddCategory(categoryName, modName, showHeader, canCollapse, collapsed) on your created pages! This is only intended for special protected pages! (PlayerSelectPage and Misc page)");

var category = new Category(categoryName, this, showHeader, modName, canCollapse, collapsed);
SubElements.Add(category);

if (UIUtils.IsQMReady())
Expand Down

0 comments on commit 0749686

Please sign in to comment.