mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-11-19 13:17:10 +00:00
Merge branch 'dev' into mira-events-dev
This commit is contained in:
37 files changed
+157
-194
No files matched your search
@@ -15,6 +15,7 @@ namespace MiraAPI.Colors.ColorSpaces;
|
||||
/// <param name="a">The alpha component.</param>
|
||||
[Serializable]
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "Unity parity.")]
|
||||
// ReSharper disable InconsistentNaming (Justification: Read above.)
|
||||
public record struct CmykColor(float c, float m, float y, float k, float a = 1f)
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace MiraAPI.Colors.ColorSpaces;
|
||||
/// <param name="a">The alpha component.</param>
|
||||
[Serializable]
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "Unity parity.")]
|
||||
// ReSharper disable InconsistentNaming (Justification: Read above.)
|
||||
public record struct HsbColor(float h, float s, float b, float a = 1f)
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace MiraAPI.Colors.ColorSpaces;
|
||||
/// <param name="a">The alpha component.</param>
|
||||
[Serializable]
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "Unity parity.")]
|
||||
// ReSharper disable InconsistentNaming (Justification: Read above.)
|
||||
public record struct HslColor(float h, float s, float l, float a = 1f)
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace MiraAPI.Colors;
|
||||
public class RegisterCustomColorsAttribute(string idPrefix) : Attribute
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the translation ID prefix for all of the colors within the container type.
|
||||
/// Gets the translation ID prefix for all colors within the container type.
|
||||
/// </summary>
|
||||
public string IdPrefix => idPrefix;
|
||||
|
||||
|
||||
@@ -273,7 +273,7 @@ public abstract class ModdedOptionMemberAttribute(string? memberName, Type? hold
|
||||
/// The static getter <see cref="MethodInfo"/> used to push the target instance onto the evaluation stack for instance methods,
|
||||
/// or <see langword="null"/> if <paramref name="method"/> is static.
|
||||
/// </param>
|
||||
/// <param name="returnType">The return <see cref="Type"/> of the generated delegate (or <see cref="void"/> for actions).</param>
|
||||
/// <param name="returnType">The return <see cref="Type"/> of the generated delegate (or <see cref="Void"/> for actions).</param>
|
||||
/// <param name="paramTypes">The parameter types accepted by the generated delegate.</param>
|
||||
/// <param name="delegateType">The concrete delegate <see cref="Type"/> to create (e.g., <see cref="Func{T, TResult}"/> or <see cref="Action{T}"/>).</param>
|
||||
/// <param name="suffix">A descriptive suffix appended to the generated <see cref="DynamicMethod"/> name for debugging and stack traces.</param>
|
||||
@@ -346,7 +346,7 @@ public abstract class ModdedOptionMemberAttribute(string? memberName, Type? hold
|
||||
/// The static getter <see cref="MethodInfo"/> used to push the target instance onto the evaluation stack for instance methods,
|
||||
/// or <see langword="null"/> if <paramref name="method"/> is static.
|
||||
/// </param>
|
||||
/// <param name="returnType">The return <see cref="Type"/> of the generated delegate (or <see cref="void"/> for actions).</param>
|
||||
/// <param name="returnType">The return <see cref="Type"/> of the generated delegate (or <see cref="Void"/> for actions).</param>
|
||||
/// <param name="baseParamTypes">The parameter types accepted by the generated delegate.</param>
|
||||
/// <param name="delegateType">The concrete delegate <see cref="Type"/> to create.</param>
|
||||
/// <param name="suffix">A descriptive suffix appended to the generated <see cref="DynamicMethod"/> name for debugging and stack traces.</param>
|
||||
|
||||
@@ -20,7 +20,7 @@ public sealed class ModdedOptionVisibilityAttribute(string? memberName = null, T
|
||||
|
||||
internal Func<bool>? GetVisibility(AbstractOptionGroup group, PropertyInfo property)
|
||||
{
|
||||
if (ResolveMember(group, property, out Type type, out var instanceGetter, out var notFound) is not { } member)
|
||||
if (ResolveMember(group, property, out var type, out var instanceGetter, out var notFound) is not { } member)
|
||||
{
|
||||
if (notFound)
|
||||
Error($"Member {MemberName} does not exist in {type.FullName}");
|
||||
|
||||
@@ -6,10 +6,12 @@ namespace MiraAPI.GameOptions.Attributes;
|
||||
/// An attribute used to mark a method or property as one that returns an instance of the class it's declared in.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Property)]
|
||||
// ReSharper disable once ClassNeverInstantiated.Global (Justification: Used by dependant code.)
|
||||
public sealed class InstanceGetterAttribute : Attribute;
|
||||
|
||||
/// <summary>
|
||||
/// An attribute used to mark a class as one whose reflection search should include private members.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
// ReSharper disable once ClassNeverInstantiated.Global (Justification: Used by dependant code.)
|
||||
public sealed class SearchPrivateAttribute : Attribute;
|
||||
@@ -15,7 +15,7 @@ public class ModdedPlayerOptionAttribute(
|
||||
bool allowNone = true)
|
||||
: ModdedOptionAttribute(title)
|
||||
{
|
||||
internal override IModdedOption? CreateOption(object? value, PropertyInfo property)
|
||||
internal override IModdedOption CreateOption(object? value, PropertyInfo property)
|
||||
{
|
||||
var option = new ModdedPlayerOption(Title, allowNone);
|
||||
return option;
|
||||
|
||||
@@ -15,7 +15,7 @@ public class ModdedStringOptionAttribute(
|
||||
string[] values)
|
||||
: ModdedOptionAttribute(title)
|
||||
{
|
||||
internal override IModdedOption? CreateOption(object? value, PropertyInfo property)
|
||||
internal override IModdedOption CreateOption(object? value, PropertyInfo property)
|
||||
{
|
||||
var option = new ModdedStringOption(Title, (string)(value ?? string.Empty), values);
|
||||
return option;
|
||||
|
||||
@@ -22,6 +22,7 @@ public class ModdedToggleOptionAttribute(
|
||||
/// </summary>
|
||||
/// <param name="title">The option title.</param>
|
||||
public ModdedToggleOptionAttribute(string title)
|
||||
// ReSharper disable once IntroduceOptionalParameters.Global (Justification: Kept for backwards compatibility.)
|
||||
: this(title, "On", "Off")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -18,10 +18,7 @@ public class ModdedPlayerOptionListAttribute(
|
||||
{
|
||||
internal override IModdedOptionList CreateOptionList(IList value, PropertyInfo property)
|
||||
{
|
||||
return new ModdedOptionList<ModdedPlayerOption>(value.Count, idx =>
|
||||
{
|
||||
return new(GetFormattedTitle(idx), allowNone);
|
||||
});
|
||||
return new ModdedOptionList<ModdedPlayerOption>(value.Count, idx => new(GetFormattedTitle(idx), allowNone));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -35,7 +32,7 @@ public class ModdedPlayerOptionListAttribute(
|
||||
NetworkedPlayerInfo info => info ? opt.Values.IndexOf(info) : (allowNone ? -1 : 0),
|
||||
_ => (int)value,
|
||||
};
|
||||
opt?.SetValue(final);
|
||||
opt.SetValue(final);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -20,9 +20,7 @@ public class ModdedStringOptionListAttribute(
|
||||
internal override IModdedOptionList CreateOptionList(IList value, PropertyInfo property)
|
||||
{
|
||||
return new ModdedOptionList<ModdedStringOption>(value.Count, idx =>
|
||||
{
|
||||
return new ModdedStringOption(Title.Translate(), (string)(value[idx] ?? string.Empty), values);
|
||||
});
|
||||
new ModdedStringOption(Title.Translate(), (string)(value[idx] ?? string.Empty), values));
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -23,6 +23,7 @@ public class ModdedToggleOptionListAttribute(
|
||||
/// </summary>
|
||||
/// <param name="title">The option's title.</param>
|
||||
public ModdedToggleOptionListAttribute(string title)
|
||||
// ReSharper disable once IntroduceOptionalParameters.Global (Justification: Kept for backwards compatibility.)
|
||||
: this(title, "On", "Off")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -284,7 +284,7 @@ public static class ModdedArrayBuilder
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="ModdedArray{T}"/> from a span of values.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The the type of the values.</typeparam>
|
||||
/// <typeparam name="T">The type of the values.</typeparam>
|
||||
/// <param name="values">The values to initialise with.</param>
|
||||
/// <returns>The <see cref="ModdedArray{T}"/> instance initialised with the provided values.</returns>
|
||||
public static ModdedArray<T> Create<T>(ReadOnlySpan<T> values)
|
||||
|
||||
@@ -435,7 +435,7 @@ public static class ModdedOptionsManager
|
||||
|
||||
attribute.SetValue(value);
|
||||
|
||||
if (attribute is ModdedOptionListAttribute listAttribute && value != null)
|
||||
if (attribute is ModdedOptionListAttribute listAttribute && value != null!)
|
||||
ListInstanceCache.AddOrUpdate(value, listAttribute);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
using System.Linq;
|
||||
using MiraAPI.PluginLoading;
|
||||
|
||||
namespace MiraAPI.GameOptions;
|
||||
|
||||
[MiraIgnore]
|
||||
internal sealed class ModifierOptionGroup : AbstractOptionGroup
|
||||
{
|
||||
public override string GroupName { get; }
|
||||
|
||||
public ModifierOptionGroup(string name, IModdedOption[] options, params AbstractOptionGroup[] groups)
|
||||
{
|
||||
GroupName = name;
|
||||
Options.AddRange(options);
|
||||
Options.AddRange(groups.SelectMany(x => x.Options));
|
||||
}
|
||||
}
|
||||
@@ -47,10 +47,7 @@ public abstract class ModdedOption<T> : IModdedOption
|
||||
/// </summary>
|
||||
public T Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return Getter != null ? Getter(_value) : _value;
|
||||
}
|
||||
get => Getter != null ? Getter(_value) : _value;
|
||||
protected set
|
||||
{
|
||||
if (Setter != null)
|
||||
|
||||
@@ -40,8 +40,8 @@ public class ModdedOptionList<T> : IModdedOptionList<T>
|
||||
/// <param name="options">The options list.</param>
|
||||
public ModdedOptionList(IEnumerable<T> options)
|
||||
{
|
||||
Count = options.Count();
|
||||
Options = [.. options];
|
||||
Count = Options.Count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -103,14 +103,14 @@ public sealed class HnsDangerMeter(nint cppPtr) : MonoBehaviour(cppPtr)
|
||||
private void UpdateDangerMusic()
|
||||
{
|
||||
var localPlayer = PlayerControl.LocalPlayer;
|
||||
if (localPlayer != null && localPlayer.Data != null && localPlayer.Data.IsDead)
|
||||
if (localPlayer == null || localPlayer.Data == null || !localPlayer.Data.IsDead)
|
||||
{
|
||||
HnsMusicHandler.Instance.SetTaskState(false);
|
||||
HnsMusicHandler.Instance.ResetMusic();
|
||||
HnsMusicHandler.Instance.SetMusicValues(dangerLevel1, dangerLevel2);
|
||||
return;
|
||||
}
|
||||
|
||||
HnsMusicHandler.Instance.SetMusicValues(dangerLevel1, dangerLevel2);
|
||||
HnsMusicHandler.Instance.SetTaskState(false);
|
||||
HnsMusicHandler.Instance.ResetMusic();
|
||||
}
|
||||
|
||||
private void UpdateDangerMeter()
|
||||
|
||||
@@ -83,7 +83,7 @@ public abstract class CustomMultiSelectMenu<TEntry> : CustomPhoneMenu<CustomMult
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Setup the given <paramref name="panel"/> once created, given its index, entry, and onClick action.
|
||||
/// Set up the given <paramref name="panel"/> once created, given its index, entry, and onClick action.
|
||||
/// </summary>
|
||||
/// <param name="panel">The panel to configure.</param>
|
||||
/// <param name="i">The <paramref name="panel"/>'s index.</param>
|
||||
@@ -96,18 +96,18 @@ public abstract class CustomMultiSelectMenu<TEntry> : CustomPhoneMenu<CustomMult
|
||||
/// </summary>
|
||||
/// <param name="entries">All entries to give the custom menu.</param>
|
||||
/// <param name="onClick">Function called when all selections are made/confirmed.</param>
|
||||
/// <param name="totalSelections">The number of selections required.</param>
|
||||
/// <param name="shouldConfirm">Whether the entire selection should be confirmed manually.</param>
|
||||
/// <param name="canRepeat">If the same entry can be selected multiple times, else unselect entry on click.</param>
|
||||
protected void Begin(IEnumerable<TEntry> entries, Action<List<TEntry>?> onClick, int totalSelections, bool shouldConfirm, bool canRepeat = false)
|
||||
/// <param name="totSelections">The number of selections required.</param>
|
||||
/// <param name="confirm">Whether the entire selection should be confirmed manually.</param>
|
||||
/// <param name="repeat">If the same entry can be selected multiple times, else unselect entry on click.</param>
|
||||
protected void Begin(IEnumerable<TEntry> entries, Action<List<TEntry>?> onClick, int totSelections, bool confirm, bool repeat = false)
|
||||
{
|
||||
MinigameStubs.Begin(Component, null);
|
||||
MeetingVoteAreaVisibility.HideNameplates(Component);
|
||||
|
||||
this.totalSelections = totalSelections;
|
||||
this.shouldConfirm = shouldConfirm;
|
||||
this.canRepeat = canRepeat;
|
||||
this.onSelection = onClick;
|
||||
totalSelections = totSelections;
|
||||
shouldConfirm = confirm;
|
||||
canRepeat = repeat;
|
||||
onSelection = onClick;
|
||||
|
||||
var back = backButton.GetComponent<PassiveButton>();
|
||||
back.OnClick.AddListener((UnityAction)(() =>
|
||||
@@ -138,10 +138,10 @@ public abstract class CustomMultiSelectMenu<TEntry> : CustomPhoneMenu<CustomMult
|
||||
/// </summary>
|
||||
/// <param name="entries">All entries to give the custom menu.</param>
|
||||
/// <param name="onClick">Function called when the selection is made.</param>
|
||||
/// <param name="shouldConfirm">Whether the set of both selections should be confirmed manually.</param>
|
||||
protected void Begin(IEnumerable<TEntry> entries, Action<TEntry?> onClick, bool shouldConfirm)
|
||||
/// <param name="confirm">Whether the set of both selections should be confirmed manually.</param>
|
||||
protected void Begin(IEnumerable<TEntry> entries, Action<TEntry?> onClick, bool confirm)
|
||||
{
|
||||
Begin(entries, list => onClick(list?[0]), 1, shouldConfirm);
|
||||
Begin(entries, list => onClick(list?[0]), 1, confirm);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -149,11 +149,11 @@ public abstract class CustomMultiSelectMenu<TEntry> : CustomPhoneMenu<CustomMult
|
||||
/// </summary>
|
||||
/// <param name="entries">All entries to give the custom menu.</param>
|
||||
/// <param name="onClick">Function called when both selections are made.</param>
|
||||
/// <param name="shouldConfirm">Whether the set of both selections should be confirmed manually.</param>
|
||||
/// <param name="canRepeat">If the same entry can be selected both times, else unselect entry on click.</param>
|
||||
protected void Begin(IEnumerable<TEntry> entries, Action<TEntry?, TEntry?> onClick, bool shouldConfirm, bool canRepeat = false)
|
||||
/// <param name="confirm">Whether the set of both selections should be confirmed manually.</param>
|
||||
/// <param name="repeat">If the same entry can be selected both times, else unselect entry on click.</param>
|
||||
protected void Begin(IEnumerable<TEntry> entries, Action<TEntry?, TEntry?> onClick, bool confirm, bool repeat = false)
|
||||
{
|
||||
Begin(entries, list => onClick(list?[0], list?[1]), 2, shouldConfirm, canRepeat);
|
||||
Begin(entries, list => onClick(list?[0], list?[1]), 2, confirm, repeat);
|
||||
}
|
||||
|
||||
private void OnEntryClick(TEntry entry)
|
||||
|
||||
@@ -65,7 +65,7 @@ public abstract class CustomPaginableMenu : CustomPhoneMenu<CustomPaginableMenu.
|
||||
protected static new TMenu Create<TMenu>(PanelButtonOnMouse? onMouseOut = null, PanelButtonOnMouse? onMouseOver = null)
|
||||
where TMenu : CustomPaginableMenu, new()
|
||||
{
|
||||
TMenu customMenu = CustomPhoneMenu.Create<TMenu>(onMouseOut, onMouseOver);
|
||||
var customMenu = CustomPhoneMenu.Create<TMenu>(onMouseOut, onMouseOver);
|
||||
|
||||
var nextButton = Object.Instantiate(customMenu.backButton, customMenu.transform).gameObject;
|
||||
nextButton.transform.localPosition = new Vector3(1.85f, -2.185f, customMenu.MenuDepth);
|
||||
|
||||
@@ -135,7 +135,7 @@ public abstract class CustomPhoneMenu : ICustomMenu
|
||||
/// </summary>
|
||||
public List<ShapeshifterPanel> EntryPanels => [.. MenuEntries.Select(e => e.Panel)];
|
||||
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member (Justification: Unity convention.)
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member (Justification: Unity fields.)
|
||||
#pragma warning disable S1104 // Fields should not have public accessibility (Justification: Read above.)
|
||||
#pragma warning disable SA1300 // Element should begin with upper-case letter (Justification: Read above.)
|
||||
public Transform transform => Component.transform;
|
||||
|
||||
@@ -152,7 +152,7 @@ public static class KeybindManager
|
||||
public static List<ActionElementMap> GetControllerConflicts(bool enabledOnly = false)
|
||||
{
|
||||
var conflicts = new List<ActionElementMap>();
|
||||
var actions = Keybinds.Where(x => x.Exclusive && x.RewiredInputAction != null && (!enabledOnly || KeybindUtils.IsControllerActionActive(x.RewiredInputAction.id))).Select(x => x.RewiredInputAction!.id).ToHashSet();
|
||||
var actions = Keybinds.Where(x => x is { Exclusive: true, RewiredInputAction: not null } && (!enabledOnly || KeybindUtils.IsControllerActionActive(x.RewiredInputAction.id))).Select(x => x.RewiredInputAction!.id).ToHashSet();
|
||||
var player = ReInput.players.GetPlayer(0);
|
||||
for (var i = 0; i < player.controllers.joystickCount; i++)
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ public class LocalEnumSettingAttribute(
|
||||
private readonly string? _description = description;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override LocalEnumSetting CreateSetting(Type tab, ConfigEntryBase configEntryBase)
|
||||
public override ILocalSetting CreateSetting(Type tab, ConfigEntryBase configEntryBase)
|
||||
{
|
||||
return new LocalEnumSetting(tab, configEntryBase, configEntryBase.SettingType, _name, _description, names);
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ public class LocalNumberSettingAttribute(
|
||||
private readonly string? _description = description;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override LocalNumberSetting CreateSetting(Type tab, ConfigEntryBase configEntryBase)
|
||||
public override ILocalSetting CreateSetting(Type tab, ConfigEntryBase configEntryBase)
|
||||
{
|
||||
return new LocalNumberSetting(tab, configEntryBase, _name, _description, new FloatRange(min, max), increment, suffixType, formatString);
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public class LocalSliderSettingAttribute(
|
||||
private readonly string? _description = description;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override LocalSliderSetting CreateSetting(Type tab, ConfigEntryBase configEntryBase)
|
||||
public override ILocalSetting CreateSetting(Type tab, ConfigEntryBase configEntryBase)
|
||||
{
|
||||
return new LocalSliderSetting(tab, configEntryBase, _name, _description, new FloatRange(min, max), displayValue, suffixType, formatString, roundValue);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class LocalToggleSettingAttribute(
|
||||
private readonly string? _description = description;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override LocalToggleSetting CreateSetting(Type tab, ConfigEntryBase configEntryBase)
|
||||
public override ILocalSetting CreateSetting(Type tab, ConfigEntryBase configEntryBase)
|
||||
{
|
||||
return new LocalToggleSetting(tab, configEntryBase, _name, _description);
|
||||
}
|
||||
|
||||
@@ -108,14 +108,12 @@ public class LocalSliderSetting(
|
||||
/// <inheritdoc/>
|
||||
protected override string GetValueText()
|
||||
{
|
||||
if (DisplayValue)
|
||||
{
|
||||
var value = GetValue();
|
||||
var formatted = Helpers.FormatValue(value, SuffixType, FormatString);
|
||||
var maxFormatted = Helpers.FormatValue(SliderRange.max, SuffixType, FormatString);
|
||||
return $"<font=\"LiberationSans SDF\" material=\"LiberationSans SDF - Chat Message Masked\">{Name.Translate()}: <b>{formatted} / {maxFormatted}</font></b>";
|
||||
}
|
||||
if (!DisplayValue)
|
||||
return $"<font=\"LiberationSans SDF\" material=\"LiberationSans SDF - Chat Message Masked\">{Name.Translate()}</font></b>";
|
||||
|
||||
return $"<font=\"LiberationSans SDF\" material=\"LiberationSans SDF - Chat Message Masked\">{Name.Translate()}</font></b>";
|
||||
var value = GetValue();
|
||||
var formatted = Helpers.FormatValue(value, SuffixType, FormatString);
|
||||
var maxFormatted = Helpers.FormatValue(SliderRange.max, SuffixType, FormatString);
|
||||
return $"<font=\"LiberationSans SDF\" material=\"LiberationSans SDF - Chat Message Masked\">{Name.Translate()}: <b>{formatted} / {maxFormatted}</font></b>";
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public abstract class MultiTargetMeetingButton : TargetedMeetingButton
|
||||
}
|
||||
|
||||
Timer = Cooldown;
|
||||
UsesLeft -= 1;
|
||||
UsesLeft--;
|
||||
OnFinish();
|
||||
Targets = [];
|
||||
}
|
||||
|
||||
+11
-11
@@ -195,68 +195,68 @@ public class MiraApiSettings(ConfigFile config) : LocalSettingsTab(config)
|
||||
/// Gets the scale of the ability buttons.
|
||||
/// </summary>
|
||||
[LocalSliderSetting(min: 0.5f, max: 1.5f, suffixType: MiraNumberSuffixes.Multiplier, formatString: "0.00", displayValue: true)]
|
||||
public ConfigEntry<float> ButtonUIFactorSlider { get; private set; } = config.Bind("MiraApi.VisualsUi", "MiraApi.ButtonScaleFactor", 0.75f);
|
||||
public ConfigEntry<float> ButtonUIFactorSlider { get; } = config.Bind("MiraApi.VisualsUi", "MiraApi.ButtonScaleFactor", 0.75f);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the scale of the UI buttons.
|
||||
/// </summary>
|
||||
[LocalSliderSetting(min: 0.3f, max: 2f, suffixType: MiraNumberSuffixes.Multiplier, formatString: "0.00", displayValue: true)]
|
||||
public ConfigEntry<float> TopRightButtonsFactorSlider { get; private set; } = config.Bind("MiraApi.VisualsUi", "MiraApi.TopRightButtonScaleFactor", 1f);
|
||||
public ConfigEntry<float> TopRightButtonsFactorSlider { get; } = config.Bind("MiraApi.VisualsUi", "MiraApi.TopRightButtonScaleFactor", 1f);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the fps specified by the player.
|
||||
/// </summary>
|
||||
[LocalSliderSetting(min: 60f, max: 240f, suffixType: MiraNumberSuffixes.None, formatString: "0", displayValue: true, roundValue: true)]
|
||||
public ConfigEntry<float> SetFpsSlider { get; private set; } = config.Bind("MiraApi.VisualsUi", "Max FPS", 120f);
|
||||
public ConfigEntry<float> SetFpsSlider { get; } = config.Bind("MiraApi.VisualsUi", "Max FPS", 120f);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the modifiers hud should be on the left side of the screen (under roles/task tab). Recommended for streamers.
|
||||
/// </summary>
|
||||
[LocalToggleSetting]
|
||||
public ConfigEntry<bool> ModifiersHudLeftSide { get; private set; } = config.Bind("MiraApi.VisualsUi", "MiraApi.ShowModifiersHudOnLeftSide", false);
|
||||
public ConfigEntry<bool> ModifiersHudLeftSide { get; } = config.Bind("MiraApi.VisualsUi", "MiraApi.ShowModifiersHudOnLeftSide", false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to show keybinds on buttons.
|
||||
/// </summary>
|
||||
[LocalToggleSetting]
|
||||
public ConfigEntry<bool> ShowKeybinds { get; private set; } = config.Bind("MiraApi.VisualsUi", "MiraApi.ShowKeybindsOnButtons", true);
|
||||
public ConfigEntry<bool> ShowKeybinds { get; } = config.Bind("MiraApi.VisualsUi", "MiraApi.ShowKeybindsOnButtons", true);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the scale of the match info guide.
|
||||
/// </summary>
|
||||
[LocalSliderSetting(min: 0.5f, max: 1f, suffixType: MiraNumberSuffixes.Multiplier, formatString: "0.00", displayValue: true)]
|
||||
public ConfigEntry<float> MatchInfoGuideScaleFactor { get; private set; } = config.Bind("MiraApi.MatchInfoGuide", "MiraApi.MatchInfoGuideScaleFactor", 1f);
|
||||
public ConfigEntry<float> MatchInfoGuideScaleFactor { get; } = config.Bind("MiraApi.MatchInfoGuide", "MiraApi.MatchInfoGuideScaleFactor", 1f);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the flag indicating whether the wiki is on the bottom row.
|
||||
/// </summary>
|
||||
[LocalToggleSetting]
|
||||
public ConfigEntry<bool> WikiOnBottomRow { get; private set; } = config.Bind("MiraApi.MatchInfoGuide", "MiraApi.WikiOnBottomRow", true);
|
||||
public ConfigEntry<bool> WikiOnBottomRow { get; } = config.Bind("MiraApi.MatchInfoGuide", "MiraApi.WikiOnBottomRow", true);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the flag indicating the position for the wiki's tabs.
|
||||
/// </summary>
|
||||
[LocalEnumSetting(names: ["MiraApi.WikiTabPosition.LeftSide", "MiraApi.WikiTabPosition.RightSide", "MiraApi.WikiTabPosition.Below"])]
|
||||
public ConfigEntry<MatchInfoTabPos> WikiTabPosition { get; private set; } =
|
||||
public ConfigEntry<MatchInfoTabPos> WikiTabPosition { get; } =
|
||||
config.Bind("MiraApi.MatchInfoGuide", "MiraApi.WikiTabPosition", MiraApiPlugin.IsMobile ? MatchInfoTabPos.RightSide : MatchInfoTabPos.LeftSide);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to show the red flash from sabotages.
|
||||
/// </summary>
|
||||
[LocalToggleSetting]
|
||||
public ConfigEntry<bool> EnableSabotageFlashes { get; private set; } = config.Bind("MiraApi.Accessibility", "MiraApi.EnableSabotageFlashes", true);
|
||||
public ConfigEntry<bool> EnableSabotageFlashes { get; } = config.Bind("MiraApi.Accessibility", "MiraApi.EnableSabotageFlashes", true);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to enable the sabotage sound effects or not.
|
||||
/// </summary>
|
||||
[LocalToggleSetting]
|
||||
public ConfigEntry<bool> EnableSabotageBlares { get; private set; } = config.Bind("MiraApi.Accessibility", "MiraApi.EnableSabotageBlare", true);
|
||||
public ConfigEntry<bool> EnableSabotageBlares { get; } = config.Bind("MiraApi.Accessibility", "MiraApi.EnableSabotageBlare", true);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether variable colors will remain static or not.
|
||||
/// </summary>
|
||||
[LocalToggleSetting]
|
||||
public ConfigEntry<bool> EnableVariableColors { get; private set; } = config.Bind("MiraApi.Accessibility", "MiraApi.EnableVariableColors", true);
|
||||
public ConfigEntry<bool> EnableVariableColors { get; } = config.Bind("MiraApi.Accessibility", "MiraApi.EnableVariableColors", true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1224,25 +1224,25 @@ public static class RoleGuidePatches
|
||||
|
||||
public static IEnumerable<RoleBehaviour> GetActiveRoles()
|
||||
{
|
||||
IEnumerable<RoleBehaviour> comparisons = [];
|
||||
var player = PlayerControl.LocalPlayer;
|
||||
var data = player != null ? player.Data : null;
|
||||
|
||||
var curRole = PlayerControl.LocalPlayer.Data.Role;
|
||||
if (player == null || data == null)
|
||||
yield break;
|
||||
|
||||
comparisons = comparisons.AddItem(curRole);
|
||||
var curRole = data.Role;
|
||||
yield return curRole;
|
||||
|
||||
if (PlayerControl.LocalPlayer && PlayerControl.LocalPlayer.Data && PlayerControl.LocalPlayer.Data.IsDead &&
|
||||
!comparisons.Any(x => x.Role == PlayerControl.LocalPlayer.Data.RoleWhenAlive.Value))
|
||||
if (data.IsDead && curRole.Role != data.RoleWhenAlive.Value)
|
||||
{
|
||||
comparisons = comparisons.AddItem(RoleManager.Instance.GetRole(PlayerControl.LocalPlayer.Data.RoleWhenAlive.Value));
|
||||
yield return RoleManager.Instance.GetRole(data.RoleWhenAlive.Value);
|
||||
}
|
||||
|
||||
return comparisons;
|
||||
}
|
||||
|
||||
public static List<uint> GetActiveIds()
|
||||
{
|
||||
var activeModifiers = GetActiveModifiers();
|
||||
List<uint> comparisons = activeModifiers.Select(x => x.TypeId).ToList();
|
||||
var comparisons = activeModifiers.Select(x => x.TypeId).ToList();
|
||||
comparisons.AddRange(GetActiveRoles().Select(x => (uint)x.Role));
|
||||
|
||||
return comparisons;
|
||||
@@ -1251,9 +1251,9 @@ public static class RoleGuidePatches
|
||||
private static List<DetailedPanel> SortEntries(List<DetailedPanel> entries, string searchText)
|
||||
{
|
||||
var activeModifiers = PlayerControl.LocalPlayer.GetModifiers<GameModifier>().Select(x => x.TypeId);
|
||||
var roles = GetActiveRoles().Select(x => (uint)x.Role).ToList();
|
||||
List<uint> comparisons = activeModifiers.ToList();
|
||||
comparisons.AddRange(roles);
|
||||
var roles = GetActiveRoles().Select(x => (uint)x.Role).ToHashSet();
|
||||
var comparisons = activeModifiers.ToHashSet();
|
||||
comparisons.UnionWith(roles);
|
||||
|
||||
var comparer = new BasicGuideComparer(comparisons);
|
||||
|
||||
@@ -1262,7 +1262,7 @@ public static class RoleGuidePatches
|
||||
.ThenByDescending(p =>
|
||||
p.Title.Contains(searchText, StringComparison.OrdinalIgnoreCase) ||
|
||||
p.Category.Contains(searchText, StringComparison.OrdinalIgnoreCase))
|
||||
.ThenBy(x => x.Modifier != null ? x.Modifier.TypeId : (uint)x.Role!.Role, comparer);
|
||||
.ThenBy(x => x.Modifier?.TypeId ?? (uint)x.Role!.Role, comparer);
|
||||
return
|
||||
[
|
||||
.. _sortMethod is SortingMethod.Alphabetical
|
||||
|
||||
@@ -87,6 +87,6 @@ public class OptionPreset(string name, MiraPluginInfo plugin, ConfigFile presetC
|
||||
public bool IsOptionInPreset(OptionBehaviour baseOption)
|
||||
{
|
||||
var selectedOpt = Plugin.InternalOptions.FirstOrDefault(x => x.OptionBehaviour == baseOption);
|
||||
return selectedOpt != null && selectedOpt.ConfigDefinition != null && PresetConfig.ContainsKey(selectedOpt.ConfigDefinition);
|
||||
return selectedOpt?.ConfigDefinition != null && PresetConfig.ContainsKey(selectedOpt.ConfigDefinition);
|
||||
}
|
||||
}
|
||||
@@ -9,13 +9,13 @@ namespace MiraAPI.Utilities.Assets;
|
||||
/// </summary>
|
||||
public static class MiraAssets
|
||||
{
|
||||
private static readonly Assembly _assembly = typeof(MiraAssets).Assembly;
|
||||
private static readonly Assembly Assembly = typeof(MiraAssets).Assembly;
|
||||
|
||||
static MiraAssets()
|
||||
{
|
||||
var boxTex = SpriteTools.LoadTextureFromResourcePath(
|
||||
"MiraAPI.Resources.RoundedBox.png",
|
||||
_assembly);
|
||||
Assembly);
|
||||
var boxSprite = Sprite.Create(
|
||||
boxTex,
|
||||
new Rect(0, 0, boxTex.width, boxTex.height),
|
||||
@@ -36,7 +36,7 @@ public static class MiraAssets
|
||||
/// <summary>
|
||||
/// Gets the Mira API <see cref="AssetBundle"/>.
|
||||
/// </summary>
|
||||
public static AssetBundle MiraAssetBundle { get; } = AssetBundleManager.Load("mirabundle");
|
||||
public static AssetBundle MiraAssetBundle { get; } = AssetBundleManager.Load(Assembly, "mirabundle");
|
||||
|
||||
/// <summary>
|
||||
/// Gets the ModifierDisplay prefab.
|
||||
@@ -61,7 +61,7 @@ public static class MiraAssets
|
||||
/// <summary>
|
||||
/// Gets the empty <see cref="Sprite"/> asset.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset Empty { get; } = new("MiraAPI.Resources.Empty.png", _assembly);
|
||||
public static LoadableResourceAsset Empty { get; } = new("MiraAPI.Resources.Empty.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the RoundedBox <see cref="Sprite"/>, which is a rounded rectangle used for UI elements.
|
||||
@@ -71,312 +71,312 @@ public static class MiraAssets
|
||||
/// <summary>
|
||||
/// Gets the Next Button sprite.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset NextButton { get; } = new("MiraAPI.Resources.NextButton.png", _assembly);
|
||||
public static LoadableResourceAsset NextButton { get; } = new("MiraAPI.Resources.NextButton.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Mira settings icon.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset SettingsIcon { get; } = new("MiraAPI.Resources.Settings.png", _assembly);
|
||||
public static LoadableResourceAsset SettingsIcon { get; } = new("MiraAPI.Resources.Settings.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the highlighted Next Button sprite.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset NextButtonActive { get; } = new("MiraAPI.Resources.NextButtonActive.png", _assembly);
|
||||
public static LoadableResourceAsset NextButtonActive { get; } = new("MiraAPI.Resources.NextButtonActive.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Cog icon used in Role Settings Menu.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset Cog { get; } = new("MiraAPI.Resources.Cog.png", _assembly);
|
||||
public static LoadableResourceAsset Cog { get; } = new("MiraAPI.Resources.Cog.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Checkmark Box used in the Settings Menu.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset CheckmarkBox { get; } = new("MiraAPI.Resources.CheckMarkBox.png", _assembly);
|
||||
public static LoadableResourceAsset CheckmarkBox { get; } = new("MiraAPI.Resources.CheckMarkBox.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Reset Box used in the Settings Menu.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset ResetButton { get; } = new("MiraAPI.Resources.ResetButton.png", _assembly);
|
||||
public static LoadableResourceAsset ResetButton { get; } = new("MiraAPI.Resources.ResetButton.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Checkmark used in the Settings Menu.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset Checkmark { get; } = new("MiraAPI.Resources.Checkmark.png", _assembly);
|
||||
public static LoadableResourceAsset Checkmark { get; } = new("MiraAPI.Resources.Checkmark.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the white CategoryHeader used in the Settings Menu.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset CategoryHeader { get; } = new("MiraAPI.Resources.CategoryHeader.png", _assembly);
|
||||
public static LoadableResourceAsset CategoryHeader { get; } = new("MiraAPI.Resources.CategoryHeader.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the Keybind icons.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset KeybindButton { get; } = new("MiraAPI.Resources.KeybindButton.png", _assembly);
|
||||
public static LoadableResourceAsset KeybindButton { get; } = new("MiraAPI.Resources.KeybindButton.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for crewmate role files in TaskAdderGame.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset CrewmateFile { get; } = new("MiraAPI.Resources.CrewmateFile.png", _assembly);
|
||||
public static LoadableResourceAsset CrewmateFile { get; } = new("MiraAPI.Resources.CrewmateFile.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for impostor role files in TaskAdderGame.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset ImpostorFile { get; } = new("MiraAPI.Resources.ImpostorFile.png", _assembly);
|
||||
public static LoadableResourceAsset ImpostorFile { get; } = new("MiraAPI.Resources.ImpostorFile.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for custom team role files in TaskAdderGame.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset CustomTeamFile { get; } = new("MiraAPI.Resources.CustomFile.png", _assembly);
|
||||
public static LoadableResourceAsset CustomTeamFile { get; } = new("MiraAPI.Resources.CustomFile.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for modifier file in TaskAdderGame.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset ModifierFile { get; } = new("MiraAPI.Resources.ModifierFile.png", _assembly);
|
||||
public static LoadableResourceAsset ModifierFile { get; } = new("MiraAPI.Resources.ModifierFile.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the Classic gamemode.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset ClassicGamemodeIcon { get; } = new("MiraAPI.Resources.ClassicGamemodeIcon.png", _assembly);
|
||||
public static LoadableResourceAsset ClassicGamemodeIcon { get; } = new("MiraAPI.Resources.ClassicGamemodeIcon.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the Hide n Seek gamemode.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset HnSGamemodeIcon { get; } = new("MiraAPI.Resources.HnSGamemodeIcon.png", _assembly);
|
||||
public static LoadableResourceAsset HnSGamemodeIcon { get; } = new("MiraAPI.Resources.HnSGamemodeIcon.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for timed modifier file in TaskAdderGame.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset TimedModifierFile { get; } = new("MiraAPI.Resources.TimedModifierFile.png", _assembly);
|
||||
public static LoadableResourceAsset TimedModifierFile { get; } = new("MiraAPI.Resources.TimedModifierFile.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the new chat button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset ChatHoverSprite { get; } = new("MiraAPI.Resources.NormalChatHover.png", _assembly);
|
||||
public static LoadableResourceAsset ChatHoverSprite { get; } = new("MiraAPI.Resources.NormalChatHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the new chat button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset ChatIdleSprite { get; } = new("MiraAPI.Resources.NormalChatIdle.png", _assembly);
|
||||
public static LoadableResourceAsset ChatIdleSprite { get; } = new("MiraAPI.Resources.NormalChatIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the new chat button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset ChatOpenSprite { get; } = new("MiraAPI.Resources.NormalChatOpen.png", _assembly);
|
||||
public static LoadableResourceAsset ChatOpenSprite { get; } = new("MiraAPI.Resources.NormalChatOpen.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for players button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset WikiPlayersButtonHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarPlayersButtonHover.png", _assembly);
|
||||
public static LoadableResourceAsset WikiPlayersButtonHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarPlayersButtonHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the players button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset WikiPlayersButtonIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarPlayersButtonIdle.png", _assembly);
|
||||
public static LoadableResourceAsset WikiPlayersButtonIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarPlayersButtonIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the players button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset WikiPlayersButtonOpenSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarPlayersButtonOpen.png", _assembly);
|
||||
public static LoadableResourceAsset WikiPlayersButtonOpenSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarPlayersButtonOpen.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the settings button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset WikiSettingsButtonHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarSettingsButtonHover.png", _assembly);
|
||||
public static LoadableResourceAsset WikiSettingsButtonHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarSettingsButtonHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the settings button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset WikiSettingsButtonIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarSettingsButtonIdle.png", _assembly);
|
||||
public static LoadableResourceAsset WikiSettingsButtonIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarSettingsButtonIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the settings button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset WikiSettingsButtonOpenSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarSettingsButtonOpen.png", _assembly);
|
||||
public static LoadableResourceAsset WikiSettingsButtonOpenSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarSettingsButtonOpen.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset WikiRolesButtonHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarRolesButtonHover.png", _assembly);
|
||||
public static LoadableResourceAsset WikiRolesButtonHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarRolesButtonHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset WikiRolesButtonIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarRolesButtonIdle.png", _assembly);
|
||||
public static LoadableResourceAsset WikiRolesButtonIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarRolesButtonIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset WikiRolesButtonOpenSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarRolesButtonOpen.png", _assembly);
|
||||
public static LoadableResourceAsset WikiRolesButtonOpenSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarRolesButtonOpen.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the modifiers button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset WikiModifiersButtonHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarModifiersButtonHover.png", _assembly);
|
||||
public static LoadableResourceAsset WikiModifiersButtonHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarModifiersButtonHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the modifiers button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset WikiModifiersButtonIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarModifiersButtonIdle.png", _assembly);
|
||||
public static LoadableResourceAsset WikiModifiersButtonIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarModifiersButtonIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the modifiers button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset WikiModifiersButtonOpenSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarModifiersButtonOpen.png", _assembly);
|
||||
public static LoadableResourceAsset WikiModifiersButtonOpenSprite { get; } = new("MiraAPI.Resources.Wiki.SidebarModifiersButtonOpen.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset GroupCountHoverSprite { get; } = new("MiraAPI.Resources.Wiki.GroupCountHover.png", _assembly);
|
||||
public static LoadableResourceAsset GroupCountHoverSprite { get; } = new("MiraAPI.Resources.Wiki.GroupCountHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset GroupCountIdleSprite { get; } = new("MiraAPI.Resources.Wiki.GroupCountIdle.png", _assembly);
|
||||
public static LoadableResourceAsset GroupCountIdleSprite { get; } = new("MiraAPI.Resources.Wiki.GroupCountIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset GroupFactionHoverSprite { get; } = new("MiraAPI.Resources.Wiki.GroupFactionHover.png", _assembly);
|
||||
public static LoadableResourceAsset GroupFactionHoverSprite { get; } = new("MiraAPI.Resources.Wiki.GroupFactionHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset GroupFactionIdleSprite { get; } = new("MiraAPI.Resources.Wiki.GroupFactionIdle.png", _assembly);
|
||||
public static LoadableResourceAsset GroupFactionIdleSprite { get; } = new("MiraAPI.Resources.Wiki.GroupFactionIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset GroupNoneHoverSprite { get; } = new("MiraAPI.Resources.Wiki.GroupNoneHover.png", _assembly);
|
||||
public static LoadableResourceAsset GroupNoneHoverSprite { get; } = new("MiraAPI.Resources.Wiki.GroupNoneHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset GroupNoneIdleSprite { get; } = new("MiraAPI.Resources.Wiki.GroupNoneIdle.png", _assembly);
|
||||
public static LoadableResourceAsset GroupNoneIdleSprite { get; } = new("MiraAPI.Resources.Wiki.GroupNoneIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset SearchClearHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SearchClearHover.png", _assembly);
|
||||
public static LoadableResourceAsset SearchClearHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SearchClearHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset SearchClearIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SearchClearIdle.png", _assembly);
|
||||
public static LoadableResourceAsset SearchClearIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SearchClearIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset SearchIconHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SearchIconHover.png", _assembly);
|
||||
public static LoadableResourceAsset SearchIconHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SearchIconHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset SearchIconIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SearchIconIdle.png", _assembly);
|
||||
public static LoadableResourceAsset SearchIconIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SearchIconIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset SortingAzHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SortingAzHover.png", _assembly);
|
||||
public static LoadableResourceAsset SortingAzHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SortingAzHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset SortingAzIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SortingAzIdle.png", _assembly);
|
||||
public static LoadableResourceAsset SortingAzIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SortingAzIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset SortingZaHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SortingZaHover.png", _assembly);
|
||||
public static LoadableResourceAsset SortingZaHoverSprite { get; } = new("MiraAPI.Resources.Wiki.SortingZaHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset SortingZaIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SortingZaIdle.png", _assembly);
|
||||
public static LoadableResourceAsset SortingZaIdleSprite { get; } = new("MiraAPI.Resources.Wiki.SortingZaIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset VisibleAllHoverSprite { get; } = new("MiraAPI.Resources.Wiki.VisibleAllHover.png", _assembly);
|
||||
public static LoadableResourceAsset VisibleAllHoverSprite { get; } = new("MiraAPI.Resources.Wiki.VisibleAllHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset VisibleAllIdleSprite { get; } = new("MiraAPI.Resources.Wiki.VisibleAllIdle.png", _assembly);
|
||||
public static LoadableResourceAsset VisibleAllIdleSprite { get; } = new("MiraAPI.Resources.Wiki.VisibleAllIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset VisibleOffHoverSprite { get; } = new("MiraAPI.Resources.Wiki.VisibleOffHover.png", _assembly);
|
||||
public static LoadableResourceAsset VisibleOffHoverSprite { get; } = new("MiraAPI.Resources.Wiki.VisibleOffHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset VisibleOffIdleSprite { get; } = new("MiraAPI.Resources.Wiki.VisibleOffIdle.png", _assembly);
|
||||
public static LoadableResourceAsset VisibleOffIdleSprite { get; } = new("MiraAPI.Resources.Wiki.VisibleOffIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset VisibleOnHoverSprite { get; } = new("MiraAPI.Resources.Wiki.VisibleOnHover.png", _assembly);
|
||||
public static LoadableResourceAsset VisibleOnHoverSprite { get; } = new("MiraAPI.Resources.Wiki.VisibleOnHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the roles button while hovering.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset VisibleOnIdleSprite { get; } = new("MiraAPI.Resources.Wiki.VisibleOnIdle.png", _assembly);
|
||||
public static LoadableResourceAsset VisibleOnIdleSprite { get; } = new("MiraAPI.Resources.Wiki.VisibleOnIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for crewmates.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset IconCrewmate { get; } = new("MiraAPI.Resources.Wiki.IconCrewmate.png", _assembly);
|
||||
public static LoadableResourceAsset IconCrewmate { get; } = new("MiraAPI.Resources.Wiki.IconCrewmate.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for impostors.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset IconImpostor { get; } = new("MiraAPI.Resources.Wiki.IconImpostor.png", _assembly);
|
||||
public static LoadableResourceAsset IconImpostor { get; } = new("MiraAPI.Resources.Wiki.IconImpostor.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for neutrals.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset IconNeutral { get; } = new("MiraAPI.Resources.Wiki.IconNeutral.png", _assembly);
|
||||
public static LoadableResourceAsset IconNeutral { get; } = new("MiraAPI.Resources.Wiki.IconNeutral.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for the player list.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset IconPlayerList { get; } = new("MiraAPI.Resources.Wiki.IconPlayerList.png", _assembly);
|
||||
public static LoadableResourceAsset IconPlayerList { get; } = new("MiraAPI.Resources.Wiki.IconPlayerList.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for settings.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset IconSettings { get; } = new("MiraAPI.Resources.Wiki.IconSettings.png", _assembly);
|
||||
public static LoadableResourceAsset IconSettings { get; } = new("MiraAPI.Resources.Wiki.IconSettings.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used for terminology.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset IconTerminology { get; } = new("MiraAPI.Resources.Wiki.IconTerminology.png", _assembly);
|
||||
public static LoadableResourceAsset IconTerminology { get; } = new("MiraAPI.Resources.Wiki.IconTerminology.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Page switching sprite.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset PageLeftHover { get; } = new("MiraAPI.Resources.Wiki.PageLeftHover.png", _assembly);
|
||||
public static LoadableResourceAsset PageLeftHover { get; } = new("MiraAPI.Resources.Wiki.PageLeftHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Page switching sprite.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset PageLeftIdle { get; } = new("MiraAPI.Resources.Wiki.PageLeftIdle.png", _assembly);
|
||||
public static LoadableResourceAsset PageLeftIdle { get; } = new("MiraAPI.Resources.Wiki.PageLeftIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Page switching sprite.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset PageRightHover { get; } = new("MiraAPI.Resources.Wiki.PageRightHover.png", _assembly);
|
||||
public static LoadableResourceAsset PageRightHover { get; } = new("MiraAPI.Resources.Wiki.PageRightHover.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Page switching sprite.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset PageRightIdle { get; } = new("MiraAPI.Resources.Wiki.PageRightIdle.png", _assembly);
|
||||
public static LoadableResourceAsset PageRightIdle { get; } = new("MiraAPI.Resources.Wiki.PageRightIdle.png", Assembly);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the sprite used below the tab icons in the wiki.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset TabButtonContainer { get; } = new("MiraAPI.Resources.Wiki.TabButtonContainer.png", _assembly);
|
||||
public static LoadableResourceAsset TabButtonContainer { get; } = new("MiraAPI.Resources.Wiki.TabButtonContainer.png", Assembly);
|
||||
|
||||
internal static LoadableResourceAsset BlankSprite { get; } = new("MiraAPI.Resources.BlankSprite.png", _assembly);
|
||||
internal static LoadableResourceAsset BlankSprite { get; } = new("MiraAPI.Resources.BlankSprite.png", Assembly);
|
||||
}
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace MiraAPI.Utilities;
|
||||
|
||||
@@ -10,22 +8,13 @@ namespace MiraAPI.Utilities;
|
||||
/// <param name="activeIds">The collection of currently active IDs.</param>
|
||||
public class BasicGuideComparer(IEnumerable<uint> activeIds) : IComparer<uint>
|
||||
{
|
||||
private readonly HashSet<uint> _activeIds = activeIds as HashSet<uint> ?? [.. activeIds];
|
||||
|
||||
/// <inheritdoc/>
|
||||
public int Compare(uint x, uint y)
|
||||
{
|
||||
var xActive = activeIds.Contains(x);
|
||||
var yActive = activeIds.Contains(y);
|
||||
|
||||
if (xActive && !yActive)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!xActive && yActive)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
var xActive = _activeIds.Contains(x);
|
||||
var yActive = _activeIds.Contains(y);
|
||||
return yActive.CompareTo(xActive);
|
||||
}
|
||||
}
|
||||
@@ -897,9 +897,8 @@ public static class Helpers
|
||||
return;
|
||||
}
|
||||
|
||||
var cachedPrefab = Object.Instantiate(rowPrefab!.gameObject);
|
||||
var cachedPrefab = Object.Instantiate(rowPrefab!.gameObject, null, false);
|
||||
cachedPrefab.name = "MiraAPIAdvancedSettingsRowPrefab";
|
||||
cachedPrefab.transform.SetParent(null, false);
|
||||
cachedPrefab.transform.localPosition = Vector3.zero;
|
||||
cachedPrefab.transform.localRotation = Quaternion.identity;
|
||||
cachedPrefab.SetActive(false);
|
||||
@@ -919,9 +918,7 @@ public static class Helpers
|
||||
{
|
||||
return CreateAdvancedSettingsPage(
|
||||
parent,
|
||||
[.. settings.Select(setting => new AdvancedSettingsRow(setting.Key, setting.Value, null))],
|
||||
2,
|
||||
false);
|
||||
[.. settings.Select(setting => new AdvancedSettingsRow(setting.Key, setting.Value, null))]);
|
||||
}
|
||||
|
||||
internal static GameObject CreateAdvancedSettingsPage(
|
||||
|
||||
@@ -23,12 +23,10 @@ public class StateMachineWrapper<T>
|
||||
private readonly Dictionary<string, PropertyInfo> _propertyCache;
|
||||
private readonly Type _type;
|
||||
|
||||
private T? _parentInstance;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the instance of the <typeparamref name="T"/>.
|
||||
/// </summary>
|
||||
public T Instance => _parentInstance ??= (T)_thisProperty.GetValue(_stateMachine)!;
|
||||
public T Instance => field ??= (T)_thisProperty.GetValue(_stateMachine)!;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="StateMachineWrapper{T}"/> class.
|
||||
|
||||
@@ -30,11 +30,10 @@ public class PlayerVoteData(nint cppPtr) : MonoBehaviour(cppPtr)
|
||||
/// </summary>
|
||||
public int VotesRemaining
|
||||
{
|
||||
get => _votesRemaining;
|
||||
set => _votesRemaining = Math.Max(0, value);
|
||||
get;
|
||||
set => field = Math.Max(0, value);
|
||||
}
|
||||
|
||||
private int _votesRemaining = 1;
|
||||
= 1;
|
||||
|
||||
[SuppressMessage("Style", "IDE0051:Remove unused private members", Justification = "Unity convention.")]
|
||||
private void Awake()
|
||||
|
||||
Reference in new issue
Block a user