private void Destroy(IntPtr hwnd) { // MessageBox.Show("Destroying", "hwnd " + hwnd); var process = Process.GetProcesses().Where(p => p.MainWindowHandle == hwnd).First(); Console.WriteLine("process " + process); if (process == null) { return; } var window = new HwndControl(process.MainWindowHandle, new Point(0, 0)); TweenShark.To(window, 2F, new TweenOps(Ease.OutBounce) .PropBy("X", _random.Next(100) - 50) .PropBy("Y", _random.Next(100) - 50) ); var mainPoint = new Point(window.X, window.Y); DestroyRecursive(process.MainWindowHandle, mainPoint); }
public void RegisterPropertyTweenerTest() { TweenShark.Initialize(new TweenSharkTickImpl(), new NullLogger()); var type = typeof(TweenShark); var info = type.GetField("_core", BindingFlags.NonPublic | BindingFlags.Static); var core = (TweenSharkCore)info.GetValue(null); // the core must be created Assert.IsInstanceOfType(core, typeof(TweenSharkCore)); var param0 = new PrivateObject(core); var accessor = new TweenSharkCore_Accessor(param0); var beforeCount = accessor._registeredPropertyTweeners.Count; // if we overwrite an existing type the number of registered tweeners must not change TweenShark.RegisterPropertyTweener(typeof(SimpleTweenerImpl <SByte>), typeof(SByte)); Assert.AreEqual(beforeCount, accessor._registeredPropertyTweeners.Count); // the tweener for sbyte must be overwritten Assert.AreEqual(accessor._registeredPropertyTweeners[typeof(SByte).FullName], typeof(SimpleTweenerImpl <SByte>)); // if we overwrite an existing type the number of registered tweeners must change TweenShark.RegisterPropertyTweener(typeof(SimpleTweenerImpl <SByte>), typeof(TweeningTestObject)); Assert.AreEqual(beforeCount + 1, accessor._registeredPropertyTweeners.Count); // the tweener for sbyte must be overwritten Assert.AreEqual(accessor._registeredPropertyTweeners[typeof(TweeningTestObject).FullName], typeof(SimpleTweenerImpl <SByte>)); }
public void RunningTweenSharkConstructorTest() { TweenShark tweenShark = null; // TODO: Passenden Wert initialisieren RunningTweenShark target = new RunningTweenShark(tweenShark); Assert.Inconclusive("TODO: Code zum Überprüfen des Ziels implementieren"); }
public void InitializeTest() { TweenShark.Initialize(new TweenSharkTickImpl(), new NullLogger()); var type = typeof(TweenShark); var info = type.GetField("_core", BindingFlags.NonPublic | BindingFlags.Static); var core = (TweenSharkCore)info.GetValue(null); // the core must be created Assert.IsInstanceOfType(core, typeof(TweenSharkCore)); var param0 = new PrivateObject(core); var accessor = new TweenSharkCore_Accessor(param0); // the standard property tweeners must be registered Assert.AreEqual(10, accessor._registeredPropertyTweeners.Count); // check that all tweeners are registerd correctly Assert.AreEqual(accessor._registeredPropertyTweeners[typeof(SByte).FullName], typeof(SignedByteTweener)); Assert.AreEqual(accessor._registeredPropertyTweeners[typeof(Int16).FullName], typeof(SignedInt16Tweener)); Assert.AreEqual(accessor._registeredPropertyTweeners[typeof(Int32).FullName], typeof(SignedInt32Tweener)); Assert.AreEqual(accessor._registeredPropertyTweeners[typeof(Int64).FullName], typeof(SignedInt64Tweener)); Assert.AreEqual(accessor._registeredPropertyTweeners[typeof(Byte).FullName], typeof(UnsignedByteTweener)); Assert.AreEqual(accessor._registeredPropertyTweeners[typeof(UInt16).FullName], typeof(UnsignedInt16Tweener)); Assert.AreEqual(accessor._registeredPropertyTweeners[typeof(UInt32).FullName], typeof(UnsignedInt32Tweener)); Assert.AreEqual(accessor._registeredPropertyTweeners[typeof(UInt64).FullName], typeof(UnsignedInt64Tweener)); Assert.AreEqual(accessor._registeredPropertyTweeners[typeof(Single).FullName], typeof(FloatTweener)); Assert.AreEqual(accessor._registeredPropertyTweeners[typeof(Double).FullName], typeof(DoubleTweener)); }
private void SpinCubeAroundX() { TweenShark.To(_cube.transform, 10, new TweenOps(GetSelectedEasingFunction()) .UV3CompBy("localEulerAngles", 600, V3Compnent.Right) .OnUpdate(t => Debug.Log("x: " + _cube.transform.localEulerAngles.x)) ); }
private void TweenButton() { TweenShark.To(_btn, 5, new TweenOps(Ease.InOutQuart) .Prop(new PropertyOps("X", 500, false).Ease(Ease.Linear)) .Prop(new PropertyOps("Y", 500, false).Ease(Ease.OutQuint)) ); }
public Form1() { InitializeComponent(); TweenShark.Initialize(new TweenSharkWinformsTick(), new ConsoleLogger()); TweenShark.RegisterPropertyTweener(typeof(ColorTweener), typeof(Color)); Deactivate += (sender, e) => Destroy(GetForegroundWindow()); this.Click += (sender, e) => { }; // this.BackgroundImage = Resources.background; // // this.FormBorderStyle = FormBorderStyle.None; // this.TransparencyKey = Color.FromArgb(255, 0, 255); button1.MouseEnter += HandleButtonMouseEnter; button1.MouseLeave += HandleButtonMouseLeave; button2.MouseEnter += HandleButtonMouseEnter; button2.MouseLeave += HandleButtonMouseLeave; }
public void EmitOnUpdateTest() { TweenShark tweenShark = null; // TODO: Passenden Wert initialisieren RunningTweenShark target = new RunningTweenShark(tweenShark); // TODO: Passenden Wert initialisieren target.EmitOnUpdate(); Assert.Inconclusive("Eine Methode, die keinen Wert zurückgibt, kann nicht überprüft werden."); }
public void ProgressTest() { TweenShark tweenShark = null; // TODO: Passenden Wert initialisieren RunningTweenShark target = new RunningTweenShark(tweenShark); // TODO: Passenden Wert initialisieren float actual; actual = target.Progress; Assert.Inconclusive("Überprüfen Sie die Richtigkeit dieser Testmethode."); }
private void SpinWasher(ComponentEvent e) { var dichWasher = GetDishWasher(); TweenShark.To(dichWasher.transform, 10, new TweenOps(Ease.InOutQuad) .UV3CompTo("localEulerAngles", 27000, V3Compnent.Up) ); }
private void HandleButtonMouseEnter(object sender, EventArgs e) { var b = (Button)sender; TweenShark.To(b, 0.2F, new TweenOps(Ease.OutQuad) // .PropTo("Left", b.Left < 100 ? 200 : 50) .PropTo("BackColor", Color.FromArgb(200, 255, 0, 0)) ); }
private void SpinCubeAroundZ() { TweenShark.To(_cube, 10, new TweenOps(GetSelectedEasingFunction()) .URotateTo(1200, V3Compnent.Forward) .OnStart(t => Debug.Log("OnStart Progress = " + t.Progress)) .OnUpdate(t => _progressTextField.Text = "Progress: " + t.Progress) .OnComplete(t => Debug.Log("OnComplete Progress = " + t.Progress)) ); }
private void TweenMaterial() { TweenShark.To(_cube, GetTweenDuration(), new TweenOps(GetSelectedEasingFunction()) .UFadeMaterials(new Material[] { _cube.renderer.materials[1], _cube.renderer.materials[2] }) ); }
private void HandleButtonMouseLeave(object sender, EventArgs e) { var b = (Button)sender; // b.BackColor = null; TweenShark.To(b, 0.2F, new TweenOps(Ease.OutQuad) .PropTo("BackColor", Color.FromArgb(0, 255, 255, 255)) ); //b.BackColor = Color.FromArgb() }
public void AddTweenSharkTest() { Assert.Inconclusive("needs to be rewritten to prevent runtime errors"); var obj = new TweeningTestObject(); var registeredPropertyTweens = new Dictionary <string, Type>(); registeredPropertyTweens.Add(typeof(SByte).FullName, typeof(SignedByteTweener)); var target = new TweenedObject(obj, registeredPropertyTweens); var param0 = new PrivateObject(target); var accessor = new TweenedObject_Accessor(param0); var tweenShark = new TweenShark(obj, 1, new TweenOps().PropTo("DoubleValue", 100).PropTo("FloatValue", 101)); target.AddTweenShark(tweenShark); // check for count of tweens and tweened properties Assert.AreEqual(1, accessor._tweens.Count); Assert.AreEqual(2, accessor._propertyTweens.Count); // check for target values Assert.AreEqual(100, ((DoubleTweener)(accessor._propertyTweens["DoubleValue"])).GetTargetValue()); Assert.AreEqual(101, ((FloatTweener)(accessor._propertyTweens["FloatValue"])).GetTargetValue()); // when adding a tween on another object the number of tweens must not change, because we do not add the tween tweenShark = new TweenShark(new TweeningTestObject(), 1, new TweenOps()); target.AddTweenShark(tweenShark); // check for count of tweens and tweened properties Assert.AreEqual(1, accessor._tweens.Count); Assert.AreEqual(2, accessor._propertyTweens.Count); // when adding a tween on the correct object but with another property the numbers must change tweenShark = new TweenShark(obj, 1, new TweenOps().PropTo("IntValue", 102)); target.AddTweenShark(tweenShark); // check for count of tweens and tweened properties Assert.AreEqual(2, accessor._tweens.Count); Assert.AreEqual(3, accessor._propertyTweens.Count); // check for target values Assert.AreEqual(100, ((DoubleTweener)(accessor._propertyTweens["DoubleValue"])).GetTargetValue()); Assert.AreEqual(101, ((FloatTweener)(accessor._propertyTweens["FloatValue"])).GetTargetValue()); Assert.AreEqual(102, ((SignedInt32Tweener)(accessor._propertyTweens["IntValue"])).GetTargetValue()); // but when we now add another tween that overrides tweened properties, only the number of tweens may change tweenShark = new TweenShark(obj, 1, new TweenOps().PropTo("DoubleValue", 200).PropTo("FloatValue", 201).PropTo("IntValue", 202)); target.AddTweenShark(tweenShark); // check for count of tweens and tweened properties Assert.AreEqual(3, accessor._tweens.Count); Assert.AreEqual(3, accessor._propertyTweens.Count); // check for target values Assert.AreEqual(200, ((DoubleTweener)(accessor._propertyTweens["DoubleValue"])).GetTargetValue()); Assert.AreEqual(201, ((FloatTweener)(accessor._propertyTweens["FloatValue"])).GetTargetValue()); Assert.AreEqual(202, ((SignedInt32Tweener)(accessor._propertyTweens["IntValue"])).GetTargetValue()); }
private void button1_Click(object sender, EventArgs e) { var b = (Button)sender; //b. // TweenShark.To(this, 1, new TweenOps().PropBy("Counter", 100)); TweenShark.To(this, 1, new TweenOps(Ease.InOutQuint) .PropTo("Left", Left < 100 ? 1000 : 0) //Screen.FromControl(this).WorkingArea.Width - Width : 0) .OnUpdate(tween => Counter = Left) ); }
public void GetTweenSharkTest() { TweenShark tweenShark = null; // TODO: Passenden Wert initialisieren RunningTweenShark target = new RunningTweenShark(tweenShark); // TODO: Passenden Wert initialisieren TweenShark expected = null; // TODO: Passenden Wert initialisieren TweenShark actual; actual = target.GetTweenShark(); Assert.AreEqual(expected, actual); Assert.Inconclusive("Überprüfen Sie die Richtigkeit dieser Testmethode."); }
public void TweenSharkConstructorTest() { var obj = new TweeningTestObject(); const float duration = 1F; var tweenOps = new TweenOps(); var tweenShark = new TweenShark(obj, duration, tweenOps); Assert.AreSame(obj, tweenShark.Obj); Assert.AreEqual(duration, tweenShark.Duration); Assert.AreSame(tweenOps, tweenShark.TweenOps); }
public void TickTest() { TweenShark tweenShark = null; // TODO: Passenden Wert initialisieren RunningTweenShark target = new RunningTweenShark(tweenShark); // TODO: Passenden Wert initialisieren long currentTicks = 0; // TODO: Passenden Wert initialisieren bool expected = false; // TODO: Passenden Wert initialisieren bool actual; actual = target.Tick(currentTicks); Assert.AreEqual(expected, actual); Assert.Inconclusive("Überprüfen Sie die Richtigkeit dieser Testmethode."); }
public void RemoveTest() { TweenShark tweenShark = null; // TODO: Passenden Wert initialisieren RunningTweenShark target = new RunningTweenShark(tweenShark); // TODO: Passenden Wert initialisieren ITweenSharkTweener tweener = null; // TODO: Passenden Wert initialisieren bool expected = false; // TODO: Passenden Wert initialisieren bool actual; actual = target.Remove(tweener); Assert.AreEqual(expected, actual); Assert.Inconclusive("Überprüfen Sie die Richtigkeit dieser Testmethode."); }
public void ToTest() { object obj = null; // TODO: Passenden Wert initialisieren float duration = 0F; // TODO: Passenden Wert initialisieren TweenOps tweenOps = null; // TODO: Passenden Wert initialisieren TweenShark expected = null; // TODO: Passenden Wert initialisieren TweenShark actual; actual = TweenShark.To(obj, duration, tweenOps); Assert.AreEqual(expected, actual); Assert.Inconclusive("Überprüfen Sie die Richtigkeit dieser Testmethode."); }
public RunningTweenShark(TweenShark tweenShark) { _tweenShark = tweenShark; _tweenOps = tweenShark.TweenOps; StartTicks = DateTime.Now.Ticks; DurationTicks = (uint)(1000 * 10000 * tweenShark.Duration); _deltaTicks = 0; _onStart = _tweenOps.OnStartCallback; _onUpdate = _tweenOps.OnUpdateCallback; _onComplete = _tweenOps.OnCompleteCallback; }
private void BringCubeTo(GameObject go, float forward, float right, float up, bool autoResume) { if (_tweenerSelection.Selected == 1) { iTween.Init(go); iTween.MoveTo(go, iTween.Hash( "x", right, "y", up, "z", forward, "Time", GetTweenDuration(), "onComplete", (Action <object>)((obj) => { if (autoResume) { BringCubeTo(go, (random.Next(700) - 350) / 100.0f, (random.Next(700) - 350) / 100.0f, (random.Next(500) - 250) / 100.0f, true) ; } }) ) ); } else { var ts = TweenShark.To(go, GetTweenDuration(), new TweenOps(GetSelectedEasingFunction()) // var ts = TweenShark.To(go, GetTweenDuration(), new TweenOps(EaseEx.InElastic, new object[] {0.1f, 0.5f}) .UMoveTo(new Vector3(right, up, forward)) // .UColorTo(new Color(random.Next(100) / 100.0f, random.Next(100) / 100.0f, random.Next(100) / 100.0f, random.Next(100) / 100.0f)) .OnComplete((obj) => { if (autoResume) { BringCubeTo(go, (random.Next(700) - 350) / 100.0f, (random.Next(700) - 350) / 100.0f, (random.Next(500) - 250) / 100.0f, true) ; } }) ); } }
private TweenSharkCore SetupCoreWithTweens() { var core = new TweenSharkCore(new TweenSharkTickImpl()); core.RegisterPropertyTweener(typeof(DoubleTweener), typeof(Double)); core.RegisterPropertyTweener(typeof(FloatTweener), typeof(Single)); // short tweens (one second) var duration = 1; var to = new TweeningTestObject { DoubleValue = 100, FloatValue = 100 }; var tween = new TweenShark(to, duration, new TweenOps().PropTo("DoubleValue", 200)); core.To(tween); tween = new TweenShark(to, duration, new TweenOps().PropTo("FloatValue", 200)); core.To(tween); // medium duration tweens (3 seconds) duration = 3; to = new TweeningTestObject { DoubleValue = 100 }; tween = new TweenShark(to, duration, new TweenOps().PropTo("DoubleValue", 200)); core.To(tween); tween = new TweenShark(to, duration, new TweenOps().PropTo("FloatValue", 200)); core.To(tween); // medium duration tweens (5 seconds) duration = 5; to = new TweeningTestObject { DoubleValue = 100 }; tween = new TweenShark(to, duration, new TweenOps().PropTo("DoubleValue", 200)); core.To(tween); tween = new TweenShark(to, duration, new TweenOps().PropTo("FloatValue", 200)); core.To(tween); return(core); }
private void DestroyRecursive(IntPtr hwnd, Point mainPoint, int level = 0, int maxLevel = 3) { IntPtr child = IntPtr.Zero; do { child = FindWindowEx(hwnd, child, null, null); if (child != IntPtr.Zero) { TweenShark.To(new HwndControl(child, mainPoint), 2F, new TweenOps(Ease.OutQuint) .PropBy("X", _random.Next(100) - 50) .PropBy("Y", _random.Next(100) - 50) ); if (level < maxLevel) { DestroyRecursive(child, mainPoint, level + 1, maxLevel); } } } while (child != IntPtr.Zero); }
private void OpenClose(ComponentEvent e) { var dichWasher = GetDishWasher(); var klappe = GetDishWasherKlappe(); if (klappe != null && dichWasher != null) { Debug.Log("local euler: " + klappe.transform.localEulerAngles); Debug.Log("abs euler: " + klappe.transform.eulerAngles); Debug.Log("local rotation: " + klappe.transform.localRotation); Debug.Log("rotation: " + klappe.transform.rotation); if (klappe.transform.localEulerAngles.x <= 10) { TweenShark.To(klappe.transform, 2, new TweenOps(Ease.InOutQuad) .UV3CompTo("localEulerAngles", -90, V3Compnent.Right) ); TweenShark.To(dichWasher.transform, 2, new TweenOps(Ease.OutQuad) .UV3CompTo("position", 5, V3Compnent.Up) ); } else { TweenShark.To(klappe.transform, 2, new TweenOps(Ease.InOutQuad) .UV3CompTo("localEulerAngles", 360, V3Compnent.Right) ); TweenShark.To(dichWasher.transform, 2, new TweenOps(Ease.InQuad) .UV3CompTo("position", 0, V3Compnent.Up) ); } } }
public void To(TweenShark tweenShark) { if (tweenShark.Obj == null) { TweenShark.Logger.Error("given object is null!"); return; } TweenedObject tweenedObject; if (!_objects.TryGetValue(tweenShark.Obj, out tweenedObject)) { tweenedObject = new TweenedObject(tweenShark.Obj, _registeredPropertyTweeners); _objectsTweenedObjects.Add(tweenedObject); _objects[tweenShark.Obj] = tweenedObject; } // TODO: clone the tweenShark given or make some other class containing all the tweeners //- für die interne Verarbeitung brauchen wir Kopien der Tweens // -> so kann der User seine TweenShark instanzen aufheben und wieder benutzen // -> ohne die Kopie bekommt der Nutzer aus seiner Instanz die einzelnen Tweener rausgelöscht, wenn es zu einen overwrite kommt tweenedObject.AddTweenShark(tweenShark); }
public HBoxLayout() { SetPadding(5, 5, 5, 5); AddChild( new Label(200, 122, "VBox with background and automatic vertical positioning of elements and padding of 5,5,5,5") ); AddChild( new Label(100, 22, "Top Align").SetVAlign(VerticalAlign.Top) .SetX(170).SetY(40) // setting of x and y does not do anything in a vbox ); AddChild( new Label(100, 22, "Middle Align").SetVAlign(VerticalAlign.Middle) .SetX(170).SetY(40) // setting of x and y does not do anything in a vbox ); AddChild( new Label(100, 22, "Bottom Align").SetVAlign(VerticalAlign.Bottom) .SetX(170).SetY(40) // setting of x and y does not do anything in a vbox ); AddChild( new Button(100, 22, "Pad 0") .OnClick( e => TweenShark.To(this, 1, new TweenOps(Ease.OutQuad).PropTo("Padding", 0)) ) ); AddChild( new Button(100, 22, "Pad 20") .OnClick( e => TweenShark.To(this, 1, new TweenOps(Ease.OutQuad).PropTo("Padding", 20)) ) ); AddChild( new Button(100, 22, "Pad 100") .OnClick( e => TweenShark.To(this, 1, new TweenOps(Ease.OutQuad).PropTo("Padding", 100)) ) ); AddHSpacer(10); AddChild( new Button(100, 22, "Space 0") .OnClick( e => TweenShark.To(this, 1, new TweenOps(Ease.OutQuad).PropTo("Spacing", 0)) ) ); AddChild( new Button(100, 22, "Space 10") .OnClick( e => TweenShark.To(this, 1, new TweenOps(Ease.OutQuad).PropTo("Spacing", 10)) ) ); AddChild( new Button(100, 22, "Space 20") .OnClick( e => TweenShark.To(this, 1, new TweenOps(Ease.OutQuad).PropTo("Spacing", 20)) ) ); }
public VBox100Layout() { // 100% width SetPercentualWidth(1f); SetPadding(5, 5, 5, 5); AddChild( new Label(400, 22, "VBox with 100% width and padding of 5,5,5,5") ); AddChild( new Button(150, 22, "Button at x=50") .SetX(50).SetY(30) // setting of y does not do anything in a vbox ); AddChild( new Button(150, 22, "Button at x=100") .SetX(100).SetY(30) // setting of y does not do anything in a vbox ); AddChild( new Button(150, 22, "Button at x=150") .SetX(150).SetY(30) // setting of y does not do anything in a vbox ); AddChild( new Label(100, 22, "Left Align").SetHAlign(HorizontalAlign.Left) .SetX(170).SetY(40) // setting of y does not do anything in a vbox ); AddChild( new Label(100, 22, "Center Align").SetHAlign(HorizontalAlign.Center) .SetX(170).SetY(40) // setting of y does not do anything in a vbox ); AddChild( new Label(100, 22, "Right Align").SetHAlign(HorizontalAlign.Right) .SetX(170).SetY(40) // setting of y does not do anything in a vbox ); AddChild( new Label(100, 22, "100% width").SetPercentualWidth(1) ); AddChild( new Button(200, 22, "Set Padding to 0") .OnClick( e => TweenShark.To(this, 1, new TweenOps(Ease.OutQuad).PropTo("Padding", 0)) ) ); AddChild( new Button(200, 22, "Set Padding to 20") .OnClick( e => TweenShark.To(this, 1, new TweenOps(Ease.OutQuad).PropTo("Padding", 20)) ) ); AddChild( new Button(200, 22, "Set Padding to 100") .OnClick( e => TweenShark.To(this, 1, new TweenOps(Ease.OutQuad).PropTo("Padding", 100)) ) ); AddVSpacer(10); AddChild( new Button(200, 22, "Set Spacing to 0") .OnClick( e => TweenShark.To(this, 1, new TweenOps(Ease.OutQuad).PropTo("Spacing", 0)) ) ); AddChild( new Button(200, 22, "Set Spacing to 10") .OnClick( e => TweenShark.To(this, 1, new TweenOps(Ease.OutQuad).PropTo("Spacing", 10)) ) ); AddChild( new Button(200, 22, "Set Spacing to 20") .OnClick( e => TweenShark.To(this, 1, new TweenOps(Ease.OutQuad).PropTo("Spacing", 20)) ) ); }
private void BringCubeVertical(float up) { TweenShark.To(_cube.transform, GetTweenDuration(), new TweenOps(GetSelectedEasingFunction()) .UV3CompBy("position", up, V3Compnent.Up) ); }