Files
ichni_Creator_Studio/Assets/Scripts/Manager/EditorManager.cs
SoulliesOfficial 5349cde381 特效范例
2025-02-19 09:15:51 -05:00

124 lines
6.0 KiB
C#

using System;
using System.Collections;
using System.Collections.Generic;
using Ichni.Editor;
using Ichni.RhythmGame;
using Ichni.RhythmGame.Beatmap;
using Ichni.RhythmGame.ThemeBundles.Basic;
using Sirenix.OdinInspector;
using UnityEngine;
namespace Ichni
{
public class EditorManager : GameElement
{
public static EditorManager instance;
public ProjectManager projectManager;
public EditorUIManager uiManager;
public EditorSettings editorSettings;
public BackgroundController backgroundController;
public CameraManager cameraManager;
public ProjectInformation projectInformation;
public SongInformation songInformation;
public BeatmapContainer beatmapContainer;
public CommandScripts commandScripts;
public NoteBase.NoteJudgeType currentJudgeType;
public BasePrefabsCollection basePrefabs;
private void Awake()
{
instance = this;
projectManager = new ProjectManager();
if (!ES3.FileExists(Application.streamingAssetsPath + "/EditorSettings.es3"))
{
editorSettings = new EditorSettings(300, 100, 100);
EditorSettings.SaveSettings(editorSettings);
}
else
{
EditorSettings.LoadSettings(ref editorSettings);
}
}
private void Start()
{
this.elementName = "EditorManager";
this.elementGuid = Guid.Empty;
uiManager.hierarchy.GenerateTab(this, null);
projectManager.loadManager.Load("TestProject");
uiManager.timeline.musicPlayer.audioSource.clip = songInformation.song;
beatmapContainer.gameElementList.ForEach(gameElement =>
{
gameElement.AfterInitialize();
gameElement.Refresh();
});
}
public override void SetUpInspector()
{
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(),
new List<string>(), true, null));
var generateBackgroundSetterButton =
inspector.GenerateButton(this, container, "Generate Background Setter",
() => BackgroundSetter.GenerateElement("Background Setter", Guid.NewGuid(),
new List<string>(), true, null, false,
"basic", "Skybox", "Background"));
projectInformation.SetUpInspector();
songInformation.SetUpInspector();
cameraManager.SetUpInspector();
}
private void CreateNew()
{
projectManager.GenerateProject("TestProject");
var f0 = ElementFolder.GenerateElement("Folder", Guid.NewGuid(), new List<string>(), true, null);
var dis0 = Displacement.GenerateElement("Displacement-0",Guid.NewGuid(), new List<string>(),true, f0,
new FlexibleFloat(),
new FlexibleFloat(new List<AnimatedFloat>(){new (0,2,0,10, AnimationCurveType.Linear)}),
new FlexibleFloat());
var dis1 = Displacement.GenerateElement("Displacement-1", Guid.NewGuid(), new List<string>(), true, f0,
new FlexibleFloat(new List<AnimatedFloat>()
{
new(0, 0.5f, 0, -4, AnimationCurveType.OutQuad),
new(0.5f, 1, -4, 0, AnimationCurveType.InQuad),
new(1, 1.5f, 0, 4, AnimationCurveType.OutQuad),
new(1.5f, 2, 4, 0, AnimationCurveType.InQuad),
}),
new FlexibleFloat(new List<AnimatedFloat>(){new (0,2,0,-10, AnimationCurveType.Linear)}),
new FlexibleFloat());
var t0 = Track.GenerateElement("Track", Guid.NewGuid(), new List<string>(), true, f0);
t0.trackPathSubmodule = new TrackPathSubmodule(t0, Track.TrackSpaceType.Linear, Track.TrackSamplingType.TimeDistributed, false);
t0.submoduleList.Add(t0.trackPathSubmodule);
t0.trackTimeSubmodule = new TrackTimeSubmoduleMovable(t0, 0, 2, 1, AnimationCurveType.OutQuad);
t0.submoduleList.Add(t0.trackTimeSubmodule);
var pp0 = TrackPercentPoint.GenerateElement("TrackPercentPoint-0", Guid.NewGuid(), new List<string>(), true, t0,
new FlexibleFloat(new List<AnimatedFloat>() { new(0, 2, 0, 1, AnimationCurveType.OutQuad) }));
var tr0 = Trail.GenerateElement("Trail-0", Guid.NewGuid(), new List<string>(), true, pp0, 5);
// t0.trackRendererSubmodule = new TrackRendererSubmoduleAutoOrient(t0);
var p0 = PathNode.GenerateElement("PathNode-0", Guid.NewGuid(), new List<string>(), true, t0);
p0.transformSubmodule = new TransformSubmodule(p0, new Vector3(-5, 5, 10), Vector3.zero, Vector3.one);
p0.colorSubmodule = new ColorSubmodule(p0, Color.white);
var p1 = PathNode.GenerateElement("PathNode-1", Guid.NewGuid(), new List<string>(), true, t0);
p1.transformSubmodule = new TransformSubmodule(p1, new Vector3(5, -5, 10), Vector3.zero, Vector3.one);
p1.colorSubmodule = new ColorSubmodule(p1, Color.red);
var n0 = Tap.GenerateElement("Note-0", Guid.NewGuid(), new List<string>(), true, t0, 1f);
var n0v = BasicNoteVisual.GenerateElement("Note-0-V", Guid.NewGuid(), new List<string>(), true, n0,
"basic", "BasicNoteTap3D");
}
}
}