毫无头绪!

This commit is contained in:
2025-02-28 20:08:00 +08:00
parent 5238cd0e5e
commit 07256af84b
26 changed files with 1115 additions and 485 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Dreamteck.Splines.Primitives;
using Ichni.Editor;
using Ichni.RhythmGame;
using Ichni.RhythmGame.Beatmap;
@@ -13,7 +14,7 @@ namespace Ichni
public class EditorManager : GameElement
{
public static EditorManager instance;
public ProjectManager projectManager;
public MusicPlayer musicPlayer;
public EditorUIManager uiManager;
@@ -22,14 +23,14 @@ namespace Ichni
public BackgroundController backgroundController;
public CameraManager cameraManager;
public PostProcessingManager postProcessingManager;
public Timeline timeline;
public ProjectInformation projectInformation;
public SongInformation songInformation;
public BeatmapContainer beatmapContainer;
public CommandScripts commandScripts;
public NoteBase.NoteJudgeType currentJudgeType;
public BasePrefabsCollection basePrefabs;
@@ -38,7 +39,7 @@ namespace Ichni
instance = this;
projectManager = new ProjectManager();
operationManager = new OperationManager();
if (!ES3.FileExists(Application.streamingAssetsPath + "/EditorSettings.es3"))
{
editorSettings = new EditorSettings(300, 100, 100);
@@ -55,8 +56,8 @@ namespace Ichni
this.elementName = "EditorManager";
this.elementGuid = Guid.Empty;
uiManager.hierarchy.GenerateTab(this, null);
projectManager.loadManager.Load("TestProject");
StartCoroutine(projectManager.loadManager.Load("TestProject"));
musicPlayer.audioSource.clip = songInformation.song;
beatmapContainer.gameElementList.ForEach(gameElement =>
@@ -69,14 +70,14 @@ namespace Ichni
public override void SetUpInspector()
{
IHaveInspection inspector = uiManager.inspector;
var container = inspector.GenerateContainer("Editor Manager");
var judgeTypeDropdown = inspector.GenerateDropdown(this, container, "Judge Type",
typeof(NoteBase.NoteJudgeType), nameof(currentJudgeType));
var generateFolderButton =
inspector.GenerateButton(this, container, "Generate Folder",
() => ElementFolder.GenerateElement("Folder", Guid.NewGuid(),
() => ElementFolder.GenerateElement("Folder", Guid.NewGuid(),
new List<string>(), true, null));
var generateBackgroundSetterButton =
@@ -84,7 +85,7 @@ namespace Ichni
() => BackgroundSetter.GenerateElement("Background Setter", Guid.NewGuid(),
new List<string>(), true, null, false,
"basic", "Skybox", "Background"));
projectInformation.SetUpInspector();
songInformation.SetUpInspector();
cameraManager.SetUpInspector();

View File

@@ -21,13 +21,14 @@ namespace Ichni.Editor
public void PlayMusic()
{
isPlaying = !isPlaying;
Trail.SetAllTrails(true, false);
EditorManager.instance.songInformation.songTime = audioSource.time;
if(isPlaying)audioSource.Play();
else audioSource.Pause();
if (isPlaying) audioSource.Play();
else audioSource.Pause();
}
public void PauseMusic()
{
isPlaying = false;
@@ -35,7 +36,7 @@ namespace Ichni.Editor
EditorManager.instance.songInformation.songTime = audioSource.time;
audioSource.Pause();
}
public void StopMusic()
{
isPlaying = false;

View File

@@ -24,11 +24,11 @@ namespace Ichni
encryptionPassword = "Soullies515",
format = ES3.Format.JSON,
};
public SaveManager saveManager;
public LoadManager loadManager;
public ExportManager exportManager;
public ProjectManager()
{
saveManager = new SaveManager();
@@ -38,12 +38,12 @@ namespace Ichni
public void GenerateProject(string projectName)
{
EditorManager.instance.projectInformation = new ProjectInformation(projectName, "Soullies",
EditorManager.instance.projectInformation = new ProjectInformation(projectName, "Soullies",
"2.0", "2025-02-08", "2025-02-08", new List<string>());
EditorManager.instance.songInformation = new SongInformation("TestSong", 120, 0);
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))
{
@@ -64,12 +64,12 @@ namespace Ichni
string commandScriptsPath = exportPath + "/CommandScripts.bytes";
LogWindow.Log("Start Exporting...");
ExportProjectInfo(projectInfoPath);
ExportSongInfo(songInfoPath);
ExportBeatMap(beatmapPath);
ExportCommandScripts(commandScriptsPath);
LogWindow.Log("Export Complete", Color.green);
}
@@ -107,12 +107,12 @@ namespace Ichni
public void Save()
{
LogWindow.Log("Start Saving...");
SaveProjectInfo();
SaveSongInfo();
SaveBeatMap();
SaveCommandScripts();
LogWindow.Log("Save Complete", Color.green);
}
@@ -147,16 +147,19 @@ namespace Ichni
public class LoadManager
{
public void Load(string projectName)
public IEnumerator Load(string projectName)
{
LoadProjectInfo(projectName);
LoadSongInfo();
LoadBeatMap();
LoadCommandScripts();
while (ThemeBundleManager.instance.waitingBundleAmount != 0)
{
yield return new WaitForEndOfFrame();
}
LoadBeatMap();
LogWindow.Log("Load Complete", Color.green);
}
private void LoadProjectInfo(string projectName)
{
string projectInfoPath = Application.streamingAssetsPath + "/Projects/" + projectName + "/ProjectInfo.json";

View File

@@ -16,29 +16,51 @@ namespace Ichni
public List<ThemeBundle> loadedThemeBundleList;
public int waitingBundleAmount;
private void Awake()
{
instance = this;
loadedThemeBundleList = new List<ThemeBundle>();
AssetBundle.UnloadAllAssetBundles(true);
LoadAllThemeBundlesAbstract();
//DontDestroyOnLoad(gameObject);
LoadThemeBundle("basic");
LoadThemeBundle("departure_to_multiverse");
LoadThemeBundle("basic");
}
public bool TryGetThemeBundle(string themeBundleName, out ThemeBundle themeBundle)
{
themeBundle = loadedThemeBundleList.Find(bundle => bundle.themeBundleName == themeBundleName);
return themeBundle != null;
}
public T GetObject<T>(string themeBundleName, string objectName) where T : class
private IEnumerator WaitAndLoad()
{
return loadedThemeBundleList.Find(bundle => bundle.themeBundleName == themeBundleName)?.GetObject<T>(objectName);
while (waitingBundleAmount != 0)
{
yield return null;
}
}
public T GetObject<T>(string themeBundleName, string objectName) where T : class//?
{
print(themeBundleName + " " + objectName);
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;
}
public void LoadThemeBundles(List<string> list)
@@ -77,22 +99,23 @@ namespace Ichni
waitingBundleAmount++;
StartCoroutine(LoadThemeBundleCoroutine(themeBundleName));
}
IEnumerator LoadThemeBundleCoroutine(string themeBundleName)
{
string uri = "";
if (Application.platform == RuntimePlatform.WindowsEditor ||
Application.platform == RuntimePlatform.WindowsPlayer)
{
uri = Application.streamingAssetsPath + "/ThemeBundles/Windows64/" + themeBundleName;
}else if (Application.platform == RuntimePlatform.OSXEditor ||
}
else if (Application.platform == RuntimePlatform.OSXEditor ||
Application.platform == RuntimePlatform.OSXPlayer)
{
uri = Application.streamingAssetsPath + "/ThemeBundles/OSX/" + themeBundleName;
}
UnityWebRequest request = UnityWebRequestAssetBundle.GetAssetBundle(uri, 0);
yield return request.SendWebRequest();
AssetBundle bundle = AssetBundle.LoadFromFile(uri);
@@ -120,6 +143,7 @@ namespace Ichni
yield return new WaitForEndOfFrame();
waitingBundleAmount--;
print(themeBundleName + " Done!");
}
}
@@ -231,7 +255,7 @@ namespace Ichni
}
}
}
return default(T);
}
}