基础内容11 - SAVE LOAD EXPORT

This commit is contained in:
SoulliesOfficial
2025-02-08 23:09:50 -05:00
parent 7ab738cb68
commit e3a8450a27
61 changed files with 1229 additions and 237 deletions

View File

@@ -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();
});
}
}
}
}
}

View File

@@ -1,18 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CommandScriptContainer : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@@ -0,0 +1,47 @@
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni.RhythmGame
{
public class CommandScripts : IBaseElement
{
List<string> commandList;
public BaseElement_BM matchedBM { get; set; }
public CommandScripts(List<string> commandList)
{
this.commandList = commandList;
}
public void SaveBM()
{
matchedBM = new CommandScripts_BM(commandList);
}
}
namespace Beatmap
{
public class CommandScripts_BM : BaseElement_BM
{
public List<string> commandList;
public CommandScripts_BM()
{
}
public CommandScripts_BM(List<string> commandList)
{
this.commandList = commandList;
}
public override void ExecuteBM()
{
EditorManager.instance.commandScripts = new CommandScripts(commandList);
}
}
}
}

View File

@@ -0,0 +1,13 @@
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni
{
public class EditorSettings
{
public int autoSaveInterval = 300;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6d388e457813547ca8a9e6282d72ae32
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,18 +1,80 @@
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
public class ProjectInformation : MonoBehaviour
namespace Ichni.RhythmGame
{
// Start is called before the first frame update
void Start()
public class ProjectInformation : IBaseElement
{
public string projectName;
public string creatorName;
public string editorVersion;
public string createTime;
public string lastSaveTime;
public List<string> selectedThemeBundleList;
public string projectPath;
public BaseElement_BM matchedBM { get; set; }
public string peojectInfoPath => projectPath + "/ProjectInfo.json";
public string songInfoPath => projectPath + "/SongInfo.json";
public string songPath => projectPath + EditorManager.instance.songInformation.songName + ".wav";
public string beatmapPath => projectPath + "/Beatmap.json";
public string CommandScriptsPath => projectPath + "/CommandScripts.json";
public ProjectInformation(string projectName, string creatorName, string editorVersion,
string createTime, string lastSaveTime, List<string> selectedThemeBundleList)
{
this.projectName = projectName;
this.creatorName = creatorName;
this.editorVersion = editorVersion;
this.createTime = createTime;
this.lastSaveTime = lastSaveTime;
this.selectedThemeBundleList = selectedThemeBundleList;
projectPath = Application.streamingAssetsPath + "/Projects/" + projectName;
}
public void SaveBM()
{
matchedBM = new ProjectInformation_BM(projectName, creatorName, editorVersion,
createTime, lastSaveTime, selectedThemeBundleList);
}
}
// Update is called once per frame
void Update()
namespace Beatmap
{
public class ProjectInformation_BM : BaseElement_BM
{
public string projectName;
public string creatorName;
public string editorVersion;
public string createTime;
public string lastSaveTime;
public List<string> selectedThemeBundleList;
public ProjectInformation_BM()
{
}
public ProjectInformation_BM(string projectName, string creatorName, string editorVersion,
string createTime, string lastSaveTime, List<string> selectedThemeBundleList)
{
this.projectName = projectName;
this.creatorName = creatorName;
this.editorVersion = editorVersion;
this.createTime = createTime;
this.lastSaveTime = lastSaveTime;
this.selectedThemeBundleList = selectedThemeBundleList;
}
public override void ExecuteBM()
{
EditorManager.instance.projectInformation = new ProjectInformation(projectName,
creatorName, editorVersion, createTime, lastSaveTime, selectedThemeBundleList);
}
}
}
}
}

View File

@@ -1,18 +1,60 @@
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
public class SongInformation : MonoBehaviour
namespace Ichni.RhythmGame
{
// Start is called before the first frame update
void Start()
public class SongInformation : IBaseElement
{
public AudioClip song; //曲目
public string songName;
public string songLocation; //曲名
public float bpm; //每分钟节拍数
public float delay; //设定音乐和谱面延迟Delay秒后开始在延迟中SongPosition为负数。
public BaseElement_BM matchedBM { get; set; }
public SongInformation(string songName, float bpm, float delay)
{
this.songName = songName;
this.bpm = bpm;
this.delay = delay;
songLocation = EditorManager.instance.projectInformation.projectPath + "/" + songName + ".wav";
Debug.Log("Loading song from " + songLocation + " " + ES3.FileExists(songLocation));
song = ES3.LoadAudio(songLocation, AudioType.WAV);
}
public void SaveBM()
{
matchedBM = new SongInformation_BM(songName, bpm, delay);
}
}
// Update is called once per frame
void Update()
namespace Beatmap
{
public class SongInformation_BM : BaseElement_BM
{
public string songName;
public float bpm;
public float delay;
public SongInformation_BM()
{
}
public SongInformation_BM(string songName, float bpm, float delay)
{
this.songName = songName;
this.bpm = bpm;
this.delay = delay;
}
public override void ExecuteBM()
{
EditorManager.instance.songInformation = new SongInformation(songName, bpm, delay);
}
}
}
}
}