1.修复多处错误2.SplineNode依然存在设置不生效的错误
This commit is contained in:
@@ -26,19 +26,24 @@ namespace Demo.Editor
|
||||
{
|
||||
typeName = typeName[..typeName.LastIndexOf('`')];
|
||||
}
|
||||
stream.Write($"#include \"{currentType.BaseType.Name}.helper.h\"\n\n#define {typeName}\n\n");
|
||||
string baseTypeName = currentType.BaseType.Name;
|
||||
if (baseTypeName.Contains('`'))
|
||||
{
|
||||
baseTypeName = baseTypeName[..baseTypeName.LastIndexOf('`')];
|
||||
}
|
||||
stream.Write($"#include \"{baseTypeName}.helper.h\"\n\n#define {typeName}\n\n");
|
||||
}
|
||||
|
||||
private static void WriteCPPStyleFunction(StreamWriter stream, string name, IEnumerable<string> paramList, string description)
|
||||
{
|
||||
if (name == nameof(ScriptableObject.LoadSubScript))
|
||||
{
|
||||
// stream.WriteLine("#define __build_in_pragma #");
|
||||
// stream.WriteLine("#define __build_in_to_text(x) #x");
|
||||
stream.WriteLine("#define __build_in_pragma #");
|
||||
stream.WriteLine("#define __build_in_to_text(x) #x");
|
||||
|
||||
// stream.Write("/*\n" + description + "\n*/\n");
|
||||
// stream.Write($"#define {name}({string.Join(',', paramList)}) __build_in_pragma include __build_in_to_text(./##{paramList.First()})\n\n");
|
||||
stream.Write($"#define {name}({string.Join(',', paramList)})\n\n");
|
||||
stream.Write("/*\n" + description + "\n*/\n");
|
||||
stream.Write($"#define {name}({string.Join(',', paramList)}) __build_in_pragma include {paramList.ToArray()[1]}\n\n");
|
||||
//stream.Write($"#define {name}({string.Join(',', paramList)})\n\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -394,6 +394,11 @@ namespace Demo
|
||||
{
|
||||
// 先天支持的工具函数
|
||||
|
||||
[Content, SerializeField] private Vector3
|
||||
EnterGameLocalPosition = Vector3.zero,
|
||||
EnterGameEulerAngles = Vector3.zero,
|
||||
EnterGameLocalScaling = Vector3.one;
|
||||
|
||||
/// <summary>
|
||||
/// 设置坐标
|
||||
/// </summary>
|
||||
@@ -410,7 +415,7 @@ namespace Demo
|
||||
")]
|
||||
public void SetLocalPosition(string x, string y, string z)
|
||||
{
|
||||
transform.localPosition = new(Parse(x), Parse(y), Parse(z));
|
||||
EnterGameLocalPosition = new(Parse(x), Parse(y), Parse(z));
|
||||
}
|
||||
/// <summary>
|
||||
/// 设置欧拉角
|
||||
@@ -428,7 +433,7 @@ namespace Demo
|
||||
")]
|
||||
public void SetLocalEulerAngles(string x, string y, string z)
|
||||
{
|
||||
transform.localEulerAngles = new(Parse(x), Parse(y), Parse(z));
|
||||
EnterGameEulerAngles = new(Parse(x), Parse(y), Parse(z));
|
||||
}
|
||||
/// <summary>
|
||||
/// 设置缩放
|
||||
@@ -446,7 +451,14 @@ namespace Demo
|
||||
")]
|
||||
public void SetLocalScaling(string x, string y, string z)
|
||||
{
|
||||
transform.localScale = new(Parse(x), Parse(y), Parse(z));
|
||||
EnterGameLocalScaling = new(Parse(x), Parse(y), Parse(z));
|
||||
}
|
||||
|
||||
public virtual void ResetEnterGameStatus()
|
||||
{
|
||||
transform.localPosition = EnterGameLocalPosition;
|
||||
transform.localEulerAngles = EnterGameEulerAngles;
|
||||
transform.localScale = EnterGameLocalScaling;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -473,13 +485,13 @@ namespace Demo
|
||||
/// 指定多少个<see cref="TickType.Update"/>状态的<see cref="UpdateTicks(float, float, TickType)"/>执行一次更新,不会影响到子物体
|
||||
/// 属于性能优化的高级选项
|
||||
/// </summary>
|
||||
/// <param name="frame">间隔帧数, 小于等于1的值代表无论如何都会更新</param>
|
||||
/// <param name="frame">每frame帧更新一次, 等于0代表不会在<see cref="TickType.Update"/>状态运行</param>
|
||||
[ScriptableCall(@"
|
||||
<summary>
|
||||
指定多少个Update状态的UpdateTicks执行一次更新,不会影响到子物体
|
||||
属于性能优化的高级选项
|
||||
</summary>
|
||||
<param name=""frame"">间隔帧数, 小于等于1的值代表无论如何都会更新</param>
|
||||
<param name=""frame"">每frame帧更新一次, 等于0代表不会在Update状态运行</param>
|
||||
")]
|
||||
public void SetUpdatePerFrame(string frame)
|
||||
{
|
||||
@@ -571,18 +583,24 @@ namespace Demo
|
||||
|
||||
// GetParent
|
||||
ScriptableObject result = Parent;
|
||||
if (path[0] == '/' || path[0]=='\\')
|
||||
{
|
||||
result = GetRoot();
|
||||
}
|
||||
|
||||
if (Parent == null)
|
||||
{
|
||||
throw new InvalidOperationException($"Root is nosupport to {nameof(FindWithPath)}");
|
||||
}
|
||||
|
||||
// Find
|
||||
var components = path.Split('/', '\\');
|
||||
components[^1] = new ToolFile(components[^1]).GetFilename(true);
|
||||
foreach (var component in components)
|
||||
{
|
||||
if (component == "..")
|
||||
result = result.Parent;
|
||||
else if (component == ".")
|
||||
else if (component == "." || string.IsNullOrEmpty(component))
|
||||
continue;
|
||||
else
|
||||
{
|
||||
@@ -590,7 +608,7 @@ namespace Demo
|
||||
string targetScriptObjectPath = component;
|
||||
Regex regex = new(@"^(.*)\[(\d*)\]$");
|
||||
var match = regex.Match(component);
|
||||
if(match.Success)
|
||||
if (match.Success)
|
||||
{
|
||||
targetScriptObjectPath = match.Groups[1].Value;
|
||||
index = int.Parse(match.Groups[2].Value);
|
||||
@@ -901,7 +919,12 @@ namespace Demo
|
||||
#if UNITY_EDITOR
|
||||
s_PreparePerfMarker.Begin(this);
|
||||
#endif
|
||||
if (tickType == TickType.Reset)
|
||||
{
|
||||
ResetEnterGameStatus();
|
||||
}
|
||||
// UpdateTicks
|
||||
if (UpdatePerFrame > 0)
|
||||
{
|
||||
if (ScriptUpdateCounter % UpdatePerFrame == 0)
|
||||
UpdateTicks(currentTime, deltaTime, tickType);
|
||||
|
||||
@@ -65,6 +65,12 @@ namespace Demo.Game
|
||||
protected override void UpdateTicks(float currentTime, float deltaTime, TickType tickType)
|
||||
{
|
||||
base.UpdateTicks(currentTime, deltaTime, tickType);
|
||||
|
||||
float GetPercentValue()
|
||||
{
|
||||
return (currentTime - Entries[Content].TimePoint) / (Entries[Content + 1].TimePoint - Entries[Content].TimePoint);
|
||||
}
|
||||
|
||||
if (Entries.Count == 0)
|
||||
return;
|
||||
if (Entries.Count == 1)
|
||||
@@ -72,22 +78,20 @@ namespace Demo.Game
|
||||
UpdateEntry(0, 0);
|
||||
return;
|
||||
}
|
||||
// TODO : 删除后存在问题
|
||||
if (Entries[0].TimePoint <= 0 && tickType == TickType.Reset)
|
||||
{
|
||||
UpdateEntry(0, 0);
|
||||
}
|
||||
switch (tickType)
|
||||
{
|
||||
case TickType.Pause:
|
||||
//case TickType.LateUpdate:
|
||||
break;
|
||||
case TickType.Reset:
|
||||
case TickType.Start:
|
||||
{
|
||||
Content = 0;
|
||||
while (Content + 1 < Entries.Count && Entries[Content + 1].TimePoint < currentTime)
|
||||
Content++;
|
||||
UpdateEntry(Content, 0);
|
||||
UpdateEntry(Content, GetPercentValue());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -100,7 +104,7 @@ namespace Demo.Game
|
||||
if (Content + 1 >= Entries.Count)
|
||||
UpdateEntry(Content, 1);
|
||||
else
|
||||
UpdateEntry(Content, (currentTime - Entries[Content].TimePoint) / (Entries[Content + 1].TimePoint - Entries[Content].TimePoint));
|
||||
UpdateEntry(Content, GetPercentValue());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user