using System.Collections; using System.Collections.Generic; using System.IO; using System.Linq; using Ichni.RhythmGame.Beatmap; using Lean.Pool; using UnityEngine; namespace Ichni.StartMenu { public class LoadProjectModule : MonoBehaviour { public GameObject LoadProjectTab; public RectTransform loadTabList; public List projectFileList; public List projectInformationList; public List songInformationList; private void Start() { projectInformationList = new List(); songInformationList = new List(); GetAllProjects(); } public void GetAllProjects() { string path = Path.Combine(Application.streamingAssetsPath, "Projects"); projectFileList = ES3.GetDirectories(path).ToList(); foreach (string project in projectFileList) { string projectInformationPath = path + "/" + project + "/ProjectInfo.json"; string songInformationPath = path + "/" + project + "/SongInfo.json"; if (!File.Exists(projectInformationPath) || !File.Exists(songInformationPath)) continue; projectInformationList.Add(ES3.Load("ProjectInformation", projectInformationPath)); songInformationList.Add(ES3.Load("SongInformation", songInformationPath)); } for (int i = 0; i < projectInformationList.Count; i++) { var currentProject = projectInformationList[i]; var song = songInformationList[i]; string projectName = currentProject.projectName; string lastSavedTime = currentProject.lastSaveTime; string songName = song.songName; LoadProjectTab tab = LeanPool.Spawn(LoadProjectTab, loadTabList).GetComponent(); tab.SetUpTab(projectName, lastSavedTime, songName); } } } }