加载工程

This commit is contained in:
SoulliesOfficial
2025-03-08 18:19:32 -05:00
parent e0ae43c25c
commit baa5453d89
11 changed files with 629 additions and 52 deletions

View File

@@ -11,6 +11,8 @@ namespace Ichni
public static InformationTransistor instance;
public bool isLoadedProject;
public string loadedProjectName;
public ProjectInformation_BM projectInfo_BM;
public SongInformation_BM songInfo_BM;

View File

@@ -1,7 +1,10 @@
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
namespace Ichni.StartMenu
@@ -23,13 +26,24 @@ namespace Ichni.StartMenu
loadButton.onClick.AddListener(LoadProject);
}
public void LoadProject()
private void LoadProject()
{
// var b = IchniApp.instance.GetModel<InformationTransistor>();
// if (b == null) Debug.LogError("XXX");
// b.isLoadedProject = true;
// IchniApp.instance.GetModel<InformationTransistor>().loadingFolder = projectName;
// StartPageManager.startPageManager.GoToEditScene();
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);
}
}
}