diff --git a/Assets/Scripts/Framework/LogKit/VerText.cs b/Assets/Scripts/Framework/LogKit/VerText.cs index 29eb4f7b7..73c214e97 100644 --- a/Assets/Scripts/Framework/LogKit/VerText.cs +++ b/Assets/Scripts/Framework/LogKit/VerText.cs @@ -1,3 +1,4 @@ +using AibisDream.Framework; using TMPro; using UnityEngine; @@ -5,9 +6,20 @@ namespace AibisDream.Kit { public class VerText : MonoBehaviour { - void Start() + private void Start() { GetComponent().text = $"Ver.{Application.version}"; + EnumEventSystem.Global.Register(UIEventEnum.RecordingModeChanged, OnRecordingModeChanged); + } + + private void OnDestroy() + { + EnumEventSystem.Global.UnRegister(UIEventEnum.RecordingModeChanged, OnRecordingModeChanged); + } + + private void OnRecordingModeChanged(bool isRecording) + { + gameObject.SetActive(!isRecording); } } } diff --git a/Assets/Scripts/Game Loop/EventEnums.cs b/Assets/Scripts/Game Loop/EventEnums.cs index 2946a9a8d..5d2de24f6 100644 --- a/Assets/Scripts/Game Loop/EventEnums.cs +++ b/Assets/Scripts/Game Loop/EventEnums.cs @@ -98,4 +98,9 @@ namespace AibisDream PauseMenuAmbEnter, PauseMenuAmbExit, } + + public enum UIEventEnum + { + RecordingModeChanged + } } diff --git a/Assets/Scripts/UI/Cursor/CursorManager.cs b/Assets/Scripts/UI/Cursor/CursorManager.cs index 0fd4fad2f..b67607e3d 100644 --- a/Assets/Scripts/UI/Cursor/CursorManager.cs +++ b/Assets/Scripts/UI/Cursor/CursorManager.cs @@ -23,6 +23,29 @@ namespace AibisDream #else InitCursor(); #endif + EnumEventSystem.Global.Register(UIEventEnum.RecordingModeChanged, OnRecordingModeChanged); + } + + private void OnDestroy() + { + EnumEventSystem.Global.UnRegister(UIEventEnum.RecordingModeChanged, OnRecordingModeChanged); + } + + private void OnRecordingModeChanged(bool isRecording) + { +#if UNITY_ANDROID || UNITY_IOS + return; +#endif + + if (_cursor != null) + { + _cursor.gameObject.SetActive(!isRecording); + } + + if (isRecording) + { + Cursor.visible = false; + } } private void InitCursor() diff --git a/Assets/Scripts/UI/UIManager.cs b/Assets/Scripts/UI/UIManager.cs index 59c723cb5..77aa70056 100644 --- a/Assets/Scripts/UI/UIManager.cs +++ b/Assets/Scripts/UI/UIManager.cs @@ -23,6 +23,7 @@ namespace AibisDream public RectTransform DialogCanvas { get; private set; } private GraphicRaycaster _raycaster; + private bool _isRecordingMode; #endregion @@ -63,6 +64,13 @@ namespace AibisDream ShowPanel(); } } + + if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) + && Input.GetKeyDown(KeyCode.R)) + { + _isRecordingMode = !_isRecordingMode; + EnumEventSystem.Global.Send(UIEventEnum.RecordingModeChanged, _isRecordingMode); + } } private void InitRefs()