mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
Optimize search and filter to be "per-menu"
This commit is contained in:
1 parent
6d1557a48d
commit
3cf1963414
1 file changed
+158
-43
@@ -35,6 +35,10 @@ public static class RoleGuidePatches
|
|||||||
private static SpriteRenderer _searchSortingFilterIdle;
|
private static SpriteRenderer _searchSortingFilterIdle;
|
||||||
private static SpriteRenderer _searchSortingFilterHover;
|
private static SpriteRenderer _searchSortingFilterHover;
|
||||||
private static Scroller _rolesScroller;
|
private static Scroller _rolesScroller;
|
||||||
|
private static bool _needsRoleRefresh;
|
||||||
|
private static bool _needsModifierRefresh;
|
||||||
|
private static bool _needsToggledRoleRefresh;
|
||||||
|
private static bool _needsToggledModifierRefresh;
|
||||||
|
|
||||||
[HarmonyPostfix]
|
[HarmonyPostfix]
|
||||||
[HarmonyPriority(Priority.First)]
|
[HarmonyPriority(Priority.First)]
|
||||||
@@ -67,7 +71,7 @@ public static class RoleGuidePatches
|
|||||||
roleMenuGradient.transform.localScale = new Vector3(0.5297f, 0.1565f, 1);
|
roleMenuGradient.transform.localScale = new Vector3(0.5297f, 0.1565f, 1);
|
||||||
roleMenuGradient.transform.localPosition = new Vector3(0, -0.62f, -5);
|
roleMenuGradient.transform.localPosition = new Vector3(0, -0.62f, -5);
|
||||||
var wikiTab = Object.Instantiate(__instance.settingsTabs[2], __instance.settingsTabs[2].transform.parent);
|
var wikiTab = Object.Instantiate(__instance.settingsTabs[2], __instance.settingsTabs[2].transform.parent);
|
||||||
advancedWikiTab = wikiTab.GetComponent<Scroller>();
|
_advancedInfoTabScroller = wikiTab.GetComponent<Scroller>();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HarmonyPrefix]
|
[HarmonyPrefix]
|
||||||
@@ -202,10 +206,11 @@ public static class RoleGuidePatches
|
|||||||
__instance.settingsTabs[2],
|
__instance.settingsTabs[2],
|
||||||
__instance.settingsTabs[2].transform.parent);
|
__instance.settingsTabs[2].transform.parent);
|
||||||
modifiersTab.name = "ModifiersPanel";
|
modifiersTab.name = "ModifiersPanel";
|
||||||
modifiersTab.transform.FindChild("MaskArea")?.transform.localPosition = new Vector3(-0.0184f, 0.15f, -0.1f);
|
modifiersTab.transform.FindChild("MaskArea")?.transform.localPosition =
|
||||||
|
new Vector3(-0.0184f, 0.15f, -0.1f);
|
||||||
modifiersTab.transform.GetAllChildren()
|
modifiersTab.transform.GetAllChildren()
|
||||||
.First(x => x.name.Contains("BG_Gradient")).transform.localPosition = new Vector3(0, -0.62f, -5);
|
.First(x => x.name.Contains("BG_Gradient")).transform.localPosition = new Vector3(0, -0.62f, -5);
|
||||||
modifiersWikiTab = modifiersTab.GetComponent<Scroller>();
|
_modifiersScroller = modifiersTab.GetComponent<Scroller>();
|
||||||
__instance.settingsTabs.Add(modifiersTab);
|
__instance.settingsTabs.Add(modifiersTab);
|
||||||
|
|
||||||
var wikiTab = Object.Instantiate(
|
var wikiTab = Object.Instantiate(
|
||||||
@@ -215,7 +220,7 @@ public static class RoleGuidePatches
|
|||||||
wikiTab.transform.FindChild("MaskArea")?.transform.localPosition = new Vector3(-0.0184f, 0.15f, -0.1f);
|
wikiTab.transform.FindChild("MaskArea")?.transform.localPosition = new Vector3(-0.0184f, 0.15f, -0.1f);
|
||||||
wikiTab.transform.GetAllChildren()
|
wikiTab.transform.GetAllChildren()
|
||||||
.First(x => x.name.Contains("BG_Gradient")).transform.localPosition = new Vector3(0, -0.62f, -5);
|
.First(x => x.name.Contains("BG_Gradient")).transform.localPosition = new Vector3(0, -0.62f, -5);
|
||||||
advancedWikiTab = wikiTab.GetComponent<Scroller>();
|
_advancedInfoTabScroller = wikiTab.GetComponent<Scroller>();
|
||||||
|
|
||||||
DisplayNormalRoleSettings(__instance, true);
|
DisplayNormalRoleSettings(__instance, true);
|
||||||
|
|
||||||
@@ -282,11 +287,16 @@ public static class RoleGuidePatches
|
|||||||
_searchIconHover.sprite = MiraAssets.SearchIconHoverSprite;
|
_searchIconHover.sprite = MiraAssets.SearchIconHoverSprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
SortAllModifiers(text);
|
if (MatchInfoGuide.Instance.activeTabIndex != 3)
|
||||||
|
{
|
||||||
SortAllRoles(text);
|
SortAllRoles(text);
|
||||||
|
|
||||||
_rolesScroller.ScrollToTop();
|
_rolesScroller.ScrollToTop();
|
||||||
modifiersWikiTab.ScrollToTop();
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SortAllModifiers(text);
|
||||||
|
_modifiersScroller.ScrollToTop();
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
searchBoxTmp.transform.localPosition = new Vector3(-1.438f, 0.756f, -0.2f);
|
searchBoxTmp.transform.localPosition = new Vector3(-1.438f, 0.756f, -0.2f);
|
||||||
|
|
||||||
@@ -323,6 +333,8 @@ public static class RoleGuidePatches
|
|||||||
settingBtnHighlight.transform.GetChild(0).gameObject.SetActive(false);
|
settingBtnHighlight.transform.GetChild(0).gameObject.SetActive(false);
|
||||||
|
|
||||||
var rolesButton = __instance.TabButtons[2];
|
var rolesButton = __instance.TabButtons[2];
|
||||||
|
rolesButton.OnClick = new Button.ButtonClickedEvent();
|
||||||
|
rolesButton.OnClick.AddListener((Action)(() => OpenRolesTab()));
|
||||||
var rolesCollider = rolesButton.GetComponent<BoxCollider2D>();
|
var rolesCollider = rolesButton.GetComponent<BoxCollider2D>();
|
||||||
rolesButton.transform.GetChild(0).gameObject.SetActive(false);
|
rolesButton.transform.GetChild(0).gameObject.SetActive(false);
|
||||||
var rolesBtnInactive = rolesButton.inactiveSprites.GetComponent<SpriteRenderer>();
|
var rolesBtnInactive = rolesButton.inactiveSprites.GetComponent<SpriteRenderer>();
|
||||||
@@ -338,7 +350,9 @@ public static class RoleGuidePatches
|
|||||||
rolesBtnHighlight.size = Vector2.one;
|
rolesBtnHighlight.size = Vector2.one;
|
||||||
rolesBtnHighlight.transform.GetChild(0).gameObject.SetActive(false);
|
rolesBtnHighlight.transform.GetChild(0).gameObject.SetActive(false);
|
||||||
|
|
||||||
var modifiersButton = Object.Instantiate(__instance.TabButtons[2], __instance.TabButtons[2].transform.parent);
|
var modifiersButton = Object.Instantiate(
|
||||||
|
__instance.TabButtons[2],
|
||||||
|
__instance.TabButtons[2].transform.parent);
|
||||||
modifiersButton.OnClick = new Button.ButtonClickedEvent();
|
modifiersButton.OnClick = new Button.ButtonClickedEvent();
|
||||||
modifiersButton.OnClick.AddListener((Action)(() => OpenModifiersTab()));
|
modifiersButton.OnClick.AddListener((Action)(() => OpenModifiersTab()));
|
||||||
var modifiersCollider = modifiersButton.GetComponent<BoxCollider2D>();
|
var modifiersCollider = modifiersButton.GetComponent<BoxCollider2D>();
|
||||||
@@ -357,10 +371,13 @@ public static class RoleGuidePatches
|
|||||||
modifiersBtnHighlight.transform.GetChild(0).gameObject.SetActive(false);
|
modifiersBtnHighlight.transform.GetChild(0).gameObject.SetActive(false);
|
||||||
__instance.TabButtons.Add(modifiersButton);
|
__instance.TabButtons.Add(modifiersButton);
|
||||||
|
|
||||||
playerCollider.size = settingsCollider.size = rolesCollider.size = modifiersCollider.size = new Vector2(0.8f, 0.74f);
|
playerCollider.size = settingsCollider.size =
|
||||||
playerCollider.offset = settingsCollider.offset = rolesCollider.offset = modifiersCollider.offset = Vector2.zero;
|
rolesCollider.size = modifiersCollider.size = new Vector2(0.8f, 0.74f);
|
||||||
|
playerCollider.offset = settingsCollider.offset =
|
||||||
|
rolesCollider.offset = modifiersCollider.offset = Vector2.zero;
|
||||||
playerButton.transform.localScale = settingButton.transform.localScale =
|
playerButton.transform.localScale = settingButton.transform.localScale =
|
||||||
rolesButton.transform.localScale = modifiersButton.transform.localScale = new Vector3(0.7f, 0.7f, 1);
|
rolesButton.transform.localScale =
|
||||||
|
modifiersButton.transform.localScale = new Vector3(0.7f, 0.7f, 1);
|
||||||
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);
|
||||||
rolesButton.transform.localPosition = new Vector3(-3.6f, -0.544f, -0.2f);
|
rolesButton.transform.localPosition = new Vector3(-3.6f, -0.544f, -0.2f);
|
||||||
@@ -394,14 +411,64 @@ public static class RoleGuidePatches
|
|||||||
|
|
||||||
public static void OpenModifiersTab()
|
public static void OpenModifiersTab()
|
||||||
{
|
{
|
||||||
advancedWikiTab?.gameObject.SetActive(false);
|
_advancedInfoTabScroller?.gameObject.SetActive(false);
|
||||||
MatchInfoGuide.Instance.SetActiveTab(3);
|
MatchInfoGuide.Instance.SetActiveTab(3);
|
||||||
|
if (_needsToggledModifierRefresh)
|
||||||
|
{
|
||||||
|
ToggleModifierVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_needsModifierRefresh)
|
||||||
|
{
|
||||||
|
var text = string.Empty;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
text = searchBoxTmp.outputText.text;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
|
||||||
|
SortAllModifiers(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
_needsModifierRefresh = false;
|
||||||
|
_needsToggledModifierRefresh = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void OpenRolesTab()
|
||||||
|
{
|
||||||
|
_advancedInfoTabScroller?.gameObject.SetActive(false);
|
||||||
|
MatchInfoGuide.Instance.SetActiveTab(2);
|
||||||
|
if (_needsToggledRoleRefresh)
|
||||||
|
{
|
||||||
|
ToggleRoleVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_needsRoleRefresh)
|
||||||
|
{
|
||||||
|
var text = string.Empty;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
text = searchBoxTmp.outputText.text;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// ignored
|
||||||
|
}
|
||||||
|
|
||||||
|
SortAllRoles(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
_needsRoleRefresh = false;
|
||||||
|
_needsToggledRoleRefresh = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static readonly Dictionary<RoleBehaviour, DetailedPanel> RolePanels = [];
|
private static readonly Dictionary<RoleBehaviour, DetailedPanel> RolePanels = [];
|
||||||
private static readonly Dictionary<GameModifier, DetailedPanel> ModifierPanels = [];
|
private static readonly Dictionary<GameModifier, DetailedPanel> ModifierPanels = [];
|
||||||
private static Scroller modifiersWikiTab;
|
private static Scroller _modifiersScroller;
|
||||||
private static Scroller advancedWikiTab;
|
private static Scroller _advancedInfoTabScroller;
|
||||||
private static TextBoxTMP searchBoxTmp;
|
private static TextBoxTMP searchBoxTmp;
|
||||||
private static GameObject currentAdvancedTabObject;
|
private static GameObject currentAdvancedTabObject;
|
||||||
private static TextMeshPro titleText;
|
private static TextMeshPro titleText;
|
||||||
@@ -436,19 +503,19 @@ public static class RoleGuidePatches
|
|||||||
}
|
}
|
||||||
|
|
||||||
var text = string.Empty;
|
var text = string.Empty;
|
||||||
try
|
|
||||||
{
|
|
||||||
text = searchBoxTmp.outputText.text;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
// ignored
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (MatchInfoGuide.Instance.activeTabIndex != 3)
|
||||||
|
{
|
||||||
SortAllRoles(text);
|
SortAllRoles(text);
|
||||||
SortAllModifiers(text);
|
|
||||||
|
|
||||||
_rolesScroller.ScrollToTop();
|
_rolesScroller.ScrollToTop();
|
||||||
|
_needsModifierRefresh = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SortAllModifiers(text);
|
||||||
|
_modifiersScroller.ScrollToTop();
|
||||||
|
_needsRoleRefresh = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SwitchFilter()
|
public static void SwitchFilter()
|
||||||
@@ -479,8 +546,16 @@ public static class RoleGuidePatches
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MatchInfoGuide.Instance.activeTabIndex != 3)
|
||||||
|
{
|
||||||
ToggleRoleVisibility();
|
ToggleRoleVisibility();
|
||||||
|
_needsToggledModifierRefresh = _needsModifierRefresh = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ToggleModifierVisibility();
|
ToggleModifierVisibility();
|
||||||
|
_needsToggledRoleRefresh = _needsRoleRefresh = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SwitchMethod()
|
public static void SwitchMethod()
|
||||||
@@ -512,8 +587,16 @@ public static class RoleGuidePatches
|
|||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MatchInfoGuide.Instance.activeTabIndex != 3)
|
||||||
|
{
|
||||||
SortAllRoles(text);
|
SortAllRoles(text);
|
||||||
|
_needsModifierRefresh = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
SortAllModifiers(text);
|
SortAllModifiers(text);
|
||||||
|
_needsRoleRefresh = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SwitchGrouping()
|
public static void SwitchGrouping()
|
||||||
@@ -554,8 +637,16 @@ public static class RoleGuidePatches
|
|||||||
// ignored
|
// ignored
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (MatchInfoGuide.Instance.activeTabIndex != 3)
|
||||||
|
{
|
||||||
SortAllRoles(text);
|
SortAllRoles(text);
|
||||||
|
_needsModifierRefresh = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
SortAllModifiers(text);
|
SortAllModifiers(text);
|
||||||
|
_needsRoleRefresh = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DisplayNormalRoleSettings(MatchInfoGuide instance, bool reset)
|
public static void DisplayNormalRoleSettings(MatchInfoGuide instance, bool reset)
|
||||||
@@ -595,7 +686,7 @@ public static class RoleGuidePatches
|
|||||||
{
|
{
|
||||||
var panel = Object.Instantiate(
|
var panel = Object.Instantiate(
|
||||||
instance.MatchInfoRolePanelPrefab,
|
instance.MatchInfoRolePanelPrefab,
|
||||||
modifiersWikiTab.Inner);
|
_modifiersScroller.Inner);
|
||||||
var amount =
|
var amount =
|
||||||
modifier.GetAmountPerGame();
|
modifier.GetAmountPerGame();
|
||||||
var chance =
|
var chance =
|
||||||
@@ -668,10 +759,17 @@ public static class RoleGuidePatches
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
advancedWikiTab?.gameObject.SetActive(false);
|
_advancedInfoTabScroller?.gameObject.SetActive(false);
|
||||||
|
|
||||||
ToggleModifierVisibility();
|
if (MatchInfoGuide.Instance.activeTabIndex != 3)
|
||||||
|
{
|
||||||
ToggleRoleVisibility();
|
ToggleRoleVisibility();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ToggleModifierVisibility();
|
||||||
|
}
|
||||||
|
|
||||||
if (reset)
|
if (reset)
|
||||||
{
|
{
|
||||||
instance.CreatePlayerEntries();
|
instance.CreatePlayerEntries();
|
||||||
@@ -728,12 +826,13 @@ public static class RoleGuidePatches
|
|||||||
}
|
}
|
||||||
|
|
||||||
SortAllModifiers(text);
|
SortAllModifiers(text);
|
||||||
|
_needsRoleRefresh = true;
|
||||||
|
|
||||||
/*var instance = MatchInfoGuide.Instance;
|
/*var instance = MatchInfoGuide.Instance;
|
||||||
instance.rolesEnabledMessage.SetActive(num == 0);*/
|
instance.rolesEnabledMessage.SetActive(num == 0);*/
|
||||||
|
|
||||||
modifiersWikiTab.SetYBoundsMax(Mathf.Clamp(Mathf.Ceil(num / 2f) * 1.3f - 1.5f, 0f, 999f));
|
_modifiersScroller.SetYBoundsMax(Mathf.Clamp(Mathf.Ceil(num / 2f) * 1.3f - 1.5f, 0f, 999f));
|
||||||
modifiersWikiTab.SetYBoundsMax(Mathf.Clamp(Mathf.Ceil(num / 2f) * 1.3f - 1.5f, 0f, 999f));
|
_modifiersScroller.SetYBoundsMax(Mathf.Clamp(Mathf.Ceil(num / 2f) * 1.3f - 1.5f, 0f, 999f));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ToggleRoleVisibility()
|
public static void ToggleRoleVisibility()
|
||||||
@@ -796,13 +895,21 @@ public static class RoleGuidePatches
|
|||||||
|
|
||||||
public static void SortAllRoles(string searchText)
|
public static void SortAllRoles(string searchText)
|
||||||
{
|
{
|
||||||
var newSorted = RolePanels
|
var newSorted = sortMethod is SortingMethod.Alphabetical
|
||||||
|
? RolePanels
|
||||||
.OrderByDescending(child =>
|
.OrderByDescending(child =>
|
||||||
child.Value.GetTitle().Equals(searchText, StringComparison.OrdinalIgnoreCase))
|
child.Value.GetTitle().Equals(searchText, StringComparison.OrdinalIgnoreCase))
|
||||||
.ThenByDescending(child => child.Value.GetTitle().Contains(
|
.ThenByDescending(child => child.Value.GetTitle().Contains(
|
||||||
searchText,
|
searchText,
|
||||||
StringComparison.InvariantCultureIgnoreCase))
|
StringComparison.InvariantCultureIgnoreCase))
|
||||||
.ThenBy(GetSortingOrder());
|
.ThenBy(GetSortingOrder())
|
||||||
|
: RolePanels
|
||||||
|
.OrderByDescending(child =>
|
||||||
|
child.Value.GetTitle().Equals(searchText, StringComparison.OrdinalIgnoreCase))
|
||||||
|
.ThenByDescending(child => child.Value.GetTitle().Contains(
|
||||||
|
searchText,
|
||||||
|
StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
.ThenByDescending(GetSortingOrder());
|
||||||
|
|
||||||
foreach (var pair in newSorted)
|
foreach (var pair in newSorted)
|
||||||
{
|
{
|
||||||
@@ -812,13 +919,21 @@ public static class RoleGuidePatches
|
|||||||
|
|
||||||
public static void SortAllModifiers(string searchText)
|
public static void SortAllModifiers(string searchText)
|
||||||
{
|
{
|
||||||
var newSorted = ModifierPanels
|
var newSorted = sortMethod is SortingMethod.Alphabetical
|
||||||
|
? ModifierPanels
|
||||||
.OrderByDescending(child =>
|
.OrderByDescending(child =>
|
||||||
child.Value.GetTitle().Equals(searchText, StringComparison.OrdinalIgnoreCase))
|
child.Value.GetTitle().Equals(searchText, StringComparison.OrdinalIgnoreCase))
|
||||||
.ThenByDescending(child => child.Value.GetTitle().Contains(
|
.ThenByDescending(child => child.Value.GetTitle().Contains(
|
||||||
searchText,
|
searchText,
|
||||||
StringComparison.InvariantCultureIgnoreCase))
|
StringComparison.InvariantCultureIgnoreCase))
|
||||||
.ThenBy(GetModifierSortingOrder());
|
.ThenBy(GetModifierSortingOrder())
|
||||||
|
: ModifierPanels
|
||||||
|
.OrderByDescending(child =>
|
||||||
|
child.Value.GetTitle().Equals(searchText, StringComparison.OrdinalIgnoreCase))
|
||||||
|
.ThenByDescending(child => child.Value.GetTitle().Contains(
|
||||||
|
searchText,
|
||||||
|
StringComparison.InvariantCultureIgnoreCase))
|
||||||
|
.ThenByDescending(GetModifierSortingOrder());
|
||||||
|
|
||||||
foreach (var pair in newSorted)
|
foreach (var pair in newSorted)
|
||||||
{
|
{
|
||||||
@@ -920,7 +1035,7 @@ public static class RoleGuidePatches
|
|||||||
titleText.text = TranslationController.Instance.GetString(StringNames.MatchInfoGuideTitle);
|
titleText.text = TranslationController.Instance.GetString(StringNames.MatchInfoGuideTitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
advancedWikiTab?.gameObject.SetActive(false);
|
_advancedInfoTabScroller?.gameObject.SetActive(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DisplayAdvancedWiki(MatchInfoGuide instance, BaseModifier modifier)
|
public static void DisplayAdvancedWiki(MatchInfoGuide instance, BaseModifier modifier)
|
||||||
@@ -929,20 +1044,20 @@ public static class RoleGuidePatches
|
|||||||
Warning($"Opening advanced tab for {name}.");
|
Warning($"Opening advanced tab for {name}.");
|
||||||
instance.settingsTabs[2].SetActive(false);
|
instance.settingsTabs[2].SetActive(false);
|
||||||
instance.settingsTabs[3].SetActive(false);
|
instance.settingsTabs[3].SetActive(false);
|
||||||
advancedWikiTab?.gameObject.SetActive(true);
|
_advancedInfoTabScroller?.gameObject.SetActive(true);
|
||||||
if (currentAdvancedTabObject)
|
if (currentAdvancedTabObject)
|
||||||
{
|
{
|
||||||
currentAdvancedTabObject.SetActive(false);
|
currentAdvancedTabObject.SetActive(false);
|
||||||
currentAdvancedTabObject.Destroy();
|
currentAdvancedTabObject.Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (advancedWikiTab == null)
|
if (_advancedInfoTabScroller == null)
|
||||||
{
|
{
|
||||||
Warning($"Wiki tab is null.");
|
Warning($"Wiki tab is null.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
currentAdvancedTabObject = modifier.GetAdvancedWiki(instance, titleText, advancedWikiTab);
|
currentAdvancedTabObject = modifier.GetAdvancedWiki(instance, titleText, _advancedInfoTabScroller);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DisplayAdvancedWiki(MatchInfoGuide instance, RoleBehaviour role)
|
public static void DisplayAdvancedWiki(MatchInfoGuide instance, RoleBehaviour role)
|
||||||
@@ -950,14 +1065,14 @@ public static class RoleGuidePatches
|
|||||||
Warning($"Opening advanced tab for {role.GetRoleName()}.");
|
Warning($"Opening advanced tab for {role.GetRoleName()}.");
|
||||||
instance.settingsTabs[2].SetActive(false);
|
instance.settingsTabs[2].SetActive(false);
|
||||||
instance.settingsTabs[3].SetActive(false);
|
instance.settingsTabs[3].SetActive(false);
|
||||||
advancedWikiTab?.gameObject.SetActive(true);
|
_advancedInfoTabScroller?.gameObject.SetActive(true);
|
||||||
if (currentAdvancedTabObject)
|
if (currentAdvancedTabObject)
|
||||||
{
|
{
|
||||||
currentAdvancedTabObject.SetActive(false);
|
currentAdvancedTabObject.SetActive(false);
|
||||||
currentAdvancedTabObject.Destroy();
|
currentAdvancedTabObject.Destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (advancedWikiTab == null)
|
if (_advancedInfoTabScroller == null)
|
||||||
{
|
{
|
||||||
Warning($"Wiki tab is null.");
|
Warning($"Wiki tab is null.");
|
||||||
return;
|
return;
|
||||||
@@ -965,11 +1080,11 @@ public static class RoleGuidePatches
|
|||||||
|
|
||||||
if (role is ICustomRole custom)
|
if (role is ICustomRole custom)
|
||||||
{
|
{
|
||||||
currentAdvancedTabObject = custom.GetAdvancedWiki(instance, titleText, advancedWikiTab);
|
currentAdvancedTabObject = custom.GetAdvancedWiki(instance, titleText, _advancedInfoTabScroller);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
advancedWikiTab.ScrollToTop();
|
_advancedInfoTabScroller.ScrollToTop();
|
||||||
var titleTxt = role.GetRoleName() +
|
var titleTxt = role.GetRoleName() +
|
||||||
$" ({TranslationController.Instance.GetString(role.TeamType is RoleTeamTypes.Crewmate ? StringNames.Crewmate : StringNames.Impostor)})";
|
$" ({TranslationController.Instance.GetString(role.TeamType is RoleTeamTypes.Crewmate ? StringNames.Crewmate : StringNames.Impostor)})";
|
||||||
var description = TranslationController.Instance.GetString(role.BlurbNameLong);
|
var description = TranslationController.Instance.GetString(role.BlurbNameLong);
|
||||||
@@ -989,9 +1104,9 @@ public static class RoleGuidePatches
|
|||||||
description,
|
description,
|
||||||
titleText,
|
titleText,
|
||||||
out var desc);
|
out var desc);
|
||||||
currentAdvancedTabObject.transform.SetParent(advancedWikiTab.Inner.transform);
|
currentAdvancedTabObject.transform.SetParent(_advancedInfoTabScroller.Inner.transform);
|
||||||
currentAdvancedTabObject.transform.localPosition = new Vector3(0f, 0f, 0f);
|
currentAdvancedTabObject.transform.localPosition = new Vector3(0f, 0f, 0f);
|
||||||
advancedWikiTab.SetYBoundsMax(Mathf.Clamp(desc.textBounds.size.y - 2, 0f, 999f));
|
_advancedInfoTabScroller.SetYBoundsMax(Mathf.Clamp(desc.textBounds.size.y - 2, 0f, 999f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user