1.准备编写ScriptableEnum的Helper2.准备Judgement的快速创建体系

This commit is contained in:
2025-10-07 15:45:12 +08:00
parent 54a28c6671
commit 3429df6e49
3 changed files with 51 additions and 34 deletions

View File

@@ -70,8 +70,9 @@ e.g: LoadSubScript(SplineCore, ""SplineCore.h"") with(r = 1, g = 1, b = 1);
{ {
foreach (var type in asm.GetTypes()) foreach (var type in asm.GetTypes())
{ {
if (typeof(ScriptableObject).IsAssignableFrom(type) == false) // Functions
continue; if (typeof(ScriptableObject).IsAssignableFrom(type))
{
var scriptCalls = (from info in type.GetMembers(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly) var scriptCalls = (from info in type.GetMembers(BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)
where info is MethodInfo where info is MethodInfo
where info.GetCustomAttribute<ScriptableCallAttribute>(false) != null where info.GetCustomAttribute<ScriptableCallAttribute>(false) != null
@@ -108,6 +109,12 @@ e.g: LoadSubScript(SplineCore, ""SplineCore.h"") with(r = 1, g = 1, b = 1);
break; break;
} }
} }
}
// Enums
if (typeof(Enum).IsAssignableFrom(type)&& type.GetCustomAttribute<ScriptableCallAttribute>(false) != null)
{
// TODO
}
} }
} }
} }

View File

@@ -88,7 +88,7 @@ namespace Demo.Editor.UI
if (Mathf.Approximately(durationX, durationY)) if (Mathf.Approximately(durationX, durationY))
{ {
from = (durationX - clip.x) / left2rightDuration; from = (durationX - clip.x) / left2rightDuration;
to = Mathf.Max(from + 0.1f, EditorController.instance.SongOffset); to = Mathf.Max(from + 0.1f, (EditorController.instance.SongOffset - clip.x) / left2rightDuration);
} }
else else
{ {

View File

@@ -30,6 +30,16 @@ namespace Demo
} }
} }
[System.AttributeUsage(AttributeTargets.Enum, Inherited = true, AllowMultiple = false)]
public sealed class ScriptableEnumAttribute : Attribute
{
public string Description;
public ScriptableEnumAttribute(string description)
{
this.Description = description;
}
}
public static class ScriptCallUtility public static class ScriptCallUtility
{ {
// 解析函数调用的方法,支持 with 子句 // 解析函数调用的方法,支持 with 子句