Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
@@ -46,6 +46,12 @@ namespace Ichni.Editor
|
||||
}
|
||||
private void DetectSetRange()
|
||||
{
|
||||
if (Keyboard.current.spaceKey.wasPressedThisFrame)
|
||||
{
|
||||
|
||||
EditorManager.instance.musicPlayer.PlayMusic();
|
||||
|
||||
}
|
||||
if (Mouse.current.scroll.ReadValue().y != 0)
|
||||
{
|
||||
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace Ichni.RhythmGame
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
currentAnimationIndex = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,11 @@ namespace Ichni.RhythmGame
|
||||
public Gradient gradient;
|
||||
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
float IHaveTrail.visibleTimeLength
|
||||
{
|
||||
get => visibleTimeLength;
|
||||
set => visibleTimeLength = value;
|
||||
}
|
||||
|
||||
public static Trail GenerateElement(string name, Guid id, List<string> tags, bool isFirstGenerated,
|
||||
GameElement parentElement, float visibleTimeLength, bool isAutoOrient, float widthMultiplier,
|
||||
@@ -121,11 +126,42 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void FreezeAllTrails(bool freeze)
|
||||
{
|
||||
foreach (GameElement x in EditorManager.instance.beatmapContainer.gameElementList)
|
||||
{
|
||||
if (x is IHaveTrail t && t != null)
|
||||
{
|
||||
FreezeTrail(freeze, t);
|
||||
}
|
||||
}
|
||||
}
|
||||
public static void FreezeTrail(bool freeze, IHaveTrail trail)
|
||||
{
|
||||
|
||||
|
||||
if (!freeze)
|
||||
{
|
||||
UnfreezeTrail(trail);
|
||||
return;
|
||||
}
|
||||
trail.trailRenderer.time = Mathf.Infinity; // 使现有轨迹永不消失
|
||||
trail.trailRenderer.emitting = false; // 停止生成新轨迹点
|
||||
}
|
||||
|
||||
// 解冻尾迹(恢复动态更新)
|
||||
public static void UnfreezeTrail(IHaveTrail trail)
|
||||
{
|
||||
trail.trailRenderer.Clear(); // 清除当前冻结的轨迹
|
||||
trail.trailRenderer.time = trail.visibleTimeLength; // 恢复原始持续时间
|
||||
trail.trailRenderer.emitting = true; // 重新开始发射轨迹点
|
||||
}
|
||||
}
|
||||
|
||||
public interface IHaveTrail
|
||||
{
|
||||
TrailRenderer trailRenderer { get; set; }
|
||||
float visibleTimeLength { get; set; }
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
|
||||
@@ -31,9 +31,13 @@ namespace Ichni.Editor
|
||||
{
|
||||
|
||||
isPlaying = !isPlaying;
|
||||
Trail.SetAllTrails(true, false);
|
||||
|
||||
EditorManager.instance.songInformation.songTime = audioSource.time;
|
||||
if (isPlaying) audioSource.Play();
|
||||
if (isPlaying)
|
||||
{
|
||||
Trail.FreezeAllTrails(!isPlaying);
|
||||
audioSource.Play();
|
||||
}
|
||||
else PauseMusic();
|
||||
}
|
||||
public IEnumerator PlayBackMusic()
|
||||
@@ -48,15 +52,14 @@ namespace Ichni.Editor
|
||||
public void PauseMusic()
|
||||
{
|
||||
isPlaying = false;
|
||||
Trail.SetAllTrails(false, false);
|
||||
EditorManager.instance.songInformation.songTime = audioSource.time;
|
||||
audioSource.Pause();
|
||||
Trail.FreezeAllTrails(!isPlaying);
|
||||
}
|
||||
|
||||
public void StopMusic()
|
||||
{
|
||||
isPlaying = false;
|
||||
Trail.SetAllTrails(false, true);
|
||||
EditorManager.instance.songInformation.songTime = 0;
|
||||
audioSource.Stop();
|
||||
EditorManager.instance.uiManager.timeline.timePointerModule.SetRange(0);
|
||||
|
||||
Reference in New Issue
Block a user