mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
Fix all scrolling issues (i think)
This commit is contained in:
1 parent
e0c1038658
commit
1933bb73bd
3 files changed
+23
-21
No files matched your search
@@ -25,17 +25,17 @@ public static class GameOptionsMenuPatch
|
||||
__instance.MapPicker.gameObject.SetActive(false);
|
||||
|
||||
float num = 2.1f;
|
||||
|
||||
|
||||
var filteredGroups = GameSettingMenuPatches.SelectedMod.OptionGroups.Where(x => x.GroupVisible.Invoke() && x.AdvancedRole is null);
|
||||
|
||||
|
||||
foreach (IModdedOptionGroup group in filteredGroups)
|
||||
{
|
||||
var filteredOpts = ModdedOptionsManager.Groups[group].Where(x=>x.Visible.Invoke()).ToList();
|
||||
var filteredOpts = ModdedOptionsManager.Groups[group].Where(x => x.Visible.Invoke()).ToList();
|
||||
if (filteredOpts.Count == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
CategoryHeaderMasked categoryHeaderMasked = Object.Instantiate(__instance.categoryHeaderOrigin, Vector3.zero, Quaternion.identity, __instance.settingsContainer);
|
||||
categoryHeaderMasked.SetHeader(CustomStringName.CreateAndRegister(group.GroupName), 20);
|
||||
if (group.GroupColor != Color.clear)
|
||||
@@ -46,7 +46,7 @@ public static class GameOptionsMenuPatch
|
||||
categoryHeaderMasked.transform.localScale = Vector3.one * 0.63f;
|
||||
categoryHeaderMasked.transform.localPosition = new Vector3(-0.903f, num, -2f);
|
||||
num -= 0.63f;
|
||||
|
||||
|
||||
foreach (var opt in filteredOpts)
|
||||
{
|
||||
OptionBehaviour newOpt = opt.CreateOption(__instance.checkboxOrigin, __instance.numberOptionOrigin, __instance.stringOptionOrigin, __instance.settingsContainer);
|
||||
@@ -83,7 +83,6 @@ public static class GameOptionsMenuPatch
|
||||
}
|
||||
|
||||
__instance.scrollBar.SetYBoundsMax(-num - 1.65f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace MiraAPI.Patches.Options;
|
||||
public static class GameSettingMenuPatches
|
||||
{
|
||||
public static int CurrentSelectedMod { get; private set; }
|
||||
|
||||
|
||||
public static MiraPluginInfo SelectedMod { get; private set; }
|
||||
|
||||
private static TextMeshPro _text;
|
||||
@@ -116,12 +116,14 @@ public static class GameSettingMenuPatches
|
||||
roleChance.gameObject.DestroyImmediate();
|
||||
}
|
||||
|
||||
|
||||
roles.roleChances.Clear();
|
||||
roles.roleChances = null;
|
||||
roles.AdvancedRolesSettings.gameObject.SetActive(false);
|
||||
roles.RoleChancesSettings.gameObject.SetActive(true);
|
||||
roles.SetQuotaTab();
|
||||
|
||||
roles.scrollBar.CalculateAndSetYBounds(roles.roleChances.Count + 3, 1f, 6f, 0.43f);
|
||||
roles.scrollBar.ScrollToTop();
|
||||
}
|
||||
|
||||
if (settings?.Children != null)
|
||||
@@ -150,6 +152,7 @@ public static class GameSettingMenuPatches
|
||||
settings.Children = null;
|
||||
|
||||
settings.Initialize();
|
||||
settings.scrollBar.ScrollToTop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,13 @@
|
||||
using HarmonyLib;
|
||||
using MiraAPI.Networking;
|
||||
using MiraAPI.Roles;
|
||||
using MiraAPI.Utilities;
|
||||
using MiraAPI.Utilities.Assets;
|
||||
using Reactor.Networking.Rpc;
|
||||
using Reactor.Utilities;
|
||||
using Reactor.Utilities.Extensions;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using MiraAPI.Networking;
|
||||
using Reactor.Networking.Rpc;
|
||||
using Reactor.Utilities;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
@@ -25,7 +25,7 @@ public static class RoleSettingMenuPatches
|
||||
{
|
||||
__instance.roleChances = new Il2CppSystem.Collections.Generic.List<RoleOptionSetting>();
|
||||
__instance.advancedSettingChildren = new Il2CppSystem.Collections.Generic.List<OptionBehaviour>();
|
||||
|
||||
|
||||
var maskBg = __instance.scrollBar.transform.FindChild("MaskBg");
|
||||
|
||||
if (GameSettingMenuPatches.CurrentSelectedMod == 0)
|
||||
@@ -45,17 +45,17 @@ public static class RoleSettingMenuPatches
|
||||
__instance.scrollBar.transform.localPosition = new Vector3(-1.4957f, 1.5261f, -4);
|
||||
maskBg.localPosition = new Vector3(1.5353f, -1.0607f, -.1f);
|
||||
maskBg.localScale = new Vector3(6.6811f, 4.1563f, 0.5598f);
|
||||
|
||||
|
||||
int num3 = 0;
|
||||
|
||||
var crewRoles = GameSettingMenuPatches.SelectedMod.CustomRoles.Values
|
||||
.OfType<ICustomRole>()
|
||||
.Where(role => role.Team == ModdedRoleTeams.Crewmate && !role.HideSettings)
|
||||
.ToList();
|
||||
|
||||
|
||||
if (crewRoles.Count > 0)
|
||||
{
|
||||
|
||||
|
||||
CategoryHeaderEditRole categoryHeaderEditRole = Object.Instantiate(__instance.categoryHeaderEditRoleOrigin, Vector3.zero, Quaternion.identity, __instance.RoleChancesSettings.transform);
|
||||
categoryHeaderEditRole.SetHeader(StringNames.CrewmateRolesHeader, 20);
|
||||
categoryHeaderEditRole.transform.localPosition = new Vector3(4.986f, num, -2f);
|
||||
@@ -67,7 +67,7 @@ public static class RoleSettingMenuPatches
|
||||
num3++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var impRoles = GameSettingMenuPatches.SelectedMod.CustomRoles.Values
|
||||
.OfType<ICustomRole>()
|
||||
.Where(role => role.Team == ModdedRoleTeams.Impostor && !role.HideSettings)
|
||||
@@ -89,7 +89,7 @@ public static class RoleSettingMenuPatches
|
||||
num3++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
var neutRoles = GameSettingMenuPatches.SelectedMod.CustomRoles.Values
|
||||
.OfType<ICustomRole>()
|
||||
.Where(role => role.Team == ModdedRoleTeams.Neutral && !role.HideSettings)
|
||||
@@ -104,7 +104,7 @@ public static class RoleSettingMenuPatches
|
||||
categoryHeaderEditRole3.Title.text = "Neutral Roles";
|
||||
categoryHeaderEditRole3.transform.localPosition = new Vector3(4.986f, num, -2f);
|
||||
num -= 0.522f;
|
||||
|
||||
|
||||
foreach (var role in neutRoles)
|
||||
{
|
||||
CreateQuotaOption(__instance, role as RoleBehaviour, ref num, num3);
|
||||
@@ -161,7 +161,7 @@ public static class RoleSettingMenuPatches
|
||||
|
||||
private static void CreateAdvancedSettings(RolesSettingsMenu __instance, RoleBehaviour role)
|
||||
{
|
||||
foreach (var option in __instance.advancedSettingChildren)
|
||||
foreach (var option in __instance.advancedSettingChildren)
|
||||
{
|
||||
Object.Destroy(option.gameObject);
|
||||
}
|
||||
@@ -171,7 +171,7 @@ public static class RoleSettingMenuPatches
|
||||
float num = -0.872f;
|
||||
|
||||
var filteredOptions = GameSettingMenuPatches.SelectedMod.Options.Where(x => x.AdvancedRole == role.GetType());
|
||||
|
||||
|
||||
foreach (var option in filteredOptions)
|
||||
{
|
||||
if (option.AdvancedRole is not null && option.AdvancedRole != role.GetType())
|
||||
@@ -207,7 +207,7 @@ public static class RoleSettingMenuPatches
|
||||
{
|
||||
ICustomRole customRole = role as ICustomRole;
|
||||
__instance.roleDescriptionText.text = customRole.RoleLongDescription;
|
||||
__instance.roleTitleText.text = DestroyableSingleton<TranslationController>.Instance.GetString(role.StringName, []);
|
||||
__instance.roleTitleText.text = DestroyableSingleton<TranslationController>.Instance.GetString(role.StringName, Array.Empty<Il2CppSystem.Object>());
|
||||
__instance.roleScreenshot.sprite = Sprite.Create(customRole.OptionsScreenshot.LoadAsset().texture, new Rect(0, 0, 370, 230), Vector2.one / 2, 100);
|
||||
__instance.roleScreenshot.drawMode = SpriteDrawMode.Sliced;
|
||||
__instance.roleHeaderSprite.color = customRole.RoleColor;
|
||||
|
||||
Reference in new issue
Block a user