mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
Merge branch 'dev' into options-improvements
This commit is contained in:
5 files changed
+63
-74
No files matched your search
@@ -139,7 +139,7 @@ public static class GameModeOption
|
|||||||
|
|
||||||
[HarmonyPatch(typeof(GameOptionsMenu), nameof(GameOptionsMenu.ValueChanged))]
|
[HarmonyPatch(typeof(GameOptionsMenu), nameof(GameOptionsMenu.ValueChanged))]
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
private static bool ValueChanged(GameOptionsMenu __instance, OptionBehaviour option)
|
private static bool ValueChanged(OptionBehaviour option)
|
||||||
{
|
{
|
||||||
if (!OptionBehaviour.Equals(option))
|
if (!OptionBehaviour.Equals(option))
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -208,7 +208,7 @@ internal static class GameOptionsMenuPatch
|
|||||||
internal static List<KeyValuePair<string, string>> GetActiveGameSettingsRows(Func<bool, string> formatBool)
|
internal static List<KeyValuePair<string, string>> GetActiveGameSettingsRows(Func<bool, string> formatBool)
|
||||||
{
|
{
|
||||||
var menu = GameSettingMenu.Instance ? GameSettingMenu.Instance.GameSettingsTab : null;
|
var menu = GameSettingMenu.Instance ? GameSettingMenu.Instance.GameSettingsTab : null;
|
||||||
if (!menu || menu.Children == null)
|
if (!menu || menu!.Children == null)
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -216,7 +216,7 @@ internal static class GameOptionsMenuPatch
|
|||||||
var rows = new List<KeyValuePair<string, string>>();
|
var rows = new List<KeyValuePair<string, string>>();
|
||||||
foreach (var option in menu.Children)
|
foreach (var option in menu.Children)
|
||||||
{
|
{
|
||||||
if (!option || !option!.gameObject.activeInHierarchy ||
|
if (!option || !option.gameObject.activeInHierarchy ||
|
||||||
option == menu.MapPicker ||
|
option == menu.MapPicker ||
|
||||||
(GameModeOption.OptionBehaviour && option == GameModeOption.OptionBehaviour) ||
|
(GameModeOption.OptionBehaviour && option == GameModeOption.OptionBehaviour) ||
|
||||||
!option.Data)
|
!option.Data)
|
||||||
|
|||||||
@@ -41,18 +41,17 @@ public static class RoleGuidePatches
|
|||||||
private static readonly List<string> UntrackedRolePanelDiagnostics = [];
|
private static readonly List<string> UntrackedRolePanelDiagnostics = [];
|
||||||
|
|
||||||
private static GameObject searchComponentContainer;
|
private static GameObject searchComponentContainer;
|
||||||
public static PassiveButton SearchIconButton;
|
|
||||||
private static SpriteRenderer _searchIconIdle;
|
private static SpriteRenderer _searchIconIdle;
|
||||||
private static SpriteRenderer _searchIconHover;
|
private static SpriteRenderer _searchIconHover;
|
||||||
public static PassiveButton SearchSortingOrderButton;
|
private static PassiveButton _searchSortingOrderButton;
|
||||||
private static SpriteRenderer _searchSortingOrderIdle;
|
private static SpriteRenderer _searchSortingOrderIdle;
|
||||||
private static SpriteRenderer _searchSortingOrderHover;
|
private static SpriteRenderer _searchSortingOrderHover;
|
||||||
public static TextMeshPro GroupSortingTmp;
|
private static TextMeshPro groupSortingTmp;
|
||||||
public static PassiveButton SearchSortingGroupButton;
|
private static PassiveButton _searchSortingGroupButton;
|
||||||
private static SpriteRenderer _searchSortingGroupIdle;
|
private static SpriteRenderer _searchSortingGroupIdle;
|
||||||
private static SpriteRenderer _searchSortingGroupHover;
|
private static SpriteRenderer _searchSortingGroupHover;
|
||||||
public static TextMeshPro FilterSortingTmp;
|
private static TextMeshPro filterSortingTmp;
|
||||||
public static PassiveButton SearchSortingFilterButton;
|
private static PassiveButton _searchSortingFilterButton;
|
||||||
private static SpriteRenderer _searchSortingFilterIdle;
|
private static SpriteRenderer _searchSortingFilterIdle;
|
||||||
private static SpriteRenderer _searchSortingFilterHover;
|
private static SpriteRenderer _searchSortingFilterHover;
|
||||||
private static Scroller _rolesScroller;
|
private static Scroller _rolesScroller;
|
||||||
@@ -107,14 +106,14 @@ public static class RoleGuidePatches
|
|||||||
|
|
||||||
var playerMenuGradient = instance.matchInfoPlayersMaskArea.transform.parent.GetAllChildren()
|
var playerMenuGradient = instance.matchInfoPlayersMaskArea.transform.parent.GetAllChildren()
|
||||||
.First(x => x.name.Contains("BG_Gradient"));
|
.First(x => x.name.Contains("BG_Gradient"));
|
||||||
var settingsenuGradient = instance.matchInfoSettingsMaskArea.transform.parent.GetAllChildren()
|
var settingsMenuGradient = instance.matchInfoSettingsMaskArea.transform.parent.GetAllChildren()
|
||||||
.First(x => x.name.Contains("BG_Gradient"));
|
.First(x => x.name.Contains("BG_Gradient"));
|
||||||
var roleMenuGradient = instance.MatchInfoRoleMaskArea.transform.parent.GetAllChildren()
|
var roleMenuGradient = instance.MatchInfoRoleMaskArea.transform.parent.GetAllChildren()
|
||||||
.First(x => x.name.Contains("BG_Gradient"));
|
.First(x => x.name.Contains("BG_Gradient"));
|
||||||
playerMenuGradient
|
playerMenuGradient
|
||||||
.GetComponent<SpriteRenderer>()
|
.GetComponent<SpriteRenderer>()
|
||||||
.maskInteraction =
|
.maskInteraction =
|
||||||
settingsenuGradient.GetComponent<SpriteRenderer>()
|
settingsMenuGradient.GetComponent<SpriteRenderer>()
|
||||||
.maskInteraction =
|
.maskInteraction =
|
||||||
roleMenuGradient.GetComponent<SpriteRenderer>()
|
roleMenuGradient.GetComponent<SpriteRenderer>()
|
||||||
.maskInteraction = SpriteMaskInteraction.VisibleInsideMask;
|
.maskInteraction = SpriteMaskInteraction.VisibleInsideMask;
|
||||||
@@ -190,10 +189,9 @@ public static class RoleGuidePatches
|
|||||||
_currentWikiPage = null!;
|
_currentWikiPage = null!;
|
||||||
_loadingSpinner = null;
|
_loadingSpinner = null;
|
||||||
ResetSettingsState();
|
ResetSettingsState();
|
||||||
SearchIconButton = null!;
|
_searchSortingOrderButton = null!;
|
||||||
SearchSortingOrderButton = null!;
|
_searchSortingGroupButton = null!;
|
||||||
SearchSortingGroupButton = null!;
|
_searchSortingFilterButton = null!;
|
||||||
SearchSortingFilterButton = null!;
|
|
||||||
_searchIconIdle = null!;
|
_searchIconIdle = null!;
|
||||||
_searchIconHover = null!;
|
_searchIconHover = null!;
|
||||||
_searchSortingOrderIdle = null!;
|
_searchSortingOrderIdle = null!;
|
||||||
@@ -417,9 +415,9 @@ public static class RoleGuidePatches
|
|||||||
HudManager.Instance.SettingsButton,
|
HudManager.Instance.SettingsButton,
|
||||||
searchComponentContainer.transform);
|
searchComponentContainer.transform);
|
||||||
sortingOrderButton.gameObject.SetActive(true);
|
sortingOrderButton.gameObject.SetActive(true);
|
||||||
SearchSortingOrderButton = sortingOrderButton.GetComponent<PassiveButton>();
|
_searchSortingOrderButton = sortingOrderButton.GetComponent<PassiveButton>();
|
||||||
SetupSearchButton(
|
SetupSearchButton(
|
||||||
SearchSortingOrderButton,
|
_searchSortingOrderButton,
|
||||||
"SearchSortingOrderButton",
|
"SearchSortingOrderButton",
|
||||||
SwitchMethod,
|
SwitchMethod,
|
||||||
GetSortMethodSprite(_sortMethod, false),
|
GetSortMethodSprite(_sortMethod, false),
|
||||||
@@ -432,9 +430,9 @@ public static class RoleGuidePatches
|
|||||||
sortingOrderButton,
|
sortingOrderButton,
|
||||||
searchComponentContainer.transform);
|
searchComponentContainer.transform);
|
||||||
sortingGroupButton.gameObject.SetActive(true);
|
sortingGroupButton.gameObject.SetActive(true);
|
||||||
SearchSortingGroupButton = sortingGroupButton.GetComponent<PassiveButton>();
|
_searchSortingGroupButton = sortingGroupButton.GetComponent<PassiveButton>();
|
||||||
SetupSearchButton(
|
SetupSearchButton(
|
||||||
SearchSortingGroupButton,
|
_searchSortingGroupButton,
|
||||||
"SearchSortingGroupButton",
|
"SearchSortingGroupButton",
|
||||||
SwitchGrouping,
|
SwitchGrouping,
|
||||||
GetSortGroupSprite(_sortGrouping, false),
|
GetSortGroupSprite(_sortGrouping, false),
|
||||||
@@ -447,9 +445,9 @@ public static class RoleGuidePatches
|
|||||||
sortingOrderButton,
|
sortingOrderButton,
|
||||||
searchComponentContainer.transform);
|
searchComponentContainer.transform);
|
||||||
sortingFilterButton.gameObject.SetActive(true);
|
sortingFilterButton.gameObject.SetActive(true);
|
||||||
SearchSortingFilterButton = sortingFilterButton.GetComponent<PassiveButton>();
|
_searchSortingFilterButton = sortingFilterButton.GetComponent<PassiveButton>();
|
||||||
SetupSearchButton(
|
SetupSearchButton(
|
||||||
SearchSortingFilterButton,
|
_searchSortingFilterButton,
|
||||||
"SearchSortingFilterButton",
|
"SearchSortingFilterButton",
|
||||||
SwitchFilter,
|
SwitchFilter,
|
||||||
GetSortFilterSprite(_sortFilter, false),
|
GetSortFilterSprite(_sortFilter, false),
|
||||||
@@ -510,9 +508,8 @@ public static class RoleGuidePatches
|
|||||||
sortingOrderButton,
|
sortingOrderButton,
|
||||||
sortingOrderButton.transform.parent);
|
sortingOrderButton.transform.parent);
|
||||||
searchIconButton.gameObject.SetActive(true);
|
searchIconButton.gameObject.SetActive(true);
|
||||||
SearchIconButton = searchIconButton.GetComponent<PassiveButton>();
|
|
||||||
SetupSearchButton(
|
SetupSearchButton(
|
||||||
SearchIconButton,
|
searchIconButton.GetComponent<PassiveButton>(),
|
||||||
"SearchIconButton",
|
"SearchIconButton",
|
||||||
ClearSearchText,
|
ClearSearchText,
|
||||||
MiraAssets.SearchIconIdleSprite,
|
MiraAssets.SearchIconIdleSprite,
|
||||||
@@ -677,17 +674,17 @@ public static class RoleGuidePatches
|
|||||||
orderSortingTmp.horizontalAlignment = HorizontalAlignmentOptions.Center;
|
orderSortingTmp.horizontalAlignment = HorizontalAlignmentOptions.Center;
|
||||||
orderSortingTmp.transform.localPosition = new Vector3(-0.65f, 0.4f, 0);
|
orderSortingTmp.transform.localPosition = new Vector3(-0.65f, 0.4f, 0);
|
||||||
|
|
||||||
GroupSortingTmp = Object.Instantiate(
|
groupSortingTmp = Object.Instantiate(
|
||||||
orderSortingTmp,
|
orderSortingTmp,
|
||||||
sortingGroupButton.transform);
|
sortingGroupButton.transform);
|
||||||
GroupSortingTmp.text = MiraLocaleManager.Get("MiraApi.Wiki.GroupingLabel");
|
groupSortingTmp.text = MiraLocaleManager.Get("MiraApi.Wiki.GroupingLabel");
|
||||||
GroupSortingTmp.transform.localPosition = new Vector3(-0.65f, 0.4f, 0);
|
groupSortingTmp.transform.localPosition = new Vector3(-0.65f, 0.4f, 0);
|
||||||
|
|
||||||
FilterSortingTmp = Object.Instantiate(
|
filterSortingTmp = Object.Instantiate(
|
||||||
orderSortingTmp,
|
orderSortingTmp,
|
||||||
sortingFilterButton.transform);
|
sortingFilterButton.transform);
|
||||||
FilterSortingTmp.text = MiraLocaleManager.Get("MiraApi.Wiki.FilterLabel");
|
filterSortingTmp.text = MiraLocaleManager.Get("MiraApi.Wiki.FilterLabel");
|
||||||
FilterSortingTmp.transform.localPosition = new Vector3(-0.65f, 0.4f, 0);
|
filterSortingTmp.transform.localPosition = new Vector3(-0.65f, 0.4f, 0);
|
||||||
|
|
||||||
playerButton.transform.localPosition = new Vector3(-3.6f, 0.656f, -0.2f);
|
playerButton.transform.localPosition = new Vector3(-3.6f, 0.656f, -0.2f);
|
||||||
settingButton.transform.localPosition = new Vector3(-3.6f, 0.056f, -0.2f);
|
settingButton.transform.localPosition = new Vector3(-3.6f, 0.056f, -0.2f);
|
||||||
@@ -1140,10 +1137,9 @@ public static class RoleGuidePatches
|
|||||||
.ThenByDescending(p =>
|
.ThenByDescending(p =>
|
||||||
p.Title.Contains(searchText, StringComparison.OrdinalIgnoreCase) ||
|
p.Title.Contains(searchText, StringComparison.OrdinalIgnoreCase) ||
|
||||||
p.Category.Contains(searchText, StringComparison.OrdinalIgnoreCase));
|
p.Category.Contains(searchText, StringComparison.OrdinalIgnoreCase));
|
||||||
return (_sortMethod is SortingMethod.Alphabetical
|
return [.. _sortMethod is SortingMethod.Alphabetical
|
||||||
? sorted.ThenBy(p => p.GetSortKey(_sortGrouping))
|
? sorted.ThenBy(p => p.GetSortKey(_sortGrouping))
|
||||||
: sorted.ThenByDescending(p => p.GetSortKey(_sortGrouping)))
|
: sorted.ThenByDescending(p => p.GetSortKey(_sortGrouping))];
|
||||||
.ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool MatchesSearch(DetailedPanel entry, string searchText)
|
private static bool MatchesSearch(DetailedPanel entry, string searchText)
|
||||||
@@ -2084,7 +2080,6 @@ public static class RoleGuidePatches
|
|||||||
|
|
||||||
_settingsScroller.gameObject.SetActive(true);
|
_settingsScroller.gameObject.SetActive(true);
|
||||||
_settingsPageObject = Helpers.CreateAdvancedSettingsPage(
|
_settingsPageObject = Helpers.CreateAdvancedSettingsPage(
|
||||||
guide,
|
|
||||||
_settingsScroller,
|
_settingsScroller,
|
||||||
rows,
|
rows,
|
||||||
columns,
|
columns,
|
||||||
@@ -2155,38 +2150,38 @@ public static class RoleGuidePatches
|
|||||||
/// <param name="paginationVisible">False while searching, since search results are a single page.</param>
|
/// <param name="paginationVisible">False while searching, since search results are a single page.</param>
|
||||||
private static void RepurposeSortButtons(bool paginationVisible)
|
private static void RepurposeSortButtons(bool paginationVisible)
|
||||||
{
|
{
|
||||||
if (!SearchSortingFilterButton || !SearchSortingGroupButton || !SearchSortingOrderButton)
|
if (!_searchSortingFilterButton || !_searchSortingGroupButton || !_searchSortingOrderButton)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!_sortButtonsRepurposed)
|
if (!_sortButtonsRepurposed)
|
||||||
{
|
{
|
||||||
_savedFilterLabel = FilterSortingTmp.text;
|
_savedFilterLabel = filterSortingTmp.text;
|
||||||
_savedGroupLabel = GroupSortingTmp.text;
|
_savedGroupLabel = groupSortingTmp.text;
|
||||||
_savedFilterIconScale = _searchSortingFilterIdle.transform.localScale;
|
_savedFilterIconScale = _searchSortingFilterIdle.transform.localScale;
|
||||||
_savedGroupIconScale = _searchSortingGroupIdle.transform.localScale;
|
_savedGroupIconScale = _searchSortingGroupIdle.transform.localScale;
|
||||||
_savedFilterLabelPosition = FilterSortingTmp.transform.localPosition;
|
_savedFilterLabelPosition = filterSortingTmp.transform.localPosition;
|
||||||
_savedGroupLabelPosition = GroupSortingTmp.transform.localPosition;
|
_savedGroupLabelPosition = groupSortingTmp.transform.localPosition;
|
||||||
|
|
||||||
SetPaginationSprites(_searchSortingFilterIdle, _searchSortingFilterHover, true);
|
SetPaginationSprites(_searchSortingFilterIdle, _searchSortingFilterHover, true);
|
||||||
SetPaginationSprites(_searchSortingGroupIdle, _searchSortingGroupHover, false);
|
SetPaginationSprites(_searchSortingGroupIdle, _searchSortingGroupHover, false);
|
||||||
FilterSortingTmp.transform.localPosition = new Vector3(
|
filterSortingTmp.transform.localPosition = new Vector3(
|
||||||
-1.25f,
|
-1.25f,
|
||||||
0f,
|
0f,
|
||||||
_savedFilterLabelPosition.z);
|
_savedFilterLabelPosition.z);
|
||||||
GroupSortingTmp.transform.localPosition = new Vector3(
|
groupSortingTmp.transform.localPosition = new Vector3(
|
||||||
0f,
|
0f,
|
||||||
0f,
|
0f,
|
||||||
_savedGroupLabelPosition.z);
|
_savedGroupLabelPosition.z);
|
||||||
FilterSortingTmp.text = MiraLocaleManager.Get("MiraApi.Wiki.PrevPage", "Prev");
|
filterSortingTmp.text = MiraLocaleManager.Get("MiraApi.Wiki.PrevPage", "Prev");
|
||||||
GroupSortingTmp.text = MiraLocaleManager.Get("MiraApi.Wiki.NextPage", "Next");
|
groupSortingTmp.text = MiraLocaleManager.Get("MiraApi.Wiki.NextPage", "Next");
|
||||||
_sortButtonsRepurposed = true;
|
_sortButtonsRepurposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchSortingOrderButton.gameObject.SetActive(false);
|
_searchSortingOrderButton.gameObject.SetActive(false);
|
||||||
SearchSortingFilterButton.gameObject.SetActive(paginationVisible);
|
_searchSortingFilterButton.gameObject.SetActive(paginationVisible);
|
||||||
SearchSortingGroupButton.gameObject.SetActive(paginationVisible);
|
_searchSortingGroupButton.gameObject.SetActive(paginationVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SetPaginationSprites(SpriteRenderer idle, SpriteRenderer hover, bool isLeft)
|
private static void SetPaginationSprites(SpriteRenderer idle, SpriteRenderer hover, bool isLeft)
|
||||||
@@ -2212,7 +2207,7 @@ public static class RoleGuidePatches
|
|||||||
}
|
}
|
||||||
|
|
||||||
_sortButtonsRepurposed = false;
|
_sortButtonsRepurposed = false;
|
||||||
if (!SearchSortingFilterButton || !SearchSortingGroupButton || !SearchSortingOrderButton)
|
if (!_searchSortingFilterButton || !_searchSortingGroupButton || !_searchSortingOrderButton)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2227,13 +2222,13 @@ public static class RoleGuidePatches
|
|||||||
_searchSortingFilterHover.transform.localScale = _savedFilterIconScale;
|
_searchSortingFilterHover.transform.localScale = _savedFilterIconScale;
|
||||||
_searchSortingGroupIdle.transform.localScale =
|
_searchSortingGroupIdle.transform.localScale =
|
||||||
_searchSortingGroupHover.transform.localScale = _savedGroupIconScale;
|
_searchSortingGroupHover.transform.localScale = _savedGroupIconScale;
|
||||||
FilterSortingTmp.text = _savedFilterLabel;
|
filterSortingTmp.text = _savedFilterLabel;
|
||||||
GroupSortingTmp.text = _savedGroupLabel;
|
groupSortingTmp.text = _savedGroupLabel;
|
||||||
FilterSortingTmp.transform.localPosition = _savedFilterLabelPosition;
|
filterSortingTmp.transform.localPosition = _savedFilterLabelPosition;
|
||||||
GroupSortingTmp.transform.localPosition = _savedGroupLabelPosition;
|
groupSortingTmp.transform.localPosition = _savedGroupLabelPosition;
|
||||||
SearchSortingOrderButton.gameObject.SetActive(true);
|
_searchSortingOrderButton.gameObject.SetActive(true);
|
||||||
SearchSortingFilterButton.gameObject.SetActive(true);
|
_searchSortingFilterButton.gameObject.SetActive(true);
|
||||||
SearchSortingGroupButton.gameObject.SetActive(true);
|
_searchSortingGroupButton.gameObject.SetActive(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2255,4 +2250,4 @@ internal enum SortingFilter
|
|||||||
EnabledOnly,
|
EnabledOnly,
|
||||||
DisabledOnly,
|
DisabledOnly,
|
||||||
AllRoles,
|
AllRoles,
|
||||||
}
|
}
|
||||||
@@ -141,13 +141,12 @@ internal static class GuideOptionPages
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return pages
|
return [.. pages
|
||||||
.OrderBy(page => page.MenuOrder)
|
.OrderBy(page => page.MenuOrder)
|
||||||
.ThenBy(page => page.GroupPriority)
|
.ThenBy(page => page.GroupPriority)
|
||||||
.ThenBy(page => page.Order)
|
.ThenBy(page => page.Order)
|
||||||
.ThenBy(page => page.Group.GroupName, StringComparer.OrdinalIgnoreCase)
|
.ThenBy(page => page.Group.GroupName, StringComparer.OrdinalIgnoreCase)
|
||||||
.ThenBy(page => page.ModAbbreviation, StringComparer.OrdinalIgnoreCase)
|
.ThenBy(page => page.ModAbbreviation, StringComparer.OrdinalIgnoreCase)];
|
||||||
.ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int GetMenuOrder(MenuCategory menu)
|
private static int GetMenuOrder(MenuCategory menu)
|
||||||
@@ -173,7 +172,7 @@ internal static class GuideOptionPages
|
|||||||
var pageList = pages.ToList();
|
var pageList = pages.ToList();
|
||||||
var normalizedQuery = NormalizeSearchText(query);
|
var normalizedQuery = NormalizeSearchText(query);
|
||||||
var matchingModPages = normalizedQuery.Length < 3
|
var matchingModPages = normalizedQuery.Length < 3
|
||||||
? Array.Empty<GuideOptionPage>()
|
? []
|
||||||
: pageList
|
: pageList
|
||||||
.Where(page => page.ModSearchTerms.Any(term =>
|
.Where(page => page.ModSearchTerms.Any(term =>
|
||||||
NormalizeSearchText(term).Contains(normalizedQuery, StringComparison.Ordinal)))
|
NormalizeSearchText(term).Contains(normalizedQuery, StringComparison.Ordinal)))
|
||||||
@@ -181,16 +180,15 @@ internal static class GuideOptionPages
|
|||||||
|
|
||||||
if (matchingModPages.Length > 0)
|
if (matchingModPages.Length > 0)
|
||||||
{
|
{
|
||||||
return matchingModPages.SelectMany(page => page.Entries).ToList();
|
return [.. matchingModPages.SelectMany(page => page.Entries)];
|
||||||
}
|
}
|
||||||
|
|
||||||
return pageList
|
return [.. pageList
|
||||||
.SelectMany(page => page.Entries
|
.SelectMany(page => page.Entries
|
||||||
.Select(entry => (Entry: entry, Rank: Rank(entry, query, cmp)))
|
.Select(entry => (Entry: entry, Rank: Rank(entry, query, cmp)))
|
||||||
.Where(result => result.Rank < int.MaxValue)
|
.Where(result => result.Rank < int.MaxValue)
|
||||||
.OrderBy(result => result.Rank)
|
.OrderBy(result => result.Rank)
|
||||||
.Select(result => result.Entry))
|
.Select(result => result.Entry))];
|
||||||
.ToList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string[] GetModSearchTerms(MiraPluginInfo plugin, AbstractOptionGroup group)
|
private static string[] GetModSearchTerms(MiraPluginInfo plugin, AbstractOptionGroup group)
|
||||||
@@ -211,7 +209,7 @@ internal static class GuideOptionPages
|
|||||||
AddNamespace(terms, option.GetType());
|
AddNamespace(terms, option.GetType());
|
||||||
}
|
}
|
||||||
|
|
||||||
return terms.Where(term => !string.IsNullOrWhiteSpace(term)).ToArray();
|
return [.. terms.Where(term => !string.IsNullOrWhiteSpace(term))];
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void AddNamespace(HashSet<string> terms, Type type)
|
private static void AddNamespace(HashSet<string> terms, Type type)
|
||||||
@@ -224,7 +222,7 @@ internal static class GuideOptionPages
|
|||||||
|
|
||||||
private static string NormalizeSearchText(string value)
|
private static string NormalizeSearchText(string value)
|
||||||
{
|
{
|
||||||
return new string(value.Where(char.IsLetterOrDigit).Select(char.ToLowerInvariant).ToArray());
|
return new string([.. value.Where(char.IsLetterOrDigit).Select(char.ToLowerInvariant)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int Rank(GuideOptionEntry entry, string query, StringComparison cmp)
|
private static int Rank(GuideOptionEntry entry, string query, StringComparison cmp)
|
||||||
@@ -336,9 +334,9 @@ internal static class GuideOptionPages
|
|||||||
return TrailingZeroRegex.Replace(number.Data.GetValueString(number.Value), string.Empty);
|
return TrailingZeroRegex.Replace(number.Data.GetValueString(number.Value), string.Empty);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return option.Data.Type == global::OptionTypes.Checkbox
|
return option.Data.Type == OptionTypes.Checkbox
|
||||||
? formatBool(Math.Abs(option.GetFloatData() - 1f) < 0.0001f)
|
? formatBool(Math.Abs(option.GetFloatData() - 1f) < 0.0001f)
|
||||||
: option.Data.GetValueString(option.GetFloatData());
|
: option.Data.GetValueString(option.GetFloatData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -914,25 +914,21 @@ public static class Helpers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a page of vanilla settings rows inside a roles-style scroller.
|
/// Creates a page of vanilla settings rows inside a roles-style scroller.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="guide">The guide object.</param>
|
|
||||||
/// <param name="parent">The <see cref="Scroller"/> the page is parented to.</param>
|
/// <param name="parent">The <see cref="Scroller"/> the page is parented to.</param>
|
||||||
/// <param name="settings">The rows to show: key is the label, value is the displayed value.</param>
|
/// <param name="settings">The rows to show: key is the label, value is the displayed value.</param>
|
||||||
/// <returns>The <see cref="GameObject"/> that holds all the rows. Destroy it to remove the page.</returns>
|
/// <returns>The <see cref="GameObject"/> that holds all the rows. Destroy it to remove the page.</returns>
|
||||||
public static GameObject CreateAdvancedSettingsPage(
|
public static GameObject CreateAdvancedSettingsPage(
|
||||||
MatchInfoGuide guide,
|
|
||||||
Scroller parent,
|
Scroller parent,
|
||||||
IReadOnlyList<KeyValuePair<string, string>> settings)
|
IReadOnlyList<KeyValuePair<string, string>> settings)
|
||||||
{
|
{
|
||||||
return CreateAdvancedSettingsPage(
|
return CreateAdvancedSettingsPage(
|
||||||
guide,
|
|
||||||
parent,
|
parent,
|
||||||
settings.Select(setting => new AdvancedSettingsRow(setting.Key, setting.Value, null)).ToList(),
|
[.. settings.Select(setting => new AdvancedSettingsRow(setting.Key, setting.Value, null))],
|
||||||
2,
|
2,
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
|
|
||||||
internal static GameObject CreateAdvancedSettingsPage(
|
internal static GameObject CreateAdvancedSettingsPage(
|
||||||
MatchInfoGuide guide,
|
|
||||||
Scroller parent,
|
Scroller parent,
|
||||||
List<AdvancedSettingsRow> settings,
|
List<AdvancedSettingsRow> settings,
|
||||||
int columns = 2,
|
int columns = 2,
|
||||||
@@ -997,7 +993,7 @@ public static class Helpers
|
|||||||
bounds.Encapsulate(next);
|
bounds.Encapsulate(next);
|
||||||
return bounds;
|
return bounds;
|
||||||
});
|
});
|
||||||
var rowScale = (columnWidth / prefabBounds.size.x) * 1.22f;
|
var rowScale = columnWidth / prefabBounds.size.x * 1.22f;
|
||||||
var rowHeight = prefabBounds.size.y * rowScale;
|
var rowHeight = prefabBounds.size.y * rowScale;
|
||||||
var rowPitch = 0.45f * rowScale;
|
var rowPitch = 0.45f * rowScale;
|
||||||
var groupedSettings = groupsAsColumns
|
var groupedSettings = groupsAsColumns
|
||||||
@@ -1009,7 +1005,7 @@ public static class Helpers
|
|||||||
groupsAsColumns = groupedSettings.Count > 1;
|
groupsAsColumns = groupedSettings.Count > 1;
|
||||||
if (groupsAsColumns)
|
if (groupsAsColumns)
|
||||||
{
|
{
|
||||||
rowScale = (columnWidth / prefabBounds.size.x) * (columns > 2 ? 1.15f : 1f);
|
rowScale = columnWidth / prefabBounds.size.x * (columns > 2 ? 1.15f : 1f);
|
||||||
rowHeight = prefabBounds.size.y * rowScale;
|
rowHeight = prefabBounds.size.y * rowScale;
|
||||||
rowPitch = 0.45f * rowScale;
|
rowPitch = 0.45f * rowScale;
|
||||||
}
|
}
|
||||||
@@ -1321,4 +1317,4 @@ public static class Helpers
|
|||||||
panel.roleCount.fontMaterial.SetFloat(panel.STENCIL_NAME, 50f);
|
panel.roleCount.fontMaterial.SetFloat(panel.STENCIL_NAME, 50f);
|
||||||
panel.roleIcon.transform.localScale = new Vector3(3.5f, 3.5f, 1f);
|
panel.roleIcon.transform.localScale = new Vector3(3.5f, 3.5f, 1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user