using System; using System.Collections; using System.Collections.Generic; using Sirenix.OdinInspector; using UnityEngine; namespace Ichni.Menu { public class MenuInformationRecorder : SerializedMonoBehaviour { public static MenuInformationRecorder instance; public Dictionary songSelectionRecords; private void Awake() { if (instance == null) { instance = this; songSelectionRecords = new Dictionary(); } else { Destroy(gameObject); } } public SongSelectionRecord GetRecordOfThisChapter() { ChapterSelectionUnit currentChapter = ChapterSelectionManager.instance.currentChapter; if (songSelectionRecords.TryGetValue(currentChapter, out SongSelectionRecord record)) { return record; } else { return new SongSelectionRecord(currentChapter.songs[0], currentChapter.songs[0].difficultyDataList[0]); } } } public class SongSelectionRecord { public SongItemData song; public int difficultyIndex; public SongSelectionRecord(SongItemData song, DifficultyData difficulty) { this.song = song; difficultyIndex = song.difficultyDataList.IndexOf(difficulty); } } }