mirror of
https://github.com/RHeavenStudioPlus/HeavenStudioPlus.git
synced 2024-11-29 04:53:06 +00:00
Editor: Timeline now scales to fit song length
This commit is contained in:
parent
b1e70bc64b
commit
a570793803
3 changed files with 19 additions and 1 deletions
|
@ -224,6 +224,8 @@ namespace RhythmHeavenMania.Editor
|
||||||
{
|
{
|
||||||
Conductor.instance.musicSource.clip = await LoadClip(Path.Combine(paths));
|
Conductor.instance.musicSource.clip = await LoadClip(Path.Combine(paths));
|
||||||
changedMusic = true;
|
changedMusic = true;
|
||||||
|
|
||||||
|
Timeline.FitToSong();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -349,6 +351,8 @@ namespace RhythmHeavenMania.Editor
|
||||||
|
|
||||||
if (path != String.Empty)
|
if (path != String.Empty)
|
||||||
{
|
{
|
||||||
|
loadedMusic = false;
|
||||||
|
|
||||||
using (FileStream zipFile = File.Open(path, FileMode.Open))
|
using (FileStream zipFile = File.Open(path, FileMode.Open))
|
||||||
{
|
{
|
||||||
using (var archive = new ZipArchive(zipFile, ZipArchiveMode.Read))
|
using (var archive = new ZipArchive(zipFile, ZipArchiveMode.Read))
|
||||||
|
@ -387,10 +391,14 @@ namespace RhythmHeavenMania.Editor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!loadedMusic)
|
||||||
|
Conductor.instance.musicSource.clip = null;
|
||||||
|
|
||||||
currentRemixPath = path;
|
currentRemixPath = path;
|
||||||
remixName = Path.GetFileName(path);
|
remixName = Path.GetFileName(path);
|
||||||
UpdateEditorStatus(false);
|
UpdateEditorStatus(false);
|
||||||
CommandManager.instance.Clear();
|
CommandManager.instance.Clear();
|
||||||
|
Timeline.FitToSong();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,6 +189,15 @@ namespace RhythmHeavenMania.Editor.Track
|
||||||
AutoBtnUpdate();
|
AutoBtnUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void FitToSong()
|
||||||
|
{
|
||||||
|
var currentSizeDelta = TimelineContent.sizeDelta;
|
||||||
|
float songBeats = Conductor.instance.SongLengthInBeats();
|
||||||
|
if (songBeats == 0) songBeats = 320;
|
||||||
|
else songBeats += 10;
|
||||||
|
TimelineContent.sizeDelta = new Vector2(songBeats, currentSizeDelta.y);
|
||||||
|
}
|
||||||
|
|
||||||
public void AutoBtnUpdate()
|
public void AutoBtnUpdate()
|
||||||
{
|
{
|
||||||
var animName = GameManager.instance.autoplay ? "Idle" : "Disabled";
|
var animName = GameManager.instance.autoplay ? "Idle" : "Disabled";
|
||||||
|
|
|
@ -107,6 +107,7 @@ namespace RhythmHeavenMania.Util
|
||||||
|
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
|
if (audioSource != null)
|
||||||
audioSource.Stop();
|
audioSource.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue