void Awake() { shrink = GetComponent <Shrink>(); fade = GetComponent <Fade>(); shrink.StartShrinking(sizeToShrinkTo); }
private void LayoutRoot_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { //ChildWindow1 childWindow = new ChildWindow1(); smarttable //childWindow.Show(); if (ctxMenuCreator.PopupDisplayed) { popupMenu.Hide(); ctxMenuCreator.PopupDisplayed = false; } if (spButtons.Visibility == System.Windows.Visibility.Visible && storyboardFlag == false) { //spButtons.Visibility = System.Windows.Visibility.Collapsed; Shrink.Begin(); storyboardFlag = true; } //FrameworkElement element = e.OriginalSource as FrameworkElement; //scrollViewer.ScrollIntoView(element); //if (DGBorder.RenderTransform is ScaleTransform) //{ // if (((ScaleTransform)DGBorder.RenderTransform).ScaleX == ScaleTransforms.Half) // { // ScaleTransform st = new ScaleTransform(); // st.ScaleX = ScaleTransforms.Full; // st.ScaleY = ScaleTransforms.Full; // //st.CenterX = ((Point)e.GetPosition(null)).X; // //st.CenterY = ((Point)e.GetPosition(null)).Y; // DGBorder.RenderTransform = null; // DGBorder.RenderTransform = st; // FrameworkElement element = e.OriginalSource as FrameworkElement; // scrollViewer.ScrollIntoView(element); // } //} }
private void removeBlankPlaces() { Shrink shrinkFilter = new Shrink(Color.FromArgb(255, 255, 255)); ResizeNearestNeighbor resizeFilter = new ResizeNearestNeighbor(0, 0); Bitmap tempImage = shrinkFilter.Apply(_processedImage.Bitmap); // image dimenstoin int width = _processedImage.Width; int height = _processedImage.Height; // shrinked image dimension int tw = tempImage.Width; int th = tempImage.Height; // resize factors float fx = (float)width / (float)tw; float fy = (float)height / (float)th; if (fx > fy) { fx = fy; } // set new size of shrinked image int nw = (int)Math.Round(fx * tw); int nh = (int)Math.Round(fy * th); resizeFilter.NewWidth = nw; resizeFilter.NewHeight = nh; // resize image Bitmap tempImage2 = resizeFilter.Apply(tempImage); Image <Bgr, Byte> imageCV = new Image <Bgr, byte>(tempImage2); _processedImage = imageCV.Mat; }
public static Bitmap Shrink(Bitmap Imagem) { Shrink filter = new Shrink(); Imagem = Imagem.Clone(new Rectangle(0, 0, Imagem.Width, Imagem.Height), System.Drawing.Imaging.PixelFormat.Format24bppRgb); Imagem = filter.Apply(Imagem); return(Imagem); }
private void categories_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e) { Shrink.Stop(); TextBlock txtRef = (TextBlock)sender; Shrink.SetValue(Storyboard.TargetNameProperty, txtRef.Name); Shrink.Begin(); }
private static float Use(PowerUp.Abilities ability, Paddle paddle, bool begin, bool isServer) { // Switch of ability: switch (ability) { // If we are using the grow power up, call its respective function. case PowerUp.Abilities.Grow: if (begin) { Grow.Begin(paddle); } else { Grow.End(paddle); } return(Grow.Duration); // If we are using the shrink power up, call its respective function. case PowerUp.Abilities.Shrink: if (begin) { Shrink.Begin(paddle); } else { Shrink.End(paddle); } return(Shrink.Duration); // If we are using the confusion power up, call its respective function. case PowerUp.Abilities.Confusion: if (begin) { Confusion.Begin(paddle); } else { Confusion.End(paddle); } return(Confusion.Duration); // As ricochet is one time use, return zero as the duration and only use on begin. case PowerUp.Abilities.Ricochet: // Only run on server as this is change to the ball's velocity which the server controls. if (isServer && begin) { Ricochet.Use(); } return(0f); } return(0f); }
/// <summary> /// Crop the image's borders /// </summary> /// <param name="image">Reference to a Bitmap</param> private void Crop(ref System.Drawing.Bitmap image) { Shrink filter = new Shrink(Color.White); try { image = filter.Apply(image); } catch (Exception) { } }
public mShrinkToColor(System.Drawing.Color SelectedColor) { BitmapType = mFilter.BitmapTypes.Rgb24bpp; FilterColor = SelectedColor; Effect = new Shrink(FilterColor); Sequence.Clear(); Sequence.Add(Effect); }
public void Run(string[] args) { if (args.Length != 4) { Console.WriteLine("CRFSharpConsole -shrink [Encoded CRF model file name] [Shrinked CRF model file name] [thread num]"); return; } CRFSharpWrapper.Shrink shrink = new Shrink(); shrink.Process(args[1], args[2], int.Parse(args[3])); }
public void Shrink_CalculatesCorrectNewLocation(double[] expectedAnswer, params double[][] testValues) { var theOperator = new Shrink(0.5); var inds = Helpers.CreateFitnessAssessedIndividualsFromArray(testValues); var simplex = new Simplex(inds); var newLocation = theOperator.Operate(simplex); Assert.Equal(expectedAnswer, newLocation.Select(d => (double)d)); }
private void spButtons_MouseEnter(object sender, System.Windows.RoutedEventArgs e) { if (spButtons.Visibility == System.Windows.Visibility.Collapsed) { spButtons.Visibility = System.Windows.Visibility.Visible; Grow.Begin(); storyboardFlag = false; } else { Shrink.Begin(); storyboardFlag = true; } }
IEnumerator CreatePowerUps() { var random = new System.Random(); int randNum; while (Application.isPlaying) { if (!delay.IsDelayed) { randNum = random.Next(5); if (randNum == 0) { print("Creating powerup"); var powerUp = Instantiate(PowerUp); randNum = random.Next(5); Ability ability = null; switch (randNum) { case 0: ability = new SpeedUp(gameBall, this); break; case 1: ability = new SlowDown(gameBall, this); break; case 2: ability = new Grow(leftPaddle, rightPaddle, gameBall); break; case 3: ability = new Shrink(leftPaddle, rightPaddle, gameBall); break; case 4: ability = new ChangeDirection(gameBall); break; } var position = new Vector3((float)random.NextDouble() * 6 - 3, (float)random.NextDouble() * 6 - 3, 0); powerUp.Init(ability, position); PowerUpsOnField.Add(powerUp); powerUp.GameManager = this; } } yield return(new WaitForSeconds(1f)); } }
public override int GetHashCode() { unchecked { int hash = 19; hash = hash * 29 + Horizontal.GetHashCode(); hash = hash * 29 + Vertical.GetHashCode(); hash = hash * 29 + Wrap.GetHashCode(); hash = hash * 29 + ReadingOrder.GetHashCode(); hash = hash * 29 + TextRotation?.GetHashCode() ?? 0; hash = hash * 29 + Indent?.GetHashCode() ?? 0; hash = hash * 29 + RelativeIndent?.GetHashCode() ?? 0; hash = hash * 29 + JustifyLastLine?.GetHashCode() ?? 0; hash = hash * 29 + Shrink?.GetHashCode() ?? 0; hash = hash * 29 + MergeCell?.GetHashCode() ?? 0; return(hash); } }
private void 帮助ToolStripMenuItem_Click(object sender, EventArgs e) { Shrink shrink = new Shrink(); shrink.ExShrink(); }
private void LayoutRoot_MouseRightButtonDown(object sender, MouseButtonEventArgs e) { if (applicationViewModel.EwavDatasourceSelectedIndex < 0) //replaced 1 with 0 { ctxMenuCreator.DisplayWithOutDSSelected = true; } else { ctxMenuCreator.DisplayWithOutDSSelected = false; } Point p = e.GetSafePosition(dgCanvas); RemovePopup(); string tempGadgetName = dgCanvas.GadgetNameOnRightClick; Point contextMeneRightClickCoord = e.GetSafePosition(dgCanvas); if (contextMeneRightClickCoord.Y < 0) { return; } if (string.IsNullOrEmpty(tempGadgetName)) { popupMenu = ctxMenuCreator.CreateContextMenu("", contextMeneRightClickCoord, dgCanvas.StrataList, dgCanvas.SelectedGadget, dgCanvas, LayoutRoot, dgCanvas.Gridcells, dgCanvas.Gadgetparameters); } else { popupMenu = ctxMenuCreator.CreateContextMenu(tempGadgetName, contextMeneRightClickCoord, dgCanvas.StrataList, dgCanvas.SelectedGadget, dgCanvas, LayoutRoot, dgCanvas.Gridcells, dgCanvas.Gadgetparameters); } dgCanvas.AddChild(popupMenu, LayoutRoot); if (!ctxMenuCreator.PopupDisplayed) { ctxMenuCreator.PopupDisplayed = true; } DragCanvas.SetLeft(popupMenu, p.X); DragCanvas.SetTop(popupMenu, p.Y); popupMenu.Show(); //ScaleTransform st = new ScaleTransform(); //st.ScaleX = 2; //st.ScaleY = 2; //popupMenu.RenderTransform = st; if (dgCanvas.SelectedGadget != null) { UpdateZOrder((UIElement)dgCanvas.SelectedGadget, true); } UpdateZOrder(popupMenu, true); e.Handled = true; dgCanvas.GadgetNameOnRightClick = ""; // resetting the value to bring canvas context menu. if (DragCanvasRightMouseDownEvent != null) { DragCanvasRightMouseDownEvent(this); } if (spButtons.Visibility == System.Windows.Visibility.Visible && storyboardFlag == false) { //spButtons.Visibility = System.Windows.Visibility.Collapsed; Shrink.Begin(); storyboardFlag = true; } }
public void TypeOfT() { var shrinker = Shrink.Type <int>(); }
private void button2_Click(object sender, EventArgs e) { Shrink.No(); this.Close(); }
void JoyconMethod() { // make sure the Joycon only gets checked if attached if (joycons.Count > 0) { Joycon j = joycons [jc_ind]; // GetButtonDown checks if a button has been pressed (not held) if (canSpawnSpriteMask) { if (j.GetButtonDown(Joycon.Button.SHOULDER_2) && !isCuttingAnim) { //Debug.Log ("Shoulder button 2 pressed"); j.SetRumble(160, 320, 0.6f, 200); Shrink spriteMask = Instantiate(spriteMaskPrefab, transform.position, transform.rotation); spriteMask.playerRedController = this; numOfMasksSpawnable--; isCuttingAnim = true; audio.Play(); } } // GetButtonDown checks if a button has been released if (j.GetButtonUp(Joycon.Button.SHOULDER_2)) { //Debug.Log ("Shoulder button 2 released"); isCuttingAnim = false; } // GetButtonDown checks if a button is currently down (pressed or held) if (j.GetButton(Joycon.Button.SHOULDER_2)) { //Debug.Log ("Shoulder button 2 held"); } if (j.GetButtonDown(Joycon.Button.DPAD_DOWN)) { //Debug.Log ("Rumble"); // Rumble for 200 milliseconds, with low frequency rumble at 160 Hz and high frequency rumble at 320 Hz. For more information check: // https://github.com/dekuNukem/Nintendo_Switch_Reverse_Engineering/blob/master/rumble_data_table.md //j.SetRumble (160, 320, 0.6f, 200); // The last argument (time) in SetRumble is optional. Call it with three arguments to turn it on without telling it when to turn off. // (Useful for dynamically changing rumble values.) // Then call SetRumble(0,0,0) when you want to turn it off. } stick = j.GetStick(); // Gyro values: x, y, z axis values (in radians per second) gyro = j.GetGyro(); // Accel values: x, y, z axis values (in Gs) accel = j.GetAccel(); orientation = j.GetVector(); if (j.GetButton(Joycon.Button.DPAD_UP)) { transform.Translate(0f, moveSpeedY, 0f, Space.World); } else { } if (j.GetButton(Joycon.Button.DPAD_DOWN)) { transform.Translate(0f, -moveSpeedY, 0f, Space.World); } else { } if (j.GetButton(Joycon.Button.DPAD_LEFT)) { transform.Translate(-moveSpeedX, 0f, 0f, Space.World); } else { } if (j.GetButton(Joycon.Button.DPAD_RIGHT)) { transform.Translate(moveSpeedX, 0f, 0f, Space.World); } else { } float zOnly = orientation.eulerAngles.z; Vector3 newRot = new Vector3(gameObject.transform.localRotation.x, gameObject.transform.localRotation.y, zOnly); //gameObject.transform.eulerAngles = newRot; Quaternion targetRotation = Quaternion.Euler(newRot); transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, degreesPerSec * Time.deltaTime); //gameObject.transform.rotation = orientation; } }
private void OnCollisionEnter(Collision collision) { if (state == OpponentState.Untouched) { VRNodeMinion vrNodeMinion = collision.gameObject.GetComponent <VRNodeMinion>(); if (vrNodeMinion != null) { var sit = new HandSituation(); HandSituations.Add(sit); sit.hand = vrNodeMinion; reboundDir = sit.hand.GetForce( ).normalized; reboundMod = sit.hand.GetForce( ).magnitude / Time.deltaTime * 2.0f; // This range is about 0.0f to 4.0f. if (debug) { Debug.Log("Hit by hand reboundMod: " + reboundMod); } // Can only collide with "gloves on" if (sit.hand.glove != null && sit.hand.glove.gameObject.activeInHierarchy) { state = OpponentState.Hit; GameLord.instance.MusicLord.PlayResponseClip(transform.localPosition); SetRends(rewardMat); fx_hitHand_one.SetActive(true); OpponentLord.RegisterHit(this); // Flatten transform.localScale = new Vector3(transform.localScale.x, transform.localScale.y, 0.1f * transform.localScale.z); // Turn light rewardMat.SetColor("_EmissionColor", rewardMat.color * 0.25f * reboundMod); } else { state = OpponentState.Missed; SetRends(punishMat); timer = 0.5f; } } } else if (state == OpponentState.Passed) { // Can only damage the player once if (!damage && collision.gameObject == GameLord.instance.Player.head) { damage = true; timer = 0.5f; // Give the fx time GameLord.instance.Player.OnDamage(transform.position); } } else if (state == OpponentState.Hit) { if (debug) { Debug.Log("OnCollisionEnter: Hit by other: " + collision.gameObject.name); } if (!finished) { Shrink shrink = collision.gameObject.GetComponent <Shrink>(); if (shrink != null) { if (debug) { Debug.Log("OnCollisionEnter: Hit by Shrink"); } shrink.OnHit( ); fx_hitTrigger.SetActive(true); timer = 1.0f; // Give the fx time finished = true; } } } }