From 2d0b7c80f589c42ca62aff0c88d58093b5fe12d1 Mon Sep 17 00:00:00 2001 From: _nebula <41904486+misternebula@users.noreply.github.com> Date: Mon, 22 May 2023 00:34:52 +0100 Subject: [PATCH 01/96] create rebinding helper --- .../Interfaces/IRebindingHelper.cs | 16 ++++++ src/OWML.ModHelper.Input/RebindingHelper.cs | 51 +++++++++++++++++++ 2 files changed, 67 insertions(+) create mode 100644 src/OWML.Common/Interfaces/IRebindingHelper.cs create mode 100644 src/OWML.ModHelper.Input/RebindingHelper.cs diff --git a/src/OWML.Common/Interfaces/IRebindingHelper.cs b/src/OWML.Common/Interfaces/IRebindingHelper.cs new file mode 100644 index 000000000..485a6eb53 --- /dev/null +++ b/src/OWML.Common/Interfaces/IRebindingHelper.cs @@ -0,0 +1,16 @@ +using System.Collections.Generic; +using UnityEngine.InputSystem; + +namespace OWML.Common +{ + public interface IRebindingHelper + { + public List Rebindables { get; } + + public InputConsts.InputCommandType RegisterRebindableAxis(string name, string primary); + + public InputAction RegisterCustomAction(string name); + + public void AddBinding(InputAction action, string control); + } +} diff --git a/src/OWML.ModHelper.Input/RebindingHelper.cs b/src/OWML.ModHelper.Input/RebindingHelper.cs new file mode 100644 index 000000000..da9cb44c3 --- /dev/null +++ b/src/OWML.ModHelper.Input/RebindingHelper.cs @@ -0,0 +1,51 @@ +using OWML.Common; +using OWML.Utils; +using System.Collections.Generic; +using UnityEngine.InputSystem; + +namespace OWML.ModHelper.Input +{ + public class RebindingHelper : IRebindingHelper + { + public static InputActionMap CustomActionMap = new("OWMLCustomActionMap"); + + public List Rebindables { get; } = new List(); + + private readonly IModConsole _console; + + public RebindingHelper(IModConsole console) + { + _console = console; + } + + public IInputCommands GetCommand(InputConsts.InputCommandType commandType) => InputLibrary.GetInputCommand(commandType); + + // must be called in Start() + public InputConsts.InputCommandType RegisterRebindableAxis(string name, string primary) + { + _console.WriteLine($"RegisterRebindableAxis name:{name} primary:{primary}"); + + var commandType = EnumUtils.Create(name); + var rebindableId = EnumUtils.Create(primary); + + var inputCommandData = InputCommandDefinitions.InputCommandData.CreateCommandData(CommandDataType.Axis, commandType); + inputCommandData.TrySetAsAxis(rebindableId, primary); + InputCommandDefinitions.AddInputCommandData(inputCommandData); + + Rebindables.Add(rebindableId); + + return commandType; + } + + public InputAction RegisterCustomAction(string name) + => CustomActionMap.AddAction( + name, + InputActionType.Button, + interactions: "OWInput", + processors: "OWAxis", + expectedControlLayout: "Button"); + + public void AddBinding(InputAction action, string control) + => CustomActionMap.AddBinding(control, action, groups: "KeyboardMouse"); + } +} From 0dae760c06e5389705c3880cea102b83233bcf46 Mon Sep 17 00:00:00 2001 From: _nebula <41904486+misternebula@users.noreply.github.com> Date: Mon, 22 May 2023 00:35:17 +0100 Subject: [PATCH 02/96] add to containers and modhelper --- src/OWML.Common/Interfaces/IModHelper.cs | 2 ++ src/OWML.ModHelper.Input/OWML.ModHelper.Input.csproj | 1 + src/OWML.ModHelper/ModHelper.cs | 6 +++++- src/OWML.ModLoader/Owo.cs | 2 ++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/OWML.Common/Interfaces/IModHelper.cs b/src/OWML.Common/Interfaces/IModHelper.cs index c120ae2b5..8d06dd278 100644 --- a/src/OWML.Common/Interfaces/IModHelper.cs +++ b/src/OWML.Common/Interfaces/IModHelper.cs @@ -25,5 +25,7 @@ public interface IModHelper IOwmlConfig OwmlConfig { get; } IModInteraction Interaction { get; } + + IRebindingHelper RebindingHelper { get; } } } diff --git a/src/OWML.ModHelper.Input/OWML.ModHelper.Input.csproj b/src/OWML.ModHelper.Input/OWML.ModHelper.Input.csproj index 8a7df8688..f3c04a9f5 100644 --- a/src/OWML.ModHelper.Input/OWML.ModHelper.Input.csproj +++ b/src/OWML.ModHelper.Input/OWML.ModHelper.Input.csproj @@ -3,6 +3,7 @@ net48 9.0 + True diff --git a/src/OWML.ModHelper/ModHelper.cs b/src/OWML.ModHelper/ModHelper.cs index 5e70eeb4c..6de9d0cfa 100644 --- a/src/OWML.ModHelper/ModHelper.cs +++ b/src/OWML.ModHelper/ModHelper.cs @@ -27,6 +27,8 @@ public class ModHelper : IModHelper public IModInteraction Interaction { get; } + public IRebindingHelper RebindingHelper { get; } + public ModHelper( IModLogger logger, IModConsole console, @@ -38,7 +40,8 @@ public ModHelper( IModManifest manifest, IModConfig config, IOwmlConfig owmlConfig, - IModInteraction interaction) + IModInteraction interaction, + IRebindingHelper rebinding) { Logger = logger; Console = console; @@ -51,6 +54,7 @@ public ModHelper( Config = config; OwmlConfig = owmlConfig; Interaction = interaction; + RebindingHelper = rebinding; } } } diff --git a/src/OWML.ModLoader/Owo.cs b/src/OWML.ModLoader/Owo.cs index 8f55c0b21..ad4f2163c 100644 --- a/src/OWML.ModLoader/Owo.cs +++ b/src/OWML.ModLoader/Owo.cs @@ -7,6 +7,7 @@ using OWML.ModHelper; using OWML.ModHelper.Assets; using OWML.ModHelper.Events; +using OWML.ModHelper.Input; using OWML.ModHelper.Interaction; using OWML.Utils; using System; @@ -237,6 +238,7 @@ private IModHelper CreateModHelper(IModData modData) => .Add() .Add() .Add() + .Add() .Add() .Resolve(); From c04d2a3e5e504e3d63ef8416218a9a678eae9d90 Mon Sep 17 00:00:00 2001 From: _nebula <41904486+misternebula@users.noreply.github.com> Date: Mon, 22 May 2023 00:35:32 +0100 Subject: [PATCH 03/96] update menus --- .../ModMenuWithSelectables.cs | 11 ++++++- src/OWML.ModHelper.Menus/ModsMenu.cs | 30 +++++++++++++++---- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/src/OWML.ModHelper.Menus/ModMenuWithSelectables.cs b/src/OWML.ModHelper.Menus/ModMenuWithSelectables.cs index 16377d48c..7212fdbcb 100644 --- a/src/OWML.ModHelper.Menus/ModMenuWithSelectables.cs +++ b/src/OWML.ModHelper.Menus/ModMenuWithSelectables.cs @@ -90,7 +90,16 @@ public override void Initialize(Menu menu) UpdateNavigation(); } - public override void SelectFirst() => Menu.SetSelectOnActivate(Selectables[0]); + public override void SelectFirst() + { + if (Selectables == null || Selectables.Count == 0) + { + Console.WriteLine("No selectables in ModMenuWithSelectables", MessageType.Error); + return; + } + + Menu.SetSelectOnActivate(Selectables[0]); + } public override void UpdateNavigation() { diff --git a/src/OWML.ModHelper.Menus/ModsMenu.cs b/src/OWML.ModHelper.Menus/ModsMenu.cs index ca773160f..d468bf8ed 100644 --- a/src/OWML.ModHelper.Menus/ModsMenu.cs +++ b/src/OWML.ModHelper.Menus/ModsMenu.cs @@ -17,7 +17,7 @@ public class ModsMenu : ModPopupMenu, IModsMenu private readonly IModStorage _storage; private readonly List _modConfigMenus = new(); - private readonly List _noConfigMods = new(); + private readonly List<(IModData data, IModBehaviour mod)> _noConfigMods = new(); private readonly List _menuOptions = new(); private IModMenus _menus; @@ -39,7 +39,7 @@ public void AddMod(IModData modData, IModBehaviour mod) } else { - _noConfigMods.Add(modData); + _noConfigMods.Add((modData, mod)); } } @@ -57,6 +57,19 @@ public IModConfigMenu GetModMenu(IModBehaviour modBehaviour) public void Initialize(IModMenus menus, IModOWMenu owMenu) { + var modsToRemove = new List<(IModData data, IModBehaviour mod)>(); + + foreach (var item in _noConfigMods) + { + if (item.mod.ModHelper.RebindingHelper.Rebindables.Count != 0) + { + modsToRemove.Add(item); + _modConfigMenus.Add(new ModConfigMenu(item.data, item.mod, _storage, Console)); + } + } + + _noConfigMods.RemoveAll(x => modsToRemove.Contains(x)); + _modConfigMenus.ForEach(x => x.RemoveAllListeners()); OwmlMenu.RemoveAllListeners(); @@ -98,17 +111,17 @@ private IModPopupMenu CreateModsMenu(IModTabbedMenu options) var enabledMods = _modConfigMenus.Where(modConfigMenu => modConfigMenu.ModData.Config.Enabled).ToList(); var index = CreateBlockOfButtons(options, modsTab, enabledMods, 1, "-- ENABLED MODS --"); - foreach (var mod in _noConfigMods.Where(modData => modData.Config.Enabled)) + foreach (var (data, mod) in _noConfigMods.Where(x => x.data.Config.Enabled)) { - index = CreateSeparator(options, modsTab, index, mod.Manifest.Name); + index = CreateSeparator(options, modsTab, index, data.Manifest.Name); } var disabledMods = _modConfigMenus.Except(enabledMods).ToList(); index = CreateBlockOfButtons(options, modsTab, disabledMods, index, "-- DISABLED MODS --"); - foreach (var mod in _noConfigMods.Where(modData => !modData.Config.Enabled)) + foreach (var (data, mod) in _noConfigMods.Where(x => !x.data.Config.Enabled)) { - index = CreateSeparator(options, modsTab, index, mod.Manifest.Name); + index = CreateSeparator(options, modsTab, index, data.Manifest.Name); } modsTab.Menu.SetValue("_menuOptions", _menuOptions.ToArray()); @@ -118,6 +131,8 @@ private IModPopupMenu CreateModsMenu(IModTabbedMenu options) private int CreateBlockOfButtons(IModTabbedMenu options, IModTabMenu menu, List configMenus, int index, string title) { + Console.WriteLine($"CreateBlockOfButtons - {configMenus.Count} mods"); + index = CreateSeparator(options, menu, index, $"{Environment.NewLine}{title}{Environment.NewLine}"); if (configMenus.Count <= 0) @@ -132,6 +147,9 @@ private int CreateBlockOfButtons(IModTabbedMenu options, IModTabMenu menu, InitConfigMenu(modConfigMenu, options, modTab); modButton.OnClick += () => modTab.Open(); menu.AddButton((IModButtonBase)modButton, index++); + + var rebindButton = CreateButton(options, "Rebinding"); + modTab.AddButton((IModButtonBase)rebindButton, 0); } return index; } From e232f42d06399794be5ebfd1b2d0584799d198eb Mon Sep 17 00:00:00 2001 From: _nebula <41904486+misternebula@users.noreply.github.com> Date: Mon, 22 May 2023 00:49:53 +0100 Subject: [PATCH 04/96] Update Readme.md --- Readme.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Readme.md b/Readme.md index 6a6d44f79..7d446192f 100644 --- a/Readme.md +++ b/Readme.md @@ -46,14 +46,9 @@ To get started, check out [our tutorial on the docs](https://owml.outerwildsmods ## Compatibility -|Version|Compatible| -|-|-| -|1.1.10|Yes| -|1.1.9|Unknown| -|1.1.8|Unknown| -|1.0.0 - 1.0.7|No| +OWML is only supported on the latest game version, `1.1.13.456`. It may work on older versions, but that cannot be guaranteed. -OWML is compatible with Echoes of the Eye, and works on both Epic and Steam installations. +OWML is compatible with Echoes of the Eye, and works on Epic, Steam, and Microsoft Store installations. ## Feedback and Support @@ -80,7 +75,7 @@ Contributors: * [JohnCorby](https://github.com/JohnCorby) - Helped with audio loading stuff. Special thanks to: -* [Outer Wilds](http://www.outerwilds.com) +* [Outer Wilds](https://www.mobiusdigitalgames.com/outer-wilds.html) * [Outer Wilds on Reddit](https://www.reddit.com/r/outerwilds) * The unnofficial Outer Wilds Discord * Inspired by (and some code from) [SMAPI](https://smapi.io) From 182522920731a8c951992303094d0a6a5b6d31fc Mon Sep 17 00:00:00 2001 From: _nebula <41904486+misternebula@users.noreply.github.com> Date: Mon, 22 May 2023 11:32:24 +0100 Subject: [PATCH 05/96] add patch --- src/OWML.ModHelper.Input/Patches.cs | 36 +++++++++++++++++++++ src/OWML.ModHelper.Input/RebindingHelper.cs | 24 ++++++++++++-- 2 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 src/OWML.ModHelper.Input/Patches.cs diff --git a/src/OWML.ModHelper.Input/Patches.cs b/src/OWML.ModHelper.Input/Patches.cs new file mode 100644 index 000000000..3dc49ef2e --- /dev/null +++ b/src/OWML.ModHelper.Input/Patches.cs @@ -0,0 +1,36 @@ +using OWML.Logging; +using System; +using UnityEngine; +using UnityEngine.InputSystem; + +namespace OWML.ModHelper.Input +{ + internal static class Patches + { + public static bool LoadActions(InputCommandManager __instance, string json, ref bool __result) + { + ModConsole.OwmlConsole.WriteLine("Inserting custom action map..."); + + var flag = false; + try + { + var inputActionAsset = InputActionAsset.FromJson(json); + + foreach (var action in RebindingHelper.CustomActionMap.actions) + { + ModConsole.OwmlConsole.WriteLine($"- name:{action.name}"); + } + + inputActionAsset.AddActionMap(RebindingHelper.CustomActionMap); + flag = __instance.LoadActions(inputActionAsset); + } + catch (Exception ex) + { + Debug.LogException(ex); + } + + __result = flag; + return false; + } + } +} diff --git a/src/OWML.ModHelper.Input/RebindingHelper.cs b/src/OWML.ModHelper.Input/RebindingHelper.cs index da9cb44c3..9b43e5c7b 100644 --- a/src/OWML.ModHelper.Input/RebindingHelper.cs +++ b/src/OWML.ModHelper.Input/RebindingHelper.cs @@ -1,6 +1,8 @@ using OWML.Common; using OWML.Utils; +using System; using System.Collections.Generic; +using System.Reflection; using UnityEngine.InputSystem; namespace OWML.ModHelper.Input @@ -13,14 +15,16 @@ public class RebindingHelper : IRebindingHelper private readonly IModConsole _console; - public RebindingHelper(IModConsole console) + public RebindingHelper(IModConsole console, IHarmonyHelper harmony) { _console = console; + + // this adds the prefix once per mod, but it shouldn't affect anything? + harmony.AddPrefix(typeof(InputCommandManager).GetMethod("LoadActions", new Type[] { typeof(string) }), typeof(Patches), nameof(Patches.LoadActions)); } public IInputCommands GetCommand(InputConsts.InputCommandType commandType) => InputLibrary.GetInputCommand(commandType); - // must be called in Start() public InputConsts.InputCommandType RegisterRebindableAxis(string name, string primary) { _console.WriteLine($"RegisterRebindableAxis name:{name} primary:{primary}"); @@ -37,6 +41,22 @@ public InputConsts.InputCommandType RegisterRebindableAxis(string name, string p return commandType; } + public InputConsts.InputCommandType RegisterRebindableAxis(string name, string primary, string secondary) + { + _console.WriteLine($"RegisterRebindableAxis name:{name} primary:{primary} secondary:{secondary}"); + + var commandType = EnumUtils.Create(name); + var rebindableId = EnumUtils.Create(primary); + + var inputCommandData = InputCommandDefinitions.InputCommandData.CreateCommandData(CommandDataType.Axis, commandType); + inputCommandData.TrySetAsAxis(rebindableId, primary, secondary); + InputCommandDefinitions.AddInputCommandData(inputCommandData); + + Rebindables.Add(rebindableId); + + return commandType; + } + public InputAction RegisterCustomAction(string name) => CustomActionMap.AddAction( name, From 26587ba70de07ef79982d365d2a310fa4ec87b14 Mon Sep 17 00:00:00 2001 From: _nebula <41904486+misternebula@users.noreply.github.com> Date: Mon, 22 May 2023 16:48:23 +0100 Subject: [PATCH 06/96] stuff? --- src/OWML.ModHelper.Input/Patches.cs | 224 +++++++++++++++++++- src/OWML.ModHelper.Input/RebindingHelper.cs | 4 + src/OWML.ModHelper.Menus/ModsMenu.cs | 25 ++- 3 files changed, 247 insertions(+), 6 deletions(-) diff --git a/src/OWML.ModHelper.Input/Patches.cs b/src/OWML.ModHelper.Input/Patches.cs index 3dc49ef2e..0025c4198 100644 --- a/src/OWML.ModHelper.Input/Patches.cs +++ b/src/OWML.ModHelper.Input/Patches.cs @@ -9,8 +9,6 @@ internal static class Patches { public static bool LoadActions(InputCommandManager __instance, string json, ref bool __result) { - ModConsole.OwmlConsole.WriteLine("Inserting custom action map..."); - var flag = false; try { @@ -21,7 +19,30 @@ public static bool LoadActions(InputCommandManager __instance, string json, ref ModConsole.OwmlConsole.WriteLine($"- name:{action.name}"); } - inputActionAsset.AddActionMap(RebindingHelper.CustomActionMap); + var existingActionMap = inputActionAsset.FindActionMap(RebindingHelper.CustomActionMap.name); + if (existingActionMap != null) + { + ModConsole.OwmlConsole.WriteLine("Found existing custom action map"); + foreach (var newAction in RebindingHelper.CustomActionMap.actions) + { + if (existingActionMap.FindAction(newAction.name) == null) + { + ModConsole.OwmlConsole.WriteLine($"- Couldn't find {newAction.name} in existing action map"); + existingActionMap.AddAction(newAction.name, newAction.type, null, newAction.interactions, newAction.processors, null, newAction.expectedControlType); + foreach (var binding in newAction.bindings) + { + existingActionMap.AddBinding(binding); + } + } + } + } + else + { + ModConsole.OwmlConsole.WriteLine("Inserting custom action map"); + inputActionAsset.AddActionMap(RebindingHelper.CustomActionMap); + } + + flag = __instance.LoadActions(inputActionAsset); } catch (Exception ex) @@ -32,5 +53,202 @@ public static bool LoadActions(InputCommandManager __instance, string json, ref __result = flag; return false; } + + public static bool TryCreateInputCommands(InputCommandDefinitions.InputCommandData data, InputActionAsset asset, out IInputCommands command, ref bool __result) + { + ModConsole.OwmlConsole.WriteLine($"TryCreateInputCommands - CommandType:{data.CommandType} DataType:{data.DataType}"); + + command = null; + if (!data.IsValid) + { + Debug.LogError("Invalid InputCommandData"); + __result = false; + return false; + } + + if (data.DataType == CommandDataType.Undefined) + { + __result = false; + return false; + } + + if (data.DataType == CommandDataType.Basic && InputCommandUtils.TryCreateBasicAction(data.DataType, data.Primary, asset, out var vectorInputAction)) + { + command = new InputCommands(data.CommandType, vectorInputAction); + __result = true; + return false; + } + + if (!InputCommandUtils.TryCreateAxisAction(data.DataType, data.Primary, asset, out var axisInputAction)) + { + Debug.LogError("Invalid primary axis ActionData for InputCommandType " + data.CommandType.ToString()); + __result = false; + return false; + } + + if (data.IsComposite) + { + if (!InputCommandUtils.TryCreateAxisAction(data.DataType, data.Secondary, asset, out var axisInputAction2)) + { + Debug.LogError("Invalid secondary axis ActionData for InputCommandType " + data.CommandType.ToString()); + __result = false; + return false; + } + + if (axisInputAction is not IInputActionPair inputActionPair || axisInputAction2 is not IInputActionPair inputActionPair2) + { + Debug.LogError("Composite bindings not InputActionPairs"); + __result = false; + return false; + } + + command = new CompositeInputCommands(data.CommandType, inputActionPair, inputActionPair2); + __result = true; + return false; + } + else + { + if (!data.IsSingle) + { + Debug.LogError("Single Action InputCommand with type " + data.CommandType.ToString() + " unhandled"); + __result = false; + return false; + } + + command = new InputAxisCommands(data.CommandType, axisInputAction); + __result = true; + return false; + } + } + + public static bool TryCreateBasicAction(CommandDataType type, InputCommandDefinitions.InputActionData actionData, InputActionAsset asset, out IVectorInputAction action, ref bool __result) + { + ModConsole.OwmlConsole.WriteLine($"TryCreateBasicAction - actionData.actionName1:{actionData.ActionName1}"); + + action = null; + if (type != CommandDataType.Basic) + { + ModConsole.OwmlConsole.WriteLine("- NOT BASIC!"); + __result = false; + return false; + } + + if (!actionData.IsSingle) + { + ModConsole.OwmlConsole.WriteLine("- NOT SINGLE!"); + __result = false; + return false; + } + + var inputAction = asset.FindAction(actionData.ActionName1, false); + if (inputAction == null) + { + ModConsole.OwmlConsole.WriteLine("- NOT IN ASSET!"); + __result = false; + return false; + } + + InputCommandManager.SanitizeActionForPlatform(inputAction); + var isRebindable = actionData.IsRebindable; + if (InputCommandManager.RebindableInputActionsMap.ContainsKey(actionData.ID)) + { + ModConsole.OwmlConsole.WriteLine($" - in rebindable action map"); + action = InputCommandManager.RebindableInputActionsMap[actionData.ID] as RebindableInputAction; + if (action == null) + { + Debug.LogError("IRebindableInputAction RebindableInputActionsMap mismatch when loading " + actionData.ID); + } + } + else if (isRebindable) + { + ModConsole.OwmlConsole.WriteLine($" - not in rebindable action map, is rebindable"); + action = new RebindableInputAction(actionData.ID, inputAction); + InputCommandManager.RebindableInputActionsMap.Add(actionData.ID, (RebindableInputAction)action); + } + else + { + ModConsole.OwmlConsole.WriteLine($" - not in rebindable action map, not rebindable"); + action = new BasicInputAction(inputAction); + } + + __result = action != null; + return false; + } + + public static bool TryCreateAxisAction(CommandDataType type, InputCommandDefinitions.InputActionData actionData, InputActionAsset asset, out IAxisInputAction action, ref bool __result) + { + ModConsole.OwmlConsole.WriteLine($"TryCreateAxisAction - actionData.actionName1:{actionData.ActionName1}"); + + action = null; + if (type != CommandDataType.Axis && type != CommandDataType.Composite) + { + ModConsole.OwmlConsole.WriteLine($"- type is not axis or composite!"); + __result = false; + return false; + } + + InputAction inputAction = asset.FindAction(actionData.ActionName1, false); + if (inputAction == null) + { + ModConsole.OwmlConsole.WriteLine($"- NOT IN ASSET"); + __result = false; + return false; + } + + InputCommandManager.SanitizeActionForPlatform(inputAction); + bool isRebindable = actionData.IsRebindable; + if (!actionData.IsPair) + { + if (InputCommandManager.RebindableInputActionsMap.ContainsKey(actionData.ID)) + { + action = InputCommandManager.RebindableInputActionsMap[actionData.ID] as RebindableAxisInputAction; + if (action == null) + { + Debug.LogError("IRebindableInputAction RebindableInputActionsMap mismatch when loading " + actionData.ID); + } + } + else if (isRebindable) + { + action = new RebindableAxisInputAction(actionData.ID, inputAction); + InputCommandManager.RebindableInputActionsMap.Add(actionData.ID, (RebindableAxisInputAction)action); + } + else + { + action = new AxisInputAction(inputAction); + } + + __result = action != null; + return false; + } + + InputAction inputAction2 = asset.FindAction(actionData.ActionName2, false); + if (inputAction2 == null) + { + __result = false; + return false; + } + + InputCommandManager.SanitizeActionForPlatform(inputAction2); + if (InputCommandManager.RebindableInputActionsMap.ContainsKey(actionData.ID)) + { + action = InputCommandManager.RebindableInputActionsMap[actionData.ID] as RebindableInputActionPair; + if (action == null) + { + Debug.LogError("IRebindableInputAction RebindableInputActionsMap mismatch when loading " + actionData.ID); + } + } + else if (isRebindable) + { + action = new RebindableInputActionPair(actionData.ID, inputAction, inputAction2); + InputCommandManager.RebindableInputActionsMap.Add(actionData.ID, (RebindableInputActionPair)action); + } + else + { + action = new InputActionPair(inputAction, inputAction2); + } + + __result = action != null; + return false; + } } } diff --git a/src/OWML.ModHelper.Input/RebindingHelper.cs b/src/OWML.ModHelper.Input/RebindingHelper.cs index 9b43e5c7b..0fdb06ef2 100644 --- a/src/OWML.ModHelper.Input/RebindingHelper.cs +++ b/src/OWML.ModHelper.Input/RebindingHelper.cs @@ -21,6 +21,10 @@ public RebindingHelper(IModConsole console, IHarmonyHelper harmony) // this adds the prefix once per mod, but it shouldn't affect anything? harmony.AddPrefix(typeof(InputCommandManager).GetMethod("LoadActions", new Type[] { typeof(string) }), typeof(Patches), nameof(Patches.LoadActions)); + + //harmony.AddPrefix(typeof(InputCommandUtils).GetMethod("TryCreateInputCommands", BindingFlags.Static | BindingFlags.Public), typeof(Patches), nameof(Patches.TryCreateInputCommands)); + //harmony.AddPrefix(typeof(InputCommandUtils).GetMethod("TryCreateBasicAction", BindingFlags.Static | BindingFlags.NonPublic), typeof(Patches), nameof(Patches.TryCreateBasicAction)); + //harmony.AddPrefix(typeof(InputCommandUtils).GetMethod("TryCreateAxisAction", BindingFlags.Static | BindingFlags.NonPublic), typeof(Patches), nameof(Patches.TryCreateAxisAction)); } public IInputCommands GetCommand(InputConsts.InputCommandType commandType) => InputLibrary.GetInputCommand(commandType); diff --git a/src/OWML.ModHelper.Menus/ModsMenu.cs b/src/OWML.ModHelper.Menus/ModsMenu.cs index d468bf8ed..cb7fd4286 100644 --- a/src/OWML.ModHelper.Menus/ModsMenu.cs +++ b/src/OWML.ModHelper.Menus/ModsMenu.cs @@ -147,9 +147,7 @@ private int CreateBlockOfButtons(IModTabbedMenu options, IModTabMenu menu, InitConfigMenu(modConfigMenu, options, modTab); modButton.OnClick += () => modTab.Open(); menu.AddButton((IModButtonBase)modButton, index++); - - var rebindButton = CreateButton(options, "Rebinding"); - modTab.AddButton((IModButtonBase)rebindButton, 0); + InitRebindingOptions(modConfigMenu, options, modTab); } return index; } @@ -168,6 +166,27 @@ private void InitConfigMenu(IModConfigMenuBase modConfigMenu, IModTabbedMenu opt modConfigMenu.UpdateUIValues(); } + private void InitRebindingOptions(IModConfigMenu modConfigMenu, IModTabbedMenu options, IModTabMenu menu) + { + if (!modConfigMenu.ModData.Config.Enabled) + { + return; + } + + var rebindableIds = modConfigMenu.Mod.ModHelper.RebindingHelper.Rebindables; + var rebindingElementTemplate = options.InputTab.Menu.transform.Find("MenuGeneral").Find("UIElement-Pause"); + + foreach (var id in rebindableIds) + { + // sorry, but i have no idea how to extend the current menu system for this. so im just doing it the hacky way + var newRebindingElement = UnityEngine.Object.Instantiate(rebindingElementTemplate); + newRebindingElement.transform.parent = menu.Menu.transform.Find("Scroll View").Find("Viewport").Find("Content"); + newRebindingElement.transform.localScale = Vector3.one; + newRebindingElement.GetComponent().SetValue("_rebindId", id); + newRebindingElement.GetComponent().Initialize(); + } + } + private IModButton CreateButton(IModTabbedMenu options, string name) { var modButton = options.GameplayTab.Buttons.First().Copy(name); From 5e2dac56581f92d0212e0ee418e3d9522fbffc9c Mon Sep 17 00:00:00 2001 From: _nebula <41904486+misternebula@users.noreply.github.com> Date: Mon, 22 May 2023 19:06:57 +0100 Subject: [PATCH 07/96] aaaaa --- src/OWML.Common/Interfaces/IModHelper.cs | 6 +- .../Interfaces/Menus/IModButton.cs | 36 -- .../Interfaces/Menus/IModButtonBase.cs | 33 -- .../Interfaces/Menus/IModConfigMenu.cs | 9 - .../Interfaces/Menus/IModConfigMenuBase.cs | 18 - .../Interfaces/Menus/IModFieldInput.cs | 7 - src/OWML.Common/Interfaces/Menus/IModInput.cs | 11 - .../Interfaces/Menus/IModInputBase.cs | 21 -- .../Interfaces/Menus/IModInputMenu.cs | 17 - .../Interfaces/Menus/IModLayoutButton.cs | 7 - .../Interfaces/Menus/IModLayoutManager.cs | 24 -- .../Interfaces/Menus/IModMainMenu.cs | 21 -- src/OWML.Common/Interfaces/Menus/IModMenu.cs | 95 ------ .../Menus/IModMenuWithSelectables.cs | 9 - src/OWML.Common/Interfaces/Menus/IModMenus.cs | 13 - .../Interfaces/Menus/IModMessagePopup.cs | 17 - .../Interfaces/Menus/IModNumberInput.cs | 9 - .../Interfaces/Menus/IModOWMenu.cs | 11 - .../Interfaces/Menus/IModPauseMenu.cs | 15 - .../Interfaces/Menus/IModPopupManager.cs | 11 - .../Interfaces/Menus/IModPopupMenu.cs | 38 --- .../Interfaces/Menus/IModPromptButton.cs | 9 - .../Interfaces/Menus/IModSelectorInput.cs | 15 - .../Interfaces/Menus/IModSeparator.cs | 13 - .../Interfaces/Menus/IModSliderInput.cs | 15 - .../Interfaces/Menus/IModTabMenu.cs | 15 - .../Interfaces/Menus/IModTabbedMenu.cs | 23 -- .../Interfaces/Menus/IModTemporaryPopup.cs | 7 - .../Interfaces/Menus/IModTextInput.cs | 9 - .../Interfaces/Menus/IModToggleInput.cs | 13 - src/OWML.Common/Interfaces/Menus/IModsMenu.cs | 11 - src/OWML.Common/Interfaces/Menus/InputType.cs | 10 - src/OWML.ModHelper.Menus/ModButtonBase.cs | 99 ------ src/OWML.ModHelper.Menus/ModConfigMenu.cs | 97 ------ src/OWML.ModHelper.Menus/ModConfigMenuBase.cs | 174 ---------- src/OWML.ModHelper.Menus/ModFieldInput.cs | 40 --- src/OWML.ModHelper.Menus/ModInput.cs | 62 ---- src/OWML.ModHelper.Menus/ModInputMenu.cs | 100 ------ src/OWML.ModHelper.Menus/ModLayoutButton.cs | 33 -- src/OWML.ModHelper.Menus/ModLayoutManager.cs | 125 ------- src/OWML.ModHelper.Menus/ModMainMenu.cs | 71 ---- src/OWML.ModHelper.Menus/ModMenu.cs | 323 ------------------ .../ModMenuWithSelectables.cs | 183 ---------- src/OWML.ModHelper.Menus/ModMenus.cs | 83 ----- src/OWML.ModHelper.Menus/ModMessagePopup.cs | 72 ---- src/OWML.ModHelper.Menus/ModNumberInput.cs | 54 --- src/OWML.ModHelper.Menus/ModOptionsMenu.cs | 162 --------- src/OWML.ModHelper.Menus/ModPauseMenu.cs | 36 -- src/OWML.ModHelper.Menus/ModPopupInput.cs | 54 --- src/OWML.ModHelper.Menus/ModPopupManager.cs | 85 ----- src/OWML.ModHelper.Menus/ModPopupMenu.cs | 125 ------- src/OWML.ModHelper.Menus/ModPromptButton.cs | 61 ---- src/OWML.ModHelper.Menus/ModSelectorInput.cs | 73 ---- src/OWML.ModHelper.Menus/ModSeparator.cs | 88 ----- src/OWML.ModHelper.Menus/ModSliderInput.cs | 84 ----- src/OWML.ModHelper.Menus/ModTabMenu.cs | 73 ---- src/OWML.ModHelper.Menus/ModTemporaryPopup.cs | 58 ---- src/OWML.ModHelper.Menus/ModTextInput.cs | 53 --- src/OWML.ModHelper.Menus/ModTitleButton.cs | 78 ----- src/OWML.ModHelper.Menus/ModToggleInput.cs | 48 --- src/OWML.ModHelper.Menus/ModUIStyleApplier.cs | 73 ---- src/OWML.ModHelper.Menus/ModsMenu.cs | 221 ------------ .../NewMenuSystem/Interfaces/IMenuManager.cs | 17 + .../Interfaces/IOptionsMenuManager.cs | 23 ++ .../Interfaces/IPauseMenuManager.cs | 13 + .../Interfaces/ITitleMenuManager.cs | 35 ++ .../NewMenuSystem/MenuManager.cs | 22 ++ .../NewMenuSystem/OptionsMenuManager.cs | 84 +++++ .../NewMenuSystem/TitleMenuManager.cs | 61 ++++ .../OWML.ModHelper.Menus.csproj | 1 + src/OWML.ModHelper.Menus/OwmlConfigMenu.cs | 72 ---- src/OWML.ModHelper/ModHelper.cs | 6 - src/OWML.ModLoader/ModLoader.cs | 22 +- src/OWML.ModLoader/Owo.cs | 19 +- .../OWML.LoadCustomAssets/LoadCustomAssets.cs | 7 +- 75 files changed, 282 insertions(+), 3556 deletions(-) delete mode 100644 src/OWML.Common/Interfaces/Menus/IModButton.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModButtonBase.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModConfigMenu.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModConfigMenuBase.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModFieldInput.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModInput.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModInputBase.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModInputMenu.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModLayoutButton.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModLayoutManager.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModMainMenu.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModMenu.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModMenuWithSelectables.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModMenus.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModMessagePopup.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModNumberInput.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModOWMenu.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModPauseMenu.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModPopupManager.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModPopupMenu.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModPromptButton.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModSelectorInput.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModSeparator.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModSliderInput.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModTabMenu.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModTabbedMenu.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModTemporaryPopup.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModTextInput.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModToggleInput.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/IModsMenu.cs delete mode 100644 src/OWML.Common/Interfaces/Menus/InputType.cs delete mode 100644 src/OWML.ModHelper.Menus/ModButtonBase.cs delete mode 100644 src/OWML.ModHelper.Menus/ModConfigMenu.cs delete mode 100644 src/OWML.ModHelper.Menus/ModConfigMenuBase.cs delete mode 100644 src/OWML.ModHelper.Menus/ModFieldInput.cs delete mode 100644 src/OWML.ModHelper.Menus/ModInput.cs delete mode 100644 src/OWML.ModHelper.Menus/ModInputMenu.cs delete mode 100644 src/OWML.ModHelper.Menus/ModLayoutButton.cs delete mode 100644 src/OWML.ModHelper.Menus/ModLayoutManager.cs delete mode 100644 src/OWML.ModHelper.Menus/ModMainMenu.cs delete mode 100644 src/OWML.ModHelper.Menus/ModMenu.cs delete mode 100644 src/OWML.ModHelper.Menus/ModMenuWithSelectables.cs delete mode 100644 src/OWML.ModHelper.Menus/ModMenus.cs delete mode 100644 src/OWML.ModHelper.Menus/ModMessagePopup.cs delete mode 100644 src/OWML.ModHelper.Menus/ModNumberInput.cs delete mode 100644 src/OWML.ModHelper.Menus/ModOptionsMenu.cs delete mode 100644 src/OWML.ModHelper.Menus/ModPauseMenu.cs delete mode 100644 src/OWML.ModHelper.Menus/ModPopupInput.cs delete mode 100644 src/OWML.ModHelper.Menus/ModPopupManager.cs delete mode 100644 src/OWML.ModHelper.Menus/ModPopupMenu.cs delete mode 100644 src/OWML.ModHelper.Menus/ModPromptButton.cs delete mode 100644 src/OWML.ModHelper.Menus/ModSelectorInput.cs delete mode 100644 src/OWML.ModHelper.Menus/ModSeparator.cs delete mode 100644 src/OWML.ModHelper.Menus/ModSliderInput.cs delete mode 100644 src/OWML.ModHelper.Menus/ModTabMenu.cs delete mode 100644 src/OWML.ModHelper.Menus/ModTemporaryPopup.cs delete mode 100644 src/OWML.ModHelper.Menus/ModTextInput.cs delete mode 100644 src/OWML.ModHelper.Menus/ModTitleButton.cs delete mode 100644 src/OWML.ModHelper.Menus/ModToggleInput.cs delete mode 100644 src/OWML.ModHelper.Menus/ModUIStyleApplier.cs delete mode 100644 src/OWML.ModHelper.Menus/ModsMenu.cs create mode 100644 src/OWML.ModHelper.Menus/NewMenuSystem/Interfaces/IMenuManager.cs create mode 100644 src/OWML.ModHelper.Menus/NewMenuSystem/Interfaces/IOptionsMenuManager.cs create mode 100644 src/OWML.ModHelper.Menus/NewMenuSystem/Interfaces/IPauseMenuManager.cs create mode 100644 src/OWML.ModHelper.Menus/NewMenuSystem/Interfaces/ITitleMenuManager.cs create mode 100644 src/OWML.ModHelper.Menus/NewMenuSystem/MenuManager.cs create mode 100644 src/OWML.ModHelper.Menus/NewMenuSystem/OptionsMenuManager.cs create mode 100644 src/OWML.ModHelper.Menus/NewMenuSystem/TitleMenuManager.cs delete mode 100644 src/OWML.ModHelper.Menus/OwmlConfigMenu.cs diff --git a/src/OWML.Common/Interfaces/IModHelper.cs b/src/OWML.Common/Interfaces/IModHelper.cs index 8d06dd278..836577984 100644 --- a/src/OWML.Common/Interfaces/IModHelper.cs +++ b/src/OWML.Common/Interfaces/IModHelper.cs @@ -1,6 +1,4 @@ -using OWML.Common.Menus; - -namespace OWML.Common +namespace OWML.Common { public interface IModHelper { @@ -16,8 +14,6 @@ public interface IModHelper IModStorage Storage { get; } - IModMenus Menus { get; } - IModManifest Manifest { get; } IModConfig Config { get; } diff --git a/src/OWML.Common/Interfaces/Menus/IModButton.cs b/src/OWML.Common/Interfaces/Menus/IModButton.cs deleted file mode 100644 index fcb48625a..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModButton.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using UnityEngine.UI; - -namespace OWML.Common.Menus -{ - public interface IModButton : IModButtonBase - { - event Action OnClick; - - int Index { get; set; } - - Button Button { get; } - - void Initialize(IModMenu menu); - - string Title { get; set; } - - new IModButton Copy(); - - IModButton Copy(string title); - - IModButton Copy(string title, int index); - - IModButton Duplicate(string title); - - IModButton Duplicate(string title, int index); - - IModButton Replace(string title); - - IModButton Replace(string title, int index); - - void Show(); - - void Hide(); - } -} \ No newline at end of file diff --git a/src/OWML.Common/Interfaces/Menus/IModButtonBase.cs b/src/OWML.Common/Interfaces/Menus/IModButtonBase.cs deleted file mode 100644 index cb5906526..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModButtonBase.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System; -using UnityEngine.UI; - -namespace OWML.Common.Menus -{ - public interface IModButtonBase - { - event Action OnClick; - - int Index { get; set; } - - Button Button { get; } - - bool IsSelected { get; } - - void Initialize(IModMenu menu); - - IModButtonBase Copy(); - - IModButtonBase Copy(int index); - - IModButtonBase Duplicate(); - - IModButtonBase Duplicate(int index); - - IModButtonBase Replace(); - - IModButtonBase Replace(int index); - - void Show(); - void Hide(); - } -} \ No newline at end of file diff --git a/src/OWML.Common/Interfaces/Menus/IModConfigMenu.cs b/src/OWML.Common/Interfaces/Menus/IModConfigMenu.cs deleted file mode 100644 index 448e1eeda..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModConfigMenu.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModConfigMenu : IModConfigMenuBase - { - IModData ModData { get; } - - IModBehaviour Mod { get; } - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModConfigMenuBase.cs b/src/OWML.Common/Interfaces/Menus/IModConfigMenuBase.cs deleted file mode 100644 index bb93635bd..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModConfigMenuBase.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModConfigMenuBase : IModPopupMenu - { - IModManifest Manifest { get; } - - void UpdateUIValues(); - - void Initialize( - Menu modMenuCopy, - IModToggleInput toggleTemplate, - IModSliderInput sliderTemplate, - IModTextInput textInputTemplate, - IModNumberInput numberInputTemplate, - IModSelectorInput selectorTemplate, - IModSeparator seperatorTemplate); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModFieldInput.cs b/src/OWML.Common/Interfaces/Menus/IModFieldInput.cs deleted file mode 100644 index 29019750f..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModFieldInput.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModFieldInput : IModInput - { - IModButton Button { get; } - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModInput.cs b/src/OWML.Common/Interfaces/Menus/IModInput.cs deleted file mode 100644 index a42de92ba..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModInput.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System; - -namespace OWML.Common.Menus -{ - public interface IModInput : IModInputBase - { - event Action OnChange; - - T Value { get; set; } - } -} \ No newline at end of file diff --git a/src/OWML.Common/Interfaces/Menus/IModInputBase.cs b/src/OWML.Common/Interfaces/Menus/IModInputBase.cs deleted file mode 100644 index 11d2fad71..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModInputBase.cs +++ /dev/null @@ -1,21 +0,0 @@ -using UnityEngine; - -namespace OWML.Common.Menus -{ - public interface IModInputBase - { - MonoBehaviour Element { get; } - - string Title { get; set; } - - int Index { get; set; } - - bool IsSelected { get; } - - void Show(); - - void Hide(); - - void Initialize(IModMenu menu); - } -} \ No newline at end of file diff --git a/src/OWML.Common/Interfaces/Menus/IModInputMenu.cs b/src/OWML.Common/Interfaces/Menus/IModInputMenu.cs deleted file mode 100644 index 70bccf531..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModInputMenu.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace OWML.Common.Menus -{ - public interface IModInputMenu : IModTemporaryPopup - { - event Action OnConfirm; - - event Action OnCancel; - - void Initialize(PopupInputMenu inputMenu); - - void Open(InputType inputType, string value); - - IModInputMenu Copy(); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModLayoutButton.cs b/src/OWML.Common/Interfaces/Menus/IModLayoutButton.cs deleted file mode 100644 index 0c1edacf2..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModLayoutButton.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModLayoutButton : IModButtonBase - { - IModLayoutManager Layout { get; } - } -} \ No newline at end of file diff --git a/src/OWML.Common/Interfaces/Menus/IModLayoutManager.cs b/src/OWML.Common/Interfaces/Menus/IModLayoutManager.cs deleted file mode 100644 index c73cb767f..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModLayoutManager.cs +++ /dev/null @@ -1,24 +0,0 @@ -using UnityEngine; -using UnityEngine.UI; - -namespace OWML.Common.Menus -{ - public interface IModLayoutManager - { - LayoutGroup LayoutGroup { get; } - - int ChildCount { get; } - - void UpdateState(); - - void Clear(); - - void AddText(string text); - - void AddTextAt(string text, int index); - - void AddPicture(Texture2D texture, float scale = 1.0f); - - void AddPictureAt(Texture2D texture, int index, float scale = 1.0f); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModMainMenu.cs b/src/OWML.Common/Interfaces/Menus/IModMainMenu.cs deleted file mode 100644 index c0dec8c48..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModMainMenu.cs +++ /dev/null @@ -1,21 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModMainMenu : IModOWMenu - { - new IModTabbedMenu OptionsMenu { get; } - - new IModButton OptionsButton { get; } - - new IModButton QuitButton { get; } - - IModButton ResumeExpeditionButton { get; } - - IModButton NewExpeditionButton { get; } - - IModButton ViewCreditsButton { get; } - - IModButton SwitchProfileButton { get; } - - void Initialize(TitleScreenManager titleScreenManager); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModMenu.cs b/src/OWML.Common/Interfaces/Menus/IModMenu.cs deleted file mode 100644 index 2e6f1adc8..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModMenu.cs +++ /dev/null @@ -1,95 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace OWML.Common.Menus -{ - public interface IModMenu - { - event Action OnInit; - - Menu Menu { get; } - - List BaseButtons { get; } - - List Buttons { get; } - - List LayoutButtons { get; } - - List PromptButtons { get; } - - [Obsolete("Use GetTitleButton instead")] - IModButton GetButton(string title); - - IModButton GetTitleButton(string title); - - IModPromptButton GetPromptButton(string title); - - [Obsolete("Use AddButton(IModButtonBase) instead.")] - IModButton AddButton(IModButton button); - - [Obsolete("Use AddButton(IModButtonBase, int) instead.")] - IModButton AddButton(IModButton button, int index); - - IModButtonBase AddButton(IModButtonBase button); - - IModButtonBase AddButton(IModButtonBase button, int index); - - List ToggleInputs { get; } - - IModToggleInput GetToggleInput(string title); - - IModToggleInput AddToggleInput(IModToggleInput input); - - IModToggleInput AddToggleInput(IModToggleInput input, int index); - - List SliderInputs { get; } - - IModSliderInput GetSliderInput(string title); - - IModSliderInput AddSliderInput(IModSliderInput input); - - IModSliderInput AddSliderInput(IModSliderInput input, int index); - - List SelectorInputs { get; } - - IModSelectorInput GetSelectorInput(string title); - - IModSelectorInput AddSelectorInput(IModSelectorInput input); - - IModSelectorInput AddSelectorInput(IModSelectorInput input, int index); - - List TextInputs { get; } - - IModTextInput GetTextInput(string title); - - IModTextInput AddTextInput(IModTextInput input); - - IModTextInput AddTextInput(IModTextInput input, int index); - - List NumberInputs { get; } - - IModNumberInput GetNumberInput(string title); - - IModNumberInput AddNumberInput(IModNumberInput input); - - IModNumberInput AddNumberInput(IModNumberInput input, int index); - - List Separators { get; } - - IModSeparator AddSeparator(IModSeparator separator); - - IModSeparator AddSeparator(IModSeparator separator, int index); - - IModSeparator GetSeparator(string title); - - object GetInputValue(string key); - - T GetInputValue(string key); - - void SetInputValue(string key, object value); - - void SelectFirst(); - - void UpdateNavigation(); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModMenuWithSelectables.cs b/src/OWML.Common/Interfaces/Menus/IModMenuWithSelectables.cs deleted file mode 100644 index 9c78aa9ae..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModMenuWithSelectables.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -namespace OWML.Common.Menus -{ - public interface IModMenuWithSelectables : IModPopupMenu - { - event Action OnCancel; - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModMenus.cs b/src/OWML.Common/Interfaces/Menus/IModMenus.cs deleted file mode 100644 index 0cc69079a..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModMenus.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModMenus - { - IModMainMenu MainMenu { get; } - - IModPauseMenu PauseMenu { get; } - - IModsMenu ModsMenu { get; } - - IModPopupManager PopupManager { get; } - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModMessagePopup.cs b/src/OWML.Common/Interfaces/Menus/IModMessagePopup.cs deleted file mode 100644 index 8ed76613d..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModMessagePopup.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; - -namespace OWML.Common.Menus -{ - public interface IModMessagePopup : IModTemporaryPopup - { - event Action OnConfirm; - - event Action OnCancel; - - void Initialize(PopupMenu messageMenu); - - void ShowMessage(string message, bool addCancel, string okMessage, string cancelMessage); - - IModMessagePopup Copy(); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModNumberInput.cs b/src/OWML.Common/Interfaces/Menus/IModNumberInput.cs deleted file mode 100644 index b82c7a89e..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModNumberInput.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModNumberInput : IModFieldInput - { - IModNumberInput Copy(); - - IModNumberInput Copy(string key); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModOWMenu.cs b/src/OWML.Common/Interfaces/Menus/IModOWMenu.cs deleted file mode 100644 index 57e3edc75..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModOWMenu.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModOWMenu : IModMenu - { - IModTabbedMenu OptionsMenu { get; } - - IModButton OptionsButton { get; } - - IModButton QuitButton { get; } - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModPauseMenu.cs b/src/OWML.Common/Interfaces/Menus/IModPauseMenu.cs deleted file mode 100644 index 2c567c775..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModPauseMenu.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModPauseMenu : IModPopupMenu, IModOWMenu - { - new IModTabbedMenu OptionsMenu { get; } - - new IModButton OptionsButton { get; } - - new IModButton QuitButton { get; } - - IModButton ResumeButton { get; } - - void Initialize(PauseMenuManager pauseMenuManager); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModPopupManager.cs b/src/OWML.Common/Interfaces/Menus/IModPopupManager.cs deleted file mode 100644 index 5c568623f..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModPopupManager.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModPopupManager - { - void Initialize(PopupInputMenu inputMenu, IModTabbedMenu options); - - IModMessagePopup CreateMessagePopup(string message, bool addCancel = false, string okMessage = "OK", string cancelMessage = "Cancel"); - - IModInputMenu CreateInputPopup(InputType inputType, string value); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModPopupMenu.cs b/src/OWML.Common/Interfaces/Menus/IModPopupMenu.cs deleted file mode 100644 index 56cdd3913..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModPopupMenu.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using UnityEngine.UI; - -namespace OWML.Common.Menus -{ - public interface IModPopupMenu : IModMenu - { - event Action OnOpened; - - event Action OnClosed; - - [Obsolete("Use OnOpened instead.")] - Action OnOpen { get; set; } - - [Obsolete("Use OnClosed instead.")] - Action OnClose { get; set; } - - bool IsOpen { get; } - - string Title { get; set; } - - void Open(); - - void Close(); - - void Toggle(); - - IModPopupMenu Copy(); - - IModPopupMenu Copy(string title); - - void Initialize(Menu menu); - - void Initialize(Menu menu, LayoutGroup layoutGroup); - - void RemoveAllListeners(); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModPromptButton.cs b/src/OWML.Common/Interfaces/Menus/IModPromptButton.cs deleted file mode 100644 index 1a2333ba5..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModPromptButton.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModPromptButton : IModButton - { - string DefaultTitle { get; } - - ScreenPrompt Prompt { get; set; } - } -} \ No newline at end of file diff --git a/src/OWML.Common/Interfaces/Menus/IModSelectorInput.cs b/src/OWML.Common/Interfaces/Menus/IModSelectorInput.cs deleted file mode 100644 index 8e83c7cd5..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModSelectorInput.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModSelectorInput : IModInput - { - OptionsSelectorElement SelectorElement { get; } - - int SelectedIndex { get; set; } - - void Initialize(string option, string[] options); - - IModSelectorInput Copy(); - - IModSelectorInput Copy(string title); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModSeparator.cs b/src/OWML.Common/Interfaces/Menus/IModSeparator.cs deleted file mode 100644 index 1d54f6487..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModSeparator.cs +++ /dev/null @@ -1,13 +0,0 @@ -using UnityEngine.UI; - -namespace OWML.Common.Menus -{ - public interface IModSeparator : IModInputBase - { - LayoutElement LayoutElement { get; } - - IModSeparator Copy(); - - IModSeparator Copy(string title); - } -} \ No newline at end of file diff --git a/src/OWML.Common/Interfaces/Menus/IModSliderInput.cs b/src/OWML.Common/Interfaces/Menus/IModSliderInput.cs deleted file mode 100644 index 4a67c73a2..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModSliderInput.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModSliderInput : IModInput - { - float Min { get; set; } - - float Max { get; set; } - - bool HasValueText { get; } - - IModSliderInput Copy(); - - IModSliderInput Copy(string title); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModTabMenu.cs b/src/OWML.Common/Interfaces/Menus/IModTabMenu.cs deleted file mode 100644 index 38b2d6fba..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModTabMenu.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModTabMenu : IModPopupMenu - { - void Initialize(TabButton tabButton); - - TabButton TabButton { get; } - - void HideButton(); - - new IModTabMenu Copy(); - - new IModTabMenu Copy(string title); - } -} \ No newline at end of file diff --git a/src/OWML.Common/Interfaces/Menus/IModTabbedMenu.cs b/src/OWML.Common/Interfaces/Menus/IModTabbedMenu.cs deleted file mode 100644 index a67e05c8d..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModTabbedMenu.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModTabbedMenu : IModPopupMenu - { - IModTabMenu GameplayTab { get; } - - IModTabMenu AudioTab { get; } - - IModTabMenu InputTab { get; } - - IModTabMenu GraphicsTab { get; } - - new IModTabbedMenu Copy(); - - void Initialize(TabbedMenu menu, int menuStackCount); - - new TabbedMenu Menu { get; } - - void AddTab(IModTabMenu tab, bool enable = true); - - void SetIsBlocking(bool isBlocking); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModTemporaryPopup.cs b/src/OWML.Common/Interfaces/Menus/IModTemporaryPopup.cs deleted file mode 100644 index eb293dbd1..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModTemporaryPopup.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModTemporaryPopup : IModMenu - { - void DestroySelf(); - } -} \ No newline at end of file diff --git a/src/OWML.Common/Interfaces/Menus/IModTextInput.cs b/src/OWML.Common/Interfaces/Menus/IModTextInput.cs deleted file mode 100644 index dae9925f9..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModTextInput.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModTextInput : IModFieldInput - { - IModTextInput Copy(); - - IModTextInput Copy(string key); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModToggleInput.cs b/src/OWML.Common/Interfaces/Menus/IModToggleInput.cs deleted file mode 100644 index 72f400f7e..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModToggleInput.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModToggleInput : IModInput - { - ToggleElement Toggle { get; } - - public IModButton Button { get; } - - IModToggleInput Copy(); - - IModToggleInput Copy(string key); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/IModsMenu.cs b/src/OWML.Common/Interfaces/Menus/IModsMenu.cs deleted file mode 100644 index e791ae357..000000000 --- a/src/OWML.Common/Interfaces/Menus/IModsMenu.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace OWML.Common.Menus -{ - public interface IModsMenu : IModPopupMenu - { - void AddMod(IModData modData, IModBehaviour mod); - - IModConfigMenu GetModMenu(IModBehaviour modBehaviour); - - void Initialize(IModMenus menus, IModOWMenu mainMenu); - } -} diff --git a/src/OWML.Common/Interfaces/Menus/InputType.cs b/src/OWML.Common/Interfaces/Menus/InputType.cs deleted file mode 100644 index 20359c685..000000000 --- a/src/OWML.Common/Interfaces/Menus/InputType.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace OWML.Common.Menus -{ - public enum InputType - { - Text = 0, - - Number = 1 - } - -} diff --git a/src/OWML.ModHelper.Menus/ModButtonBase.cs b/src/OWML.ModHelper.Menus/ModButtonBase.cs deleted file mode 100644 index 0ef8c1eeb..000000000 --- a/src/OWML.ModHelper.Menus/ModButtonBase.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using OWML.Common.Menus; -using OWML.Utils; -using UnityEngine; -using UnityEngine.UI; - -namespace OWML.ModHelper.Menus -{ - public abstract class ModButtonBase : IModButtonBase - { - public event Action OnClick; - - public Button Button { get; } - - public IModMenu Menu { get; private set; } - - private int _index; - public int Index - { - get => Button.transform.parent == null ? _index : Button.transform.GetSiblingIndex(); - set - { - _index = value; - Button.transform.SetSiblingIndex(value); - } - } - public bool IsSelected => _uIStyleApplier?.GetValue("_selected") ?? false; - - private readonly UIStyleApplier _uIStyleApplier; - - protected ModButtonBase(Button button, IModMenu menu) - { - _uIStyleApplier = button.GetComponent(); - Button = button; - Button.onClick.AddListener(() => OnClick?.Invoke()); - Initialize(menu); - } - - public IModButtonBase Copy() - { - var button = GameObject.Instantiate(Button); - GameObject.Destroy(button.GetComponent()); - var modButton = (IModButtonBase)Activator.CreateInstance(GetType(), button, Menu); - modButton.Index = Index + 1; - return modButton; - } - - public void Initialize(IModMenu menu) - { - Menu = menu; - } - - public IModButtonBase Copy(int index) - { - var copy = Copy(); - copy.Index = index; - return copy; - } - - public IModButtonBase Duplicate() - { - var copy = Copy(); - Menu.AddButton(copy); - return copy; - } - - public IModButtonBase Duplicate(int index) - { - var dupe = Duplicate(); - dupe.Index = index; - return dupe; - } - - public IModButtonBase Replace() - { - var duplicate = Duplicate(); - Hide(); - return duplicate; - } - - public IModButtonBase Replace(int index) - { - var replacement = Replace(); - replacement.Index = index; - return replacement; - } - - public void Show() - { - Button.gameObject.SetActive(true); - } - - public void Hide() - { - Button.gameObject.SetActive(false); - } - - } -} diff --git a/src/OWML.ModHelper.Menus/ModConfigMenu.cs b/src/OWML.ModHelper.Menus/ModConfigMenu.cs deleted file mode 100644 index cfddb0074..000000000 --- a/src/OWML.ModHelper.Menus/ModConfigMenu.cs +++ /dev/null @@ -1,97 +0,0 @@ -using Newtonsoft.Json.Linq; -using OWML.Common; -using OWML.Common.Menus; -using System; -using System.Linq; - -namespace OWML.ModHelper.Menus -{ - public class ModConfigMenu : ModConfigMenuBase, IModConfigMenu - { - public IModData ModData { get; } - - public IModBehaviour Mod { get; } - - public ModConfigMenu(IModData modData, IModBehaviour mod, IModStorage storage, IModConsole console) - : base(modData.Manifest, storage, console) - { - ModData = modData; - Mod = mod; - } - - protected override void AddInputs() - { - var index = 3; - foreach (var setting in ModData.Config.Settings) - { - if (setting.Value is not JObject obj) - { - AddConfigInput(setting.Key, setting.Value, index++); - continue; - } - - if (Convert.ToBoolean(obj["dlcOnly"])) - { - var ownsDlc = EntitlementsManager.IsDlcOwned(); - if (ownsDlc == EntitlementsManager.AsyncOwnershipStatus.NotReady) - { - Console.WriteLine("Tried to add inputs while DLC ownership status was not determined.", MessageType.Error); - AddConfigInput(setting.Key, setting.Value, index++); - } - - if (ownsDlc == EntitlementsManager.AsyncOwnershipStatus.Owned) - { - AddConfigInput(setting.Key, setting.Value, index++); - } - } - else - { - AddConfigInput(setting.Key, setting.Value, index++); - } - } - - UpdateNavigation(); - SelectFirst(); - } - - public override void UpdateUIValues() - { - foreach (var setting in ModData.Config.Settings) - { - SetInputValue(setting.Key, setting.Value); - } - } - - protected override void OnSave() - { - var keys = ModData.Config.Settings.Select(x => x.Key).ToList(); - foreach (var key in keys) - { - var value = GetInputValue(key); - if (value != null) - { - ModData.Config.SetSettingsValue(key, value); - } - } - ModData.Storage.Save(ModData.Config, Constants.ModConfigFileName); - - // Fixes "If one mod throws an exception in Configure all mod settings break" (#452) - try - { - Mod?.Configure(ModData.Config); - } - catch (Exception e) - { - Console.WriteLine($"Exception thrown when changing settings for {Mod?.ModHelper?.Manifest?.UniqueName} : {e}", MessageType.Error); - } - - Close(); - } - - protected override void OnReset() - { - ModData.ResetConfigToDefaults(); - UpdateUIValues(); - } - } -} diff --git a/src/OWML.ModHelper.Menus/ModConfigMenuBase.cs b/src/OWML.ModHelper.Menus/ModConfigMenuBase.cs deleted file mode 100644 index ce39fbcf4..000000000 --- a/src/OWML.ModHelper.Menus/ModConfigMenuBase.cs +++ /dev/null @@ -1,174 +0,0 @@ -using Newtonsoft.Json.Linq; -using System.Linq; -using OWML.Common; -using OWML.Common.Menus; -using OWML.Utils; - -namespace OWML.ModHelper.Menus -{ - public abstract class ModConfigMenuBase : ModMenuWithSelectables, IModConfigMenuBase - { - public IModManifest Manifest { get; } - - protected readonly IModStorage Storage; - - private IModToggleInput _toggleTemplate; - private IModSliderInput _sliderTemplate; - private IModSelectorInput _selectorTemplate; - private IModTextInput _textInputTemplate; - private IModNumberInput _numberInputTemplate; - private IModSeparator _seperatorTemplate; - - protected abstract void AddInputs(); - - public abstract void UpdateUIValues(); - - protected ModConfigMenuBase(IModManifest manifest, IModStorage storage, IModConsole console) - : base(console) - { - Manifest = manifest; - Storage = storage; - } - - public void Initialize(Menu menu, IModToggleInput toggleTemplate, IModSliderInput sliderTemplate, - IModTextInput textInputTemplate, IModNumberInput numberInputTemplate, - IModSelectorInput selectorTemplate, IModSeparator seperatorTemplate) - { - _toggleTemplate = toggleTemplate; - _sliderTemplate = sliderTemplate; - _textInputTemplate = textInputTemplate; - _numberInputTemplate = numberInputTemplate; - _selectorTemplate = selectorTemplate; - _seperatorTemplate = seperatorTemplate; - - base.Initialize(menu); - menu.SetValue("_menuOptions", new MenuOption[] { }); - - Title = Manifest.Name; - - AddInputs(); - } - - public override void Open() - { - base.Open(); - UpdateUIValues(); - } - - protected void AddConfigInput(string key, object value, int index) - { - if (value is bool) - { - AddToggleInput(key, index); - return; - } - - if (value is string) - { - AddTextInput(key, index); - return; - } - - if (new[] { typeof(long), typeof(int), typeof(float), typeof(double) }.Contains(value.GetType())) - { - AddNumberInput(key, index); - return; - } - - if (value is JObject obj) - { - var settingType = (string)obj["type"]; - switch (settingType) - { - case "separator": - AddSeparator(key, index, obj); - return; - case "slider": - AddSliderInput(key, index, obj); - return; - case "toggle": - AddToggleInput(key, index, obj); - return; - case "selector": - AddSelectorInput(key, index, obj); - return; - case "text": - AddTextInput(key, index, obj); - return; - case "number": - AddNumberInput(key, index, obj); - return; - default: - Console.WriteLine("Unrecognized complex setting type: " + settingType, MessageType.Warning); - return; - } - } - - Console.WriteLine("Unrecognized setting type: " + value.GetType(), MessageType.Error); - } - - private void AddToggleInput(string key, int index, JObject obj = null) - { - var toggle = AddToggleInput(_toggleTemplate.Copy(key), index); - toggle.Element.name = key; - toggle.Title = (string)obj?["title"] ?? key; - SetupInputTooltip(toggle, (string)obj?["tooltip"]); - toggle.Show(); - } - - private void AddSliderInput(string key, int index, JObject obj) - { - var slider = AddSliderInput(_sliderTemplate.Copy(key), index); - slider.Min = (float)obj["min"]; - slider.Max = (float)obj["max"]; - slider.Element.name = key; - slider.Title = (string)obj["title"] ?? key; - SetupInputTooltip(slider, (string)obj["tooltip"]); - slider.Show(); - } - - private void AddSelectorInput(string key, int index, JObject obj) - { - var options = obj["options"].ToObject(); - var selector = AddSelectorInput(_selectorTemplate.Copy(key), index); - selector.Element.name = key; - selector.Title = (string)obj["title"] ?? key; - selector.Initialize((string)obj["value"], options); - SetupInputTooltip(selector, (string)obj["tooltip"]); - selector.Show(); - } - - private void AddTextInput(string key, int index, JObject obj = null) - { - var textInput = AddTextInput(_textInputTemplate.Copy(key), index); - textInput.Element.name = key; - textInput.Title = (string)obj?["title"] ?? key; - SetupInputTooltip(textInput, (string)obj?["tooltip"]); - textInput.Show(); - } - - private void AddNumberInput(string key, int index, JObject obj = null) - { - var numberInput = AddNumberInput(_numberInputTemplate.Copy(key), index); - numberInput.Element.name = key; - numberInput.Title = (string)obj?["title"] ?? key; - SetupInputTooltip(numberInput, (string)obj?["tooltip"]); - numberInput.Show(); - } - - private void AddSeparator(string key, int index, JObject obj) - { - var separator = AddSeparator(_seperatorTemplate.Copy("Inputs"), index); - separator.Element.name = key; - separator.Title = (string)obj?["title"] ?? key; - separator.Show(); - } - - internal void SetupInputTooltip(IModInput input, string tooltip) - { - var menuOption = input.Element.GetComponent(); - menuOption.SetValue("_tooltipTextType", UITextType.None); - menuOption.SetValue("_overrideTooltipText", tooltip?? ""); - } - } -} diff --git a/src/OWML.ModHelper.Menus/ModFieldInput.cs b/src/OWML.ModHelper.Menus/ModFieldInput.cs deleted file mode 100644 index 41f26b4de..000000000 --- a/src/OWML.ModHelper.Menus/ModFieldInput.cs +++ /dev/null @@ -1,40 +0,0 @@ -using System.Linq; -using OWML.Common.Menus; -using UnityEngine; -using UnityEngine.UI; - -namespace OWML.ModHelper.Menus -{ - public abstract class ModFieldInput : ModPopupInput, IModFieldInput - { - public IModButton Button { get; } - - protected readonly IModPopupManager PopupManager; - - protected ModFieldInput(OptionsSelectorElement element, IModMenu menu, IModPopupManager popupManager) - : base(element, menu) - { - PopupManager = popupManager; - - var buttons = element.GetComponentsInChildren