feat(record): 增加录制模式,按ctrl+R

This commit is contained in:
2026-07-10 18:58:47 +08:00
parent 892912e707
commit ea6b75d73d
4 changed files with 49 additions and 1 deletions
+13 -1
View File
@@ -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<TMP_Text>().text = $"Ver.{Application.version}";
EnumEventSystem.Global.Register<UIEventEnum, bool>(UIEventEnum.RecordingModeChanged, OnRecordingModeChanged);
}
private void OnDestroy()
{
EnumEventSystem.Global.UnRegister<UIEventEnum, bool>(UIEventEnum.RecordingModeChanged, OnRecordingModeChanged);
}
private void OnRecordingModeChanged(bool isRecording)
{
gameObject.SetActive(!isRecording);
}
}
}
+5
View File
@@ -98,4 +98,9 @@ namespace AibisDream
PauseMenuAmbEnter,
PauseMenuAmbExit,
}
public enum UIEventEnum
{
RecordingModeChanged
}
}
+23
View File
@@ -23,6 +23,29 @@ namespace AibisDream
#else
InitCursor();
#endif
EnumEventSystem.Global.Register<UIEventEnum, bool>(UIEventEnum.RecordingModeChanged, OnRecordingModeChanged);
}
private void OnDestroy()
{
EnumEventSystem.Global.UnRegister<UIEventEnum, bool>(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()
+8
View File
@@ -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<MainPanel>();
}
}
if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))
&& Input.GetKeyDown(KeyCode.R))
{
_isRecordingMode = !_isRecordingMode;
EnumEventSystem.Global.Send(UIEventEnum.RecordingModeChanged, _isRecordingMode);
}
}
private void InitRefs()