mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-19 15:51:48 +00:00
fix merge errors
This commit is contained in:
1 parent
1664aa1003
commit
a1611f5f7a
10 files changed
+29
-27
No files matched your search
@@ -3,6 +3,7 @@ using System.Globalization;
|
||||
using MiraAPI.Events;
|
||||
using MiraAPI.Events.Mira;
|
||||
using MiraAPI.Keybinds;
|
||||
using MiraAPI.LocalSettings;
|
||||
using MiraAPI.Patches;
|
||||
using MiraAPI.Utilities;
|
||||
using MiraAPI.Utilities.Assets;
|
||||
@@ -493,7 +494,7 @@ public abstract class CustomActionButton
|
||||
{
|
||||
KeybindText.text = Keybind.CurrentKey.ToString();
|
||||
KeybindIcon?.SetActive(ActiveInputManager.currentControlType == ActiveInputManager.InputType.Keyboard &&
|
||||
PluginSingleton<MiraApiPlugin>.Instance.MiraConfig!.ShowKeybinds.Value);
|
||||
LocalSettingsTabSingleton<MiraApiSettings>.Instance.ShowKeybinds.Value);
|
||||
}
|
||||
|
||||
if (Timer >= 0)
|
||||
|
||||
@@ -16,9 +16,12 @@ public class LocalEnumSettingAttribute(
|
||||
string[]? names = null
|
||||
) : LocalSettingAttribute(name, description)
|
||||
{
|
||||
private readonly string? _name = name;
|
||||
private readonly string? _description = description;
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override LocalEnumSetting CreateSetting(Type tab, ConfigEntryBase configEntryBase)
|
||||
{
|
||||
return new LocalEnumSetting(tab, configEntryBase, configEntryBase.SettingType, name, description, names);
|
||||
return new LocalEnumSetting(tab, configEntryBase, configEntryBase.SettingType, _name, _description, names);
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,12 @@ public class LocalNumberSettingAttribute(
|
||||
string? formatString = null
|
||||
) : LocalSettingAttribute(name, description)
|
||||
{
|
||||
private readonly string? _name = name;
|
||||
private readonly string? _description = description;
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override LocalNumberSetting CreateSetting(Type tab, ConfigEntryBase configEntryBase)
|
||||
{
|
||||
return new LocalNumberSetting(tab, configEntryBase, name, description, new FloatRange(min, max), increment, suffixType, formatString);
|
||||
return new LocalNumberSetting(tab, configEntryBase, _name, _description, new FloatRange(min, max), increment, suffixType, formatString);
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,12 @@ public class LocalSliderSettingAttribute(
|
||||
MiraNumberSuffixes suffixType = MiraNumberSuffixes.None
|
||||
) : LocalSettingAttribute(name, description)
|
||||
{
|
||||
private readonly string? _name = name;
|
||||
private readonly string? _description = description;
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override LocalSliderSetting CreateSetting(Type tab, ConfigEntryBase configEntryBase)
|
||||
{
|
||||
return new LocalSliderSetting(tab, configEntryBase, name, description, new FloatRange(min, max), displayValue, suffixType, formatString, roundValue);
|
||||
return new LocalSliderSetting(tab, configEntryBase, _name, _description, new FloatRange(min, max), displayValue, suffixType, formatString, roundValue);
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,12 @@ public class LocalToggleSettingAttribute(
|
||||
string? description = null
|
||||
) : LocalSettingAttribute(name, description)
|
||||
{
|
||||
private readonly string? _name = name;
|
||||
private readonly string? _description = description;
|
||||
|
||||
/// <inheritdoc/>
|
||||
internal override LocalToggleSetting CreateSetting(Type tab, ConfigEntryBase configEntryBase)
|
||||
{
|
||||
return new LocalToggleSetting(tab, configEntryBase, name, description);
|
||||
return new LocalToggleSetting(tab, configEntryBase, _name, _description);
|
||||
}
|
||||
}
|
||||
@@ -25,4 +25,10 @@ public class MiraApiSettings(ConfigFile config) : LocalSettingsTab(config)
|
||||
/// </summary>
|
||||
[LocalToggleSetting]
|
||||
public ConfigEntry<bool> ModifiersHudLeftSide { get; private set; } = config.Bind("Displays", "Show Modifiers HUD on Left Side", false);
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether to show keybinds in the control mapper.
|
||||
/// </summary>
|
||||
[LocalToggleSetting]
|
||||
public ConfigEntry<bool> ShowKeybinds { get; private set; } = config.Bind("Keybinds", "Show Keybinds in Control Mapper", true);
|
||||
}
|
||||
@@ -3,6 +3,7 @@ using System.Linq;
|
||||
using HarmonyLib;
|
||||
using MiraAPI.Hud;
|
||||
using MiraAPI.Keybinds;
|
||||
using MiraAPI.LocalSettings;
|
||||
using MiraAPI.Utilities;
|
||||
using Reactor.Utilities;
|
||||
using Reactor.Utilities.Extensions;
|
||||
@@ -165,7 +166,7 @@ public static class HudManagerPatches
|
||||
{
|
||||
btnIcon.Key.text = KeybindUtils.GetKeycodeByActionId(btnIcon.Value).ToString();
|
||||
btnIcon.Key.transform.parent.gameObject.SetActive(ActiveInputManager.currentControlType == ActiveInputManager.InputType.Keyboard &&
|
||||
PluginSingleton<MiraApiPlugin>.Instance.MiraConfig!.ShowKeybinds.Value);
|
||||
LocalSettingsTabSingleton<MiraApiSettings>.Instance.ShowKeybinds.Value);
|
||||
}
|
||||
|
||||
foreach (var entry in KeybindManager.Keybinds)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Linq;
|
||||
using HarmonyLib;
|
||||
using MiraAPI.Keybinds;
|
||||
using MiraAPI.LocalSettings;
|
||||
using Reactor.Utilities;
|
||||
using Reactor.Utilities.Extensions;
|
||||
using Rewired.UI.ControlMapper;
|
||||
@@ -26,7 +27,7 @@ public static class ControlMapperPatches
|
||||
|
||||
var toggle = Object.Instantiate(doneButton, doneButton.transform.parent);
|
||||
var text = toggle.GetComponentInChildren<TextMeshProUGUI>();
|
||||
var entry = PluginSingleton<MiraApiPlugin>.Instance!.MiraConfig!.ShowKeybinds;
|
||||
var entry = LocalSettingsTabSingleton<MiraApiSettings>.Instance.ShowKeybinds;
|
||||
toggle.gameObject.name = "KeybindsVisibleToggle";
|
||||
text.text = $"Show Keybinds: {(entry.Value ? "On" : "Off")}";
|
||||
toggle.onClick.RemoveAllListeners();
|
||||
|
||||
@@ -69,7 +69,7 @@ public static class MiraAssets
|
||||
/// Gets the Next Button sprite.
|
||||
/// </summary>
|
||||
public static LoadableResourceAsset NextButton { get; } = new("MiraAPI.Resources.NextButton.png");
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Mira settings icon..
|
||||
/// </summary>
|
||||
|
||||
@@ -476,25 +476,6 @@ public static class Helpers
|
||||
.Select(s => s[UnityEngine.Random.RandomRangeInt(0, s.Length)]).ToArray());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finds and returns an unused KeyCode that is not equal to the excluded key.
|
||||
/// </summary>
|
||||
/// <param name="exclude">The KeyCode to skip during the search.</param>
|
||||
/// <returns>
|
||||
/// The first available KeyCode not currently used by any registered keybind,
|
||||
/// or KeyCode.None if none are available.
|
||||
/// </returns>
|
||||
public static KeyboardKeyCode FindAvailableKey(KeyboardKeyCode exclude)
|
||||
{
|
||||
foreach (KeyboardKeyCode key in Enum.GetValues(typeof(KeyboardKeyCode)))
|
||||
{
|
||||
if (key == exclude) continue;
|
||||
bool used = KeybindManager.GetEntries().Exists(e => e.Key == key);
|
||||
if (!used) return key;
|
||||
}
|
||||
return KeyboardKeyCode.None;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the formated value using the specified suffix and format string.
|
||||
/// </summary>
|
||||
|
||||
Reference in new issue
Block a user