更改一些东西,以及为什么unity里面可以读mp3导出来读不了(似)
Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
31640
Assets/FR2_Cache.asset
31640
Assets/FR2_Cache.asset
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,8 @@
|
|||||||
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using Ichni.Editor;
|
||||||
using Ichni.RhythmGame.Beatmap;
|
using Ichni.RhythmGame.Beatmap;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@@ -24,19 +27,23 @@ namespace Ichni.RhythmGame
|
|||||||
this.songName = songName;
|
this.songName = songName;
|
||||||
this.bpm = bpm;
|
this.bpm = bpm;
|
||||||
this.delay = delay;
|
this.delay = delay;
|
||||||
songLocation = EditorManager.instance.projectInformation.projectPath + "/" + songName;
|
songLocation = Path.Combine(EditorManager.instance.projectInformation.projectPath, songName);
|
||||||
Debug.Log("Loading song from " + songLocation + " " + ES3.FileExists(songLocation));
|
if (!ES3.FileExists(songLocation))
|
||||||
|
{
|
||||||
string extension = System.IO.Path.GetExtension(songLocation).ToLower();
|
throw new Exception("Audio file not found: " + songLocation);
|
||||||
|
}
|
||||||
|
string extension = Path.GetExtension(songLocation).ToLower();
|
||||||
song = extension switch
|
song = extension switch
|
||||||
{
|
{
|
||||||
".mp3" => ES3.LoadAudio(songLocation, AudioType.MPEG),
|
".mp3" => ES3.LoadAudio(songLocation, AudioType.MPEG),
|
||||||
".ogg" => ES3.LoadAudio(songLocation, AudioType.OGGVORBIS),
|
".ogg" => ES3.LoadAudio(songLocation, AudioType.OGGVORBIS),
|
||||||
".wav" => ES3.LoadAudio(songLocation, AudioType.WAV),
|
".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;
|
songLength = song.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ EditorBuildSettings:
|
|||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
serializedVersion: 2
|
serializedVersion: 2
|
||||||
m_Scenes:
|
m_Scenes:
|
||||||
- enabled: 1
|
|
||||||
path: Assets/Scenes/EditorScene.unity
|
|
||||||
guid: 99c9720ab356a0642a771bea13969a05
|
|
||||||
- enabled: 1
|
- enabled: 1
|
||||||
path: Assets/Scenes/StartMenu.unity
|
path: Assets/Scenes/StartMenu.unity
|
||||||
guid: 28c134965d47644a98d3ba8a1343674a
|
guid: 28c134965d47644a98d3ba8a1343674a
|
||||||
|
- enabled: 1
|
||||||
|
path: Assets/Scenes/EditorScene.unity
|
||||||
|
guid: 99c9720ab356a0642a771bea13969a05
|
||||||
m_configObjects: {}
|
m_configObjects: {}
|
||||||
|
|||||||
Reference in New Issue
Block a user