Files
ichni_Creator_Studio/Assets/Scripts/StartMenu/LoadProjectTab.cs

49 lines
1.9 KiB
C#
Raw Normal View History

2025-03-08 14:21:10 -05:00
using System.Collections;
using System.Collections.Generic;
2025-03-08 18:19:32 -05:00
using Ichni.RhythmGame.Beatmap;
2025-03-08 14:21:10 -05:00
using TMPro;
2025-03-08 18:19:32 -05:00
using UniRx;
2025-03-08 14:21:10 -05:00
using UnityEngine;
2025-03-08 18:19:32 -05:00
using UnityEngine.SceneManagement;
2025-03-08 14:21:10 -05:00
using UnityEngine.UI;
namespace Ichni.StartMenu
{
public class LoadProjectTab : MonoBehaviour
{
public string projectName;
public TMP_Text projectNameText, lastSavedTimeText, songNameText;
public Button loadButton;
public void SetUpTab(string projectName, string lastSavedTime, string songName)
{
this.projectName = projectName;
projectNameText.text = projectName;
lastSavedTimeText.text = lastSavedTime;
songNameText.text = songName;
loadButton.onClick.AddListener(LoadProject);
}
2025-03-08 18:19:32 -05:00
private void LoadProject()
2025-03-08 14:21:10 -05:00
{
2025-03-08 18:19:32 -05:00
InformationTransistor.instance.isLoadedProject = true;
InformationTransistor.instance.loadedProjectName = projectName;
string projectPath = Application.streamingAssetsPath + "/Projects/" + projectName;
InformationTransistor.instance.projectInfo_BM = ES3.Load<ProjectInformation_BM>("ProjectInformation", projectPath + "/ProjectInfo.json");
InformationTransistor.instance.songInfo_BM = ES3.Load<SongInformation_BM>("SongInformation", projectPath + "/SongInfo.json");
ThemeBundleManager.instance.LoadThemeBundles(InformationTransistor.instance.projectInfo_BM.selectedThemeBundleList);
ThemeBundleManager.instance.waitingBundleAmount
.Where(amount => amount == 0) // 当 waitingAmount 变为 0 时触发
.First()
.Subscribe(_ =>
{
Debug.Log("All AssetBundles are loaded. Switching scene.");
SceneManager.LoadScene("EditorScene");
}).AddTo(this);
2025-03-08 14:21:10 -05:00
}
}
}