1.修改以进行可选Interaction支持\n2.并修复Parse函数中正则表达式的bug\n3.新增对序列{S,B,C}解析为小节节点的Parse, 这将会使得DDT与Parse函数能够通过bpm动态工作
This commit is contained in:
@@ -269,6 +269,7 @@ namespace Demo
|
||||
// 数值解析工具
|
||||
|
||||
private readonly Dictionary<string, DDT> DDTCache = new();
|
||||
public static float OneBarTime = 1;
|
||||
|
||||
/// <summary>
|
||||
/// <list type="bullet">从时间点列表<see cref="TimePoints"/>中获取</list>
|
||||
@@ -287,15 +288,34 @@ namespace Demo
|
||||
return result;
|
||||
if(value.EndsWith(']'))
|
||||
{
|
||||
Regex regex = new(@"^(.*)\[(\d)\]$");
|
||||
var match = regex.Match(value);
|
||||
if (match.Success)
|
||||
{
|
||||
if (FindWithPath(match.Groups[1].Value) is DDT ddt)
|
||||
Regex regex = new(@"^(.+)\[(\d+)\]$");
|
||||
var match = regex.Match(value);
|
||||
if (match.Success)
|
||||
{
|
||||
return ddt.Datas[int.Parse(match.Groups[2].Value)];
|
||||
if (FindWithPath(match.Groups[1].Value) is DDT ddt)
|
||||
{
|
||||
DDTCache[match.Groups[1].Value] = ddt;
|
||||
}
|
||||
return DDTCache[match.Groups[1].Value].Datas[int.Parse(match.Groups[2].Value)];
|
||||
}
|
||||
}
|
||||
throw new ArgumentException("value is end by ']' but not match on any invlid parse");
|
||||
}
|
||||
if (value.EndsWith('}'))
|
||||
{
|
||||
{
|
||||
Regex regex = new(@"^\{\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\}$");
|
||||
var match = regex.Match(value);
|
||||
if (match.Success)
|
||||
{
|
||||
int barSplitTimes = int.Parse(match.Groups[1].Value);
|
||||
int barCount = int.Parse(match.Groups[2].Value);
|
||||
int tickCount = int.Parse(match.Groups[3].Value);
|
||||
return (barCount + tickCount / (float)barSplitTimes) * OneBarTime;
|
||||
}
|
||||
}
|
||||
throw new ArgumentException("value is end by '}' but not match on any invlid parse");
|
||||
}
|
||||
return float.Parse(value);
|
||||
}
|
||||
@@ -871,7 +891,11 @@ namespace Demo
|
||||
file = file | "Windows";
|
||||
#endif
|
||||
file = file | ab;
|
||||
#if ENABLE_CLASS_Interaction
|
||||
var downloader = new Interaction(file.GetFullPath());
|
||||
#else
|
||||
var downloader = new ToolFile(file.GetFullPath());
|
||||
#endif
|
||||
if (AssetBundlesItemEntry == null)
|
||||
{
|
||||
var hierarchy = HierarchyWindow.instance;
|
||||
|
||||
Reference in New Issue
Block a user