HoldVisualMesh 以及快捷键更新
This commit is contained in:
@@ -36,7 +36,8 @@ namespace Ichni.RhythmGame
|
||||
/// </summary>
|
||||
public virtual void UpdateNoteInMovableTrack()
|
||||
{
|
||||
trackPositioner.SetPercent((track.trackTimeSubmodule as TrackTimeSubmoduleMovable).GetTrackPercent(exactJudgeTime));
|
||||
TrackTimeSubmoduleMovable trackTimeSubmoduleMovable = track.trackTimeSubmodule as TrackTimeSubmoduleMovable;
|
||||
trackPositioner.SetPercent(trackTimeSubmoduleMovable.GetTrackPercent(exactJudgeTime));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Ichni.RhythmGame
|
||||
this.trackDisplay.spline = path;
|
||||
this.trackDisplay.size = 0.1f;
|
||||
|
||||
this.trackDisplay.gameObject.SetActive(isShowingDisplay);
|
||||
this.SetDisplay(isShowingDisplay);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +77,13 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
path.SetPoint(point.index, point.node, SplineComputer.Space.Local);
|
||||
}
|
||||
|
||||
|
||||
public void SetDisplay(bool isShowing)
|
||||
{
|
||||
this.isShowingDisplay = isShowing;
|
||||
trackDisplay.gameObject.SetActive(isShowing);
|
||||
}
|
||||
}
|
||||
|
||||
public partial class TrackPathSubmodule
|
||||
@@ -103,7 +110,7 @@ namespace Ichni.RhythmGame
|
||||
});
|
||||
|
||||
var showDisplayToggle = inspector.GenerateToggle(this, container, "Show Display", nameof(isShowingDisplay));
|
||||
showDisplayToggle.AddListenerFunction(_ => trackDisplay.gameObject.SetActive(isShowingDisplay));
|
||||
showDisplayToggle.AddListenerFunction(_ => SetDisplay(isShowingDisplay));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,8 +58,7 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public float GetTrackPercent(float songTimeInTime)
|
||||
{
|
||||
float per = AnimationCurveEvaluator.Evaluate(animationCurveType,
|
||||
(songTimeInTime - trackStartTime) / trackTotalTime);
|
||||
float per = AnimationCurveEvaluator.Evaluate(animationCurveType, (songTimeInTime - trackStartTime) / trackTotalTime);
|
||||
return Mathf.Clamp01(per);
|
||||
}
|
||||
|
||||
|
||||
@@ -149,7 +149,7 @@ namespace Ichni.RhythmGame
|
||||
/// 批量开启或关闭所有PathNode的Sphere显示
|
||||
/// </summary>
|
||||
/// <param name="isShowing"></param>
|
||||
private void SetAllPathNodeSphere(bool isShowing)
|
||||
public void SetAllPathNodeSphere(bool isShowing)
|
||||
{
|
||||
trackPathSubmodule.pathNodeList.ForEach(pn => pn.SetPathNodeSphere(isShowing));
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ichni.RhythmGame;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.InputSystem;
|
||||
@@ -11,57 +13,102 @@ namespace Ichni.Editor
|
||||
public partial class InputListener : MonoBehaviour
|
||||
{
|
||||
private PointerEventData pointerEventData;
|
||||
private bool isPointerOverUI;
|
||||
private GameObject hoveredUI;
|
||||
public EventSystem eventSystem;
|
||||
public List<GraphicRaycaster> graphicRaycasters;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
sceneCameraTransform = EditorManager.instance.cameraManager.sceneCamera.transform;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
bool isPointerOverUI = IsPointerOverUI(out GameObject hoveredUI);
|
||||
|
||||
if (EditorManager.instance.cameraManager.isSceneCameraActive &&
|
||||
!Keyboard.current.leftCtrlKey.isPressed && !isPointerOverUI) // 场景相机的移动和旋转
|
||||
isPointerOverUI = IsPointerOverUI(out hoveredUI);
|
||||
|
||||
SceneCameraOperation();
|
||||
MusicPlayerOperation();
|
||||
TracksOperation();
|
||||
SaveAndExportOperation();
|
||||
CopyPasteDeleteOperation();
|
||||
ResolutionHintsOperation();
|
||||
UIOperation();
|
||||
SwitchCameraOperation();
|
||||
}
|
||||
}
|
||||
|
||||
public partial class InputListener
|
||||
{
|
||||
private bool isRotatingSceneCamera;
|
||||
private Transform sceneCameraTransform;
|
||||
|
||||
private void SceneCameraOperation()
|
||||
{
|
||||
if (Keyboard.current.ctrlKey.isPressed || Keyboard.current.altKey.isPressed || Keyboard.current.shiftKey.isPressed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (EditorManager.instance.cameraManager.isSceneCameraActive && !isPointerOverUI) // 场景相机的移动和旋转
|
||||
{
|
||||
float cameraMoveSpeed = EditorManager.instance.cameraManager.sceneCameraMoveSpeed * Time.deltaTime;
|
||||
Transform sceneCameraTransform = EditorManager.instance.cameraManager.sceneCamera.transform;
|
||||
|
||||
if (Keyboard.current.wKey.isPressed)
|
||||
{
|
||||
sceneCameraTransform.position += sceneCameraTransform.forward * cameraMoveSpeed;
|
||||
}
|
||||
|
||||
if (Keyboard.current.sKey.isPressed)
|
||||
{
|
||||
sceneCameraTransform.position -= sceneCameraTransform.forward * cameraMoveSpeed;
|
||||
}
|
||||
|
||||
if (Keyboard.current.dKey.isPressed)
|
||||
{
|
||||
sceneCameraTransform.position += sceneCameraTransform.right * cameraMoveSpeed;
|
||||
}
|
||||
|
||||
if (Keyboard.current.aKey.isPressed)
|
||||
{
|
||||
sceneCameraTransform.position -= sceneCameraTransform.right * cameraMoveSpeed;
|
||||
}
|
||||
|
||||
if (Keyboard.current.eKey.isPressed)
|
||||
{
|
||||
sceneCameraTransform.position += sceneCameraTransform.up * cameraMoveSpeed;
|
||||
}
|
||||
|
||||
if (Keyboard.current.qKey.isPressed)
|
||||
{
|
||||
sceneCameraTransform.position -= sceneCameraTransform.up * cameraMoveSpeed;
|
||||
}
|
||||
}
|
||||
|
||||
if (Mouse.current.rightButton.isPressed && !isPointerOverUI)
|
||||
if (EditorManager.instance.cameraManager.isSceneCameraActive)
|
||||
{
|
||||
if (Mouse.current.rightButton.wasPressedThisFrame && !isPointerOverUI)
|
||||
{
|
||||
float cameraRotateSpeed = EditorManager.instance.cameraManager.sceneCameraRotateSpeed * Time.deltaTime;
|
||||
Vector2 mouseDelta = Mouse.current.delta.ReadValue();
|
||||
sceneCameraTransform.Rotate(Vector3.up, -mouseDelta.x * cameraRotateSpeed, Space.World);
|
||||
sceneCameraTransform.Rotate(sceneCameraTransform.right, mouseDelta.y * cameraRotateSpeed, Space.World);
|
||||
isRotatingSceneCamera = true;
|
||||
}
|
||||
else if (isPointerOverUI)
|
||||
else if (Mouse.current.rightButton.wasReleasedThisFrame)
|
||||
{
|
||||
|
||||
isRotatingSceneCamera = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!isPointerOverUI && Keyboard.current.enterKey.wasPressedThisFrame) // 播放或暂停音乐
|
||||
if (isRotatingSceneCamera)
|
||||
{
|
||||
float cameraRotateSpeed = EditorManager.instance.cameraManager.sceneCameraRotateSpeed * Time.deltaTime;
|
||||
Vector2 mouseDelta = Mouse.current.delta.ReadValue();
|
||||
sceneCameraTransform.Rotate(Vector3.up, -mouseDelta.x * cameraRotateSpeed, Space.World);
|
||||
sceneCameraTransform.Rotate(sceneCameraTransform.right, mouseDelta.y * cameraRotateSpeed, Space.World);
|
||||
}
|
||||
}
|
||||
|
||||
private void MusicPlayerOperation()
|
||||
{
|
||||
if (Keyboard.current.enterKey.wasPressedThisFrame && !isPointerOverUI) // 回车键 播放或暂停音乐
|
||||
{
|
||||
if (!EditorManager.instance.musicPlayer.isPlaying)
|
||||
{
|
||||
@@ -72,63 +119,103 @@ namespace Ichni.Editor
|
||||
EditorManager.instance.musicPlayer.PauseMusic();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (Keyboard.current.leftCtrlKey.isPressed) // 快捷键
|
||||
}
|
||||
|
||||
private void TracksOperation()
|
||||
{
|
||||
if (Keyboard.current.altKey.isPressed)
|
||||
{
|
||||
// 保存和导出
|
||||
if (Keyboard.current.sKey.wasPressedThisFrame)
|
||||
if (Keyboard.current.pKey.wasPressedThisFrame) // Alt + P 显示或隐藏所有路径节点
|
||||
{
|
||||
List<Track> allTracks = EditorManager.instance.beatmapContainer.gameElementList.FindAll(x => x is Track).Cast<Track>().ToList();
|
||||
bool isAnyPathNodeShowing = allTracks.Any(track => track.trackPathSubmodule.pathNodeList.Any(pathNode => pathNode.isShowingSphere));
|
||||
allTracks.ForEach(track => track.SetAllPathNodeSphere(!isAnyPathNodeShowing));
|
||||
}
|
||||
else if (Keyboard.current.dKey.wasPressedThisFrame) // Alt + D 启用或隐藏所有轨道路径显示
|
||||
{
|
||||
List<Track> allTracks = EditorManager.instance.beatmapContainer.gameElementList.FindAll(x => x is Track).Cast<Track>().ToList();
|
||||
bool isAnyTrackDisplayShowing = allTracks.Any(track => track.trackPathSubmodule.isShowingDisplay);
|
||||
allTracks.ForEach(track => track.trackPathSubmodule.SetDisplay(!isAnyTrackDisplayShowing));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveAndExportOperation()
|
||||
{
|
||||
if (Keyboard.current.leftCtrlKey.isPressed)
|
||||
{
|
||||
if (Keyboard.current.sKey.wasPressedThisFrame) // Ctrl + S 保存
|
||||
{
|
||||
EditorManager.instance.projectManager.saveManager.Save();
|
||||
}
|
||||
else if (Keyboard.current.eKey.wasPressedThisFrame)
|
||||
else if (Keyboard.current.eKey.wasPressedThisFrame) // Ctrl + E 导出
|
||||
{
|
||||
EditorManager.instance.projectManager.exportManager.Export();
|
||||
}
|
||||
|
||||
// 复制粘贴删除
|
||||
if (Keyboard.current.cKey.wasPressedThisFrame)
|
||||
}
|
||||
}
|
||||
|
||||
private void CopyPasteDeleteOperation()
|
||||
{
|
||||
if (Keyboard.current.leftCtrlKey.isPressed)
|
||||
{
|
||||
if (Keyboard.current.cKey.wasPressedThisFrame) // Ctrl + C 复制
|
||||
{
|
||||
EditorManager.instance.operationManager.CopyPasteDeleteModule.CopyElement(EditorManager.instance.operationManager.currentSelectedElement);
|
||||
}
|
||||
else if (Keyboard.current.vKey.wasPressedThisFrame)
|
||||
else if (Keyboard.current.vKey.wasPressedThisFrame) // Ctrl + V 粘贴
|
||||
{
|
||||
EditorManager.instance.operationManager.CopyPasteDeleteModule.PasteElement(EditorManager.instance.operationManager.currentSelectedElement);
|
||||
}
|
||||
else if (Keyboard.current.dKey.wasPressedThisFrame)
|
||||
else if (Keyboard.current.dKey.wasPressedThisFrame) // Ctrl + D 删除
|
||||
{
|
||||
EditorManager.instance.operationManager.CopyPasteDeleteModule.DeleteElement(EditorManager.instance.operationManager.currentSelectedElement);
|
||||
}
|
||||
|
||||
// 开关移动设备分辨率提示
|
||||
if (Keyboard.current.digit1Key.wasPressedThisFrame)
|
||||
}
|
||||
}
|
||||
|
||||
private void ResolutionHintsOperation()
|
||||
{
|
||||
if (Keyboard.current.leftCtrlKey.isPressed)
|
||||
{
|
||||
if (Keyboard.current.digit1Key.wasPressedThisFrame) // Ctrl + 1 手机分辨率提示
|
||||
{
|
||||
EditorManager.instance.uiManager.mainPage.resolutionHints.SetPhoneFrame();
|
||||
}
|
||||
else if (Keyboard.current.digit2Key.wasPressedThisFrame)
|
||||
else if (Keyboard.current.digit2Key.wasPressedThisFrame) // Ctrl + 2 平板分辨率提示
|
||||
{
|
||||
EditorManager.instance.uiManager.mainPage.resolutionHints.SetIPadFrame();
|
||||
}
|
||||
else if (Keyboard.current.digit3Key.wasPressedThisFrame)
|
||||
else if (Keyboard.current.digit3Key.wasPressedThisFrame) // Ctrl + 3 绝对安全区域提示
|
||||
{
|
||||
EditorManager.instance.uiManager.mainPage.resolutionHints.SetSafeAreaFrame();
|
||||
}
|
||||
|
||||
// 开关所有静态窗口
|
||||
if (Keyboard.current.uKey.wasPressedThisFrame)
|
||||
}
|
||||
}
|
||||
|
||||
private void UIOperation()
|
||||
{
|
||||
if (Keyboard.current.leftCtrlKey.isPressed)
|
||||
{
|
||||
if (Keyboard.current.uKey.wasPressedThisFrame) // Ctrl + U 开关所有静态窗口
|
||||
{
|
||||
EditorManager.instance.uiManager.SetAllStaticWindowsActive();
|
||||
}
|
||||
|
||||
//切换摄像机
|
||||
if (Keyboard.current.mKey.wasPressedThisFrame)
|
||||
}
|
||||
}
|
||||
|
||||
private void SwitchCameraOperation()
|
||||
{
|
||||
if (Keyboard.current.leftCtrlKey.isPressed)
|
||||
{
|
||||
if (Keyboard.current.mKey.wasPressedThisFrame) // Ctrl + M 切换摄像机
|
||||
{
|
||||
EditorManager.instance.cameraManager.SwitchCamera();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public partial class InputListener
|
||||
{
|
||||
public bool IsPointerOverUI(out GameObject hoveredUI)
|
||||
|
||||
Reference in New Issue
Block a user