diff --git a/NebulaModel/MultiplayerOptions.cs b/NebulaModel/MultiplayerOptions.cs index a7b179ab8..65f620fb5 100644 --- a/NebulaModel/MultiplayerOptions.cs +++ b/NebulaModel/MultiplayerOptions.cs @@ -1,4 +1,5 @@ -using NebulaAPI; +using BepInEx.Configuration; +using NebulaAPI; using NebulaModel.Attributes; using NebulaModel.DataStructures; using NebulaModel.Utils; @@ -89,6 +90,10 @@ public bool StreamerMode { } } + [DisplayName("Chat Hotkey"), Category("Chat")] + [Description("Keyboard shortcut to toggle the chat window")] + public KeyboardShortcut ChatHotkey { get; set; } = new KeyboardShortcut(KeyCode.BackQuote, KeyCode.LeftAlt); + [DisplayName("Auto Open Chat"), Category("Chat")] [Description("Auto open chat window when receiving message from other players")] public bool AutoOpenChat { get; set; } = true; diff --git a/NebulaPatcher/MonoBehaviours/NebulaBootstrapper.cs b/NebulaPatcher/MonoBehaviours/NebulaBootstrapper.cs index 333091257..98043f605 100644 --- a/NebulaPatcher/MonoBehaviours/NebulaBootstrapper.cs +++ b/NebulaPatcher/MonoBehaviours/NebulaBootstrapper.cs @@ -1,5 +1,4 @@ -using CommonAPI.Systems; -using NebulaWorld; +using NebulaWorld; using UnityEngine; namespace NebulaPatcher.MonoBehaviours diff --git a/NebulaPatcher/NebulaPlugin.cs b/NebulaPatcher/NebulaPlugin.cs index 072d23552..e7c1e4bfa 100644 --- a/NebulaPatcher/NebulaPlugin.cs +++ b/NebulaPatcher/NebulaPlugin.cs @@ -1,6 +1,4 @@ using BepInEx; -using CommonAPI; -using CommonAPI.Systems; using HarmonyLib; using NebulaAPI; using NebulaModel.Logger; @@ -20,8 +18,7 @@ namespace NebulaPatcher { [BepInPlugin(PluginInfo.PLUGIN_ID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)] - [BepInDependency(CommonAPIPlugin.GUID)] - [CommonAPISubmoduleDependency(nameof(ProtoRegistry), nameof(CustomKeyBindSystem))] + [BepInDependency("dsp.common - api.CommonAPI", BepInDependency.DependencyFlags.SoftDependency)] public class NebulaPlugin : BaseUnityPlugin, IMultiplayerMod { static int command_ups = 0; @@ -176,7 +173,6 @@ private static void Initialize() { InitPatches(); AddNebulaBootstrapper(); - RegisterKeyBinds(); DiscordManager.Setup(ActivityManager_OnActivityJoin); } @@ -285,19 +281,6 @@ private void Update() } } - private static void RegisterKeyBinds() - { - CustomKeyBindSystem.RegisterKeyBind(new BuiltinKey - { - id = 212, - key = new CombineKey((int)KeyCode.BackQuote, CombineKey.ALT_COMB, ECombineKeyAction.OnceClick, false), - conflictGroup = 2052, - name = "NebulaChatWindow", - canOverride = true - }); - ProtoRegistry.RegisterString("KEYNebulaChatWindow", "Show or Hide Chat Window"); - } - private static void InitPatches() { Log.Info("Patching Dyson Sphere Program..."); diff --git a/NebulaWorld/MonoBehaviours/Local/Chat/ChatManager.cs b/NebulaWorld/MonoBehaviours/Local/Chat/ChatManager.cs index 8186390ad..0f9b3c9f1 100644 --- a/NebulaWorld/MonoBehaviours/Local/Chat/ChatManager.cs +++ b/NebulaWorld/MonoBehaviours/Local/Chat/ChatManager.cs @@ -1,6 +1,4 @@ -using CommonAPI; -using CommonAPI.Systems; -using NebulaModel; +using NebulaModel; using NebulaModel.DataStructures; using NebulaModel.Logger; using NebulaModel.Packets.Players; @@ -35,8 +33,6 @@ private void Awake() trans.sizeDelta = defaultSize; trans.anchoredPosition = defaultPos; - - chatGo.GetComponent().minSize = ChatUtils.GetDefaultSize(ChatSize.Small); } chatWindow = chatGo.transform.GetComponentInChildren(); @@ -64,7 +60,7 @@ public static void UpdateChatPosition() void Update() { - if (CustomKeyBindSystem.GetKeyBind("NebulaChatWindow").keyValue) + if (Config.Options.ChatHotkey.IsDown()) { chatWindow.Toggle(); }