mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
Fix scroller issues
This commit is contained in:
1 parent
ad113a47ab
commit
8e5028c236
10 files changed
+31
-27
No files matched your search
@@ -97,4 +97,4 @@ public static class CustomGameModeManager
|
||||
ActiveMode = IdToModeMap[0];
|
||||
Logger<MiraApiPlugin>.Warning($"Unable to find game mode of id {id}!");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -62,12 +62,12 @@ public static class GameModeOption
|
||||
Values.Add(opt, CustomStringName.CreateAndRegister(opt));
|
||||
}
|
||||
|
||||
private static List<CategoryHeaderMasked> VanillaCategories = new();
|
||||
private static List<OptionBehaviour> VanillaOptions = new();
|
||||
private static List<CategoryHeaderMasked> BaseCategories = new();
|
||||
private static List<OptionBehaviour> BaseOptions = new();
|
||||
private static List<CategoryHeaderMasked> ModeCategories = new();
|
||||
private static List<OptionBehaviour> ModeOptions = new();
|
||||
private static readonly List<CategoryHeaderMasked> VanillaCategories = new();
|
||||
private static readonly List<OptionBehaviour> VanillaOptions = new();
|
||||
private static readonly List<CategoryHeaderMasked> BaseCategories = new();
|
||||
private static readonly List<OptionBehaviour> BaseOptions = new();
|
||||
private static readonly List<CategoryHeaderMasked> ModeCategories = new();
|
||||
private static readonly List<OptionBehaviour> ModeOptions = new();
|
||||
[HarmonyPatch(typeof(GameOptionsMenu), nameof(GameOptionsMenu.CreateSettings))]
|
||||
[HarmonyPostfix]
|
||||
private static void CreateSettingsPatch(GameOptionsMenu __instance)
|
||||
@@ -76,13 +76,15 @@ public static class GameModeOption
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var num = 0.713f;
|
||||
|
||||
ModeCategories.Clear();
|
||||
ModeOptions.Clear();
|
||||
VanillaCategories.Clear();
|
||||
VanillaOptions.Clear();
|
||||
BaseCategories.Clear();
|
||||
BaseOptions.Clear();
|
||||
float num = 0.713f;
|
||||
foreach (var category in __instance.settingsContainer.GetComponentsInChildren<CategoryHeaderMasked>())
|
||||
{
|
||||
if (category)
|
||||
@@ -161,7 +163,7 @@ public static class GameModeOption
|
||||
}
|
||||
|
||||
var showOpts = mode.ShowNormalGameSettings;
|
||||
var num = 0.083f;
|
||||
var num = 0.713f - (0.63f * BaseCategories.Count) - (0.45f * BaseOptions.Count);
|
||||
foreach (var category in VanillaCategories)
|
||||
{
|
||||
category.gameObject.SetActive(showOpts);
|
||||
@@ -181,7 +183,8 @@ public static class GameModeOption
|
||||
obj.gameObject.SetActive(true);
|
||||
instance.Children.Add(obj);
|
||||
}
|
||||
instance.scrollBar.SetYBoundsMax(instance.scrollBar.GetYBounds().max + 1);
|
||||
num -= 0.63f * VanillaCategories.Count;
|
||||
num -= 0.45f * VanillaOptions.Count;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -189,21 +192,22 @@ public static class GameModeOption
|
||||
{
|
||||
obj.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (filteredGroups.Any())
|
||||
{
|
||||
num += 0.225f;
|
||||
foreach (var group in filteredGroups)
|
||||
{
|
||||
GameOptionsMenuPatch.UpdateGroup(group, ref num);
|
||||
}
|
||||
|
||||
instance.scrollBar.SetYBoundsMax(-num - 1.65f);
|
||||
}
|
||||
foreach (var option in ModeOptions)
|
||||
instance.ControllerSelectable.Clear();
|
||||
foreach (var obj in instance.scrollBar.GetComponentsInChildren<UiElement>())
|
||||
{
|
||||
option.gameObject.transform.localPosition += new Vector3(0, -0.67f, 0);
|
||||
}
|
||||
foreach (var header in ModeCategories)
|
||||
{
|
||||
header.gameObject.transform.localPosition += new Vector3(0, -0.67f, 0);
|
||||
instance.ControllerSelectable.Add(obj);
|
||||
}
|
||||
instance.scrollBar.SetYBoundsMax(-num - 1.65f);
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(GameOptionsMenu), nameof(GameOptionsMenu.ValueChanged))]
|
||||
|
||||
@@ -96,5 +96,5 @@ public enum MenuCategory
|
||||
Roles,
|
||||
Modifiers,
|
||||
CustomOne,
|
||||
CustomTwo
|
||||
CustomTwo,
|
||||
}
|
||||
@@ -14,7 +14,7 @@ public class BaseKeybind
|
||||
public InputAction? RewiredInputAction { get; internal set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the unique identifier for this keybind. Used in Rewired.
|
||||
/// Gets or sets the unique identifier for this keybind. Used in Rewired.
|
||||
/// </summary>
|
||||
public string Id { get; protected set; }
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace MiraAPI.Patches.LocalSettings;
|
||||
public static class OptionsMenuPatches
|
||||
{
|
||||
internal static OptionsMenuBehaviour? Instance { get; private set; }
|
||||
internal static BoxCollider2D MaskCollider;
|
||||
internal static BoxCollider2D MaskCollider = null!;
|
||||
private static SpriteRenderer? background;
|
||||
|
||||
private static int currentPage = 1;
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
using HarmonyLib;
|
||||
using Innersloth.Assets;
|
||||
using MiraAPI.Utilities;
|
||||
using Reactor.Utilities.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MiraAPI.Utilities.Assets;
|
||||
using Reactor.Utilities.Extensions;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
using AmongUs.Data;
|
||||
using HarmonyLib;
|
||||
using MiraAPI.Utilities;
|
||||
using Reactor.Utilities.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using MiraAPI.Utilities.Assets;
|
||||
using Reactor.Utilities.Extensions;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
using AmongUs.Data;
|
||||
using HarmonyLib;
|
||||
using MiraAPI.Utilities;
|
||||
using Reactor.Utilities.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using MiraAPI.Utilities.Assets;
|
||||
using Reactor.Utilities.Extensions;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
@@ -39,8 +39,8 @@ public sealed class MiraPluginManager
|
||||
|
||||
internal Dictionary<MiraPluginInfo, List<Type>> QueuedRoleRegistrations { get; } = [];
|
||||
internal static MiraPluginManager Instance { get; private set; } = new();
|
||||
public static ConfigFile MiraApiConfig { get; private set; }
|
||||
public static MiraPluginInfo MiraApiPluginInfo { get; private set; }
|
||||
public static ConfigFile MiraApiConfig { get; private set; } = null!;
|
||||
public static MiraPluginInfo MiraApiPluginInfo { get; private set; } = null!;
|
||||
|
||||
internal void Initialize(BasePlugin miraApiPlugin, IMiraPlugin apiPlugin)
|
||||
{
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using AmongUs.GameOptions;
|
||||
using MiraAPI.GameModes;
|
||||
using Il2CppInterop.Runtime.Attributes;
|
||||
using MiraAPI.GameModes;
|
||||
using MiraAPI.Patches.Freeplay;
|
||||
using MiraAPI.Utilities.Assets;
|
||||
using UnityEngine;
|
||||
|
||||
Reference in new issue
Block a user