自动更新型DUI扩展,将Time变量挪出TImeline UI,Effect效果容器修缮,移除Note的transform模块,Scene Camera优化
This commit is contained in:
48
Assets/Scripts/Manager/MusicPlayer.cs
Normal file
48
Assets/Scripts/Manager/MusicPlayer.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class MusicPlayer : MonoBehaviour
|
||||
{
|
||||
public bool isPlaying;
|
||||
public AudioSource audioSource;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (isPlaying)
|
||||
{
|
||||
EditorManager.instance.songInformation.songTime = EditorManager.instance.musicPlayer.audioSource.time;
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayMusic()
|
||||
{
|
||||
isPlaying = !isPlaying;
|
||||
Trail.SetAllTrails(true, false);
|
||||
EditorManager.instance.songInformation.songTime = audioSource.time;
|
||||
if(isPlaying)audioSource.Play();
|
||||
else audioSource.Pause();
|
||||
}
|
||||
|
||||
public void PauseMusic()
|
||||
{
|
||||
isPlaying = false;
|
||||
Trail.SetAllTrails(false, false);
|
||||
EditorManager.instance.songInformation.songTime = audioSource.time;
|
||||
audioSource.Pause();
|
||||
}
|
||||
|
||||
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