private void TapToPlayTouchTap(object sender, GestureEventArgs e) { if (count == 0) { count++; GameScene gameScene = null; ScreenTransition transition = new CoverTransition(TimeSpan.FromMilliseconds(500), CoverTransition.EffectOptions.FromTop); transition.EaseFunction = new CubicEase() { EasingMode = EasingMode.EaseInOut }; this.loadingEntity.IsVisible = true; var animationService = WaveServices.GetService<AnimationService>(); animationService.CreatePulseAnimation(this.loadingEntity, 1000).Run(); WaveServices.TaskScheduler.CreateTask(() => { gameScene = new GameScene(); gameScene.Initialize(WaveServices.GraphicsDevice); }) .ContinueWith(() => { WaveServices.ScreenContextManager.To(new ScreenContext(gameScene), transition); }); } }
private void Multiplayer_TouchPressed(object sender, GestureEventArgs e) { ScreenContext screenContext = new ScreenContext(new GameScene()) { Name = "FromMultiplayer", }; WaveServices.ScreenContextManager.To(screenContext); }
/// <summary> /// Handles the TouchReleased event of the gestures control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GestureEventArgs" /> instance containing the event data.</param> private void Gestures_TouchReleased(object sender, GestureEventArgs e) { this.Animation.BeginAnimation(Transform2D.OpacityProperty, this.fadeIn); }
/// <summary> /// Handles the TouchReleased event of the Button control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GestureEventArgs" /> instance containing the event data.</param> private void Button_TouchReleased(object sender, GestureEventArgs e) { if (this.Click != null) { this.Click(this, e); } }
/// <summary> /// Handles the TouchReleased event of the Gestures control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GestureEventArgs" /> instance containing the event data.</param> private void Gestures_TouchReleased(object sender, GestureEventArgs e) { this.IsFocus = true; // Switch this.on = !this.on; if (this.on) { this.bulletAnimation.BeginAnimation(Transform2D.XProperty, this.animOn); this.foregroundAnimation.BeginAnimation(Transform2D.XScaleProperty, this.animOn); this.textControl.Text = this.onText; } else { this.bulletAnimation.BeginAnimation(Transform2D.XProperty, this.animOff); this.foregroundAnimation.BeginAnimation(Transform2D.XScaleProperty, this.animOff); this.textControl.Text = this.offText; } // Event if (this.Toggled != null) { this.Toggled(this, new EventArgs()); } }
/// <summary> /// Handles the TouchReleased event of the Button control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GestureEventArgs" /> instance containing the event data.</param> private void TouchGestures_TouchReleased(object sender, GestureEventArgs e) { if (!string.IsNullOrWhiteSpace(this.pressedBackgroundImage) && this.backToBackgroundImage) { this.backToBackgroundImage = false; this.ChangeBackgroundImage(this.backgroundImage); } if (this.Click != null) { this.Click(this, e); } }
void touchGestures_TouchReleased(object sender, GestureEventArgs e) { var bitmap = ((Entity)sender).FindComponent<Transform2D>(); var getPosition = Level.Get_Grid_Position((float)bitmap.X, (float)bitmap.Y); var costTower = Static.Const.Tower_Costs[((Entity)sender).Name]; var name = ((Entity)sender).Name; // ITEM1 = y for map_grid // ITEM2 = x for map_grid // ITEM3 = grid y for map_grid // ITEM4 = grid x for map_grid // Item5 = ID of Block var towerY = getPosition.Item1; var towerX = getPosition.Item2; var towerGridX = getPosition.Item4; var towerGridY = getPosition.Item3; var sprite = Static.Const.Tower_bitmap[name]; if (getPosition.Item5 == "FIELD" && (getPosition.Item1 != -1 && getPosition.Item2 != -1) && Player.Gold >= costTower) { Level.Map_Blocks[towerGridY, towerGridX].ID = "TOWER_FIELD"; Player.Gold -= costTower; // ADD TO TOWER LIST NEW TOWER !!!!!! if (name == "Tower1") TowersList.Add(new Towers_Classes.Tower_Base(towerX, towerY, BaseTowerEntity.NumChildrens,sprite)); else if (name == "Chandler_tower") TowersList.Add(new Towers_Classes.Tower_Chandler(towerX,towerY, BaseTowerEntity.NumChildrens,sprite)); BaseTowerEntity.AddChild(TowersList[TowersList.Count - 1].Tower); MoneyCounter.Text = Player.Gold.ToString(); } bitmap.XScale = 1; bitmap.YScale = 1; var tempName = ((Entity)sender).Name; var position = Static.Const.Tower_Position[tempName]; bitmap.Y = position.Item2; bitmap.X = position.Item1; }
protected void touchGestures_ResetTimer(object sender, GestureEventArgs e) { Console.WriteLine("TEST111"); AccessFunction(); WaveServices.TimerFactory.RemoveTimer("Wave_Break"); WaveServices.TimerFactory.UpdateTimer("Wave_Break", Static.Const.L_Wave_Break_Timer[ ++Static.Const.List_Counter], AccessFunction); WaveClock.Restart(); }
private void TouchGestures_TouchTap(object sender, GestureEventArgs e) { this.navComponent.DoNavigation(); }
void MyScene_TouchPressed(object sender, GestureEventArgs e) { WaveServices.ScreenLayers.AddScene<FirstScene>() .AddScene<SecondScene>() .Apply("Menu"); }
/// <summary> /// Handles the TouchReleased event of the Gestures control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GestureEventArgs" /> instance containing the event data.</param> private void Gestures_TouchReleased(object sender, GestureEventArgs e) { this.animation.BeginAnimation(Transform2D.OpacityProperty, this.fadeOut); // Stable Change event if (this.ValueChanged != null && this.oldCachedValue1 != this.value) { this.ValueChanged(this, new ChangedEventArgs(this.oldCachedValue1, this.value)); } // RealTime Change event if (this.RealTimeValueChanged != null && this.oldCachedValue2 != this.value) { this.RealTimeValueChanged(this, new ChangedEventArgs(this.oldCachedValue2, this.value)); this.oldCachedValue2 = this.value; } }
/// <summary> /// Handles the TouchPressed event of the Gestures control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GestureEventArgs" /> instance containing the event data.</param> private void Gestures_TouchPressed(object sender, GestureEventArgs e) { this.IsFocus = true; this.oldCachedValue1 = this.value; switch (this.orientation) { case Orientation.Vertical: float offsetY = e.GestureSample.Position.Y - this.bulletTransform.Rectangle.Y; this.UpdateWidthVerticalOffset(offsetY); break; case Orientation.Horizontal: float offsetX = e.GestureSample.Position.X - this.bulletTransform.Rectangle.X; this.UpdateWidthHorizontalOffset(offsetX); break; } this.animation.BeginAnimation(Transform2D.OpacityProperty, this.fadeIn); // RealTime Change event if (this.RealTimeValueChanged != null && this.oldCachedValue2 != this.value) { this.RealTimeValueChanged(this, new ChangedEventArgs(this.oldCachedValue2, this.value)); this.oldCachedValue2 = this.value; } }
/// <summary> /// Handles the TouchMoved event of the Gestures control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GestureEventArgs" /> instance containing the event data.</param> private void Gestures_TouchMoved(object sender, GestureEventArgs e) { switch (this.orientation) { case Orientation.Vertical: float offsetY = e.GestureSample.Position.Y - this.bulletTransform.Rectangle.Y; this.UpdateWidthVerticalOffset(offsetY); break; case Orientation.Horizontal: float offsetX = e.GestureSample.Position.X - this.bulletTransform.Rectangle.X; this.UpdateWidthHorizontalOffset(offsetX); break; } // RealTime Change event if (this.RealTimeValueChanged != null && this.oldCachedValue2 != this.value) { this.RealTimeValueChanged(this, new ChangedEventArgs(this.oldCachedValue2, this.value)); this.oldCachedValue2 = this.value; } }
void MyScene_TouchPressed(object sender, GestureEventArgs e) { if (e.GestureSample.IsNew) { WaveServices.ScreenLayers.AddScene<MainScene>() .Apply("Start_FromOptions"); } }
/// <summary> /// Handles the tap event on the touch gestures /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The event args.</param> private void NotifyTap(object sender, GestureEventArgs e) { this.PerformCompleted(); this.touchGestures.TouchTap -= this.NotifyTap; }
/// <summary> /// Handles the TouchReleased event of the gestures control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GestureEventArgs" /> instance containing the event data.</param> private void Gestures_TouchReleased(object sender, GestureEventArgs e) { this.IsFocus = true; if (!this.isChecked) { this.Animation.BeginAnimation(Transform2D.OpacityProperty, this.fadeIn); this.IsChecked = true; } }
private void OnTouchPressed(object sender, GestureEventArgs e) { switch (this.currentState) { case States.Paused: this.SetNewState(States.Play); break; case States.Play: this.RabbitEmitter.ApplyImpulseToLast(); break; } }
private void ActionableTouchGesturesTouchMoved(object sender, GestureEventArgs e) { if (!this.IsDisable) { Vector2 deltaTouch = this.pressedPosition - e.GestureSample.Position; deltaTouch.X = MathHelper.Clamp(deltaTouch.X, -offset, offset); deltaTouch.Y = MathHelper.Clamp(deltaTouch.Y, -offset, offset); this.thumbTransform.X = this.pressedPosition.X - deltaTouch.X; this.thumbTransform.Y = this.pressedPosition.Y - deltaTouch.Y; deltaTouch /= this.offsetLimits; this.direction = -deltaTouch; } }
void touchGestures_TouchMoved(object sender, GestureEventArgs e) { var transform2D = ((Entity)sender).FindComponent<Transform2D>(); //SCALING IMAGE transform2D.XScale = transform2D.YScale = 0.5f; //GETTING DIFFERENCE BETWEEN SCENE STARTING POINT AND BART STARTING POINT // FOR GETTING IMAGE ON MOUSE var xDifference = TowersBar.FindComponent<Transform2D>().X; var yDifference = TowersBar.FindComponent<Transform2D>().Y; transform2D.X = e.GestureSample.Position.X - xDifference; transform2D.Y = e.GestureSample.Position.Y - yDifference; }
private void ActionableTouchGesturesTouchPressed(object sender, GestureEventArgs e) { if (!this.IsDisable) { this.pressedPosition = e.GestureSample.Position; if (this.backgroundEntity != null) { this.backgroundTransform.X = this.pressedPosition.X; this.backgroundTransform.Y = this.pressedPosition.Y; this.backgroundEntity.IsVisible = true; } this.thumbTransform.X = this.pressedPosition.X; this.thumbTransform.Y = this.pressedPosition.Y; this.thumbEntity.IsVisible = true; this.IsPressed = true; this.direction = Vector2.Zero; } }
/// <summary> /// If a pressed background image is set, it draws this last one instead of background image, /// just up to the released event is catched. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GestureEventArgs" /> instance containing the event data.</param> private void TouchGestures_TouchPressed(object sender, GestureEventArgs e) { // Asking for !this.backToBackgroundImage avoids to execute the if when has been done once before if (!string.IsNullOrWhiteSpace(this.pressedBackgroundImage) && !this.backToBackgroundImage) { this.ChangeBackgroundImage(this.pressedBackgroundImage); this.backToBackgroundImage = true; } }
private void ActionableTouchGesturesTouchReleased(object sender, GestureEventArgs e) { if (this.backgroundEntity != null) { this.backgroundEntity.IsVisible = false; } this.thumbEntity.IsVisible = false; this.direction = Vector2.Zero; this.IsPressed = false; }
void MyScene_TouchPressed(object sender, GestureEventArgs e) { WaveServices.ScreenLayers.AddScene<MainScene>() .Apply("Start_FromMenu"); }
void SecondScene_TouchPressed(object sender, GestureEventArgs e) { WaveServices.ScreenLayers.AddScene<FirstScene>() .AddScene<ThirdScene>() .Apply("Options"); }
/// <summary> /// Handles the TouchReleased event of the gestures control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GestureEventArgs" /> instance containing the event data.</param> private void Gestures_TouchReleased(object sender, GestureEventArgs e) { this.IsFocus = true; if (this.isChecked) { this.Animation.BeginAnimation(Transform2D.OpacityProperty, this.fadeOut); this.isChecked = false; } else { this.Animation.BeginAnimation(Transform2D.OpacityProperty, this.fadeIn); this.isChecked = true; } if (this.CheckedChanged != null) { this.CheckedChanged(this, e); } }
/// <summary> /// Handles the TouchPressed event of the gestures control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GestureEventArgs" /> instance containing the event data.</param> private void Gestures_TouchPressed(object sender, GestureEventArgs e) { this.IsFocus = true; this.Animation.BeginAnimation(Transform2D.OpacityProperty, this.fadeOut); }
/// <summary> /// Handles the TouchPressed event of the Gestures control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="GestureEventArgs" /> instance containing the event data.</param> private void Gestures_TouchPressed(object sender, GestureEventArgs e) { this.IsFocus = true; if (this.isReadOnly) { return; } float clickX = e.GestureSample.Position.X - this.Transform.Rectangle.X; float clickY = e.GestureSample.Position.Y - this.Transform.Rectangle.Y; // Cursor position Y float posY = this.textControl.LineSpacing; int lineIndex = 0; while (lineIndex < this.textControl.LinesInfo.Count - 1 && posY + this.textControl.FontHeight < clickY) { posY += this.textControl.FontHeight + this.textControl.LineSpacing; lineIndex++; } // Cursor position X float posX = 0; if (this.textControl.LinesInfo.Count > 0) { LineInfo lineInfo = this.textControl.LinesInfo[lineIndex]; if (posY + this.textControl.FontHeight < clickY) { // Outside of textControl posX = lineInfo.AlignmentOffsetX + lineInfo.Size.X; this.textBeforeCursor = this.textControl.Text; this.textAfterCursor = string.Empty; } else { // Search X position posX = lineInfo.AlignmentOffsetX; float maxOffsetX = lineInfo.AlignmentOffsetX + lineInfo.Size.X; int characterIndex = 0; string currentLineText = lineInfo.SubTextList[0].Text; float characterOffset = this.textControl.SpriteFont.MeasureString(currentLineText[characterIndex].ToString()).X; while (posX <= maxOffsetX && posX + (characterOffset / 2) < clickX) { posX += characterOffset; if (characterIndex < currentLineText.Length - 1) { characterIndex++; characterOffset = this.textControl.SpriteFont.MeasureString(currentLineText[characterIndex].ToString()).X; } else { break; } } // Text before cursor List<LineInfo> linesInfo = this.textControl.LinesInfo; this.textBeforeCursor = string.Empty; for (int i = 0; i < lineIndex; i++) { this.textBeforeCursor += this.textControl.LinesInfo[i].SubTextList[0].Text; } this.textBeforeCursor += currentLineText.Substring(0, characterIndex); // Text After cursor this.textAfterCursor = currentLineText.Substring(characterIndex); for (int i = lineIndex + 1; i < this.textControl.LinesInfo.Count; i++) { this.textAfterCursor += this.textControl.LinesInfo[i].SubTextList[0].Text; } } } // Final positions this.cursorTransform.X = posX; this.cursorTransform.Y = posY; this.cursorAnimation.BeginAnimation(Transform2D.OpacityProperty, this.flicker); }
private void Back_TouchPressed(object sender, GestureEventArgs e) { WaveServices.TimerFactory.RemoveTimer("Init"); ScreenContext screenContext = new ScreenContext(new MenuScene()) { Name = "FromGame", }; WaveServices.ScreenContextManager.To(screenContext); }