效果模块,以及代码位置整理

This commit is contained in:
SoulliesOfficial
2025-02-16 11:15:42 -05:00
parent 934d1b5aba
commit d77e1a0f70
204 changed files with 1107 additions and 347 deletions

View File

@@ -0,0 +1,79 @@
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni.RhythmGame
{
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);
}
public void SetUpInspector()
{
throw new System.NotImplementedException();
}
public void Refresh()
{
throw new System.NotImplementedException();
}
}
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

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

View File

@@ -0,0 +1,57 @@
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);
}
public void SetUpInspector()
{
throw new System.NotImplementedException();
}
public void Refresh()
{
throw new System.NotImplementedException();
}
}
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,11 @@
fileFormatVersion: 2
guid: 687470d59e4c04f6ea0bac268600ed33
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,90 @@
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni.RhythmGame
{
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);
}
public void SetUpInspector()
{
throw new System.NotImplementedException();
}
public void Refresh()
{
throw new System.NotImplementedException();
}
}
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

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

View File

@@ -0,0 +1,73 @@
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni.RhythmGame
{
public class SongInformation : IBaseElement
{
public AudioClip song; //曲目
public string songName;
public string songLocation; //曲名
public float bpm; //每分钟节拍数
public float delay; //设定音乐和谱面延迟Delay秒后开始在延迟中SongPosition为负数。
public float songTime;
public float songBeat => songTime / 60 * bpm;
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);
}
public void SetUpInspector()
{
throw new System.NotImplementedException();
}
public void Refresh()
{
throw new System.NotImplementedException();
}
}
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);
}
}
}
}

View File

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