start implementation of new format

needs fixes for some types
This commit is contained in:
minenice55
2022-08-21 19:46:45 -04:00
parent 38a4086acf
commit f209b2fd17
44 changed files with 374 additions and 209 deletions

View File

@ -13,8 +13,8 @@ namespace HeavenStudio
public class GameManager : MonoBehaviour
{
[Header("Lists")]
public Beatmap Beatmap = new Beatmap();
[HideInInspector] public List<Beatmap.Entity> playerEntities = new List<Beatmap.Entity>();
public DynamicBeatmap Beatmap = new DynamicBeatmap();
[HideInInspector] public List<DynamicBeatmap.DynamicEntity> playerEntities = new List<DynamicBeatmap.DynamicEntity>();
private List<GameObject> preloadedGames = new List<GameObject>();
public List<GameObject> SoundObjects = new List<GameObject>();
@ -75,7 +75,7 @@ namespace HeavenStudio
if (txt != null)
{
string json = txt.text;
Beatmap = JsonConvert.DeserializeObject<Beatmap>(json);
Beatmap = JsonConvert.DeserializeObject<DynamicBeatmap>(json);
}
else
{
@ -116,20 +116,33 @@ namespace HeavenStudio
public void NewRemix()
{
Beatmap = new Beatmap();
Beatmap = new DynamicBeatmap();
Beatmap.bpm = 120f;
Beatmap.musicVolume = 100;
Beatmap.firstBeatOffset = 0f;
Conductor.instance.musicSource.clip = null;
}
public void LoadRemix(string json = "")
public void LoadRemix(string json = "", string type = "riq", int version = 0)
{
SortEventsList();
if (json != "")
{
Beatmap = JsonConvert.DeserializeObject<Beatmap>(json);
switch (type)
{
case "tengoku":
case "rhmania":
Beatmap toConvert = JsonConvert.DeserializeObject<Beatmap>(json);
Beatmap = DynamicBeatmap.BeatmapConverter(toConvert);
break;
case "riq":
Beatmap = JsonConvert.DeserializeObject<DynamicBeatmap>(json);
break;
default:
NewRemix();
break;
}
}
else
{
@ -213,7 +226,7 @@ namespace HeavenStudio
// Debug.Log("Checking Tempo Change at " + tempoChanges[currentTempoEvent] + ", current beat " + Conductor.instance.songPositionInBeats);
if (Conductor.instance.songPositionInBeats >= tempoChanges[currentTempoEvent])
{
// Debug.Log("Tempo Change at " + Conductor.instance.songPositionInBeats + " of bpm " + Beatmap.tempoChanges[currentTempoEvent].tempo);
// Debug.Log("Tempo Change at " + Conductor.instance.songPositionInBeats + " of bpm " + DynamicBeatmap.tempoChanges[currentTempoEvent].tempo);
Conductor.instance.SetBpm(Beatmap.tempoChanges[currentTempoEvent].tempo);
Conductor.instance.timeSinceLastTempoChange = Time.time;
currentTempoEvent++;