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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,10 +28,10 @@ namespace Demo.Game
|
||||
public void AddTo(SplineCore core)
|
||||
{
|
||||
MyNodeContent = core.NodeContent;
|
||||
MyNode.AddConnection(core.MySplineComputer, MyNodeContent);
|
||||
core.MySplineComputer.SetPointSize(MyNodeContent, NodeSize);
|
||||
core.MySplineComputer.SetPointColor(MyNodeContent, NodeColor);
|
||||
core.MySplineComputer.SetPointSize(MyNodeContent, NodeSize);
|
||||
core.MySplineComputer.SetPointNormal(MyNodeContent, IsSetupNodeRotation ? NodeRotation.normalized : transform.up);
|
||||
MyNode.AddConnection(core.MySplineComputer, MyNodeContent);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -44,9 +44,9 @@ namespace Demo.Game
|
||||
</summary>
|
||||
<param name=""size""></param>
|
||||
")]
|
||||
public void SetNoteSize(string size)
|
||||
public void SetNodeSize(string size)
|
||||
{
|
||||
NodeSize = float.Parse(size);
|
||||
NodeSize = Parse(size);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -65,9 +65,9 @@ namespace Demo.Game
|
||||
<param name=""b""></param>
|
||||
<param name=""a""></param>
|
||||
")]
|
||||
public void SetNoteColor(string r, string g, string b, string a)
|
||||
public void SetNodeColor(string r, string g, string b, string a)
|
||||
{
|
||||
NodeColor = new(float.Parse(r), float.Parse(g), float.Parse(b), float.Parse(a));
|
||||
NodeColor = new(Parse(r), Parse(g), Parse(b), Parse(a));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -84,10 +84,10 @@ namespace Demo.Game
|
||||
<param name=""y""></param>
|
||||
<param name=""z""></param>
|
||||
")]
|
||||
public void SetNoteRotation(string x, string y, string z)
|
||||
public void SetNodeRotation(string x, string y, string z)
|
||||
{
|
||||
IsSetupNodeRotation = true;
|
||||
this.transform.localEulerAngles = NodeRotation = new(float.Parse(x), float.Parse(y), float.Parse(z));
|
||||
this.transform.localEulerAngles = NodeRotation = new(Parse(x), Parse(y), Parse(z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace Demo.Game
|
||||
public override void SetupMeshGenerator(SplineRenderer meshGenerater)
|
||||
{
|
||||
base.SetupMeshGenerator(meshGenerater);
|
||||
meshGenerater.autoUpdate = IsAutoOrient;
|
||||
meshGenerater.autoOrient = IsAutoOrient;
|
||||
}
|
||||
|
||||
public override IEnumerator UnloadScript()
|
||||
|
||||
@@ -27,7 +27,7 @@ namespace Demo.Game
|
||||
{
|
||||
var sample = MySplineCore.MySplineComputer.Evaluate(data);
|
||||
Cache = sample.percent;
|
||||
UpdateTarget.transform.SetLocalPositionAndRotation(sample.position, sample.rotation);
|
||||
UpdateTarget.transform.SetPositionAndRotation(sample.position, sample.rotation);
|
||||
//UpdateTarget.transform.localScale = Vector3.one * sample.size;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user