更改一些东西,以及为什么unity里面可以读mp3导出来读不了(似)

Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2025-07-09 22:33:47 +08:00
parent 1a632aea4a
commit 5eb85505e4
3 changed files with 15841 additions and 15834 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,8 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using Ichni.Editor;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
@@ -24,19 +27,23 @@ namespace Ichni.RhythmGame
this.songName = songName;
this.bpm = bpm;
this.delay = delay;
songLocation = EditorManager.instance.projectInformation.projectPath + "/" + songName;
Debug.Log("Loading song from " + songLocation + " " + ES3.FileExists(songLocation));
string extension = System.IO.Path.GetExtension(songLocation).ToLower();
songLocation = Path.Combine(EditorManager.instance.projectInformation.projectPath, songName);
if (!ES3.FileExists(songLocation))
{
throw new Exception("Audio file not found: " + songLocation);
}
string extension = Path.GetExtension(songLocation).ToLower();
song = extension switch
{
".mp3" => ES3.LoadAudio(songLocation, AudioType.MPEG),
".ogg" => ES3.LoadAudio(songLocation, AudioType.OGGVORBIS),
".wav" => ES3.LoadAudio(songLocation, AudioType.WAV),
_ => throw new System.Exception("Unsupported audio format: " + extension)
_ => throw new Exception("Unsupported audio format: " + extension)
};
if (song == null)
{
throw new Exception("Failed to load audio: " + songLocation);
}
songLength = song.length;
}

View File

@@ -5,10 +5,10 @@ EditorBuildSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Scenes:
- enabled: 1
path: Assets/Scenes/EditorScene.unity
guid: 99c9720ab356a0642a771bea13969a05
- enabled: 1
path: Assets/Scenes/StartMenu.unity
guid: 28c134965d47644a98d3ba8a1343674a
- enabled: 1
path: Assets/Scenes/EditorScene.unity
guid: 99c9720ab356a0642a771bea13969a05
m_configObjects: {}