private void CheckTimeDifference() { var diff = GetTimeDifference(); if (diff is > PauseOrFastForwardThreshold or < (-PauseOrFastForwardThreshold)) { WakeUpOrSleep(); return; } var mappedTimescale = diff.Map(-PauseOrFastForwardThreshold, PauseOrFastForwardThreshold, 1 + TimescaleBounds, 1 - TimescaleBounds, true); if (mappedTimescale > 100f) { DebugLog.ToConsole($"Warning - CheckTimeDifference() returned over 100 - should have switched into fast-forward!", MessageType.Warning); mappedTimescale = 0f; } if (mappedTimescale < 0) { DebugLog.ToConsole($"Warning - CheckTimeDifference() returned below 0 - should have switched into pausing!", MessageType.Warning); mappedTimescale = 0f; } OWTime.SetTimeScale(mappedTimescale); }
public void StartConversation() { VerifyInitialized(); enabled = true; if (!_timeFrozen && PlayerData.GetFreezeTimeWhileReadingConversations() && !Locator.GetGlobalMusicController().IsEndTimesPlaying()) { _timeFrozen = true; OWTime.Pause(OWTime.PauseType.Reading); } Locator.GetToolModeSwapper().UnequipTool(); GlobalMessenger.FireEvent("EnterConversation"); Locator.GetPlayerAudioController().PlayDialogueEnter(); _wasFlashlightOn = Locator.GetFlashlight().IsFlashlightOn(); if (_wasFlashlightOn && _turnOffFlashlight) { Locator.GetFlashlight().TurnOff(false); } DialogueConditionManager.SharedInstance.ReadPlayerData(); SetEntryNode(); _currentDialogueBox = DisplayDialogueBox2(); if (_attentionPoint != null && !PlayerState.InZeroG()) { Locator.GetPlayerTransform().GetRequiredComponent <PlayerLockOnTargeting>().LockOn(_attentionPoint, _attentionPointOffset, 2f); } if (PlayerState.InZeroG() && !_timeFrozen) { Locator.GetPlayerBody().GetComponent <Autopilot>().StartMatchVelocity(this.GetAttachedOWRigidbody().GetReferenceFrame()); } }
private void LateUpdate() { if (!_isOpenEyesSkipped && _isSolarSystemLoaded) { _isOpenEyesSkipped = true; // Skip wake up animation. var cameraEffectController = FindObjectOfType <PlayerCameraEffectController>(); cameraEffectController.OpenEyes(0, true); cameraEffectController.SetValue("_wakeLength", 0f); cameraEffectController.SetValue("_waitForWakeInput", false); // Skip wake up prompt. LateInitializerManager.pauseOnInitialization = false; Locator.GetPauseCommandListener().RemovePauseCommandLock(); Locator.GetPromptManager().RemoveScreenPrompt(cameraEffectController.GetValue <ScreenPrompt>("_wakePrompt")); OWTime.Unpause(OWTime.PauseType.Sleeping); cameraEffectController.Invoke("WakeUp"); // Enable all inputs immedeately. OWInput.ChangeInputMode(InputMode.Character); typeof(OWInput).SetValue("_inputFadeFraction", 0f); GlobalMessenger.FireEvent("TakeFirstFlashbackSnapshot"); } }
private void OnInputFocus(VREvent_t arg) { if (!OWTime.IsPaused()) { SimulateInput(JoystickButton.Start); } }
private void UpdateVisibility() { if (OWTime.IsPaused(OWTime.PauseType.Menu) || OWTime.IsPaused(OWTime.PauseType.Sleeping) || SceneHelper.IsInTitle()) { Show(); } else { Hide(); } }
private void StartPausing() { if (_state == State.Pausing) { return; } DebugLog.DebugWrite($"START PAUSING (Target:{_serverTime} Current:{Time.timeSinceLevelLoad})", MessageType.Info); Locator.GetActiveCamera().enabled = false; OWTime.SetTimeScale(0f); _state = State.Pausing; SpinnerUI.Show(); TimeSyncUI.Start(TimeSyncType.Pausing); }
private void CheckTimeDifference() { var diff = GetTimeDifference(); if (diff > PauseOrFastForwardThreshold || diff < -PauseOrFastForwardThreshold) { WakeUpOrSleep(); } var mappedTimescale = diff.Map(-PauseOrFastForwardThreshold, PauseOrFastForwardThreshold, 1 + TimescaleBounds, 1 - TimescaleBounds); OWTime.SetTimeScale(mappedTimescale); }
public void OnDisconnect() { OWTime.SetTimeScale(1f); OWTime.SetMaxDeltaTime(0.06666667f); OWTime.SetFixedTimestep(0.01666667f); Locator.GetActiveCamera().enabled = true; CurrentState = State.NotLoaded; CurrentReason = null; Physics.SyncTransforms(); SpinnerUI.Hide(); TimeSyncUI.Stop(); QSBInputManager.Instance.SetInputsEnabled(true); }
private void Update() { if (!_isStarted || OWTime.IsPaused()) { return; } if (Input.GetMouseButtonDown(0) && _isDucksEnabled) { ShootDuck(); } else if (Input.GetMouseButtonDown(1) && _isCubesEnabled) { CreateCube(); } }
private void OnCloseInfoPopup() { var pauseCommandListener = Locator.GetPauseCommandListener(); if (pauseCommandListener != null && _addedPauseLock) { pauseCommandListener.RemovePauseCommandLock(); _addedPauseLock = false; } OWTime.Unpause(OWTime.PauseType.Menu); OWInput.RestorePreviousInputs(); PopupOK?.SafeInvoke(); PopupOK = null; }
private void SpawnAt(SpawnPoint point) { var body = PlayerState.IsInsideShip() ? Locator.GetShipBody() : Locator.GetPlayerBody(); body.WarpToPositionRotation(point.transform.position, point.transform.rotation); body.SetVelocity(point.GetPointVelocity()); point.AddObjectToTriggerVolumes(Locator.GetPlayerDetector().gameObject); point.AddObjectToTriggerVolumes(_fluidDetector.gameObject); point.OnSpawnPlayer(); OWTime.Unpause(OWTime.PauseType.Menu); if (_suitUpOnTravel) { Locator.GetPlayerSuit().SuitUp(); } }
private void UpdateSignalscopeReticuleVisibility() { if (_reticule == null) { return; } if (_reticule.gameObject.activeSelf && OWTime.IsPaused()) { _reticule.gameObject.SetActive(false); } else if (!_reticule.gameObject.activeSelf && !OWTime.IsPaused()) { _reticule.gameObject.SetActive(true); } }
private static void UpdateWakeUpPrompt() { var hand = HandsController.Behaviour.RightHand; var isLookingAtHand = hand != null && CameraHelper.IsOnScreen(hand.position); var isSleeping = OWTime.IsPaused(OWTime.PauseType.Sleeping); var shouldShowText = !isLookingAtHand && isSleeping; var isShowingText = IsShowing(GestureText.WakeUp); if (!isShowingText && shouldShowText) { SetText(GestureText.WakeUp); } else if (isShowingText && !shouldShowText) { SetText(GestureText.None); } }
private void ResetTimeScale() { OWTime.SetTimeScale(1f); OWTime.SetMaxDeltaTime(0.06666667f); OWTime.SetFixedTimestep(0.01666667f); Locator.GetActiveCamera().enabled = true; _state = State.Loaded; DebugLog.DebugWrite($"RESET TIMESCALE", MessageType.Info); _isFirstFastForward = false; QSBCore.HasWokenUp = true; Physics.SyncTransforms(); SpinnerUI.Hide(); TimeSyncUI.Stop(); QSBEventManager.FireEvent(EventNames.QSBPlayerStatesRequest); RespawnOnDeath.Instance.Init(); }
private void OpenInfoPopup(string message, string okButtonText, string cancelButtonText) { TwoButtonInfoPopup.SetUpPopup(message, InputLibrary.menuConfirm, InputLibrary.cancel, new ScreenPrompt(okButtonText), new ScreenPrompt(cancelButtonText)); OWTime.Pause(OWTime.PauseType.Menu); OWInput.ChangeInputMode(InputMode.Menu); var pauseCommandListener = Locator.GetPauseCommandListener(); if (pauseCommandListener != null) { pauseCommandListener.AddPauseCommandLock(); _addedPauseLock = true; } TwoButtonInfoPopup.EnableMenu(true); }
private static bool PreUpdateRumble(object[] ___m_theList, bool ___m_isEnabled) { if (OWTime.IsPaused()) { return(false); } var a = Vector2.zero; if (___m_isEnabled && OWInput.UsingGamepad()) { var deltaTime = Time.deltaTime; for (var i = 0; i < ___m_theList.Length; i++) { var rumble = ___m_theList[i]; var isAlive = (bool)rumble.GetType().GetMethod("IsAlive").Invoke(rumble, new object[] { }); if (isAlive) { rumble.Invoke("Update", deltaTime); } var isAliveAgain = (bool)rumble.GetType().GetMethod("IsAlive").Invoke(rumble, new object[] { }); if (isAliveAgain) { var power = (Vector2)rumble.GetType().GetMethod("GetPower").Invoke(rumble, new object[] { }); a += power; } } a.x *= 1.42857146f; a.y *= 1.42857146f; var haptic = SteamVR_Actions.default_Haptic; var frequency = 0.1f; var amplitudeY = a.y * ModSettings.VibrationStrength; var amplitudeX = a.x * ModSettings.VibrationStrength; haptic.Execute(0, frequency, 10, amplitudeY, SteamVR_Input_Sources.RightHand); haptic.Execute(0, frequency, 50, amplitudeX, SteamVR_Input_Sources.RightHand); haptic.Execute(0, frequency, 10, amplitudeY, SteamVR_Input_Sources.LeftHand); haptic.Execute(0, frequency, 50, amplitudeX, SteamVR_Input_Sources.LeftHand); } return(false); }
private void StartFastForwarding() { if (_state == State.FastForwarding) { TimeSyncUI.TargetTime = _serverTime; return; } DebugLog.DebugWrite($"START FASTFORWARD (Target:{_serverTime} Current:{Time.timeSinceLevelLoad})", MessageType.Info); if (Locator.GetActiveCamera() != null) { Locator.GetActiveCamera().enabled = false; } _state = State.FastForwarding; OWTime.SetMaxDeltaTime(0.033333335f); OWTime.SetFixedTimestep(0.033333335f); TimeSyncUI.TargetTime = _serverTime; TimeSyncUI.Start(TimeSyncType.Fastforwarding); }
private void StartPausing(PauseReason reason) { if (CurrentState == State.Pausing) { TimeSyncUI.TargetTime = _serverTime; return; } DebugLog.DebugWrite($"START PAUSING (Target:{_serverTime} Current:{Time.timeSinceLevelLoad})", MessageType.Info); Locator.GetActiveCamera().enabled = false; //OWInput.ChangeInputMode(InputMode.None); QSBInputManager.Instance.SetInputsEnabled(false); OWTime.SetTimeScale(0f); CurrentState = State.Pausing; CurrentReason = reason; SpinnerUI.Show(); TimeSyncUI.TargetTime = _serverTime; TimeSyncUI.Start(TimeSyncType.Pausing, reason); }
private void UpdateLocal() { _serverTime += Time.unscaledDeltaTime; if (_state == State.NotLoaded) { return; } if (_state == State.FastForwarding) { if (Locator.GetPlayerCamera() != null && !Locator.GetPlayerCamera().enabled) { Locator.GetPlayerCamera().enabled = false; } var diff = _serverTime - Time.timeSinceLevelLoad; OWTime.SetTimeScale(Mathf.SmoothStep(MinFastForwardSpeed, MaxFastForwardSpeed, Mathf.Abs(diff) / MaxFastForwardDiff)); if (QSBSceneManager.CurrentScene == OWScene.SolarSystem && _isFirstFastForward) { var spawnPoint = Locator.GetPlayerBody().GetComponent <PlayerSpawner>().GetInitialSpawnPoint().transform; Locator.GetPlayerTransform().position = spawnPoint.position; Locator.GetPlayerTransform().rotation = spawnPoint.rotation; Physics.SyncTransforms(); } } var isDoneFastForwarding = _state == State.FastForwarding && Time.timeSinceLevelLoad >= _serverTime; var isDonePausing = _state == State.Pausing && Time.timeSinceLevelLoad < _serverTime; if (isDoneFastForwarding || isDonePausing) { ResetTimeScale(); } if (_state == State.Loaded) { CheckTimeDifference(); } }
public void EndConversation() { if (!enabled) { return; } enabled = false; if (_timeFrozen) { _timeFrozen = false; OWTime.Unpause(OWTime.PauseType.Reading); } _interactVolume.ResetInteraction(); Locator.GetPlayerTransform().GetRequiredComponent <PlayerLockOnTargeting>().BreakLock(); GlobalMessenger.FireEvent("ExitConversation"); Locator.GetPlayerAudioController().PlayDialogueExit(); if (_wasFlashlightOn && _turnOffFlashlight && _turnOnFlashlight) { Locator.GetFlashlight().TurnOn(false); } GameObject.FindWithTag("DialogueGui").GetRequiredComponent <DialogueBoxVer2>().OnEndDialogue(); if (_currentNode != null) { _currentNode.SetNodeCompleted(); } if (PlayerState.InZeroG()) { var component = Locator.GetPlayerBody().GetComponent <Autopilot>(); if (component.enabled) { component.Abort(); } } }
private void ResetTimeScale() { OWTime.SetTimeScale(1f); OWTime.SetMaxDeltaTime(0.06666667f); OWTime.SetFixedTimestep(0.01666667f); Locator.GetActiveCamera().enabled = true; CurrentState = State.Loaded; CurrentReason = null; DebugLog.DebugWrite($"RESET TIMESCALE", MessageType.Info); Physics.SyncTransforms(); SpinnerUI.Hide(); TimeSyncUI.Stop(); new RequestStateResyncMessage().Send(); RespawnOnDeath.Instance.Init(); QSBInputManager.Instance.SetInputsEnabled(true); if (!_hasWokenUp) { WakeUp(); } }
private void StartFastForwarding(FastForwardReason reason) { if (CurrentState == State.FastForwarding) { TimeSyncUI.TargetTime = _serverTime; return; } DebugLog.DebugWrite($"START FASTFORWARD (Target:{_serverTime} Current:{Time.timeSinceLevelLoad})", MessageType.Info); if (Locator.GetActiveCamera() != null) { Locator.GetActiveCamera().enabled = false; } //OWInput.ChangeInputMode(InputMode.None); QSBInputManager.Instance.SetInputsEnabled(false); CurrentState = State.FastForwarding; CurrentReason = reason; OWTime.SetMaxDeltaTime(0.033333335f); OWTime.SetFixedTimestep(0.033333335f); TimeSyncUI.TargetTime = _serverTime; TimeSyncUI.Start(TimeSyncType.FastForwarding, reason); }
private bool IsPaused() { return(OWTime.IsPaused(OWTime.PauseType.Menu) || OWTime.IsPaused(OWTime.PauseType.Sleeping) || SceneHelper.IsInTitle()); }
private bool IsMenuInteractionAllowed() { return(OWTime.IsPaused() || !SceneHelper.IsInGame() || PlayerState.IsSleepingAtCampfire()); }
private void UpdateClient() { _serverTime += Time.unscaledDeltaTime; var serverState = ServerStateManager.Instance.GetServerState(); var clientState = QSBPlayerManager.LocalPlayer.State; var currentScene = QSBSceneManager.CurrentScene; // set fastforwarding timescale if (CurrentState == State.FastForwarding && (FastForwardReason)CurrentReason == FastForwardReason.TooFarBehind) { if (Locator.GetPlayerCamera() != null && !Locator.GetPlayerCamera().enabled) { Locator.GetPlayerCamera().enabled = false; } var diff = _serverTime - Time.timeSinceLevelLoad; OWTime.SetTimeScale(Mathf.SmoothStep(MinFastForwardSpeed, MaxFastForwardSpeed, Mathf.Abs(diff) / MaxFastForwardDiff)); TimeSyncUI.TargetTime = _serverTime; } if (CurrentState == State.Pausing && (PauseReason)CurrentReason == PauseReason.TooFarAhead) { TimeSyncUI.TargetTime = _serverTime; } if (CurrentState != State.Loaded && CurrentState != State.NotLoaded && CurrentReason == null) { DebugLog.ToConsole($"Warning - CurrentReason is null.", MessageType.Warning); } // Checks to pause/fastforward if (clientState is ClientState.NotLoaded or ClientState.InTitleScreen) { return; } if (serverState == ServerState.NotLoaded && CurrentState != State.Pausing && QSBSceneManager.IsInUniverse) { StartPausing(PauseReason.ServerNotStarted); } if (serverState == ServerState.WaitingForAllPlayersToReady && CurrentState != State.Pausing && clientState == ClientState.WaitingForOthersToBeReady) { StartPausing(PauseReason.WaitingForAllPlayersToBeReady); } if (serverState == ServerState.WaitingForAllPlayersToDie && clientState == ClientState.WaitingForOthersToBeReady) { StartPausing(PauseReason.WaitingForAllPlayersToBeReady); } // Checks to revert to normal if (CurrentState == State.Pausing && (PauseReason)CurrentReason == PauseReason.ServerNotStarted) { if (serverState != ServerState.NotLoaded) { ResetTimeScale(); } } if (CurrentState == State.Pausing && (PauseReason)CurrentReason == PauseReason.WaitingForAllPlayersToBeReady) { if (clientState == ClientState.AliveInSolarSystem && serverState == ServerState.InSolarSystem) { ResetTimeScale(); } } if (CurrentState == State.Pausing && (PauseReason)CurrentReason == PauseReason.TooFarAhead) { if (Time.timeSinceLevelLoad <= _serverTime) { ResetTimeScale(); } } if (CurrentState == State.FastForwarding && (FastForwardReason)CurrentReason == FastForwardReason.TooFarBehind) { if (Time.timeSinceLevelLoad >= _serverTime) { ResetTimeScale(); } } if (CurrentState == State.Loaded) { CheckTimeDifference(); } }
private void OnGUI() { if (_playerController == null || _playerForceDetector == null) { this._playerForceDetector = Locator.GetPlayerForceDetector(); this._playerController = Locator.GetPlayerController(); if (_playerController == null || _playerForceDetector == null) { return; } } float num = 400f; if (GUIMode.IsHiddenMode() || PlayerState.UsingShipComputer()) { return; } if (inputHUD == 1) { GUI.Label(new Rect(10f + num, 10f, 200f, 20f), "Time Scale: " + Mathf.Round(Time.timeScale * 100f) / 100f); GUI.Label(new Rect(10f + num, 25f, 200f, 20f), string.Concat(new object[] { "Time Remaining: ", Mathf.Floor(TimeLoop.GetSecondsRemaining() / 60f), ":", Mathf.Round(TimeLoop.GetSecondsRemaining() % 60f * 100f / 100f) })); GUI.Label(new Rect(10f + num, 40f, 200f, 20f), "Loop Count: " + TimeLoop.GetLoopCount()); GUI.Label(new Rect(10f + num, 55f, 90f, 40f), "PauseFlags: "); GUI.Label(new Rect(100f + num, 55f, 50f, 40f), "MENU\n" + ((!OWTime.IsPaused(OWTime.PauseType.Menu)) ? "FALSE" : "TRUE ")); GUI.Label(new Rect(150f + num, 55f, 50f, 40f), "LOAD\n" + ((!OWTime.IsPaused(OWTime.PauseType.Loading)) ? "FALSE" : "TRUE ")); GUI.Label(new Rect(200f + num, 55f, 50f, 40f), "READ\n" + ((!OWTime.IsPaused(OWTime.PauseType.Reading)) ? "FALSE" : "TRUE ")); GUI.Label(new Rect(250f + num, 55f, 50f, 40f), "SLP\n" + ((!OWTime.IsPaused(OWTime.PauseType.Sleeping)) ? "FALSE" : "TRUE ")); GUI.Label(new Rect(300f + num, 55f, 50f, 40f), "INIT\n" + ((!OWTime.IsPaused(OWTime.PauseType.Initializing)) ? "FALSE" : "TRUE ")); GUI.Label(new Rect(350f + num, 55f, 50f, 40f), "STRM\n" + ((!OWTime.IsPaused(OWTime.PauseType.Streaming)) ? "FALSE" : "TRUE ")); GUI.Label(new Rect(400f + num, 55f, 50f, 40f), "SYS\n" + ((!OWTime.IsPaused(OWTime.PauseType.System)) ? "FALSE" : "TRUE ")); GUI.Label(new Rect(10f + num, 85f, 200f, 20f), "Input Mode: " + OWInput.GetInputMode().ToString()); this._inputModeArray = OWInput.GetInputModeStack(); GUI.Label(new Rect(10f + num, 100f, 200f, 20f), "Input Mode Stack: "); int num2 = 150; int num3 = 0; while (num3 < this._inputModeArray.Length && this._inputModeArray[num3] != InputMode.None) { GUI.Label(new Rect((float)num2 + num, 100f, 200f, 20f), this._inputModeArray[num3].ToString()); num2 += 75; num3++; } GUI.Label(new Rect(10f + num, 115f, 300f, 20f), "Net Force Accel: " + Mathf.Round(this._playerForceDetector.GetForceAcceleration().magnitude * 100f) / 100f); GUI.Label(new Rect(210f + num, 115f, 300f, 20f), "G-Force: " + Mathf.Round(this._gForce * 100f) / 100f); GUI.Label(new Rect(10f + num, 130f, 200f, 20f), "Load Time: " + LoadTimeTracker.GetLatestLoadTime()); if (DynamicResolutionManager.isEnabled) { GUI.Label(new Rect(10f + num, 145f, 200f, 20f), "Resolution Scale: " + DynamicResolutionManager.currentResolutionScale); } GUI.Label(new Rect(10f + num, 160f, 200f, 20f), "Player Speed: " + (Locator.GetCenterOfTheUniverse().GetOffsetVelocity() + Locator.GetPlayerBody().GetVelocity()).magnitude.ToString()); GUI.Label(new Rect(210f + num, 160f, 200f, 20f), "Player Accel: " + Locator.GetPlayerBody().GetAcceleration().magnitude.ToString()); if (Locator.GetPlayerSuit().GetComponent <JetpackThrusterModel>()) { GUI.Label(new Rect(10f + num, 175f, 200f, 20f), string.Concat(new object[] { "Jetpack Max Accel: ", Locator.GetPlayerSuit().GetComponent <JetpackThrusterModel>().GetMaxTranslationalThrust().ToString(), "/", Locator.GetPlayerSuit().GetComponent <JetpackThrusterModel>().GetBoostMaxThrust().ToString() })); } if (Locator.GetShipBody().GetComponent <ShipThrusterModel>()) { GUI.Label(new Rect(210f + num, 175f, 200f, 20f), "Ship Max Accel: " + Locator.GetShipBody().GetComponent <ShipThrusterModel>().GetMaxTranslationalThrust().ToString()); } GUI.Label(new Rect(10f + num, 190f, 400f, 20f), string.Concat(new object[] { "Inspector layer: ", rayMask, " ", LayerMask.LayerToName(rayMask) })); if (GetWarpOWRigidbody()) { GUI.Label(new Rect(10f + num, 205f, 400f, 20f), string.Concat(new string[] { "Warp Body: ", GetWarpOWRigidbody().gameObject.name, " layer: ", GetWarpOWRigidbody().gameObject.layer.ToString(), " ", LayerMask.LayerToName(GetWarpOWRigidbody().gameObject.layer) })); } if (hit.collider) { GUI.Label(new Rect(10f + num, 220f, 400f, 20f), string.Concat(new string[] { "Latest hit layer: ", hit.collider.gameObject.layer.ToString(), " ", LayerMask.LayerToName(hit.collider.gameObject.layer) })); GUI.Label(new Rect(10f + num, 235f, 600f, 20f), "Name: " + hit.collider.gameObject.name + " Distance: " + (hit.point - Locator.GetPlayerBody().transform.position).magnitude.ToString()); } /*if (PadEZ.PadManager.GetActiveController()!=null) * { * GUI.Label(new Rect(10f + num, 250f, 600f, 20f), PadEZ.PadManager.GetActiveController().GetIndex().ToString() + " " + PadEZ.PadManager.GetActiveController().GetPadType().ToString() +" "+ UnityEngine.Input.GetJoystickNames()[PadEZ.PadManager.GetActiveController().GetIndex()]); * }*/ } if (inputHUD == 2) { GUI.Label(new Rect(10f, 10f, 300f, 2500f), ReadInputManager.ReadCommandInputs(false)); } if (inputHUD == 3) { GUI.Label(new Rect(0f, 0f, 300f, 2500f), ReadInputManager.ReadCommandInputs(false)); GUI.Label(new Rect(300f, 0f, 300f, 2500f), ReadInputManager.ReadCommandInputs(true)); } if (inputHUD == 4) { GUI.Label(new Rect(0f, 0f, 500f, 2500f), ReadInputManager.ReadInputAxes()); GUI.Label(new Rect(500f, 0f, 500f, 2500f), ReadInputManager.ReadRawInputManagerButtons()); } }
public void OnGUI() { if (!DebugMode) { return; } var offset = 10f; GUI.Label(new Rect(220, 10, 200f, 20f), $"FPS : {Mathf.Round(1f / Time.smoothDeltaTime)}"); offset += _debugLineSpacing; GUI.Label(new Rect(220, offset, 200f, 20f), $"HasWokenUp : {HasWokenUp}"); offset += _debugLineSpacing; if (WakeUpSync.LocalInstance != null) { GUI.Label(new Rect(220, offset, 200f, 20f), $"Time Difference : {WakeUpSync.LocalInstance.GetTimeDifference()}"); offset += _debugLineSpacing; GUI.Label(new Rect(220, offset, 200f, 20f), $"Timescale : {OWTime.GetTimeScale()}"); offset += _debugLineSpacing; } if (!HasWokenUp) { return; } var offset3 = 10f; GUI.Label(new Rect(420, offset3, 200f, 20f), $"Current synced sector :"); offset3 += _debugLineSpacing; var sector = PlayerTransformSync.LocalInstance.ReferenceSector; var text = sector == null ? "NULL SECTOR" : $"{sector.AttachedObject.name} : {sector.IsFakeSector}"; GUI.Label(new Rect(420, offset3, 400f, 20f), $"- {text}"); offset3 += _debugLineSpacing; var offset2 = 10f; GUI.Label(new Rect(620, offset2, 200f, 20f), $"Owned Objects :"); offset2 += _debugLineSpacing; foreach (var obj in QSBWorldSync.GetWorldObjects <IQSBQuantumObject>().Where(x => x.ControllingPlayer == QSBPlayerManager.LocalPlayerId)) { GUI.Label(new Rect(620, offset2, 200f, 20f), $"- {(obj as IWorldObject).Name}, {obj.ControllingPlayer}, {obj.IsEnabled}"); offset2 += _debugLineSpacing; } if (QSBSceneManager.CurrentScene != OWScene.SolarSystem) { return; } GUI.Label(new Rect(220, offset, 200f, 20f), $"QM Illuminated : {Locator.GetQuantumMoon().IsIlluminated()}"); offset += _debugLineSpacing; GUI.Label(new Rect(220, offset, 200f, 20f), $"Shrine player in dark? : {QuantumManager.Instance.Shrine.IsPlayerInDarkness()}"); offset += _debugLineSpacing; GUI.Label(new Rect(220, offset, 200f, 20f), $"QM Visible by :"); offset += _debugLineSpacing; var tracker = Locator.GetQuantumMoon().GetValue <ShapeVisibilityTracker>("_visibilityTracker"); foreach (var player in QSBPlayerManager.GetPlayersWithCameras()) { GUI.Label(new Rect(220, offset, 200f, 20f), $" - {player.PlayerId} : {tracker.GetType().GetMethod("IsInFrustum", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(tracker, new object[] { player.Camera.GetFrustumPlanes() })}"); offset += _debugLineSpacing; } if (SocketedObjToDebug == -1) { return; } // Used for diagnosing specific socketed objects. // 110 = Cave Twin entanglement shard // 342 = Timber Hearth museum shard var socketedObject = QSBWorldSync.GetWorldFromId <QSBSocketedQuantumObject>(SocketedObjToDebug); GUI.Label(new Rect(220, offset, 200f, 20f), $"{SocketedObjToDebug} Controller : {socketedObject.ControllingPlayer}"); offset += _debugLineSpacing; GUI.Label(new Rect(220, offset, 200f, 20f), $"{SocketedObjToDebug} Illuminated : {socketedObject.AttachedObject.IsIlluminated()}"); offset += _debugLineSpacing; var socketedTrackers = socketedObject.AttachedObject.GetComponentsInChildren <ShapeVisibilityTracker>(); if (socketedTrackers == null || socketedTrackers.Length == 0) { GUI.Label(new Rect(220, offset, 200f, 20f), $"- List is null or empty."); return; } if (socketedTrackers.Any(x => x is null)) { GUI.Label(new Rect(220, offset, 200f, 20f), $"- Uses a null."); return; } GUI.Label(new Rect(220, offset, 200f, 20f), $"Visible by :"); offset += _debugLineSpacing; foreach (var player in QSBPlayerManager.GetPlayersWithCameras()) { GUI.Label(new Rect(220, offset, 200f, 20f), $" - {player.PlayerId} : {socketedTrackers.Any(x => (bool)x.GetType().GetMethod("IsInFrustum", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(x, new object[] { player.Camera.GetFrustumPlanes() }))}"); offset += _debugLineSpacing; } GUI.Label(new Rect(220, offset, 200f, 20f), $"Entangled Players :"); offset += _debugLineSpacing; foreach (var player in QuantumManager.GetEntangledPlayers(socketedObject.AttachedObject)) { GUI.Label(new Rect(220, offset, 200f, 20f), $" - {player.PlayerId}"); offset += _debugLineSpacing; } var sockets = socketedObject.AttachedObject.GetValue <List <QuantumSocket> >("_socketList"); foreach (var socket in sockets) { GUI.Label(new Rect(220, offset, 200f, 20f), $"- {socket.name} :"); offset += _debugLineSpacing; GUI.Label(new Rect(220, offset, 200f, 20f), $" - Visible:{socket.GetVisibilityObject().IsVisible()}"); offset += _debugLineSpacing; GUI.Label(new Rect(220, offset, 200f, 20f), $" - Illuminated:{socket.GetVisibilityObject().IsIlluminated()}"); offset += _debugLineSpacing; GUI.Label(new Rect(220, offset, 200f, 20f), $" - Occupied?:{socket.IsOccupied()}"); offset += _debugLineSpacing; } }