22using MelonLoader ;
33using System . Collections ;
44using System . Collections . Generic ;
5+ //using System.Linq;
6+ //using System;
7+ //using UIExpansionKit.API;
58using UnityEngine ;
69#endregion
710
811namespace PlayspaceMover
912{
1013 public static class ModInfo
1114 {
12- public const string Name = "PlayspaceMover " ;
13- public const string Description = "A SteamVR's Playspace clone for Oculus Users " ;
15+ public const string Name = "OculusPlayspaceMover " ;
16+ public const string Description = "A SteamVR's Playspace clone for VRChat from Oculus Store " ;
1417 public const string Author = "Rafa" ;
1518 public const string Company = "RBX" ;
16- public const string Version = "1.1.0 " ;
19+ public const string Version = "1.1.1 " ;
1720 public const string DownloadLink = null ;
1821 }
1922
@@ -23,25 +26,55 @@ public class Main : MelonMod
2326 private bool Enabled = true ;
2427 private float Strength = 1f ;
2528 private float DoubleClickTime = 0.25f ;
29+ private bool DisableDoubleClick = false ;
30+ private bool DisableLeftHand = false ;
31+ private bool DisableRightHand = false ;
2632 #endregion
2733
2834 private readonly string Category = "PlayspaceMover" ;
2935 public override void OnApplicationStart ( )
3036 {
31- MelonPrefs . RegisterCategory ( Category , "Playspace Mover" ) ;
37+ MelonPrefs . RegisterCategory ( Category , "Oculus Playspace Mover" ) ;
3238 MelonPrefs . RegisterBool ( Category , nameof ( Enabled ) , Enabled , "Enabled" ) ;
3339 MelonPrefs . RegisterFloat ( Category , nameof ( Strength ) , Strength , "Strength" ) ;
3440 MelonPrefs . RegisterFloat ( Category , nameof ( DoubleClickTime ) , DoubleClickTime , "Double Click Time" ) ;
41+ MelonPrefs . RegisterBool ( Category , nameof ( DisableDoubleClick ) , DisableDoubleClick , "Disable Double Click" ) ;
42+ MelonPrefs . RegisterBool ( Category , nameof ( DisableLeftHand ) , DisableLeftHand , "Disable Left Hand" ) ;
43+ MelonPrefs . RegisterBool ( Category , nameof ( DisableRightHand ) , DisableRightHand , "Disable Right Hand" ) ;
44+
3545 ApplySettings ( ) ;
3646
3747 MelonCoroutines . Start ( WaitInitialization ( ) ) ;
48+
49+ //if (MelonHandler.Mods.Any(x => x.Info.Name == "UI Expansion Kit"))
50+ //{
51+ // BindManager.Initialize();
52+
53+ // var playspaceSettings = ExpansionKitApi.CreateCustomFullMenuPopup(LayoutDescription.WideSlimList);
54+ // playspaceSettings.AddSimpleButton("Left Hand", new Action(() => BindManager.Show("Left Hand Spacedrag", new Action<KeyCode>(key =>
55+ // {
56+
57+ // }), null)
58+ // ));
59+
60+ // playspaceSettings.AddSimpleButton("Right Hand", new Action(() =>
61+ // BindManager.Show("Right Hand Spacedrag", new Action<KeyCode>(key => {
62+
63+ // }), null)
64+ // ));
65+
66+ // ExpansionKitApi.GetExpandedMenu(ExpandedMenu.SettingsMenu).AddSimpleButton("Oculus Playspace", new Action(() => playspaceSettings.Show()));
67+ //}
3868 }
3969
4070 private void ApplySettings ( )
4171 {
4272 Enabled = MelonPrefs . GetBool ( Category , nameof ( Enabled ) ) ;
4373 Strength = MelonPrefs . GetFloat ( Category , nameof ( Strength ) ) ;
4474 DoubleClickTime = MelonPrefs . GetFloat ( Category , nameof ( DoubleClickTime ) ) ;
75+ DisableDoubleClick = MelonPrefs . GetBool ( Category , nameof ( DisableDoubleClick ) ) ;
76+ DisableLeftHand = MelonPrefs . GetBool ( Category , nameof ( DisableLeftHand ) ) ;
77+ DisableRightHand = MelonPrefs . GetBool ( Category , nameof ( DisableRightHand ) ) ;
4578 }
4679
4780 public override void OnModSettingsApplied ( ) => ApplySettings ( ) ;
@@ -66,13 +99,11 @@ private IEnumerator WaitInitialization()
6699 yield break ;
67100 }
68101
69-
70-
71102 public override void OnUpdate ( )
72103 {
73104 if ( ! Enabled || Camera == null ) return ;
74105
75- if ( HasDoubleClicked ( OVRInput . Button . Three , DoubleClickTime ) || HasDoubleClicked ( OVRInput . Button . One , DoubleClickTime ) )
106+ if ( ! DisableDoubleClick && ( HasDoubleClicked ( OVRInput . Button . Three , DoubleClickTime ) || HasDoubleClicked ( OVRInput . Button . One , DoubleClickTime ) ) )
76107 {
77108 Camera . cameraLiftTransform . localPosition = StartPosition ;
78109 return ;
@@ -86,15 +117,15 @@ public override void OnUpdate()
86117 bool leftTrigger = OVRInput . Get ( OVRInput . Button . Three , OVRInput . Controller . Touch ) ;
87118 bool rightTrigger = OVRInput . Get ( OVRInput . Button . One , OVRInput . Controller . Touch ) ;
88119
89- if ( leftTrigger )
120+ if ( leftTrigger && ! DisableLeftHand )
90121 {
91122 Vector3 currentOffset = OVRInput . GetLocalControllerPosition ( OVRInput . Controller . LTouch ) ;
92123 Vector3 calculatedOffset = ( currentOffset - startingOffset ) * - Strength ;
93124 startingOffset = currentOffset ;
94125 Camera . cameraLiftTransform . localPosition += calculatedOffset ;
95126 }
96127
97- if ( rightTrigger )
128+ if ( rightTrigger && ! DisableRightHand )
98129 {
99130 Vector3 currentOffset = OVRInput . GetLocalControllerPosition ( OVRInput . Controller . RTouch ) ;
100131 Vector3 calculatedOffset = ( currentOffset - startingOffset ) * - Strength ;
0 commit comments