Files
ichni_Creator_Studio/Assets/Scripts/Base/Manager/EditorManager.cs
2025-02-09 23:47:42 -05:00

104 lines
4.4 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 : SerializedMonoBehaviour
{
public static EditorManager instance;
public SongModule songModule;
public ProjectManager projectManager;
public EditorUIManager uiManager;
public EditorSettings editorSettings;
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();
}
private void Start()
{
//CreateNew();
projectManager.loadManager.Load("TestProject");
AudioSource.PlayClipAtPoint(songInformation.song, Vector3.zero);
beatmapContainer.gameElementList.ForEach(gameElement =>
{
if (gameElement is IHaveTransformSubmodule transformedElement)
{
transformedElement.SetTransformObserver();
}
gameElement.AfterInitialize();
gameElement.Refresh();
});
}
private void Update()
{
songModule.songTime += Time.deltaTime;
}
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 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");
beatmapContainer.gameElementList.ForEach(e =>
{
e.AfterInitialize();
e.Refresh();
});
projectManager.saveManager.Save();
projectManager.exportManager.Export();
}
}
public class SongModule
{
public float songTime;
public float songBeat;
}
}