From 36b2ada16a7e207e6918eab5f7f8918998a4c936 Mon Sep 17 00:00:00 2001 From: routersys Date: Sat, 4 Jul 2026 16:25:06 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=A2=E3=83=B3=E3=82=AB=E3=83=BC=E5=BA=A7?= =?UTF-8?q?=E6=A8=99=E3=81=AE=E7=B5=B6=E5=AF=BE=E8=A8=AD=E5=AE=9A=E3=81=A8?= =?UTF-8?q?track=E5=80=8B=E6=95=B0=E6=AD=A3=E8=A6=8F=E5=8C=96=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LuaScript.Runtime/Anchor/AnchorSupport.cs | 36 +++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/LuaScript.Runtime/Anchor/AnchorSupport.cs b/LuaScript.Runtime/Anchor/AnchorSupport.cs index fc689a5..f6100e7 100644 --- a/LuaScript.Runtime/Anchor/AnchorSupport.cs +++ b/LuaScript.Runtime/Anchor/AnchorSupport.cs @@ -9,6 +9,13 @@ namespace LuaScript.Anchor public static int ClampCount(int count) => Math.Clamp(count, 0, MaxAnchors); + public static int NormalizeCount(string group, int count) + { + if (count <= 0 && string.Equals(group, TrackGroup, StringComparison.Ordinal)) + return 1; + return ClampCount(count); + } + public static void ApplyOption(string option, ref AnchorConnection connection, ref bool is3D) { switch (option) @@ -52,6 +59,35 @@ namespace LuaScript.Anchor z = 0d; } + public static ImmutableList SetPosition( + ImmutableList source, string group, int index, double x, double y, double z) + { + for (int i = 0; i < source.Count; i++) + { + var a = source[i]; + if (a.Index == index && string.Equals(a.Group, group, StringComparison.Ordinal)) + { + return source.SetItem(i, new LuaAnchorPoint + { + Group = group, + Index = index, + X = x, + Y = y, + Z = z, + }); + } + } + + return source.Add(new LuaAnchorPoint + { + Group = group, + Index = index, + X = x, + Y = y, + Z = z, + }); + } + public static ImmutableList ApplyDrag( ImmutableList source, string group, int index, double dx, double dy, double dz) {