musicplayer改

Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2025-08-23 23:18:29 +08:00
parent e4ffc1fd64
commit 84ff356427
34 changed files with 108215 additions and 337568 deletions

View File

@@ -105,7 +105,8 @@ namespace Ichni.Editor
}
// 使用 DOTween 来平滑过渡到新的时间
_activeTweener = DOTween.To(() => EditorManager.instance.songInformation.songTime, x => EditorManager.instance.songInformation.songTime = x, parsedTime, 0.2f)
.OnUpdate(UpdateTime);
.OnUpdate(UpdateTime)
;
// timePointerModule.UpdatePointers();
// timePointerModule.SetRange(songTime);

View File

@@ -32,7 +32,7 @@ namespace Ichni.RhythmGame
public float trackTotalTime;
public float visibleTrackTimeLength;
public AnimationCurveType animationCurveType;
//public bool isGoWithZ = false;
public TrackTimeSubmoduleMovable(Track track, float trackStartTime, float trackEndTime,
float visibleTrackTimeLength, AnimationCurveType animationCurveType) : base(track)
{
@@ -61,8 +61,44 @@ namespace Ichni.RhythmGame
public float GetTrackPercent(float songTimeInTime)
{
float per = AnimationCurveEvaluator.Evaluate(animationCurveType, (songTimeInTime - trackStartTime) / trackTotalTime);
// return isGoWithZ ? GetSplineZPercent(Mathf.Clamp01(per)) : Mathf.Clamp01(per);
return Mathf.Clamp01(per);
}
// private float GetSplineZPercent(float percent)
// {
// var nodeList = track.trackPathSubmodule.pathNodeList;
// int count = nodeList.Count;
// if (count <= 2) return percent;
// float startZ = nodeList[0].transformSubmodule.currentPosition.z;
// float endZ = nodeList[count - 1].transformSubmodule.currentPosition.z;
// float needZ = Mathf.Lerp(startZ, endZ, percent);
// float outpercent = 0f;
// float percentBetween = 1f / (count - 1);
// for (int i = 0; i < count - 1; i++)
// {
// float z0 = nodeList[i].transformSubmodule.currentPosition.z;
// float z1 = nodeList[i + 1].transformSubmodule.currentPosition.z;
// // 如果 needZ 在当前区间内,做插值
// if ((z0 <= needZ && needZ <= z1) || (z1 <= needZ && needZ <= z0))
// {
// float zDelta = z1 - z0;
// if (Mathf.Approximately(zDelta, 0f)) return outpercent;
// float t = (needZ - z0) / zDelta;
// outpercent += percentBetween * Mathf.Clamp01(t);
// return outpercent;
// }
// else
// {
// outpercent += percentBetween;
// }
// }
// // 如果没找到区间,返回 1f已遍历所有节点
// return 1f;
// }
public override void Refresh()
@@ -101,6 +137,8 @@ namespace Ichni.RhythmGame
var animationCurveDropdown =
inspector.GenerateDropdown(this, trackTimeSubmoduleSettings, "Animation Curve", typeof(AnimationCurveType), nameof(animationCurveType))
.AddListenerFunction(RefreshChildren);
// var isGoWithZToggle =
// inspector.GenerateToggle(this, trackTimeSubmoduleSettings, "Go With Z", nameof(isGoWithZ));
var deleteButton = inspector.GenerateButton(this, trackTimeSubmoduleSettings, "Delete", () =>
{
Delete();

View File

@@ -32,7 +32,7 @@ namespace Ichni.Editor
isPlaying = !isPlaying;
EditorManager.instance.songInformation.songTime = audioSource.time - EditorManager.instance.songInformation.offset;
audioSource.time = EditorManager.instance.songInformation.songTime + EditorManager.instance.songInformation.offset;
if (isPlaying)
{
Trail.FreezeAllTrails(!isPlaying);
@@ -51,8 +51,9 @@ namespace Ichni.Editor
}
public void PauseMusic()
{
if (isPlaying) EditorManager.instance.songInformation.songTime = audioSource.time - EditorManager.instance.songInformation.offset;
isPlaying = false;
EditorManager.instance.songInformation.songTime = audioSource.time - EditorManager.instance.songInformation.offset;
audioSource.Pause();
Trail.FreezeAllTrails(!isPlaying);
}

View File

@@ -481,7 +481,7 @@ namespace Ichni
private void AutoSave()
{
List<string> saveFiles = GetSortedSaveFiles();
if (saveFiles.Count > 0)
{
// 删除最旧的存档(如果超过数量)
@@ -490,14 +490,14 @@ namespace Ichni
string oldestSave = saveFiles[saveFiles.Count - 1];
File.Delete(oldestSave);
saveFiles.RemoveAt(saveFiles.Count - 1);
LogWindow.Log("AutoSave finished, the oldest file deleted");
}
else
{
LogWindow.Log("AutoSave finished");
}
// 依次重命名存档
for (int i = saveFiles.Count - 1; i >= 0; i--)
{