Files
ichni_Creator_Studio/Assets/Scripts/Manager/EditorManager.cs

101 lines
3.5 KiB
C#
Raw Normal View History

using System;
using System.Collections;
using System.Collections.Generic;
2025-02-28 20:08:00 +08:00
using Dreamteck.Splines.Primitives;
2025-02-09 23:47:42 -05:00
using Ichni.Editor;
using Ichni.RhythmGame;
2025-02-07 10:49:26 -05:00
using Ichni.RhythmGame.Beatmap;
using Ichni.RhythmGame.ThemeBundles.Basic;
using Sirenix.OdinInspector;
using UnityEngine;
namespace Ichni
{
2025-02-17 14:46:14 -05:00
public class EditorManager : GameElement
{
public static EditorManager instance;
2025-02-28 20:08:00 +08:00
2025-02-08 23:09:50 -05:00
public ProjectManager projectManager;
public MusicPlayer musicPlayer;
2025-02-09 23:47:42 -05:00
public EditorUIManager uiManager;
2025-02-08 23:09:50 -05:00
public EditorSettings editorSettings;
2025-02-19 19:01:21 -05:00
public OperationManager operationManager;
2025-02-17 14:46:14 -05:00
public BackgroundController backgroundController;
public CameraManager cameraManager;
public PostProcessingManager postProcessingManager;
2025-02-28 20:08:00 +08:00
public Timeline timeline;
2025-02-28 20:08:00 +08:00
2025-02-08 23:09:50 -05:00
public ProjectInformation projectInformation;
public SongInformation songInformation;
public BeatmapContainer beatmapContainer;
public CommandScripts commandScripts;
2025-02-28 20:08:00 +08:00
2025-02-02 08:34:54 -05:00
public NoteBase.NoteJudgeType currentJudgeType;
public BasePrefabsCollection basePrefabs;
2025-02-02 08:34:54 -05:00
private void Awake()
{
instance = this;
2025-02-08 23:09:50 -05:00
projectManager = new ProjectManager();
2025-02-19 19:01:21 -05:00
operationManager = new OperationManager();
2025-02-28 20:08:00 +08:00
if (!ES3.FileExists(Application.streamingAssetsPath + "/EditorSettings.es3"))
{
editorSettings = new EditorSettings(300, 100, 100);
EditorSettings.SaveSettings(editorSettings);
}
else
{
EditorSettings.LoadSettings(ref editorSettings);
}
}
private void Start()
{
2025-02-17 14:46:14 -05:00
this.elementName = "EditorManager";
this.elementGuid = Guid.Empty;
uiManager.hierarchy.GenerateTab(this, null);
2025-02-28 21:12:20 +08:00
StartCoroutine(DelayLoading());
2025-02-28 20:08:00 +08:00
2025-02-28 21:12:20 +08:00
}
public IEnumerator DelayLoading()
{
2025-02-28 20:08:00 +08:00
StartCoroutine(projectManager.loadManager.Load("TestProject"));
musicPlayer.audioSource.clip = songInformation.song;
2025-02-28 21:12:20 +08:00
yield return new WaitForSeconds(2);//什么时候能加个loading界面
2025-02-14 22:04:21 -05:00
2025-02-08 23:09:50 -05:00
beatmapContainer.gameElementList.ForEach(gameElement =>
2025-02-07 10:49:26 -05:00
{
2025-02-08 23:09:50 -05:00
gameElement.AfterInitialize();
gameElement.Refresh();
2025-02-07 10:49:26 -05:00
});
2025-02-17 14:46:14 -05:00
}
public override void SetUpInspector()
{
IHaveInspection inspector = uiManager.inspector;
2025-02-28 20:08:00 +08:00
2025-02-17 14:46:14 -05:00
var container = inspector.GenerateContainer("Editor Manager");
var judgeTypeDropdown = inspector.GenerateDropdown(this, container, "Judge Type",
typeof(NoteBase.NoteJudgeType), nameof(currentJudgeType));
2025-02-19 09:15:51 -05:00
var generateFolderButton =
inspector.GenerateButton(this, container, "Generate Folder",
2025-02-28 20:08:00 +08:00
() => ElementFolder.GenerateElement("Folder", Guid.NewGuid(),
2025-02-19 09:15:51 -05:00
new List<string>(), true, null));
var generateBackgroundSetterButton =
2025-02-17 14:46:14 -05:00
inspector.GenerateButton(this, container, "Generate Background Setter",
2025-02-19 09:15:51 -05:00
() => BackgroundSetter.GenerateElement("Background Setter", Guid.NewGuid(),
new List<string>(), true, null, false,
2025-02-17 14:46:14 -05:00
"basic", "Skybox", "Background"));
2025-02-28 20:08:00 +08:00
2025-02-17 14:46:14 -05:00
projectInformation.SetUpInspector();
songInformation.SetUpInspector();
cameraManager.SetUpInspector();
}
}
}