MusicBeat
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
#if UNITY_EDITOR
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cielonos.MainGame.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 节拍预设数据,用于编辑器中快速给节拍标记应用 tags 和颜色
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class BeatPreset
|
||||
{
|
||||
/// <summary>
|
||||
/// 预设显示名称
|
||||
/// </summary>
|
||||
public string displayName;
|
||||
|
||||
/// <summary>
|
||||
/// 预设 tags,添加节拍时自动附带
|
||||
/// </summary>
|
||||
public List<string> tags;
|
||||
|
||||
/// <summary>
|
||||
/// 编辑器中该预设对应的颜色
|
||||
/// </summary>
|
||||
public Color color;
|
||||
|
||||
public BeatPreset()
|
||||
{
|
||||
displayName = "New Preset";
|
||||
tags = new List<string>();
|
||||
color = Color.cyan;
|
||||
}
|
||||
|
||||
public BeatPreset(string displayName, List<string> tags, Color color)
|
||||
{
|
||||
this.displayName = displayName;
|
||||
this.tags = tags ?? new List<string>();
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查指定 BeatMarker 的 tags 是否与本预设完全匹配
|
||||
/// </summary>
|
||||
public bool MatchesTags(List<string> markerTags)
|
||||
{
|
||||
if (markerTags == null || markerTags.Count == 0)
|
||||
return tags == null || tags.Count == 0;
|
||||
|
||||
if (tags == null || tags.Count != markerTags.Count)
|
||||
return false;
|
||||
|
||||
for (int i = 0; i < tags.Count; i++)
|
||||
{
|
||||
if (!markerTags.Contains(tags[i]))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e8b585d86f9f54847ae6e73de15f584d
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b6a89c3d1ef423d4caeebb66af064d24
|
||||
Reference in New Issue
Block a user