songs load into the arcade list now! the maps don't work though
This commit is contained in:
parent
d1bad7e2e4
commit
fc90197eef
82
Core.cs
82
Core.cs
@ -13,6 +13,7 @@ using Arcade.UI.SongSelect;
|
||||
using static Arcade.UI.SongSelect.ArcadeSongDatabase;
|
||||
using UnityEngine.UIElements;
|
||||
using System.Xml.Linq;
|
||||
using static Dreamteck.Splines.SplineSampleModifier;
|
||||
|
||||
[assembly: MelonInfo(typeof(UnbeatableSongHack.Core), "SUnbeatable-Loader", "1.0.0", "Serena Sunskimmer82", null)]
|
||||
[assembly: MelonGame("D-CELL GAMES", "UNBEATABLE [DEMO]")]
|
||||
@ -287,7 +288,7 @@ namespace UnbeatableSongHack
|
||||
LoggerInstance.Msg("Adding song to list: " + beatmapItem.Path);
|
||||
|
||||
// This whole part would be needed for AddSongList()
|
||||
beatmapItem.Beatmap = new Beatmap();
|
||||
beatmapItem.Beatmap = ScriptableObject.CreateInstance<Beatmap>();
|
||||
beatmapItem.Beatmap.metadata.title = "Custom " + name;
|
||||
beatmapItem.Beatmap.metadata.titleUnicode = "Custom " + name;
|
||||
beatmapItem.Beatmap.metadata.artist = "Not You";
|
||||
@ -412,7 +413,7 @@ namespace UnbeatableSongHack
|
||||
}
|
||||
}
|
||||
|
||||
if (GUI.Button(new Rect(10,120,100,25), "Add Empty Songs To Arcade"))
|
||||
if (GUI.Button(new Rect(10,120,100,25), "Add Custom Songs To Arcade"))
|
||||
{
|
||||
var db = Arcade.UI.SongSelect.ArcadeSongDatabase.Instance;
|
||||
|
||||
@ -437,12 +438,12 @@ namespace UnbeatableSongHack
|
||||
LoggerInstance.Msg($"{beatmapName} has difficulty {difficulty}");
|
||||
|
||||
BeatmapItem item = new BeatmapItem();
|
||||
item.Path = "__CUSTOM" + songFile+"/"+difficulty.ToUpper();
|
||||
item.Path = "__CUSTOM" + songFile;
|
||||
item.Song = new Song(beatmapName);
|
||||
TextAsset asset = new TextAsset(beatmapContent);
|
||||
asset.name = beatmapName;
|
||||
item.BeatmapInfo = new BeatmapInfo(asset,difficulty);
|
||||
item.Beatmap = new Beatmap();
|
||||
item.Beatmap = ScriptableObject.CreateInstance<Beatmap>();
|
||||
item.Beatmap.name = beatmapName;
|
||||
item.Beatmap.metadata.title = beatmapName;
|
||||
item.Beatmap.metadata.titleUnicode = beatmapName;
|
||||
@ -637,6 +638,79 @@ namespace UnbeatableSongHack
|
||||
|
||||
}
|
||||
|
||||
[HarmonyPatch(typeof(ArcadeSongDatabase), "Awake")]
|
||||
public class ArcadeSongDatabasePatch
|
||||
{
|
||||
public static void Postfix(ref ArcadeSongDatabase __instance)
|
||||
{
|
||||
var LoggerInstance = Core.GetLogger();
|
||||
LoggerInstance.Msg("HAIIIIIIII");
|
||||
|
||||
Traverse traverse = Traverse.Create(__instance);
|
||||
BeatmapIndex beatmapIndex = traverse.Field("_beatmapIndex").GetValue<BeatmapIndex>();
|
||||
Dictionary<string, BeatmapItem> songDatabase = traverse.Field("_songDatabase").GetValue<Dictionary<string, BeatmapItem>>();
|
||||
List<BeatmapItem> songList = traverse.Field("_songList").GetValue<List<BeatmapItem>>();
|
||||
|
||||
string beatmapPath = "C:\\Program Files (x86)\\Steam\\steamapps\\common\\UNBEATABLE Demo\\SUnbeatable-Loader\\Songs\\Empty Diary (Custom)\\beatmap.dat";
|
||||
|
||||
//test song - Empty Diaryaaa
|
||||
string beatmap = File.ReadAllText(beatmapPath);
|
||||
|
||||
string songName = "";
|
||||
using (var songNameReader = new StringReader(beatmap.Substring(beatmap.IndexOf("Title:") + 6).Trim()))
|
||||
{
|
||||
songName = songNameReader.ReadLine();
|
||||
}
|
||||
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));
|
||||
LoggerInstance.Msg(difficulty);
|
||||
|
||||
string path = "__CUSTOM"+beatmapPath;
|
||||
BeatmapIndex.Song mapSong = new Song(songName);
|
||||
mapSong.stageScene = "TrainStationRhythm";
|
||||
TextAsset asset = new TextAsset();
|
||||
BeatmapInfo info = new BeatmapInfo(asset,difficulty);
|
||||
Beatmap map = ScriptableObject.CreateInstance<Beatmap>();
|
||||
map.metadata.title = songName;
|
||||
map.metadata.titleUnicode = songName;
|
||||
map.metadata.artist = "Not You";
|
||||
map.metadata.artistUnicode = "Not You";
|
||||
map.metadata.tagData.Level = 10;
|
||||
|
||||
BeatmapItem item = new BeatmapItem();
|
||||
item.Path = path;
|
||||
item.BeatmapInfo = info;
|
||||
item.Beatmap = map;
|
||||
item.Highscore = new HighScoreItem(path, 0, 0f, 0, cleared: false, new Dictionary<string, int>(), Modifiers.None);
|
||||
item.Unlocked = true;
|
||||
|
||||
songList.Add(item);
|
||||
songDatabase.TryAdd(songName, item);
|
||||
|
||||
|
||||
/*public string Path;
|
||||
|
||||
public BeatmapIndex.Song Song;
|
||||
|
||||
public BeatmapInfo BeatmapInfo;
|
||||
|
||||
public Beatmap Beatmap;
|
||||
|
||||
public HighScoreItem Highscore;
|
||||
|
||||
public bool Unlocked;
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Path;
|
||||
}*/
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user