mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
Add more option documentation
This commit is contained in:
1 parent
7fdfd506e0
commit
f53e4fdc38
14 files changed
+30
-19
No files matched your search
@@ -36,8 +36,11 @@ public abstract class MultiTargetButton<T> : CustomActionButton where T : MonoBe
|
||||
/// <returns>The list of target objects.</returns>
|
||||
public abstract T[] GetTargets();
|
||||
|
||||
/// <inheritdoc cref="CustomActionButton{T}.SetOutline"/>
|
||||
/// <summary>
|
||||
/// Sets the outline of the target <typeparamref name="T"/>.
|
||||
/// </summary>
|
||||
/// <param name="target">The target <typeparamref name="T"/> to set the oultine.</param>
|
||||
/// <param name="active">Should the outline be active.</param>
|
||||
public abstract void SetOutline(T target, bool active);
|
||||
|
||||
/// <inheritdoc cref="CustomActionButton{T}.CanUse"/>
|
||||
|
||||
@@ -43,6 +43,12 @@ public abstract class LocalSettingBase<T> : ILocalSetting
|
||||
/// <summary>
|
||||
/// Creates an instance of the setting.
|
||||
/// </summary>
|
||||
/// <param name="toggle">Toggle option to create.</param>
|
||||
/// <param name="slider">Slider option to create.</param>
|
||||
/// <param name="parent">The parent options menu.</param>
|
||||
/// <param name="offset">the Y Offset for the option in the menu.</param>
|
||||
/// <param name="order">The order of the option.</param>
|
||||
/// <param name="last">Whether the option is the last in a row.</param>
|
||||
/// <returns>The created setting.</returns>
|
||||
public abstract GameObject CreateOption(ToggleButtonBehaviour toggle, SlideBar slider, Transform parent, ref float offset, ref int order, bool last);
|
||||
|
||||
|
||||
@@ -72,13 +72,13 @@ public static class TaskAdderPatches
|
||||
__instance.TaskParent = inner.transform;
|
||||
var crewmateFolder = __instance.Root.SubFolders.ToArray().FirstOrDefault(x => x.FolderName == CrewmateName)!;
|
||||
var impostorFolder = __instance.Root.SubFolders.ToArray().FirstOrDefault(x => x.FolderName == ImpostorName)!;
|
||||
//var neutralFolder = __instance.CreateFolder("Neutral", __instance.Root, 2, Color.gray);
|
||||
// var neutralFolder = __instance.CreateFolder("Neutral", __instance.Root, 2, Color.gray);
|
||||
var modifiersFolder = __instance.CreateFolder(ModifiersName, __instance.Root, 0, Color.blue);
|
||||
|
||||
folders.Clear();
|
||||
folders.Add(crewmateFolder.FolderName, crewmateFolder);
|
||||
folders.Add(impostorFolder.FolderName, impostorFolder);
|
||||
//folders.Add("Neutrals", neutralFolder);
|
||||
// folders.Add("Neutrals", neutralFolder);
|
||||
folders.Add(ModifiersName, modifiersFolder);
|
||||
|
||||
int folderIdx = 2;
|
||||
|
||||
@@ -123,7 +123,6 @@ public static class IntroCutscenePatches
|
||||
introCutscene = __instance.Cast<IntroCutscene>();
|
||||
}
|
||||
|
||||
|
||||
Info("IntroCutscene ended");
|
||||
|
||||
MiraEventManager.InvokeEvent(new IntroEndEvent(introCutscene));
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -40,7 +40,6 @@ public static class VisorsTabPatches
|
||||
GenerateHats(tab, currentPage);
|
||||
}
|
||||
|
||||
|
||||
[HarmonyPatch(nameof(VisorsTab.OnEnable))]
|
||||
[HarmonyPrefix]
|
||||
public static bool OnEnablePrefix(VisorsTab __instance)
|
||||
|
||||
@@ -63,7 +63,7 @@ internal static class GameOptionsMenuPatch
|
||||
var filteredGroups =
|
||||
GameSettingMenuPatches.SelectedMod?.InternalOptionGroups
|
||||
.Where(x => x.OptionableType == null &&
|
||||
!x.ShowInModifiersMenu && x.ParentMenu == MenuCategory.Roles) ?? [];
|
||||
x.ParentMenu == MenuCategory.Roles) ?? [];
|
||||
|
||||
foreach (var group in filteredGroups)
|
||||
{
|
||||
@@ -171,7 +171,7 @@ internal static class GameOptionsMenuPatch
|
||||
private static void ModifiersUpdate(ref float num)
|
||||
{
|
||||
var groups = GameSettingMenuPatches.SelectedMod?.InternalOptionGroups
|
||||
.Where(x => x.ShowInModifiersMenu || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true) ?? [];
|
||||
.Where(x => x.ParentMenu is MenuCategory.Modifiers || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true) ?? [];
|
||||
|
||||
foreach (var modGroup in groups)
|
||||
{
|
||||
@@ -182,7 +182,7 @@ internal static class GameOptionsMenuPatch
|
||||
private static void ModifiersCreate(GameOptionsMenu menu)
|
||||
{
|
||||
var groups = GameSettingMenuPatches.SelectedMod?.InternalOptionGroups
|
||||
.Where(x => x.ShowInModifiersMenu || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true) ?? [];
|
||||
.Where(x => x.ParentMenu is MenuCategory.Modifiers || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true) ?? [];
|
||||
foreach (var group in groups)
|
||||
{
|
||||
CreateGroup(menu, group);
|
||||
@@ -218,7 +218,7 @@ internal static class GameOptionsMenuPatch
|
||||
}
|
||||
|
||||
var filteredGroups = GameSettingMenuPatches.SelectedMod?.InternalOptionGroups
|
||||
.Where(x => x.OptionableType == null && !x.ShowInModifiersMenu && x.ParentMenu == MenuCategory.Roles) ?? [];
|
||||
.Where(x => x.OptionableType == null && x.ParentMenu == MenuCategory.Roles) ?? [];
|
||||
|
||||
foreach (var group in filteredGroups)
|
||||
{
|
||||
|
||||
@@ -429,10 +429,10 @@ internal static class GameSettingMenuPatches
|
||||
var modHasCustomTwo = SelectedMod.InternalOptionGroups.Exists(
|
||||
x => x.ParentMenu == MenuCategory.CustomTwo);
|
||||
var modHasModifiers = SelectedMod.InternalOptionGroups.Exists(
|
||||
x => x.ShowInModifiersMenu || x.ParentMenu == MenuCategory.Modifiers || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true);
|
||||
x => x.ParentMenu == MenuCategory.Modifiers || x.OptionableType?.IsAssignableTo(typeof(BaseModifier)) == true);
|
||||
var modHasOptions =
|
||||
SelectedMod.InternalOptionGroups.Exists(x => x.OptionableType == null && (!x.ShowInModifiersMenu ||
|
||||
(x.ParentMenu != MenuCategory.Modifiers && x.ParentMenu != MenuCategory.Roles)));
|
||||
SelectedMod.InternalOptionGroups.Exists(x => x.OptionableType == null &&
|
||||
x.ParentMenu != MenuCategory.Modifiers && x.ParentMenu != MenuCategory.Roles);
|
||||
|
||||
_modifiersButton.gameObject.SetActive(true);
|
||||
_smallRolesButton.gameObject.SetActive(true);
|
||||
|
||||
@@ -132,7 +132,7 @@ public static class LobbyViewPanePatches
|
||||
ModifiersTabButton?.SelectButton(true);
|
||||
|
||||
var filteredGroups = SelectedMod.InternalOptionGroups
|
||||
.Where(x => x.GroupVisible() && (x.ShowInModifiersMenu || (x.OptionableType != null && x.OptionableType.IsAssignableTo(typeof(BaseModifier)))));
|
||||
.Where(x => x.GroupVisible() && (x.ParentMenu is MenuCategory.Modifiers || (x.OptionableType != null && x.OptionableType.IsAssignableTo(typeof(BaseModifier)))));
|
||||
|
||||
DrawOptions(__instance, filteredGroups);
|
||||
}
|
||||
@@ -152,7 +152,7 @@ public static class LobbyViewPanePatches
|
||||
}
|
||||
|
||||
var filteredGroups = SelectedMod.InternalOptionGroups
|
||||
.Where(x => x is { ShowInModifiersMenu: false, OptionableType: null } && x.GroupVisible());
|
||||
.Where(x => x is { ParentMenu: not MenuCategory.Modifiers, OptionableType: null } && x.GroupVisible());
|
||||
|
||||
DrawOptions(__instance, filteredGroups);
|
||||
return false;
|
||||
|
||||
@@ -36,7 +36,7 @@ public static class HudManagerPatches
|
||||
if (role is ICustomRole customRole)
|
||||
{
|
||||
__instance.KillButton.ToggleVisible(isActive && customRole.Configuration.UseVanillaKillButton && !flag);
|
||||
__instance.ImpostorVentButton.ToggleVisible(isActive && (customRole.Configuration.CanUseVent) && !flag);
|
||||
__instance.ImpostorVentButton.ToggleVisible(isActive && customRole.Configuration.CanUseVent && !flag);
|
||||
__instance.SabotageButton.gameObject.SetActive(isActive && customRole.Configuration.CanUseSabotage);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,6 +75,7 @@ public class OptionPreset
|
||||
/// <summary>
|
||||
/// Resets the specified option with the preset provided.
|
||||
/// </summary>
|
||||
/// <param name="baseOption">The option to reset.</param>
|
||||
public void ResetOption(OptionBehaviour baseOption)
|
||||
{
|
||||
var selectedOpt = Plugin.InternalOptions.First(x => x.OptionBehaviour == baseOption);
|
||||
@@ -87,6 +88,7 @@ public class OptionPreset
|
||||
/// <summary>
|
||||
/// Gets whether the specified option is included in the preset.
|
||||
/// </summary>
|
||||
/// <param name="baseOption">The option to check.</param>
|
||||
/// <returns>The value of whether the option is in the preset.</returns>
|
||||
public bool IsOptionInPreset(OptionBehaviour baseOption)
|
||||
{
|
||||
|
||||
@@ -134,7 +134,7 @@ public static class PresetManager
|
||||
{
|
||||
var fileName = Path.GetFileName(file);
|
||||
Info($"Loading preset file {fileName}");
|
||||
var presetName = Path.GetFileNameWithoutExtension(file);
|
||||
// var presetName = Path.GetFileNameWithoutExtension(file);
|
||||
var presetConfig = new ConfigFile(file, false)
|
||||
{
|
||||
SaveOnConfigSet = false,
|
||||
|
||||
@@ -56,7 +56,9 @@ public static class CustomRoleUtils
|
||||
var roleOptions = currentGameOptions.RoleOptions;
|
||||
|
||||
var role = GetRegisteredRole(roleType);
|
||||
var assignmentData = new RoleManager.RoleAssignmentData(role, roleOptions.GetNumPerGame(role!.Role),
|
||||
var assignmentData = new RoleManager.RoleAssignmentData(
|
||||
role,
|
||||
roleOptions.GetNumPerGame(role!.Role),
|
||||
roleOptions.GetChancePerGame(role.Role));
|
||||
|
||||
return assignmentData;
|
||||
|
||||
@@ -100,7 +100,7 @@ public static class Extensions
|
||||
public static void SetCooldownFormat(this ActionButton? button, float timer, float maxTimer, string format = "0")
|
||||
{
|
||||
var num = Mathf.Clamp(timer / maxTimer, 0f, 1f);
|
||||
button.isCoolingDown = num > 0f;
|
||||
button!.isCoolingDown = num > 0f;
|
||||
button.SetCooldownFill(num);
|
||||
if (button.isCoolingDown)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user