File tree Expand file tree Collapse file tree 2 files changed +30
-2
lines changed
Expand file tree Collapse file tree 2 files changed +30
-2
lines changed Original file line number Diff line number Diff line change 11using CinematicUnityExplorer . NightRunners . Extensions ;
22using Il2CppInterop . Runtime ;
3- using UnityEngine ;
3+ using Rewired ;
44
55namespace CinematicUnityExplorer . NightRunners . Utils
66{
@@ -40,6 +40,22 @@ public static GameObject GetCameraContainer(Camera camera)
4040 }
4141 }
4242
43+ public static void SetDefaultInputEnabled ( bool enable )
44+ {
45+ try
46+ {
47+ ReInput . controllers . Keyboard . enabled = enable ;
48+ var joysticks = ReInput . controllers . GetJoysticks ( ) ;
49+ foreach ( var joystick in joysticks )
50+ {
51+ joystick . enabled = enable ;
52+ }
53+ }
54+ catch ( Exception e )
55+ {
56+ Debug . LogError ( $ "{ e . Message } \n { e . StackTrace } ") ;
57+ }
58+ }
4359
4460 private static RCC_Camera GetRCC_Camera ( GameObject container )
4561 {
@@ -49,14 +65,14 @@ private static RCC_Camera GetRCC_Camera(GameObject container)
4965 private static void TogglePersonController ( GameObject container , bool enable )
5066 {
5167 var controller = container . GetComponent < FPEFirstPersonController > ( ) ;
68+ GodConstant . Instance . UI_Data . ui_showWarning = ! enable ; //prevents user interactions on meetspot
5269 if ( controller )
5370 {
5471 controller . enabled = enable ;
5572 if ( controller . homegarage )
5673 {
5774 controller . homegarage . noInput = ! enable ;
5875 }
59- GodConstant . Instance . UI_Data . ui_showWarning = ! enable ; //prevents user interactions on meetspot
6076 var vCamera = controller . transform . Find ( "vCamera" ) ;
6177 if ( vCamera )
6278 {
Original file line number Diff line number Diff line change @@ -99,6 +99,10 @@ internal static void BeginFreecam()
9999 connector ? . UpdateFreecamStatus ( true ) ;
100100
101101 RCCUtils . ToggleGameUI ( false ) ;
102+ if ( blockGamesInputOnFreecamToggle . isOn )
103+ {
104+ RCCUtils . SetDefaultInputEnabled ( false ) ;
105+ }
102106 previousMousePosition = IInputManager . MousePosition ;
103107
104108 CacheMainCamera ( ) ;
@@ -202,6 +206,8 @@ internal static void EndFreecam()
202206 connector ? . UpdateFreecamStatus ( false ) ;
203207
204208 RCCUtils . ToggleGameUI ( true ) ;
209+ RCCUtils . SetDefaultInputEnabled ( true ) ;
210+
205211 if ( usingGameCamera )
206212 {
207213 MaybeToggleCinemachine ( true ) ;
@@ -340,6 +346,12 @@ protected override void ConstructPanelContent()
340346 UIFactory . SetLayoutElement ( blockGamesInputOnFreecam , minHeight : 25 , flexibleWidth : 9999 ) ;
341347 blockGamesInputOnFreecamToggle . isOn = true ;
342348 blockGamesInputOnFreecamText . text = "Block games input on Freecam" ;
349+ blockGamesInputOnFreecamToggle . onValueChanged . AddListener ( blockInput => {
350+ if ( inFreeCamMode )
351+ {
352+ RCCUtils . SetDefaultInputEnabled ( ! blockInput ) ;
353+ }
354+ } ) ;
343355 }
344356
345357 AddSpacer ( 5 ) ;
You can’t perform that action at this time.
0 commit comments