From da60751b32f636db7e64dde34833c0de1eb79130 Mon Sep 17 00:00:00 2001 From: D4VID Date: Sun, 1 Jun 2025 18:46:16 +0200 Subject: [PATCH] Hide UI during play --- CameraRoll/CameraRoll/manifest.jecs | 2 +- .../src/client/tool/CameraRollTool.cs | 22 +++++++++++++------ 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/CameraRoll/CameraRoll/manifest.jecs b/CameraRoll/CameraRoll/manifest.jecs index 80b9ddb..206ed31 100755 --- a/CameraRoll/CameraRoll/manifest.jecs +++ b/CameraRoll/CameraRoll/manifest.jecs @@ -1,7 +1,7 @@ ID: D4VID_CameraRoll Name: CameraRoll Author: D4VID -Version: 0.2.5 +Version: 0.3.0 Priority: 0 ClientOnly: true Dependencies: diff --git a/CameraRoll/CameraRoll/src/client/tool/CameraRollTool.cs b/CameraRoll/CameraRoll/src/client/tool/CameraRollTool.cs index 82f7782..274ec64 100755 --- a/CameraRoll/CameraRoll/src/client/tool/CameraRollTool.cs +++ b/CameraRoll/CameraRoll/src/client/tool/CameraRollTool.cs @@ -1,11 +1,15 @@ using System.Collections.Generic; +using System.Reflection; +using EccsLogicWorldAPI.Shared.AccessHelper; using LogicLog; +using LogicWorld; using UnityEngine; namespace CameraRoll.Client.Tool { public class CameraRollTool { private static ILogicLogger _logger = null!; private static Camera _cam; + private static PropertyInfo _showBuildingUI; /// /// How fast does it interpolate between points @@ -17,7 +21,7 @@ namespace CameraRoll.Client.Tool { /// If the track is playing/animating/moving the camera /// private static bool _playing; - + // Backup of the original (local) position and rotation of the camera private static Vector3 _originalPosition; private static Quaternion _originalRotation; @@ -38,6 +42,7 @@ namespace CameraRoll.Client.Tool { _logger = logger; PathPoints.Clear(); _playing = false; + _showBuildingUI = Properties.getPrivateStatic(typeof(FirstPersonInteraction), "ShowBuildingUI"); } public static void OnEnter() { @@ -65,7 +70,7 @@ namespace CameraRoll.Client.Tool { point.SetActive(visible); } } - + public static void Play() { if (_playing) return; @@ -75,8 +80,10 @@ namespace CameraRoll.Client.Tool { _pointIndex = 0; _interpolationState = 0.0f; - + SetPointsVisible(false); + _showBuildingUI.SetValue(null, false); // Hide UI + _playing = true; } @@ -86,8 +93,9 @@ namespace CameraRoll.Client.Tool { _cam.transform.localPosition = _originalPosition; _cam.transform.localRotation = _originalRotation; - + SetPointsVisible(true); + _showBuildingUI.SetValue(null, true); // Show UI } public static void Clear() { @@ -116,15 +124,15 @@ namespace CameraRoll.Client.Tool { } _interpolationState += InterpolationSpeed; - + Vector3 prevPos = GetPos(_pointIndex - 1); Vector3 newPos = GetPos(_pointIndex); - _cam.transform.position = Vector3.Lerp(prevPos , newPos, _interpolationState); + _cam.transform.position = Vector3.Lerp(prevPos, newPos, _interpolationState); Quaternion prevRot = GetRot(_pointIndex - 1); Quaternion newRot = GetRot(_pointIndex); _cam.transform.rotation = Quaternion.Slerp(prevRot, newRot, _interpolationState); - + if (_interpolationState >= 1.0f) { _pointIndex++; _interpolationState = 0.0f;