using System.Collections; using System.Collections.Generic; using Ichni.RhythmGame.Beatmap; using TMPro; using UniRx; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.SceneManagement; using UnityEngine.UI; namespace Ichni.StartMenu { public class LoadProjectTab : MonoBehaviour { public string projectName; public TMP_Text projectNameText, lastSavedTimeText, songNameText; public Button loadButton; public Image MemuMask; public bool isRecovery = false; 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); } private void LoadProject() { MemuMask.gameObject.SetActive(true); InformationTransistor.instance.isLoadedProject = true; InformationTransistor.instance.loadedProjectName = projectName; InformationTransistor.instance.isRecovery = isRecovery; if (Keyboard.current.sKey.isPressed && Keyboard.current.lKey.isPressed) { InformationTransistor.instance.isRecovery = true; } string projectPath = Application.streamingAssetsPath + "/Projects/" + projectName; InformationTransistor.instance.projectInfo_BM = ES3.Load("ProjectInformation", projectPath + "/ProjectInfo.json"); InformationTransistor.instance.songInfo_BM = ES3.Load("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); } } }