Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
@@ -209,12 +209,12 @@ namespace Ichni
|
||||
|
||||
LogWindow.Log("Save Clip Complete", Color.green);
|
||||
}
|
||||
|
||||
|
||||
public void LoadClip(string clipName)
|
||||
{
|
||||
LogWindow.Log("Start Loading Clip...");
|
||||
|
||||
if(!ES3.FileExists(Application.streamingAssetsPath + "/Clips/" + clipName + ".json"))
|
||||
|
||||
if (!ES3.FileExists(Application.streamingAssetsPath + "/Clips/" + clipName + ".json"))
|
||||
{
|
||||
LogWindow.Log("Clip not found", Color.red);
|
||||
return;
|
||||
@@ -225,16 +225,16 @@ namespace Ichni
|
||||
LogWindow.Log("Please select only one Game Element to load the beatmap clip.", Color.red);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
GameElement selectedElement = EditorManager.instance.operationManager.currentSelectedElements[0];
|
||||
|
||||
|
||||
if (selectedElement is null)
|
||||
{
|
||||
LogWindow.Log("Please select a Game Element to load the beatmap clip.", Color.red);
|
||||
return;
|
||||
}
|
||||
Debug.Log(selectedElement.elementName + " " + selectedElement.elementGuid);
|
||||
|
||||
|
||||
_LoadClip(selectedElement, clipName);
|
||||
|
||||
LogWindow.Log("Load Clip Complete", Color.green);
|
||||
@@ -263,18 +263,18 @@ namespace Ichni
|
||||
{
|
||||
string filePath = Application.streamingAssetsPath + "/Clips/" + clipName + ".json";
|
||||
List<BaseElement_BM> clip = ES3.Load<List<BaseElement_BM>>("Clip", filePath, ProjectManager.SaveSettings);
|
||||
|
||||
|
||||
//对于第一个元素,需要特殊处理,将它放入目标物体的子物体列表中
|
||||
GameElement_BM first = clip[0] as GameElement_BM;
|
||||
List<BaseElement_BM> firstAttaches = GameElement_BM.GetAllAttachedBaseElements(first, clip);
|
||||
first.elementGuid = Guid.NewGuid();
|
||||
GameElement_BM.identifier.TryAdd(first.elementGuid, first);
|
||||
firstAttaches.ForEach(e => { e.attachedElementGuid = first.elementGuid; });
|
||||
|
||||
|
||||
//将目标物体(临时)存入读存档的Dictionary中
|
||||
target.SaveBM();
|
||||
GameElement_BM.identifier.TryAdd(target.elementGuid, target.matchedBM as GameElement_BM);
|
||||
(target.matchedBM as GameElement_BM).matchedElement = target;
|
||||
(target.matchedBM as GameElement_BM).matchedElement = target;
|
||||
first.attachedElementGuid = target.elementGuid;
|
||||
|
||||
for (var index = 1; index < clip.Count; index++)
|
||||
@@ -290,7 +290,7 @@ namespace Ichni
|
||||
}
|
||||
|
||||
first.ExecuteBM();
|
||||
|
||||
|
||||
for (var index = 1; index < clip.Count; index++)
|
||||
{
|
||||
clip[index].ExecuteBM();
|
||||
@@ -304,7 +304,7 @@ namespace Ichni
|
||||
{
|
||||
string mergePath = Application.streamingAssetsPath + "/Merges/" + mergeName + ".json";
|
||||
BeatmapContainer_BM merge = ES3.Load<BeatmapContainer_BM>("Beatmap", mergePath, ProjectManager.SaveSettings);
|
||||
|
||||
|
||||
merge.elementList.ForEach(element =>
|
||||
{
|
||||
if (element == null)
|
||||
@@ -312,12 +312,12 @@ namespace Ichni
|
||||
Debug.LogError("Null element detected in elementList. Skipping execution.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (BeatmapContainer_BM.LowPriorityGameElementTypes.Contains(element.GetType()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (element is GameElement_BM gameElement)
|
||||
{
|
||||
GameElement_BM.identifier.Add(gameElement.elementGuid, gameElement);
|
||||
@@ -371,12 +371,16 @@ namespace Ichni
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
ES3.Save("Note", clip, GetNotePrefabPath(noteName), ProjectManager.SaveSettings);
|
||||
}
|
||||
|
||||
public void LoadNotePrefab(NoteBase target, string noteName)
|
||||
{
|
||||
if (target.noteVisual != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
List<BaseElement_BM> clip = ES3.Load<List<BaseElement_BM>>("Note", GetNotePrefabPath(noteName), ProjectManager.SaveSettings);
|
||||
|
||||
if (clip == null || clip.Count == 0)
|
||||
@@ -384,17 +388,17 @@ namespace Ichni
|
||||
LogWindow.Log("Note prefab not found", Color.red);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
target.SaveBM();
|
||||
GameElement_BM.identifier.TryAdd(target.elementGuid, target.matchedBM as GameElement_BM);
|
||||
(target.matchedBM as GameElement_BM).matchedElement = target;
|
||||
|
||||
(target.matchedBM as GameElement_BM).matchedElement = target;
|
||||
|
||||
GameElement_BM first = clip[0] as GameElement_BM;
|
||||
List<BaseElement_BM> firstAttaches = GameElement_BM.GetAllAttachedBaseElements(first, clip);
|
||||
first.elementGuid = target.elementGuid;
|
||||
GameElement_BM.identifier.TryAdd(first.elementGuid, first);
|
||||
firstAttaches.ForEach(e => { e.attachedElementGuid = first.elementGuid; });
|
||||
|
||||
|
||||
for (var index = 1; index < clip.Count; index++)
|
||||
{
|
||||
var element = clip[index];
|
||||
@@ -406,11 +410,12 @@ namespace Ichni
|
||||
attachedElements.ForEach(e => { e.attachedElementGuid = gameElement.elementGuid; });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
for (var index = 1; index < clip.Count; index++)
|
||||
{
|
||||
clip[index].ExecuteBM();
|
||||
}
|
||||
target.SetDefaultSubmodules();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,7 +426,7 @@ namespace Ichni
|
||||
private string GetAutoSavePath(string autoSaveName) => autoSavePath + "/" + autoSaveName + ".json";
|
||||
private float autoSaveInterval => EditorManager.instance.editorSettings.autoSaveInterval;
|
||||
private int maximumAutoSaveCount => EditorManager.instance.editorSettings.maximumAutoSaveCount;
|
||||
|
||||
|
||||
public float autoSaveTimer;
|
||||
|
||||
public AutoSaveManager()
|
||||
@@ -466,21 +471,21 @@ namespace Ichni
|
||||
string newestSavePath = GetAutoSavePath("AutoSave_0");
|
||||
SaveBeatMap(newestSavePath);
|
||||
}
|
||||
|
||||
|
||||
private void SaveBeatMap(string autoSavePath)
|
||||
{
|
||||
EditorManager.instance.beatmapContainer.SaveBM();
|
||||
ES3.Save("BeatMap", EditorManager.instance.beatmapContainer.matchedBM as BeatmapContainer_BM,
|
||||
autoSavePath, ProjectManager.SaveSettings);
|
||||
}
|
||||
|
||||
|
||||
private List<string> GetSortedSaveFiles()
|
||||
{
|
||||
if(!ES3.DirectoryExists(autoSavePath))
|
||||
if (!ES3.DirectoryExists(autoSavePath))
|
||||
{
|
||||
Directory.CreateDirectory(autoSavePath);
|
||||
}
|
||||
|
||||
|
||||
List<string> saveFiles = new List<string>(Directory.GetFiles(autoSavePath, "AutoSave_*.es3"));
|
||||
saveFiles.Sort(string.Compare);
|
||||
return saveFiles;
|
||||
|
||||
Reference in New Issue
Block a user