Skip to content

Commit

Permalink
The keyboard can now go on your head
Browse files Browse the repository at this point in the history
... and hands
  • Loading branch information
nyakowint committed Dec 29, 2023
1 parent c6d1273 commit c16d3fe
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
6 changes: 5 additions & 1 deletion KeyboardOSC/Patches.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ namespace KeyboardOSC;
public static class Patches
{
private static Harmony Harmony;
private static WindowAttachementManager.DeviceToAttachTo kbAttachedTo;

private static WindowAttachementManager.DeviceToAttachTo kbAttachedTo =
WindowAttachementManager.DeviceToAttachTo.None;

private static bool HasSettingsBeenOpenedOnce;

public static void PatchAll()
Expand Down Expand Up @@ -127,6 +130,7 @@ public static void RequestSettingsPatch(string sender, string data)
KBCheckForUpdates = PluginSettings.GetSetting<bool>("CheckForUpdates").Value,
KBLiveSend = PluginSettings.GetSetting<bool>("LiveSend").Value,
KBTypingIndicator = PluginSettings.GetSetting<bool>("TypingIndicator").Value,
KBAttachmentIndex = (int)kbAttachedTo
};
var data2 = JsonUtility.ToJson(settings, true);
ServerBridge.Instance.SendMessage("UpdateSettings", data2, null, sender);
Expand Down
6 changes: 5 additions & 1 deletion KeyboardOSC/Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ private void SetupBar()


ChatMode.Setup(oscbarText, charCounterText);

var trackDevice = keyboardWindowObj.AddComponent<Overlay_TrackDevice>();
trackDevice.TrackedDevice = Unity_Overlay.OverlayTrackedDevice.None;

oscBarRoot.SetActive(true);
keyboardWindowObj.SetActive(true);
WindowMovementManager.MoveToEdgeOfWindowAndInheritRotation(oscBarWindow, keyboardWindow,
Expand All @@ -222,7 +226,7 @@ public void RepositionBar(Unity_Overlay barOverlay, Unity_Overlay keebOverlay)

public void AttachKeyboard(int anchor)
{
WindowMovementManager.WMM_Inst.AttachWindowToDeviceIndex(anchor, overlayManager.Keyboard_Overlay);
WindowMovementManager.WMM_Inst.AttachWindowToDeviceIndex(anchor, Overlay_Manager.Instance.Keyboard_Overlay);
}

public void ToggleChatMode()
Expand Down
1 change: 1 addition & 0 deletions KeyboardOSC/PluginSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ public class UiSettings
public bool KBCheckForUpdates = false;
public bool KBLiveSend = false;
public bool KBTypingIndicator = true;
public int KBAttachmentIndex = 0;
}
13 changes: 10 additions & 3 deletions settingsKO.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ const SettingsLayout = {
_: {
KBCheckForUpdates: new SettingsElements.Setting(SettingsElements.UIComponents.Toggle, 'Notify about updates', "The plugin will notify you if there's an update available :D", false),
KBLiveSend: new SettingsElements.Setting(SettingsElements.UIComponents.Toggle, 'Live send mode', "Messages will be sent to the chatbox as you type.", false),
KBTypingIndicator: new SettingsElements.Setting(SettingsElements.UIComponents.Toggle, 'Send typing indicator', "Some people prefer to not let people know when they are typing for some reason lol", true),
KBAttachmentIndex: new SettingsElements.Setting(SettingsElements.UIComponents.Dropdown, 'Keyboard Attachment', "put the keyboard on ur head idk", 'Disabled', ['Disabled', 'So no head?', 'Left hand', 'Right hand']),
KBOpenRepo: new SettingsElements.Setting(SettingsElements.UIComponents.Button, 'Plugin Repo', "View this plugin's repo on GitHub", '', '', ''),
KBTypingIndicator: new SettingsElements.Setting(SettingsElements.UIComponents.Toggle, 'Send typing indicator', "Some people prefer to not let people know when they are typing. If this is you here ya go!", true),
KBAttachmentIndex: new SettingsElements.Setting(SettingsElements.UIComponents.Dropdown, 'Keyboard Attachment', "put the keyboard on ur head idk, attaching to your hand basically makes you one handed lool", 'Disabled', ['Disabled', 'So no head?', 'Left hand', 'Right hand']),
KBVersionCheck: new SettingsElements.Setting(SettingsElements.UIComponents.Button, 'Check for updates', "Check for updates rn!!!!!", '', '', ''),
KBOpenRepo: new SettingsElements.Setting(SettingsElements.UIComponents.Button, 'Plugin Repo', "View this plugin's repo on GitHub", '', '', ''),
KBVersion: new SettingsElements.Setting(SettingsElements.UIComponents.Text, 'KBVersion'),
},
},
Expand Down Expand Up @@ -527,5 +527,12 @@ function SetMenuStates(data) {
var appVersionText = document.getElementById("VersionNumber_Desc");
appVersionText.innerHTML = `Build ${data.VersionNumber}`;

console.log(data)

if (data.KBVersion) {
var kbVersion = document.getElementById("KBVersion_Desc");
kbVersion.innerHTML = `KeyboardOSC Version ${data.KBVersion}`;
}

console.log("Settings Updated.");
}

0 comments on commit c16d3fe

Please sign in to comment.