@@ -164,8 +164,16 @@ namespace Ichni.Editor
|
||||
|
||||
public List<IBaseElement> GetMachedElements(TagMatcher o)
|
||||
{
|
||||
return EditorManager.instance.beatmapContainer.gameElementList
|
||||
.Where(p => o.Match(p)).Cast<IBaseElement>().ToList();
|
||||
List<IBaseElement> matchedElements = new();
|
||||
EditorManager.instance.beatmapContainer.gameElementList.Where(p => o.Match(p)).ForEach(i =>
|
||||
{
|
||||
foreach (var u in i.submoduleList)
|
||||
{
|
||||
matchedElements.Add(u);
|
||||
}
|
||||
matchedElements.Add(i);
|
||||
});
|
||||
return matchedElements.Cast<IBaseElement>().ToList();
|
||||
}
|
||||
|
||||
public List<TagMatcher> GetMatcher(GameElement baseElement)
|
||||
@@ -319,6 +327,7 @@ namespace Ichni.Editor
|
||||
// 2. 如果必须检查,保留上面那行。
|
||||
|
||||
// 使用 ReflectionHelper 处理赋值 (自动处理 Struct 回写和嵌套)
|
||||
|
||||
ReflectionHelper.SetDeepValue(baseElement, parameterName, value);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -19,10 +19,11 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public float songLength;
|
||||
public float songTime;
|
||||
public float songBeat => songTime / 60 * bpm;
|
||||
public float songBeat => beatManager is null ? songTime / 60 * bpm : beatManager.GetBeatFromTime(songTime);
|
||||
public float offset = 0f;//设定偏移
|
||||
public BaseElement_BM matchedBM { get; set; }
|
||||
|
||||
public BeatManager beatManager = null;
|
||||
public SongInformation(string songName, float bpm, float delay, float offset)
|
||||
{
|
||||
this.songName = songName;
|
||||
@@ -52,6 +53,7 @@ namespace Ichni.RhythmGame
|
||||
EditorManager.instance.uiManager.inspector.ClearInspector();
|
||||
SetUpInspector();
|
||||
});
|
||||
beatManager = new BeatManager(this);
|
||||
|
||||
}
|
||||
private AudioClip LoadMP3(string filepath)//猜猜我从哪里偷的
|
||||
@@ -101,6 +103,24 @@ namespace Ichni.RhythmGame
|
||||
|
||||
}
|
||||
}
|
||||
public class BeatManager
|
||||
{
|
||||
private SongInformation songInformation;
|
||||
|
||||
public BeatManager(SongInformation songInformation)
|
||||
{
|
||||
this.songInformation = songInformation;
|
||||
}
|
||||
|
||||
public float GetBeatFromTime(float time)
|
||||
{
|
||||
return time / 60 * songInformation.bpm;
|
||||
}
|
||||
public float GetTimeFromBeat(float beat)
|
||||
{
|
||||
return beat * 60 / songInformation.bpm;
|
||||
}
|
||||
}
|
||||
|
||||
namespace Beatmap
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user