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

120 lines
5.8 KiB
C#
Raw Normal View History

using System;
using System.Collections;
using System.Collections.Generic;
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-14 22:04:21 -05:00
2025-02-08 23:09:50 -05:00
public ProjectManager projectManager;
2025-02-09 23:47:42 -05:00
public EditorUIManager uiManager;
2025-02-08 23:09:50 -05:00
public EditorSettings editorSettings;
2025-02-17 14:46:14 -05:00
public BackgroundController backgroundController;
2025-02-08 23:09:50 -05:00
public ProjectInformation projectInformation;
public SongInformation songInformation;
public BeatmapContainer beatmapContainer;
public CommandScripts commandScripts;
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();
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-08 23:09:50 -05:00
projectManager.loadManager.Load("TestProject");
2025-02-14 22:04:21 -05:00
uiManager.timeline.musicPlayer.audioSource.clip = songInformation.song;
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
if (gameElement is IHaveTransformSubmodule transformedElement)
{
transformedElement.SetTransformObserver();
}
gameElement.AfterInitialize();
gameElement.Refresh();
2025-02-07 10:49:26 -05:00
});
2025-02-17 14:46:14 -05:00
}
public override void SetUpInspector()
{
var container = inspector.GenerateContainer("Editor Manager");
var judgeTypeDropdown = inspector.GenerateDropdown(this, container, "Judge Type",
typeof(NoteBase.NoteJudgeType), nameof(currentJudgeType));
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();
}
2025-02-08 23:09:50 -05:00
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());
2025-02-12 18:46:46 -05:00
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());
2025-02-08 23:09:50 -05:00
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");
}
}
}