static void Main(string[] args) { List <FileVersionInfo> filelist = new List <FileVersionInfo>(); foreach (var file in Directory.GetFiles(args[0])) { if (Path.GetExtension(file) == ".exe" || Path.GetExtension(file) == ".dll") { filelist.Add(new FileVersionInfo { Name = Path.GetFileName(file), Md5 = FileMd5.GetMD5HashFromFile(PathTransform.LocalFullPath(file)), }); } } // to json var filename = (args.Length < 2 || string.IsNullOrEmpty(args[1])) ? "./publish.json" : args[1]; using (var fs = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite)) { using (var sr = new StreamWriter(fs)) { sr.Write(JsonConvert.SerializeObject(filelist)); } } }
public void Update(IAnimationCurve curve, PathTransform transform, SpawnedObject spawned) { // Normal linear transforms transform.Rotation = Quaternion.Slerp(Origin.transform.rotation, Target.transform.rotation, curve.Value); transform.Scale = Vector3.Lerp(Origin.transform.localScale, Target.transform.localScale, curve.Value); // Find new position by speed var direction = (Target.transform.position - spawned.GameObject.transform.position).normalized; var delta = Speed * curve.Delta * direction; var output = spawned.GameObject.transform.position + delta; // Force position to be on the correct path var correctGap = (Target.transform.position - Origin.transform.position); var correctDirection = correctGap.normalized; var step = (output - Origin.transform.position).magnitude; // If the movement moves past the target, halt at target if (step > correctGap.magnitude) { step = correctGap.magnitude; transform.Active = false; } // Save output output = Origin.transform.position + step * correctDirection; transform.Position = output; }
public void test_arc_height() { var transform = new PathTransform(); var instance = fixture(); var spawned = new SpawnedObject() { GameObject = mobile }; target.transform.position = new Vector3(0f, 0f, 10f); curve.elapsed = 0f; instance.Update(curve, transform, spawned); Assert(transform.position == new Vector3(0f, 0f, 0f)); curve.elapsed = 2.5f; curve.Delta = 2.5f; instance.Update(curve, transform, spawned); Assert((transform.position - new Vector3(0f, 7.071068f, 2.5f)).magnitude < 0.001f); curve.elapsed = 5f; curve.Delta = 5f; instance.Update(curve, transform, spawned); Assert(transform.position == new Vector3(0f, 10f, 5f)); curve.elapsed = 10.0f; curve.Delta = 10.0f; // We never apply to the gameObject, so it doesn't step instance.Update(curve, transform, spawned); Assert((transform.position - new Vector3(0f, 0f, 10f)).magnitude < 0.001f); this.TearDown(); }
private List <FileVersionInfo> GetLocalFileVersionInfo() { var filelist = new List <string> { "CozyLauncher.exe", "CozyLauncher.Core.dll", "CozyLauncher.Infrastructure.dll", "CozyLauncher.PluginBase.dll", "NHotkey.dll", "NHotkey.Wpf.dll", "Newtonsoft.Json.dll", "YAMP.dll", "System.Windows.Interactivity.dll", "CozyLauncher.Plugin.Core.dll", "CozyLauncher.Plugin.Program.dll", "CozyLauncher.Plugin.Dirctory.dll", "CozyLauncher.Plugin.ManualRun.dll", "CozyLauncher.Plugin.WebSearch.dll", "CozyLauncher.Plugin.Ip.dll", "CozyLauncher.Plugin.Sys.dll", "CozyLauncher.Plugin.Calculator.dll", "CozyLauncher.Plugin.MouseClick.dll", }; return(filelist.Select(x => new FileVersionInfo { Name = x, Md5 = FileMd5.GetMD5HashFromFile((PathTransform.LocalFullPath(Path.Combine("..\\", x)))), }).ToList()); }
public void Transform(PathTransform p) { for (int i = 0; i < points.Count; i++) { points[i] *= p.Scale; points[i] += p.Translation; points[i] = MotionHelper.Rotate(points[i], p.Rotation, p.RotationOrigin); } }
public void Update() { try { Process.Start(PathTransform.LocalFullPath(@"update/CozyLauncher.Tool.Update.exe")); } catch (Exception) { } }
public void Update(IAnimationCurve curve, PathTransform transform, SpawnedObject origin) { var distance = (Target.transform.position - origin.GameObject.transform.position).magnitude; if (distance < Offset) { var total = 1f - (distance - Offset) / Offset; byte alpha = (byte) (255 - (byte) Math.Ceiling(255 * total)); alpha = transform.Active ? alpha : (byte) 255; transform.Color = new Color32(Color.r, Color.g, Color.b, alpha); } }
public void Run(CardCollect cc) { CozyLuaCore lua = new CozyLuaCore(); lua.LoadCLRPackage(); lua.DoString("import ('CozyPoker.Engine', 'CozyPoker.Engine.Model')"); lua.DoString("import ('CozyPoker.Engine', 'CozyPoker.Engine.Util')"); lua.DoFile(PathTransform.LuaScript(script_)); var f = lua.GetFunction("shuffle"); f.Call(cc); }
public CardCollect Run(CardCollect cc) { CozyLuaCore lua = new CozyLuaCore(); lua.LoadCLRPackage(); lua.DoString("import ('CozyPoker.Engine', 'CozyPoker.Engine.Model')"); lua.DoString("import ('CozyPoker.Engine', 'CozyPoker.Engine.Util')"); lua.DoFile(PathTransform.LuaScript(script_)); var f = lua.GetFunction("deal"); return((CardCollect)f.Call(cc).First()); }
public void Update(IAnimationCurve curve, PathTransform transform, SpawnedObject origin) { var distance = (Target.transform.position - origin.GameObject.transform.position).magnitude; if (distance < Offset) { var total = 1f - (distance - Offset) / Offset; byte alpha = (byte)(255 - (byte)Math.Ceiling(255 * total)); alpha = transform.Active ? alpha : (byte)255; transform.Color = new Color32(Color.r, Color.g, Color.b, alpha); } }
public void Update(IAnimationCurve curve, PathTransform transform, SpawnedObject target) { var delta = (target.GameObject.transform.position - target.Origin.Position).magnitude; if (Distance > 0) { if (delta <= Distance) { var total = delta / Distance; byte alpha = (byte) Math.Ceiling(255 * total); transform.Color.a = alpha; } } }
public void Update(IAnimationCurve curve, PathTransform transform, SpawnedObject target) { if (curve.Value > Offset) { var total = 1.0f - Offset; if (total >= 0) { var value = (curve.Value - Offset) / total; byte alpha = (byte) (255 - (byte) Math.Ceiling(255 * value)); alpha = transform.Active ? alpha : (byte) 255; transform.Color.a = alpha; } } }
public void Update(IAnimationCurve curve, PathTransform transform, SpawnedObject target) { var delta = (target.GameObject.transform.position - target.Origin.Position).magnitude; if (Distance > 0) { if (delta <= Distance) { var total = delta / Distance; byte alpha = (byte)Math.Ceiling(255 * total); transform.Color.a = alpha; } } }
public void Update(IAnimationCurve curve, PathTransform transform, SpawnedObject target) { if (curve.Value > Offset) { var total = 1.0f - Offset; if (total >= 0) { var value = (curve.Value - Offset) / total; byte alpha = (byte)(255 - (byte)Math.Ceiling(255 * value)); alpha = transform.Active ? alpha : (byte)255; transform.Color.a = alpha; } } }
public virtual bool Init(string script) { lua.InitEnvironment(); lua.DoFile(PathTransform.LuaScript(script)); var methods = lua.GetTable("methods"); for (var em = methods.GetEnumerator(); em.MoveNext();) { var funcName = (string)em.Value; mapMethod.Add(funcName, lua.GetFunction(funcName)); } return(true); }
virtual public bool Init(string script) { CozyLuaCore lua = new CozyLuaCore(); lua.DoFile(PathTransform.LuaScript(script)); mapMethod = new Dictionary <string, string>(); var methods = lua.GetTable("methods"); var em = methods.GetEnumerator(); while (em.MoveNext()) { mapMethod.Add((string)em.Key, (string)em.Value); } return(true); }
public CardCollect Run() { CozyLuaCore lua = new CozyLuaCore(); lua.LoadCLRPackage(); lua.DoString("import ('CozyPoker.Engine', 'CozyPoker.Engine.Model')"); lua.DoString("import ('CozyPoker.Engine', 'CozyPoker.Engine.Util')"); lua.DoFile(PathTransform.LuaScript(script_)); //lua.DoString(@" import ('CozyPoker.Engine', 'CozyPoker.Engine.Model')"); //lua.DoString(@" // cc = CardCollect() // c = Card(1,1) // cc:Add(c)"); return((CardCollect)lua["cc"]); }
public void Update(IAnimationCurve curve, PathTransform transform, SpawnedObject spawned) { // Normal linear transforms transform.Scale = Vector3.Lerp(Origin.transform.localScale, Target.transform.localScale, curve.Value); // Find new position by speed var direction = (Target.transform.position - spawned.GameObject.transform.position).normalized; var delta = Speed * curve.Delta * direction; var output = spawned.GameObject.transform.position + delta; if (Math.Abs(direction.magnitude) < DirectionTolerance) { transform.Active = false; return; } // Force position to be on the correct path var correctDirection = (Origin.transform.position - Target.transform.position).normalized; var offset = output - spawned.Origin.Position; var pathLength = (correctDirection * Vector3.Dot(offset, correctDirection) / correctDirection.magnitude); var projected = Origin.transform.position + pathLength; // Distance from here to origin var left = (projected - Target.transform.position).magnitude; var total = (spawned.Origin.Position - Target.transform.position).magnitude; var increment = 1f - left / total; // Apply arc // NB. f(x) -> (x, sin(x)) ie. f'(x) -> (1, cos(x)) var currentHeight = Mathf.Sin(increment * 180f * Mathf.Deg2Rad) * this.Height; var right = Vector3.Cross(Up, direction); var tangentDirection = Mathf.Cos(increment * 180f * Mathf.Deg2Rad) * Up - correctDirection; var normal = Vector3.Cross(right, -tangentDirection); transform.Rotation = Quaternion.LookRotation(tangentDirection, normal); transform.Position = projected + Up * currentHeight; spawned.Origin.Position = Origin.transform.position; // Halt? if ((transform.Position - Target.transform.position).magnitude < ArcFixedPath.CutoffDistance) { transform.Active = false; } }
public static FollowerPackage GetFollowerPackages() { var name = @"Data/FollowerPackage"; var result = new FollowerPackage(); int i = 1; while (File.Exists(PathTransform.LuaScript(name + i))) { var lua = new CozyLua.Core.CozyLuaCore(); lua.InitEnvironment(); lua.DoFile(PathTransform.LuaScript(name + i)); var retVal = (FollowerPackage)lua.GetFunction("GetFollowerPackage").Call()[0]; result.Followers.AddRange(retVal.Followers); ++i; } return(result); }
public void test_fixed_path_with_moving_target() { var transform = new PathTransform(); var instance = fixture(); var spawned = new SpawnedObject() { GameObject = mobile }; target.transform.position = new Vector3(0f, 0f, 10f); curve.elapsed = 0f; instance.Update(curve, transform, spawned); Assert(transform.position == new Vector3(0f, 0f, 0f)); curve.elapsed = 5f; curve.Delta = 5f; instance.Update(curve, transform, spawned); Assert(transform.position == new Vector3(0f, 0f, 5f)); this.TearDown(); }
public void Update(IAnimationCurve curve, PathTransform transform, SpawnedObject spawned) { transform.Position = Vector3.Lerp(Origin.transform.position, Target.transform.position, curve.Value); transform.Rotation = Quaternion.Slerp(Origin.transform.rotation, Target.transform.rotation, curve.Value); transform.Scale = Vector3.Lerp(Origin.transform.localScale, Target.transform.localScale, curve.Value); }
public static void InitEnvironment(this CozyLuaCore lua) { lua.LoadCLRPackage(); lua.DoFile(PathTransform.LuaScript("init")); }
public Path(int pointCount, float startT, float endT, Func <float, float> x, Func <float, float> y, PathTransform p) { Generate(pointCount, startT, endT, x, y); Transform(p); }
public Path(int pointCount, ParametricEquations eq, PathTransform p, float a = 1, float b = 0, float c = 0) { Generate(pointCount, eq, a, b, c); Transform(p); }