songs are loading and beatmaps should exist, but they aren't working properly. no preview audio and no available beatmap options.
This commit is contained in:
parent
fc90197eef
commit
6053715609
17
Core.cs
17
Core.cs
@ -644,7 +644,6 @@ namespace UnbeatableSongHack
|
|||||||
public static void Postfix(ref ArcadeSongDatabase __instance)
|
public static void Postfix(ref ArcadeSongDatabase __instance)
|
||||||
{
|
{
|
||||||
var LoggerInstance = Core.GetLogger();
|
var LoggerInstance = Core.GetLogger();
|
||||||
LoggerInstance.Msg("HAIIIIIIII");
|
|
||||||
|
|
||||||
Traverse traverse = Traverse.Create(__instance);
|
Traverse traverse = Traverse.Create(__instance);
|
||||||
BeatmapIndex beatmapIndex = traverse.Field("_beatmapIndex").GetValue<BeatmapIndex>();
|
BeatmapIndex beatmapIndex = traverse.Field("_beatmapIndex").GetValue<BeatmapIndex>();
|
||||||
@ -656,20 +655,20 @@ namespace UnbeatableSongHack
|
|||||||
//test song - Empty Diaryaaa
|
//test song - Empty Diaryaaa
|
||||||
string beatmap = File.ReadAllText(beatmapPath);
|
string beatmap = File.ReadAllText(beatmapPath);
|
||||||
|
|
||||||
string songName = "";
|
string songName = "audio.mp3";
|
||||||
using (var songNameReader = new StringReader(beatmap.Substring(beatmap.IndexOf("Title:") + 6).Trim()))
|
using (var songNameReader = new StringReader(beatmap.Substring(beatmap.IndexOf("Title:") + 6).Trim()))
|
||||||
{
|
{
|
||||||
songName = songNameReader.ReadLine();
|
//songName = songNameReader.ReadLine();
|
||||||
}
|
}
|
||||||
LoggerInstance.Msg(songName);
|
LoggerInstance.Msg(songName);
|
||||||
|
|
||||||
string difficulty = beatmap.Substring(beatmap.IndexOf("Version:") + 8 /* adding 8, the length of the string "Version:" */ , beatmap.IndexOf(" ", beatmap.IndexOf("Version:")) - (beatmap.IndexOf("Version:") + 8));
|
string difficulty = beatmap.Substring(beatmap.IndexOf("Version:") + 8 /* adding 8, the length of the string "Version:" */ , beatmap.IndexOf(" ", beatmap.IndexOf("Version:")) - (beatmap.IndexOf("Version:") + 8));
|
||||||
LoggerInstance.Msg(difficulty);
|
LoggerInstance.Msg(difficulty);
|
||||||
|
|
||||||
string path = "__CUSTOM"+beatmapPath;
|
string path = songName+"/"+difficulty;
|
||||||
BeatmapIndex.Song mapSong = new Song(songName);
|
BeatmapIndex.Song mapSong = new Song(songName);
|
||||||
mapSong.stageScene = "TrainStationRhythm";
|
mapSong.stageScene = "TrainStationRhythm";
|
||||||
TextAsset asset = new TextAsset();
|
TextAsset asset = new TextAsset(beatmap);
|
||||||
BeatmapInfo info = new BeatmapInfo(asset,difficulty);
|
BeatmapInfo info = new BeatmapInfo(asset,difficulty);
|
||||||
Beatmap map = ScriptableObject.CreateInstance<Beatmap>();
|
Beatmap map = ScriptableObject.CreateInstance<Beatmap>();
|
||||||
map.metadata.title = songName;
|
map.metadata.title = songName;
|
||||||
@ -677,6 +676,7 @@ namespace UnbeatableSongHack
|
|||||||
map.metadata.artist = "Not You";
|
map.metadata.artist = "Not You";
|
||||||
map.metadata.artistUnicode = "Not You";
|
map.metadata.artistUnicode = "Not You";
|
||||||
map.metadata.tagData.Level = 10;
|
map.metadata.tagData.Level = 10;
|
||||||
|
//map.metadata.tagData.SongLength = float.Parse(beatmap.Substring(beatmap.IndexOf("SongLength\":")+13,beatmap.IndexOf("}", beatmap.IndexOf("SongLength\":") + 13)));
|
||||||
|
|
||||||
BeatmapItem item = new BeatmapItem();
|
BeatmapItem item = new BeatmapItem();
|
||||||
item.Path = path;
|
item.Path = path;
|
||||||
@ -684,9 +684,16 @@ namespace UnbeatableSongHack
|
|||||||
item.Beatmap = map;
|
item.Beatmap = map;
|
||||||
item.Highscore = new HighScoreItem(path, 0, 0f, 0, cleared: false, new Dictionary<string, int>(), Modifiers.None);
|
item.Highscore = new HighScoreItem(path, 0, 0f, 0, cleared: false, new Dictionary<string, int>(), Modifiers.None);
|
||||||
item.Unlocked = true;
|
item.Unlocked = true;
|
||||||
|
item.Song = mapSong;
|
||||||
|
LoggerInstance.Msg("about to parse beatmap");
|
||||||
|
BeatmapParserEngine engine = new BeatmapParserEngine();
|
||||||
|
engine.ReadBeatmap(info.text, ref map, BeatmapParserEngine.SectionTypes.Everything);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
songList.Add(item);
|
songList.Add(item);
|
||||||
songDatabase.TryAdd(songName, item);
|
songDatabase.TryAdd(songName, item);
|
||||||
|
LoggerInstance.Msg("added " + songName + " " + difficulty);
|
||||||
|
|
||||||
|
|
||||||
/*public string Path;
|
/*public string Path;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user