mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
Merge branch 'dev' into more-colors
This commit is contained in:
17 files changed
+101
-107
No files matched your search
+5
-2
@@ -90,11 +90,14 @@ dotnet_diagnostic.IDE0001.severity = warning
|
||||
# IDE0079: Remove unnecessary suppression
|
||||
dotnet_diagnostic.IDE0079.severity = none
|
||||
|
||||
# S1244: Floating point numbers should not be tested for equality
|
||||
dotnet_diagnostic.S1244.severity = none
|
||||
# S3903: Types should be defined in named namespaces
|
||||
dotnet_diagnostic.S3903.severity = none
|
||||
|
||||
# IDE0045: Convert to conditional expression
|
||||
dotnet_diagnostic.IDE0045.severity = none
|
||||
|
||||
# IDE0046: Convert to conditional expression
|
||||
dotnet_diagnostic.IDE0046.severity = none
|
||||
|
||||
# S1244: Floating point numbers should not be tested for equality
|
||||
dotnet_diagnostic.S1244.severity = none
|
||||
@@ -0,0 +1,4 @@
|
||||
[*.{cs,vb}]
|
||||
|
||||
# SA1602: Enumeration items should be documented.
|
||||
dotnet_diagnostic.SA1602.severity = none
|
||||
@@ -16,11 +16,11 @@
|
||||
Your votes have double the power.</string>
|
||||
<string name="ApiExample.Role.Crewmate.Mayor.TabDescription">You get one extra vote in the meeting!</string>
|
||||
<string name="ApiExample.Role.Crewmate.Mayor.WikiDescription">The Mayor is a Crewmate role that gets two votes in the meeting, instead of the singular vote other Crewmates get.</string>
|
||||
<string name="ApiExample.Role.Crewmate.Chamelon">Chamelon</string>
|
||||
<string name="ApiExample.Role.Crewmate.Chamelon.IntroBlurb">Become one with the environment.</string>
|
||||
<string name="ApiExample.Role.Crewmate.Chamelon.MedDescription">Fade out of everyone's vision by not moving.</string>
|
||||
<string name="ApiExample.Role.Crewmate.Chamelon.TabDescription">Stay invisible while not moving.</string>
|
||||
<string name="ApiExample.Role.Crewmate.Chamelon.WikiDescription">The Chamelon is a Crewmate role that slowly becomes invisible while standing still.</string>
|
||||
<string name="ApiExample.Role.Crewmate.Chameleon">Chameleon</string>
|
||||
<string name="ApiExample.Role.Crewmate.Chameleon.IntroBlurb">Become one with the environment.</string>
|
||||
<string name="ApiExample.Role.Crewmate.Chameleon.MedDescription">Fade out of everyone's vision by not moving.</string>
|
||||
<string name="ApiExample.Role.Crewmate.Chameleon.TabDescription">Stay invisible while not moving.</string>
|
||||
<string name="ApiExample.Role.Crewmate.Chameleon.WikiDescription">The Chameleon is a Crewmate role that slowly becomes invisible while standing still.</string>
|
||||
<string name="ApiExample.Role.Outcast.OutcastKiller">Outcast Killer</string>
|
||||
<string name="ApiExample.Role.Outcast.OutcastKiller.IntroBlurb">Kill everyone else.</string>
|
||||
<string name="ApiExample.Role.Outcast.OutcastKiller.MedDescription">Be the last outcast standing.
|
||||
@@ -73,7 +73,7 @@ Eliminate every other faction.</string>
|
||||
<string name="settings.miraExample.exampleBool2">Example Bool 2</string>
|
||||
<string name="settings.miraExample.slider">Slider</string>
|
||||
<string name="settings.miraExample.exampleNumber">Example Number</string>
|
||||
<string name="settings.miraExample.exampleMultiplier">Example Multplier</string>
|
||||
<string name="settings.miraExample.exampleMultiplier">Example Multiplier</string>
|
||||
<string name="settings.miraExample.exampleEnum">Example Enum</string>
|
||||
<string name="settings.miraExample.button.exampleButton">Example Button</string>
|
||||
<string name="gameover.outcastKiller.win">Outcast Killer Wins!</string>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using AmongUs.Data;
|
||||
@@ -462,7 +461,6 @@ public class HideAndSeekMode : AbstractGameMode
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[SuppressMessage("Style", "IDE0046:Convert to conditional expression", Justification = "Warning cascades into forcing the entire tree to be ternary operators.")]
|
||||
public override PlayerBodyTypes GetBodyType(PlayerControl player)
|
||||
{
|
||||
if (player == null || player.Data == null || player.Data.Role == null)
|
||||
|
||||
@@ -43,7 +43,7 @@ public class ModdedPlayerOption : ModdedOption<int>
|
||||
data.Title = StringName;
|
||||
data.Type = global::OptionTypes.Player;
|
||||
|
||||
Values = new();
|
||||
Values = [];
|
||||
AllowNone = allowNone;
|
||||
Value = DefaultValue;
|
||||
}
|
||||
|
||||
@@ -101,7 +101,6 @@ public abstract class CustomPaginableMenu : CustomPhoneMenu<CustomPaginableMenu.
|
||||
: text.Trim().ToLowerInvariant();
|
||||
}
|
||||
|
||||
[SuppressMessage("Style", "IDE0046:Convert to conditional expression", Justification = "Creates a rather large ternary operation.")]
|
||||
private List<MenuEntry> GetFilteredEntries()
|
||||
{
|
||||
var query = NormalizeForSearch(searchText);
|
||||
|
||||
@@ -64,11 +64,9 @@ public partial class MiraApiPlugin : BasePlugin, IMiraPlugin
|
||||
private static MiraPluginManager? PluginManager { get; set; }
|
||||
internal Harmony Harmony { get; } = new(Id);
|
||||
|
||||
public static ConfigEntry<SortingGroups> WikiSortingGroup { get; private set; }
|
||||
|
||||
public static ConfigEntry<SortingMethod> WikiSortingMethod { get; private set; }
|
||||
|
||||
public static ConfigEntry<SortingFilter> WikiSortingFilter { get; private set; }
|
||||
internal static ConfigEntry<SortingGroups> WikiSortingGroup { get; private set; }
|
||||
internal static ConfigEntry<SortingMethod> WikiSortingMethod { get; private set; }
|
||||
internal static ConfigEntry<SortingFilter> WikiSortingFilter { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Load()
|
||||
|
||||
@@ -10,4 +10,7 @@ dotnet_diagnostic.CS1591.severity = none
|
||||
dotnet_diagnostic.SA1611.severity = none
|
||||
|
||||
# SA1615: Element return value should be documented.
|
||||
dotnet_diagnostic.SA1615.severity = none
|
||||
dotnet_diagnostic.SA1615.severity = none
|
||||
|
||||
# SA1602: Enumeration items should be documented.
|
||||
dotnet_diagnostic.SA1602.severity = none
|
||||
@@ -25,9 +25,9 @@ namespace MiraAPI.Patches.Options;
|
||||
[HarmonyPatch(typeof(GameOptionsMenu))]
|
||||
internal static class GameOptionsMenuPatch
|
||||
{
|
||||
private static readonly List<CategoryHeaderMasked> VanillaHeaders = new();
|
||||
private static readonly List<OptionBehaviour> VanillaOptions = new();
|
||||
private static readonly List<OptionBehaviour> MainOptions = new();
|
||||
private static readonly List<CategoryHeaderMasked> VanillaHeaders = [];
|
||||
private static readonly List<OptionBehaviour> VanillaOptions = [];
|
||||
private static readonly List<OptionBehaviour> MainOptions = [];
|
||||
private static readonly Dictionary<AbstractGameMode, List<AbstractOptionGroup>> GameModeGroups = [];
|
||||
private static readonly Dictionary<AbstractGameMode, List<OptionBehaviour>> GameModeOptions = [];
|
||||
private static readonly Dictionary<AbstractGameMode, List<CategoryHeaderMasked>> GameModeHeaders = [];
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using HarmonyLib;
|
||||
using MiraAPI.GameOptions;
|
||||
@@ -24,7 +23,6 @@ public static class SettingPatches
|
||||
/// <returns><see langword="false"/> to skip original method.</returns>
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(FloatGameSetting), nameof(FloatGameSetting.GetValueString))]
|
||||
[SuppressMessage("Style", "IDE0045:Convert to conditional expression", Justification = "Warning cascades into forcing the entire tree to be ternary operators.")]
|
||||
public static bool ValueStringPatch(
|
||||
FloatGameSetting __instance,
|
||||
ref string __result,
|
||||
|
||||
@@ -33,20 +33,13 @@ public static class RoleGuidePatches
|
||||
private static readonly List<DetailedPanel> RoleEntries = [];
|
||||
private static readonly List<DetailedPanel> ModifierEntries = [];
|
||||
|
||||
public static GameObject SearchComponentContainer;
|
||||
public static PassiveButton SearchIconButton;
|
||||
private static GameObject searchComponentContainer;
|
||||
private static SpriteRenderer _searchIconIdle;
|
||||
private static SpriteRenderer _searchIconHover;
|
||||
public static TextMeshPro OrderSortingTmp;
|
||||
public static PassiveButton SearchSortingOrderButton;
|
||||
private static SpriteRenderer _searchSortingOrderIdle;
|
||||
private static SpriteRenderer _searchSortingOrderHover;
|
||||
public static TextMeshPro GroupSortingTmp;
|
||||
public static PassiveButton SearchSortingGroupButton;
|
||||
private static SpriteRenderer _searchSortingGroupIdle;
|
||||
private static SpriteRenderer _searchSortingGroupHover;
|
||||
public static TextMeshPro FilterSortingTmp;
|
||||
public static PassiveButton SearchSortingFilterButton;
|
||||
private static SpriteRenderer _searchSortingFilterIdle;
|
||||
private static SpriteRenderer _searchSortingFilterHover;
|
||||
private static Scroller _rolesScroller;
|
||||
@@ -153,10 +146,6 @@ public static class RoleGuidePatches
|
||||
_advancedInfoTabScroller = null!;
|
||||
_currentAdvancedTabObject = null!;
|
||||
_loadingSpinner = null;
|
||||
SearchIconButton = null!;
|
||||
SearchSortingOrderButton = null!;
|
||||
SearchSortingGroupButton = null!;
|
||||
SearchSortingFilterButton = null!;
|
||||
_searchIconIdle = null!;
|
||||
_searchIconHover = null!;
|
||||
_searchSortingOrderIdle = null!;
|
||||
@@ -260,6 +249,7 @@ public static class RoleGuidePatches
|
||||
_titleText.transform.GetComponent<TextTranslatorTMP>().Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
if (!_titleIcon)
|
||||
{
|
||||
var titleIconObj = new GameObject("TitleIcon");
|
||||
@@ -369,18 +359,18 @@ public static class RoleGuidePatches
|
||||
|
||||
_guide = instance;
|
||||
_loading = false;
|
||||
SearchComponentContainer = new GameObject();
|
||||
SearchComponentContainer.transform.SetParent(instance.MatchInfoParent.transform);
|
||||
SearchComponentContainer.transform.localPosition = Vector3.zero;
|
||||
instance.MatchInfoParent.transform.GetChild(1).transform.SetParent(SearchComponentContainer.transform);
|
||||
searchComponentContainer = new GameObject();
|
||||
searchComponentContainer.transform.SetParent(instance.MatchInfoParent.transform);
|
||||
searchComponentContainer.transform.localPosition = Vector3.zero;
|
||||
instance.MatchInfoParent.transform.GetChild(1).transform.SetParent(searchComponentContainer.transform);
|
||||
|
||||
var sortingOrderButton = Object.Instantiate(
|
||||
HudManager.Instance.SettingsButton,
|
||||
SearchComponentContainer.transform);
|
||||
searchComponentContainer.transform);
|
||||
sortingOrderButton.gameObject.SetActive(true);
|
||||
SearchSortingOrderButton = sortingOrderButton.GetComponent<PassiveButton>();
|
||||
var searchSortingOrderButton = sortingOrderButton.GetComponent<PassiveButton>();
|
||||
SetupSearchButton(
|
||||
SearchSortingOrderButton,
|
||||
searchSortingOrderButton,
|
||||
"SearchSortingOrderButton",
|
||||
SwitchMethod,
|
||||
GetSortMethodSprite(_sortMethod, false),
|
||||
@@ -391,11 +381,11 @@ public static class RoleGuidePatches
|
||||
|
||||
var sortingGroupButton = Object.Instantiate(
|
||||
sortingOrderButton,
|
||||
SearchComponentContainer.transform);
|
||||
searchComponentContainer.transform);
|
||||
sortingGroupButton.gameObject.SetActive(true);
|
||||
SearchSortingGroupButton = sortingGroupButton.GetComponent<PassiveButton>();
|
||||
var searchSortingGroupButton = sortingGroupButton.GetComponent<PassiveButton>();
|
||||
SetupSearchButton(
|
||||
SearchSortingGroupButton,
|
||||
searchSortingGroupButton,
|
||||
"SearchSortingGroupButton",
|
||||
SwitchGrouping,
|
||||
GetSortGroupSprite(_sortGrouping, false),
|
||||
@@ -406,11 +396,11 @@ public static class RoleGuidePatches
|
||||
|
||||
var sortingFilterButton = Object.Instantiate(
|
||||
sortingOrderButton,
|
||||
SearchComponentContainer.transform);
|
||||
searchComponentContainer.transform);
|
||||
sortingFilterButton.gameObject.SetActive(true);
|
||||
SearchSortingFilterButton = sortingFilterButton.GetComponent<PassiveButton>();
|
||||
var searchSortingFilterButton = sortingFilterButton.GetComponent<PassiveButton>();
|
||||
SetupSearchButton(
|
||||
SearchSortingFilterButton,
|
||||
searchSortingFilterButton,
|
||||
"SearchSortingFilterButton",
|
||||
SwitchFilter,
|
||||
GetSortFilterSprite(_sortFilter, false),
|
||||
@@ -463,9 +453,8 @@ public static class RoleGuidePatches
|
||||
sortingOrderButton,
|
||||
sortingOrderButton.transform.parent);
|
||||
searchIconButton.gameObject.SetActive(true);
|
||||
SearchIconButton = searchIconButton.GetComponent<PassiveButton>();
|
||||
SetupSearchButton(
|
||||
SearchIconButton,
|
||||
searchIconButton.GetComponent<PassiveButton>(),
|
||||
"SearchIconButton",
|
||||
ClearSearchText,
|
||||
MiraAssets.SearchIconIdleSprite,
|
||||
@@ -476,7 +465,7 @@ public static class RoleGuidePatches
|
||||
|
||||
var searchBox = Object.Instantiate(
|
||||
instance.TabButtons[2].gameObject,
|
||||
SearchComponentContainer.transform);
|
||||
searchComponentContainer.transform);
|
||||
var searchButton = searchBox.GetComponent<MatchInfoGuideTabButton>();
|
||||
var tmpText = searchButton.transform.GetChild(0).GetComponent<TextMeshPro>();
|
||||
tmpText.GetComponent<TextTranslatorTMP>().Destroy();
|
||||
@@ -621,26 +610,26 @@ public static class RoleGuidePatches
|
||||
modifiersButton.OnClick.AddListener((Action)(() => OpenModifiersTab()));
|
||||
instance.TabButtons.Add(modifiersButton);
|
||||
|
||||
OrderSortingTmp = Object.Instantiate(
|
||||
var orderSortingTmp = Object.Instantiate(
|
||||
_titleText,
|
||||
sortingOrderButton.transform);
|
||||
OrderSortingTmp.text = MiraLocaleManager.Get("MiraApi.Wiki.OrderLabel");
|
||||
OrderSortingTmp.fontSize = OrderSortingTmp.fontSizeMax = 3f;
|
||||
OrderSortingTmp.alignment = TextAlignmentOptions.Center;
|
||||
OrderSortingTmp.horizontalAlignment = HorizontalAlignmentOptions.Center;
|
||||
OrderSortingTmp.transform.localPosition = new Vector3(-0.65f, 0.4f, 0);
|
||||
orderSortingTmp.text = MiraLocaleManager.Get("MiraApi.Wiki.OrderLabel");
|
||||
orderSortingTmp.fontSize = orderSortingTmp.fontSizeMax = 3f;
|
||||
orderSortingTmp.alignment = TextAlignmentOptions.Center;
|
||||
orderSortingTmp.horizontalAlignment = HorizontalAlignmentOptions.Center;
|
||||
orderSortingTmp.transform.localPosition = new Vector3(-0.65f, 0.4f, 0);
|
||||
|
||||
GroupSortingTmp = Object.Instantiate(
|
||||
OrderSortingTmp,
|
||||
var groupSortingTmp = Object.Instantiate(
|
||||
orderSortingTmp,
|
||||
sortingGroupButton.transform);
|
||||
OrderSortingTmp.text = MiraLocaleManager.Get("MiraApi.Wiki.GroupingLabel");
|
||||
GroupSortingTmp.transform.localPosition = new Vector3(-0.65f, 0.4f, 0);
|
||||
orderSortingTmp.text = MiraLocaleManager.Get("MiraApi.Wiki.GroupingLabel");
|
||||
groupSortingTmp.transform.localPosition = new Vector3(-0.65f, 0.4f, 0);
|
||||
|
||||
FilterSortingTmp = Object.Instantiate(
|
||||
OrderSortingTmp,
|
||||
var filterSortingTmp = Object.Instantiate(
|
||||
orderSortingTmp,
|
||||
sortingFilterButton.transform);
|
||||
FilterSortingTmp.text = MiraLocaleManager.Get("MiraApi.Wiki.FilterLabel");
|
||||
FilterSortingTmp.transform.localPosition = new Vector3(-0.65f, 0.4f, 0);
|
||||
filterSortingTmp.text = MiraLocaleManager.Get("MiraApi.Wiki.FilterLabel");
|
||||
filterSortingTmp.transform.localPosition = new Vector3(-0.65f, 0.4f, 0);
|
||||
|
||||
playerButton.transform.localPosition = new Vector3(-3.6f, 0.656f, -0.2f);
|
||||
settingButton.transform.localPosition = new Vector3(-3.6f, 0.056f, -0.2f);
|
||||
@@ -731,11 +720,17 @@ public static class RoleGuidePatches
|
||||
}
|
||||
}
|
||||
|
||||
public static void OpenModifiersTab() => OpenTab(ModifiersTabIndex);
|
||||
public static void OpenModifiersTab()
|
||||
{
|
||||
OpenTab(ModifiersTabIndex);
|
||||
}
|
||||
|
||||
public static void OpenRolesTab() => OpenTab(RolesTabIndex);
|
||||
public static void OpenRolesTab()
|
||||
{
|
||||
OpenTab(RolesTabIndex);
|
||||
}
|
||||
|
||||
public sealed class DetailedPanel(string title, string category, string modId, RoleBehaviour? role, GameModifier? modifier)
|
||||
private sealed class DetailedPanel(string title, string category, string modId, RoleBehaviour? role, GameModifier? modifier)
|
||||
{
|
||||
public MatchInfoRolePanel? Panel { get; set; }
|
||||
public string Title { get; } = title;
|
||||
@@ -803,14 +798,7 @@ public static class RoleGuidePatches
|
||||
|
||||
private static IEnumerator CoPopulate(float delay)
|
||||
{
|
||||
if (delay > 0f)
|
||||
{
|
||||
yield return new WaitForSeconds(delay);
|
||||
}
|
||||
else
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
yield return delay > 0f ? new WaitForSeconds(delay) : null;
|
||||
|
||||
if (!_guide)
|
||||
{
|
||||
@@ -1048,14 +1036,8 @@ public static class RoleGuidePatches
|
||||
public static void SwitchFilter()
|
||||
{
|
||||
var stepUp = (SortingFilter)((int)_sortFilter + 1);
|
||||
if (Enum.IsDefined(stepUp))
|
||||
{
|
||||
_sortFilter = stepUp;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sortFilter = SortingFilter.EnabledOnly;
|
||||
}
|
||||
|
||||
_sortFilter = Enum.IsDefined(stepUp) ? stepUp : SortingFilter.EnabledOnly;
|
||||
|
||||
MiraApiPlugin.WikiSortingFilter.Value = _sortFilter;
|
||||
|
||||
@@ -1094,14 +1076,8 @@ public static class RoleGuidePatches
|
||||
public static void SwitchMethod()
|
||||
{
|
||||
var stepUp = (SortingMethod)((int)_sortMethod + 1);
|
||||
if (Enum.IsDefined(stepUp))
|
||||
{
|
||||
_sortMethod = stepUp;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sortMethod = SortingMethod.Alphabetical;
|
||||
}
|
||||
|
||||
_sortMethod = Enum.IsDefined(stepUp) ? stepUp : SortingMethod.Alphabetical;
|
||||
|
||||
MiraApiPlugin.WikiSortingMethod.Value = _sortMethod;
|
||||
|
||||
@@ -1288,7 +1264,7 @@ public static class RoleGuidePatches
|
||||
}
|
||||
|
||||
_advancedInfoTabScroller?.gameObject.SetActive(false);
|
||||
SearchComponentContainer?.SetActive(true);
|
||||
searchComponentContainer?.SetActive(true);
|
||||
UpdateSpinner();
|
||||
}
|
||||
|
||||
@@ -1341,9 +1317,9 @@ public static class RoleGuidePatches
|
||||
_currentAdvancedTabObject.Destroy();
|
||||
}
|
||||
|
||||
if (SearchComponentContainer)
|
||||
if (searchComponentContainer)
|
||||
{
|
||||
SearchComponentContainer.SetActive(false);
|
||||
searchComponentContainer.SetActive(false);
|
||||
}
|
||||
|
||||
if (_advancedInfoTabScroller == null)
|
||||
@@ -1543,20 +1519,20 @@ public static class RoleGuidePatches
|
||||
}
|
||||
}
|
||||
|
||||
public enum SortingGroups
|
||||
internal enum SortingGroups
|
||||
{
|
||||
Ungrouped,
|
||||
Faction,
|
||||
AmountChance,
|
||||
}
|
||||
|
||||
public enum SortingMethod
|
||||
internal enum SortingMethod
|
||||
{
|
||||
Alphabetical,
|
||||
AlphabeticalDescending,
|
||||
}
|
||||
|
||||
public enum SortingFilter
|
||||
internal enum SortingFilter
|
||||
{
|
||||
EnabledOnly,
|
||||
DisabledOnly,
|
||||
|
||||
@@ -39,10 +39,10 @@ public static class RoleBehaviourStubs
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stub method for <see cref="RoleBehaviour.AppendTaskHint(StringBuilder)"/>.
|
||||
/// Stub method for <see cref="RoleBehaviour.AppendTaskHint(Il2CppSystem.Text.StringBuilder)"/>.
|
||||
/// </summary>
|
||||
/// <param name="instance">The <see cref="RoleBehaviour"/> object.</param>
|
||||
/// <param name="taskStringBuilder">The <see cref="StringBuilder"/> to append the task hint to.</param>
|
||||
/// <param name="taskStringBuilder">The <see cref="Il2CppSystem.Text.StringBuilder"/> to append the task hint to.</param>
|
||||
[HarmonyReversePatch]
|
||||
[HarmonyPatch(typeof(RoleBehaviour), nameof(RoleBehaviour.AppendTaskHint), typeof(Il2CppSystem.Text.StringBuilder))]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
|
||||
@@ -16,6 +16,7 @@ namespace MiraAPI.Presets;
|
||||
|
||||
[RegisterInIl2Cpp]
|
||||
[SuppressMessage("Style", "IDE0051:Remove unused private members", Justification = "Unity convention.")]
|
||||
[SuppressMessage("Design", "CA1050:Declare types in namespaces", Justification = "Unity script.")]
|
||||
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member (Justification: Unity fields; ignore.)
|
||||
public class SavePresetPopup(nint cppPtr) : Minigame(cppPtr)
|
||||
{
|
||||
|
||||
@@ -345,7 +345,14 @@ public interface ICustomRole : IOptionable
|
||||
/// Gets the list of abilities or other similar information to display below the text of a role's wiki page.
|
||||
/// </summary>
|
||||
[HideFromIl2Cpp]
|
||||
public List<AdvancedWikiAbilityDescription> WikiAbilities => [];
|
||||
List<AdvancedWikiAbilityDescription> WikiAbilities => [];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A data holder of an ability's wiki entry.
|
||||
/// </summary>
|
||||
/// <param name="Name">The name of the ability.</param>
|
||||
/// <param name="AbilityType">The type of the ability.</param>
|
||||
/// <param name="Description">The description of the ability.</param>
|
||||
/// <param name="Icon">The icon sprite of the ability.</param>
|
||||
public record struct AdvancedWikiAbilityDescription(string Name, string AbilityType, string Description, LoadableAsset<Sprite> Icon);
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@@ -162,7 +161,6 @@ public static class MiraLocaleManager
|
||||
/// <param name="key">The string id to find.</param>
|
||||
/// <param name="fallback">Fallback string to use if no translation is found.</param>
|
||||
/// <returns>A <see cref="string"/> based on the key provided.</returns>
|
||||
[SuppressMessage("Style", "IDE0046:Convert to conditional expression", Justification = "Warning cascades into forcing the entire tree to be ternary operators.")]
|
||||
public static string Get(MiraLanguage language, string key, string fallback = "")
|
||||
{
|
||||
if (Locale.TryGetValue(language, out var translations) &&
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
|
||||
namespace MiraAPI.Utilities;
|
||||
@@ -9,7 +8,6 @@ internal sealed class ControllableComparer<T>(T[] forcedToBottom, T[] forcedToTo
|
||||
where T : IComparable
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
[SuppressMessage("Style", "IDE0046:Convert to conditional expression", Justification = "Warning cascades into forcing the entire tree to be ternary operators.")]
|
||||
public int Compare(T? x, T? y)
|
||||
{
|
||||
if ((forcedToBottom.Contains(x) && forcedToBottom.Contains(y)) || (forcedToTop.Contains(x) && forcedToTop.Contains(y)))
|
||||
|
||||
@@ -32,6 +32,11 @@ public static class Helpers
|
||||
{
|
||||
private static readonly Regex TrailingZeroRegex = new(@"\.0+(?!\d)", RegexOptions.Compiled, TimeSpan.FromMilliseconds(100));
|
||||
|
||||
/// <summary>
|
||||
/// Gets all of the options stored within the provided type.
|
||||
/// </summary>
|
||||
/// <param name="classType">The type to get the options of.</param>
|
||||
/// <returns>A readonly list of options from the provided type.</returns>
|
||||
public static ReadOnlyCollection<IModdedOption>? GetModdedOptionsForType(Type classType)
|
||||
{
|
||||
var group = ModdedOptionsManager.Groups.FirstOrDefault(x => x.OptionableType == classType);
|
||||
@@ -39,6 +44,11 @@ public static class Helpers
|
||||
return group?.Children;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the option text of the provided type.
|
||||
/// </summary>
|
||||
/// <param name="classType">The type to get the text for.</param>
|
||||
/// <returns>The options text of the provided type.</returns>
|
||||
public static string GetOptionsText(Type classType)
|
||||
{
|
||||
var group = ModdedOptionsManager.Groups.FirstOrDefault(x => x.OptionableType == classType);
|
||||
@@ -836,7 +846,7 @@ public static class Helpers
|
||||
obj.transform.SetParent(parent.Inner.transform);
|
||||
obj.transform.localPosition = new Vector3(0f, 0.5f, 0f);
|
||||
var scrollHeight = variableTextSizing
|
||||
? (desc.textBounds.size.y - 2.5f) + maxTextSize + 0.475f
|
||||
? desc.textBounds.size.y - 2.5f + maxTextSize + 0.475f
|
||||
: desc.textBounds.size.y - 2.5f + Mathf.Ceil(num / 2f) * 1.45f;
|
||||
parent.SetYBoundsMax(Mathf.Clamp(scrollHeight, 0f, 999f));
|
||||
return obj;
|
||||
@@ -857,6 +867,7 @@ public static class Helpers
|
||||
panel.roleDescription.fontSizeMin = 1.5f;
|
||||
panel.roleDescription.ForceMeshUpdate();
|
||||
}
|
||||
|
||||
panel.roleIcon.sprite = ability.Icon.LoadAsset();
|
||||
panel.roleIcon.SetSizeLimit(0.13f);
|
||||
|
||||
|
||||
Reference in new issue
Block a user