基础内容11 - SAVE LOAD EXPORT
This commit is contained in:
@@ -1,18 +1,69 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame.Beatmap;
|
||||
using UnityEngine;
|
||||
|
||||
public class BeatmapContainer : MonoBehaviour
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
public class BeatmapContainer : IBaseElement
|
||||
{
|
||||
public List<GameElement> gameElementList;
|
||||
public BaseElement_BM matchedBM { get; set; }
|
||||
|
||||
public BeatmapContainer()
|
||||
{
|
||||
gameElementList = new List<GameElement>();
|
||||
}
|
||||
|
||||
public void SaveBM()
|
||||
{
|
||||
matchedBM = new BeatmapContainer_BM(gameElementList);
|
||||
}
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
namespace Beatmap
|
||||
{
|
||||
|
||||
public class BeatmapContainer_BM : BaseElement_BM
|
||||
{
|
||||
public List<BaseElement_BM> elementList;
|
||||
|
||||
public BeatmapContainer_BM()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public BeatmapContainer_BM(List<GameElement> gameElementList)
|
||||
{
|
||||
elementList = new List<BaseElement_BM>();
|
||||
|
||||
gameElementList.ForEach(e =>
|
||||
{
|
||||
e.SaveBM();
|
||||
e.submoduleList.RemoveAll(s=>s == null);
|
||||
e.submoduleList.ForEach(s => s.SaveBM());
|
||||
});
|
||||
|
||||
foreach (var gameElement in gameElementList)
|
||||
{
|
||||
elementList.Add(gameElement.matchedBM);
|
||||
elementList.AddRange(gameElement.submoduleList.ConvertAll(submodule => submodule.matchedBM));
|
||||
}
|
||||
}
|
||||
|
||||
public override void ExecuteBM()
|
||||
{
|
||||
EditorManager.instance.beatmapContainer = new BeatmapContainer();
|
||||
|
||||
elementList.ForEach(element =>
|
||||
{
|
||||
if (element is GameElement_BM gameElement)
|
||||
{
|
||||
GameElement_BM.identifier.Add(gameElement.elementGuid, gameElement);
|
||||
}
|
||||
|
||||
element.ExecuteBM();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user