StartMenu!

This commit is contained in:
SoulliesOfficial
2025-03-08 14:21:10 -05:00
parent 28e0a6e4b0
commit e0ae43c25c
193 changed files with 43412 additions and 7940 deletions

View File

@@ -59,7 +59,17 @@ namespace Ichni
this.elementName = "EditorManager";
this.elementGuid = Guid.Empty;
uiManager.hierarchy.GenerateTab(this, null);
StartCoroutine(DelayLoading());
if (InformationTransistor.instance.isLoadedProject)
{
LoadProject("TestProject");
}
else
{
projectManager.GenerateEmptyProject(InformationTransistor.instance.projectInfo_BM, InformationTransistor.instance.songInfo_BM);
projectManager.saveManager.Save();
}
isLoaded = true;
}
private void Update()
@@ -67,19 +77,17 @@ namespace Ichni
if(isLoaded) projectManager.autoSaveManager.UpdateAutoSave();
}
public IEnumerator DelayLoading()
public void LoadProject(string projectName)
{
StartCoroutine(projectManager.loadManager.Load("TestProject"));
projectManager.loadManager.Load(projectName);
musicPlayer.audioSource.clip = songInformation.song;
yield return new WaitForSeconds(1);//什么时候能加个loading界面
beatmapContainer.gameElementList.ForEach(gameElement =>
{
gameElement.AfterInitialize();
gameElement.Refresh();
});
isLoaded = true;
}
public override void SetUpInspector()
{
IHaveInspection inspector = uiManager.inspector;

View File

@@ -42,20 +42,13 @@ namespace Ichni
autoSaveManager = new AutoSaveManager();
}
public void GenerateProject(string projectName)
public void GenerateEmptyProject(ProjectInformation_BM projectInfo_BM, SongInformation_BM songInfo_BM)
{
EditorManager.instance.projectInformation = new ProjectInformation(projectName, "Soullies", "2.0",
DateTime.Now.ToString(CultureInfo.CurrentCulture), DateTime.Now.ToString(CultureInfo.CurrentCulture),
new List<string>());
EditorManager.instance.songInformation = new SongInformation("TestSong", 120, 0);
projectInfo_BM.ExecuteBM();
songInfo_BM.ExecuteBM();
EditorManager.instance.beatmapContainer = new BeatmapContainer();
EditorManager.instance.commandScripts = new CommandScripts(new List<string>());
//Create project folder
if (!System.IO.Directory.Exists(EditorManager.instance.projectInformation.projectPath))
{
System.IO.Directory.CreateDirectory(EditorManager.instance.projectInformation.projectPath);
}
}
}
@@ -154,16 +147,11 @@ namespace Ichni
public class LoadManager
{
public IEnumerator Load(string projectName)
public void Load(string projectName)
{
LoadProjectInfo(projectName);
LoadSongInfo();
LoadCommandScripts();
while (ThemeBundleManager.instance.waitingBundleAmount != 0)
{
yield return new WaitForEndOfFrame();
}
LoadBeatMap();
LogWindow.Log("Load Complete", Color.green);
}

View File

@@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UniRx;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Serialization;
@@ -15,19 +16,25 @@ namespace Ichni
public List<string> selectedThemeBundleList;
public List<ThemeBundle> loadedThemeBundleList;
public int waitingBundleAmount;
public IntReactiveProperty waitingBundleAmount;
private void Awake()
{
instance = this;
if (instance == null)
{
instance = this;
DontDestroyOnLoad(gameObject);
}
else if (instance != this)
{
Destroy(gameObject);
}
loadedThemeBundleList = new List<ThemeBundle>();
AssetBundle.UnloadAllAssetBundles(true);
LoadAllThemeBundlesAbstract();
//DontDestroyOnLoad(gameObject);
LoadThemeBundle("departure_to_multiverse");
LoadThemeBundle("basic");
//LoadThemeBundle("basic");
//LoadThemeBundle("departure_to_multiverse");
}
public bool TryGetThemeBundle(string themeBundleName, out ThemeBundle themeBundle)
@@ -36,30 +43,14 @@ namespace Ichni
return themeBundle != null;
}
private IEnumerator WaitAndLoad()
public T GetObject<T>(string themeBundleName, string objectName) where T : class
{
while (waitingBundleAmount != 0)
{
yield return null;
}
}
public T GetObject<T>(string themeBundleName, string objectName) where T : class//?
{
var i = loadedThemeBundleList.Find(bundle => bundle.themeBundleName == themeBundleName)?.GetObject<T>(objectName);
if (i == null)
{
Debug.LogError("Object not found");
return loadedThemeBundleList.Find(bundle => bundle.themeBundleName == "basic")?.GetObject<T>("BasicNoteTap3D");
}
else
return i;
return loadedThemeBundleList.Find(bundle => bundle.themeBundleName == themeBundleName)?.GetObject<T>(objectName);
}
public void LoadThemeBundles(List<string> list)
{
waitingBundleAmount = new IntReactiveProperty(list.Count);
foreach (var bundle in list)
{
LoadThemeBundle(bundle);
@@ -68,7 +59,8 @@ namespace Ichni
public void LoadAllThemeBundlesAbstract()
{
string uri = Application.streamingAssetsPath + "/ThemeBundles";
string uri = Application.streamingAssetsPath + "/ThemeBundles/";
if (ES3.DirectoryExists(uri))
{
List<string> allFileList = ES3.GetFiles(uri).ToList();
@@ -83,15 +75,13 @@ namespace Ichni
foreach (var abs in absList)
{
ES3Settings settings = new ES3Settings(uri + "/" + abs, ES3.EncryptionType.None);
themeBundleAbstractList.Add(ES3.Load<ThemeBundleAbstract>("ThemeBundleAbstract", settings));
themeBundleAbstractList.Add(ES3.Load<ThemeBundleAbstract>("ThemeBundleAbstract", uri + abs));
}
}
}
public void LoadThemeBundle(string themeBundleName)
{
waitingBundleAmount++;
StartCoroutine(LoadThemeBundleCoroutine(themeBundleName));
}
@@ -137,7 +127,7 @@ namespace Ichni
}
yield return new WaitForEndOfFrame();
waitingBundleAmount--;
waitingBundleAmount.Value--;
print(themeBundleName + " Done!");
}
}