From 6e2dba8e9c803193a5db21d7cc33ab04a7fd000f Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Tue, 3 May 2022 09:44:07 +0100 Subject: [PATCH] fix gui in eye --- QSB/Utility/DebugGUI.cs | 157 ++++++++++++++++++++-------------------- 1 file changed, 80 insertions(+), 77 deletions(-) diff --git a/QSB/Utility/DebugGUI.cs b/QSB/Utility/DebugGUI.cs index 359dcf94..e8ce2cda 100644 --- a/QSB/Utility/DebugGUI.cs +++ b/QSB/Utility/DebugGUI.cs @@ -173,104 +173,107 @@ internal class DebugGUI : MonoBehaviour, IAddComponentOnStart #endregion - #region Column3 - Ship data - - WriteLine(3, $"Current Flyer : {ShipManager.Instance.CurrentFlyer}"); - if (ShipTransformSync.LocalInstance != null) + if (QSBSceneManager.CurrentScene == OWScene.SolarSystem) { - var instance = ShipTransformSync.LocalInstance; - if (QSBCore.IsHost) + #region Column3 - Ship data + + WriteLine(3, $"Current Flyer : {ShipManager.Instance.CurrentFlyer}"); + if (ShipTransformSync.LocalInstance != null) { - var currentOwner = instance.netIdentity.connectionToClient; - if (currentOwner == null) + var instance = ShipTransformSync.LocalInstance; + if (QSBCore.IsHost) { - WriteLine(3, "Current Owner : NULL"); + var currentOwner = instance.netIdentity.connectionToClient; + if (currentOwner == null) + { + WriteLine(3, "Current Owner : NULL"); + } + else + { + WriteLine(3, $"Current Owner : {currentOwner.GetPlayerId()}"); + } } - else - { - WriteLine(3, $"Current Owner : {currentOwner.GetPlayerId()}"); - } - } - var sector = instance.ReferenceSector; - WriteLine(3, $"Ref. Sector : {(sector != null ? sector.Name : "NULL")}", sector == null ? Color.red : Color.white); - var transform = instance.ReferenceTransform; - WriteLine(3, $"Ref. Transform : {(transform != null ? transform.name : "NULL")}", transform == null ? Color.red : Color.white); - } - else - { - WriteLine(3, "ShipTransformSync.LocalInstance is null.", Color.red); - } - - WriteLine(3, "QSBShipComponent"); - foreach (var component in QSBWorldSync.GetWorldObjects()) - { - var attachedObject = component.AttachedObject; - if (attachedObject == null) - { - WriteLine(3, $"- {component.ObjectId} NULL ATTACHEDOBJECT", Color.red); + var sector = instance.ReferenceSector; + WriteLine(3, $"Ref. Sector : {(sector != null ? sector.Name : "NULL")}", sector == null ? Color.red : Color.white); + var transform = instance.ReferenceTransform; + WriteLine(3, $"Ref. Transform : {(transform != null ? transform.name : "NULL")}", transform == null ? Color.red : Color.white); } else { - WriteLine(3, $"- {component.AttachedObject.name} RepairFraction:{component.AttachedObject._repairFraction}"); + WriteLine(3, "ShipTransformSync.LocalInstance is null.", Color.red); } - } - WriteLine(3, "QSBShipHull"); - foreach (var hull in QSBWorldSync.GetWorldObjects()) - { - var attachedObject = hull.AttachedObject; - if (attachedObject == null) + WriteLine(3, "QSBShipComponent"); + foreach (var component in QSBWorldSync.GetWorldObjects()) { - WriteLine(3, $"- {hull.ObjectId} NULL ATTACHEDOBJECT", Color.red); - } - else - { - WriteLine(3, $"- {hull.AttachedObject.name}, Integrity:{hull.AttachedObject.integrity}"); - } - } - - #endregion - - if (QSBWorldSync.AllObjectsReady) - { - var ghost = QSBWorldSync.GetWorldObjects().First(x => x.AttachedObject._name == "Yubaba"); - WriteLine(4, ghost.AttachedObject._name); - WriteLine(4, $"Action:{ghost.GetCurrentActionName()}"); - WriteLine(4, $"Threat Awareness:{ghost.GetThreatAwareness()}"); - var interestedPlayer = ghost._data.interestedPlayer; - WriteLine(4, $"InterestedPlayer:{(interestedPlayer == null ? "NULL" : interestedPlayer.player.PlayerId)}"); - - foreach (var player in ghost._data.players.Values) - { - WriteLine(4, $"{player.player.PlayerId}"); - WriteLine(4, $"- isPlayerVisible:{player.sensor.isPlayerVisible}"); - WriteLine(4, $"- isPlayerHeldLanternVisible:{player.sensor.isPlayerHeldLanternVisible}"); - WriteLine(4, $"- isIlluminatedByPlayer:{player.sensor.isIlluminatedByPlayer}"); - WriteLine(4, $"- isPlayerLocationKnown:{player.isPlayerLocationKnown}"); - WriteLine(4, $"- timeSincePlayerLocationKnown:{player.timeSincePlayerLocationKnown}"); - var lantern = player.player.AssignedSimulationLantern; - if (lantern != null) + var attachedObject = component.AttachedObject; + if (attachedObject == null) { - WriteLine(4, $"- IsHeldByPlayer:{lantern.AttachedObject.GetLanternController().IsHeldByPlayer()}"); - WriteLine(4, $"- Concealed:{lantern.AttachedObject.GetLanternController().IsConcealed()}"); + WriteLine(3, $"- {component.ObjectId} NULL ATTACHEDOBJECT", Color.red); } else { - WriteLine(4, $"- LANTERN NULL", Color.red); + WriteLine(3, $"- {component.AttachedObject.name} RepairFraction:{component.AttachedObject._repairFraction}"); } + } - var playerCamera = player.player.Camera; - - if (playerCamera != null) + WriteLine(3, "QSBShipHull"); + foreach (var hull in QSBWorldSync.GetWorldObjects()) + { + var attachedObject = hull.AttachedObject; + if (attachedObject == null) { - var position = playerCamera.transform.position; - WriteLine(4, $"- Camera in vision cone:{ghost.AttachedObject._sensors.CheckPointInVisionCone(position)}"); - WriteLine(4, $"- CheckLineOccluded:{ghost.AttachedObject._sensors.CheckLineOccluded(ghost.AttachedObject._sensors._sightOrigin.position, position)}"); + WriteLine(3, $"- {hull.ObjectId} NULL ATTACHEDOBJECT", Color.red); } else { - WriteLine(4, $"- CAMERA NULL", Color.red); + WriteLine(3, $"- {hull.AttachedObject.name}, Integrity:{hull.AttachedObject.integrity}"); + } + } + + #endregion + + if (QSBWorldSync.AllObjectsReady) + { + var ghost = QSBWorldSync.GetWorldObjects().First(x => x.AttachedObject._name == "Yubaba"); + WriteLine(4, ghost.AttachedObject._name); + WriteLine(4, $"Action:{ghost.GetCurrentActionName()}"); + WriteLine(4, $"Threat Awareness:{ghost.GetThreatAwareness()}"); + var interestedPlayer = ghost._data.interestedPlayer; + WriteLine(4, $"InterestedPlayer:{(interestedPlayer == null ? "NULL" : interestedPlayer.player.PlayerId)}"); + + foreach (var player in ghost._data.players.Values) + { + WriteLine(4, $"{player.player.PlayerId}"); + WriteLine(4, $"- isPlayerVisible:{player.sensor.isPlayerVisible}"); + WriteLine(4, $"- isPlayerHeldLanternVisible:{player.sensor.isPlayerHeldLanternVisible}"); + WriteLine(4, $"- isIlluminatedByPlayer:{player.sensor.isIlluminatedByPlayer}"); + WriteLine(4, $"- isPlayerLocationKnown:{player.isPlayerLocationKnown}"); + WriteLine(4, $"- timeSincePlayerLocationKnown:{player.timeSincePlayerLocationKnown}"); + var lantern = player.player.AssignedSimulationLantern; + if (lantern != null) + { + WriteLine(4, $"- IsHeldByPlayer:{lantern.AttachedObject.GetLanternController().IsHeldByPlayer()}"); + WriteLine(4, $"- Concealed:{lantern.AttachedObject.GetLanternController().IsConcealed()}"); + } + else + { + WriteLine(4, $"- LANTERN NULL", Color.red); + } + + var playerCamera = player.player.Camera; + + if (playerCamera != null) + { + var position = playerCamera.transform.position; + WriteLine(4, $"- Camera in vision cone:{ghost.AttachedObject._sensors.CheckPointInVisionCone(position)}"); + WriteLine(4, $"- CheckLineOccluded:{ghost.AttachedObject._sensors.CheckLineOccluded(ghost.AttachedObject._sensors._sightOrigin.position, position)}"); + } + else + { + WriteLine(4, $"- CAMERA NULL", Color.red); + } } } }