Files
ichni_Official/Assets/Scripts/Menu/MenuInformationRecorder.cs

52 lines
1.5 KiB
C#
Raw Normal View History

2025-08-11 14:04:06 -04:00
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<ChapterSelectionUnit, SongSelectionRecord> songSelectionRecords;
private void Awake()
{
if (instance == null)
{
instance = this;
songSelectionRecords = new Dictionary<ChapterSelectionUnit, SongSelectionRecord>();
}
else
{
Destroy(gameObject);
}
}
2025-08-27 21:45:18 -04:00
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]);
}
}
2025-08-11 14:04:06 -04:00
}
2025-08-27 21:45:18 -04:00
public class SongSelectionRecord
2025-08-11 14:04:06 -04:00
{
public SongItemData song;
2025-08-27 21:45:18 -04:00
public int difficultyIndex;
2025-08-11 14:04:06 -04:00
public SongSelectionRecord(SongItemData song, DifficultyData difficulty)
{
this.song = song;
2025-08-27 21:45:18 -04:00
difficultyIndex = song.difficultyDataList.IndexOf(difficulty);
2025-08-11 14:04:06 -04:00
}
}
}