/// <summary> /// Input Handling for Cursor Down event. /// </summary> private void CursorDown(object sender, CursorDownArgs e) { if ((e.Position.X > (this.Position.X + 44) && e.Position.X < (this.Position.X + 596)) && (e.Position.Y > (this.Position.Y + 44) && e.Position.Y < (this.Position.Y + 114))) { this.Touch(); } }
/// <summary> /// Handle the CursorDown event. /// </summary> private void Touch_CursorDown(object sender, CursorDownArgs e) { IRTGame game = this.Game as IRTGame; game.ParticleManager.Queue( new ParticleEffect(e.Position, 50, ParticleEffect.EffectType.Ring, 0.2f, 3.0f, Color.SteelBlue) ); //AnimationManager.Instance.QueueAnimation(AnimationManager.AnimationType.Reject, e.Position); }
/// <summary> /// Handle the CursorDown event. /// </summary> private void CursorDown(object sender, CursorDownArgs e) { if (this.ReadyToStart) { if ((e.Position.X > 39 && e.Position.X < (39 + TextureManager.Instance.Sprites.Config.Start.Width)) && (e.Position.Y > 655 && e.Position.Y < (655 + TextureManager.Instance.Sprites.Config.Start.Height))) { this.Configurated(); } } }
/// <summary> /// Handles the CursorDown event. /// </summary> /// <param name="sender">Always null.</param> /// <param name="e">Data of event.</param> private void Instance_CursorDown(object sender, CursorDownArgs e) { // Check if the touch was inside the x area of the menu. if (e.Position.X < (this.Position.X + this.UnitTexture.Width) && e.Position.X > this.Position.X) { // Check if the touch was inside the y area of the menu. if (e.Position.Y < (this.Position.Y + this.UnitTexture.Height) && e.Position.Y > this.Position.Y) { this.AttributesVisible = !this.AttributesVisible; } } }
/// <summary> /// Handles the CursorDown event. /// </summary> /// <param name="sender">Always null.</param> /// <param name="e">Data of event.</param> private void CursorDown_Handler(object sender, CursorDownArgs e) { // Handles the event only if the aim is enabled. if (this.Enabled) { // If the touch was in the area of the aim if ((e.Position.X < (this.Position.X + this.AimAlly.Width / 2) && e.Position.X > (this.Position.X - this.AimAlly.Width / 2)) && (e.Position.Y < (this.Position.Y + this.AimAlly.Height / 2) && e.Position.Y > (this.Position.Y - this.AimAlly.Height / 2))) { this.AimingField = true; } } }
/// <summary> /// Handles the CursorDown event. /// </summary> /// <param name="sender">Always null.</param> /// <param name="e">Data of event.</param> private void CursorDown_Handler(object sender, CursorDownArgs e) { // Handles the event only if the mover is enabled. if (this.Enabled) { if (this.ReadyToOrient) { // Touch was inside of the area to orient. if (Vector2.Distance(e.Position, this.Area.Position) < this.Area.Radius) { this.ReadyToOrient = false; this.Orienting = true; // Store the cursor identifier to track the CursorUpdate and CursorUp event. this.CursorIdentifier = e.Identifier; } } else { // Touch was inside of the X area of the unit. if (e.Position.X < (this.Unit.Position.X + this.Unit.Texture.Width) && e.Position.X > this.Unit.Position.X) { // Touch was inside of the Y area of the unit. if (e.Position.Y < (this.Unit.Position.Y + this.Unit.Texture.Height / 4) && e.Position.Y > this.Unit.Position.Y) { this.Moving = true; // Dispatch the Started Event. if (this.Started != null) { this.Started(); } // Store the cursor identifier to track the CursorUpdate and CursorUp event. this.CursorIdentifier = e.Identifier; } } } } }
/// <summary> /// Handles the CursorDown event. /// </summary> /// <param name="sender">Always null.</param> /// <param name="e">Data of event.</param> private void CursorDown_Handler(object sender, CursorDownArgs e) { // Handles the event only if the aim is enabled. if (this.Enabled) { // If the touch was in the area of the aim if ((e.Position.X < (this.Position.X + this.AimAlly.Width / 2) && e.Position.X > (this.Position.X - this.AimAlly.Width / 2)) && (e.Position.Y < (this.Position.Y + this.AimAlly.Height / 2) && e.Position.Y > (this.Position.Y - this.AimAlly.Height / 2))) { this.AimingField = true; // Dispatch the Started Event. if (this.Started != null) { this.Started(); } // Store the cursor identifier to track the CursorUpdate and CursorUp event. this.CursorIdentifier = e.Identifier; } } }
/// <summary> /// Handles the CursorDown event. /// </summary> /// <param name="sender">Always null.</param> /// <param name="e">Data of event</param> private void CursorDown_Handler(object sender, CursorDownArgs e) { // Test if the unit can be selected if (!this.IsDead && !this.IsSelected) { // Touch was inside of the X area of the character. if (e.Position.X < (this.Position.X + this.Texture.Width) && e.Position.X > this.Position.X) { // Touch was inside of the Y area of the character. if (e.Position.Y < (this.Position.Y + this.Texture.Height / 4) && e.Position.Y > this.Position.Y) { // Unselect the player's units. foreach (Unit unit in this.Player.Units) { unit.IsSelected = false; } this.IsSelected = true; } } } }
/// <summary> /// Input Handling for Cursor Down event. /// </summary> private void CursorDown(object sender, CursorDownArgs e) { // Touch at unit. if ((e.Position.X > this.Position.X && e.Position.X < (this.Position.X + TextureManager.Instance.Sprites.Config.UnitGreen.Width)) && (e.Position.Y > this.Position.Y && e.Position.Y < (this.Position.Y + TextureManager.Instance.Sprites.Config.UnitGreen.Height))) { this.Touch(); } // Enable attributes only if the unit is selected. else if (this.Selected) { Vector2 attributePosition = new Vector2((640 * ((int)this.Position.X / 640)) + 38, 379); // Previous character if ((e.Position.X > (attributePosition.X + 23) && e.Position.X < (attributePosition.X + 104)) && (e.Position.Y > (attributePosition.Y + 49) && e.Position.Y < (attributePosition.Y + 247))) { this.PreviousCharacter(); } // Next character else if ((e.Position.X > (attributePosition.X + 104) && e.Position.X < (attributePosition.X + 184)) && (e.Position.Y > (attributePosition.Y + 49) && e.Position.Y < (attributePosition.Y + 247))) { this.NextCharacter(); } // -5 else if (e.Position.X > (attributePosition.X + 345) && e.Position.X < (attributePosition.X + 378)) { // Strength if (e.Position.Y > (attributePosition.Y + 82) && e.Position.Y < (attributePosition.Y + 115)) { this.ChangeStrength(-5); } // Agility else if (e.Position.Y > (attributePosition.Y + 115) && e.Position.Y < (attributePosition.Y + 147)) { this.ChangeAgility(-5); } // Vitality else if (e.Position.Y > (attributePosition.Y + 147) && e.Position.Y < (attributePosition.Y + 181)) { this.ChangeVitality(-5); } // Inteligence else if (e.Position.Y > (attributePosition.Y + 181) && e.Position.Y < (attributePosition.Y + 214)) { this.ChangeInteligence(-5); } // Dexterity else if (e.Position.Y > (attributePosition.Y + 214) && e.Position.Y < (attributePosition.Y + 247)) { this.ChangeDexterity(-5); } } // -1 else if (e.Position.X > (attributePosition.X + 378) && e.Position.X < (attributePosition.X + 411)) { // Strength if (e.Position.Y > (attributePosition.Y + 82) && e.Position.Y < (attributePosition.Y + 115)) { this.ChangeStrength(-1); } // Agility else if (e.Position.Y > (attributePosition.Y + 115) && e.Position.Y < (attributePosition.Y + 147)) { this.ChangeAgility(-1); } // Vitality else if (e.Position.Y > (attributePosition.Y + 147) && e.Position.Y < (attributePosition.Y + 181)) { this.ChangeVitality(-1); } // Inteligence else if (e.Position.Y > (attributePosition.Y + 181) && e.Position.Y < (attributePosition.Y + 214)) { this.ChangeInteligence(-1); } // Dexterity else if (e.Position.Y > (attributePosition.Y + 214) && e.Position.Y < (attributePosition.Y + 247)) { this.ChangeDexterity(-1); } } // +1 else if (e.Position.X > (attributePosition.X + 475) && e.Position.X < (attributePosition.X + 508)) { // Strength if (e.Position.Y > (attributePosition.Y + 82) && e.Position.Y < (attributePosition.Y + 115)) { this.ChangeStrength(1); } // Agility else if (e.Position.Y > (attributePosition.Y + 115) && e.Position.Y < (attributePosition.Y + 147)) { this.ChangeAgility(1); } // Vitality else if (e.Position.Y > (attributePosition.Y + 147) && e.Position.Y < (attributePosition.Y + 181)) { this.ChangeVitality(1); } // Inteligence else if (e.Position.Y > (attributePosition.Y + 181) && e.Position.Y < (attributePosition.Y + 214)) { this.ChangeInteligence(1); } // Dexterity else if (e.Position.Y > (attributePosition.Y + 214) && e.Position.Y < (attributePosition.Y + 247)) { this.ChangeDexterity(1); } } // +5 else if (e.Position.X > (attributePosition.X + 508) && e.Position.X < (attributePosition.X + 541)) { // Strength if (e.Position.Y > (attributePosition.Y + 82) && e.Position.Y < (attributePosition.Y + 115)) { this.ChangeStrength(5); } // Agility else if (e.Position.Y > (attributePosition.Y + 115) && e.Position.Y < (attributePosition.Y + 147)) { this.ChangeAgility(5); } // Vitality else if (e.Position.Y > (attributePosition.Y + 147) && e.Position.Y < (attributePosition.Y + 181)) { this.ChangeVitality(5); } // Inteligence else if (e.Position.Y > (attributePosition.Y + 181) && e.Position.Y < (attributePosition.Y + 214)) { this.ChangeInteligence(5); } // Dexterity else if (e.Position.Y > (attributePosition.Y + 214) && e.Position.Y < (attributePosition.Y + 247)) { this.ChangeDexterity(5); } } } }
/// <summary> /// Input Handling for Cursor Down event. /// </summary> private void CursorDown(object sender, CursorDownArgs e) { // 1st Line if (e.Position.Y > (this.Position.Y + 783) && e.Position.Y < (this.Position.Y + 822)) { if (e.Position.X > (this.Position.X + 27) && e.Position.X < (this.Position.X + 66)) { this.Typed("1"); } else if (e.Position.X > (this.Position.X + 71) && e.Position.X < (this.Position.X + 110)) { this.Typed("2"); } else if (e.Position.X > (this.Position.X + 115) && e.Position.X < (this.Position.X + 154)) { this.Typed("3"); } else if (e.Position.X > (this.Position.X + 159) && e.Position.X < (this.Position.X + 198)) { this.Typed("4"); } else if (e.Position.X > (this.Position.X + 203) && e.Position.X < (this.Position.X + 242)) { this.Typed("5"); } else if (e.Position.X > (this.Position.X + 247) && e.Position.X < (this.Position.X + 283)) { this.Typed("6"); } else if (e.Position.X > (this.Position.X + 291) && e.Position.X < (this.Position.X + 330)) { this.Typed("7"); } else if (e.Position.X > (this.Position.X + 335) && e.Position.X < (this.Position.X + 374)) { this.Typed("8"); } else if (e.Position.X > (this.Position.X + 379) && e.Position.X < (this.Position.X + 418)) { this.Typed("9"); } else if (e.Position.X > (this.Position.X + 423) && e.Position.X < (this.Position.X + 462)) { this.Typed("0"); } else if (e.Position.X > (this.Position.X + 467) && e.Position.X < (this.Position.X + 594)) { this.Typed(null); } } // 2nd Line else if (e.Position.Y > (this.Position.Y + 827) && e.Position.Y < (this.Position.Y + 866)) { if (e.Position.X > (this.Position.X + 35) && e.Position.X < (this.Position.X + 74)) { this.Typed("Q"); } else if (e.Position.X > (this.Position.X + 79) && e.Position.X < (this.Position.X + 118)) { this.Typed("W"); } else if (e.Position.X > (this.Position.X + 123) && e.Position.X < (this.Position.X + 162)) { this.Typed("E"); } else if (e.Position.X > (this.Position.X + 167) && e.Position.X < (this.Position.X + 206)) { this.Typed("R"); } else if (e.Position.X > (this.Position.X + 211) && e.Position.X < (this.Position.X + 250)) { this.Typed("T"); } else if (e.Position.X > (this.Position.X + 255) && e.Position.X < (this.Position.X + 294)) { this.Typed("Y"); } else if (e.Position.X > (this.Position.X + 299) && e.Position.X < (this.Position.X + 338)) { this.Typed("U"); } else if (e.Position.X > (this.Position.X + 343) && e.Position.X < (this.Position.X + 382)) { this.Typed("I"); } else if (e.Position.X > (this.Position.X + 387) && e.Position.X < (this.Position.X + 426)) { this.Typed("O"); } else if (e.Position.X > (this.Position.X + 431) && e.Position.X < (this.Position.X + 470)) { this.Typed("P"); } else if (e.Position.X > (this.Position.X + 475) && e.Position.X < (this.Position.X + 514)) { this.Typed("("); } else if (e.Position.X > (this.Position.X + 519) && e.Position.X < (this.Position.X + 558)) { this.Typed("["); } else if (e.Position.X > (this.Position.X + 563) && e.Position.X < (this.Position.X + 602)) { this.Typed("{"); } } // 3rd Line else if (e.Position.Y > (this.Position.Y + 871) && e.Position.Y < (this.Position.Y + 910)) { if (e.Position.X > (this.Position.X + 46) && e.Position.X < (this.Position.X + 85)) { this.Typed("A"); } else if (e.Position.X > (this.Position.X + 90) && e.Position.X < (this.Position.X + 129)) { this.Typed("S"); } else if (e.Position.X > (this.Position.X + 134) && e.Position.X < (this.Position.X + 173)) { this.Typed("D"); } else if (e.Position.X > (this.Position.X + 178) && e.Position.X < (this.Position.X + 217)) { this.Typed("F"); } else if (e.Position.X > (this.Position.X + 222) && e.Position.X < (this.Position.X + 261)) { this.Typed("G"); } else if (e.Position.X > (this.Position.X + 266) && e.Position.X < (this.Position.X + 305)) { this.Typed("H"); } else if (e.Position.X > (this.Position.X + 310) && e.Position.X < (this.Position.X + 349)) { this.Typed("J"); } else if (e.Position.X > (this.Position.X + 354) && e.Position.X < (this.Position.X + 393)) { this.Typed("K"); } else if (e.Position.X > (this.Position.X + 398) && e.Position.X < (this.Position.X + 437)) { this.Typed("L"); } else if (e.Position.X > (this.Position.X + 442) && e.Position.X < (this.Position.X + 481)) { this.Typed("C"); } else if (e.Position.X > (this.Position.X + 486) && e.Position.X < (this.Position.X + 525)) { this.Typed(")"); } else if (e.Position.X > (this.Position.X + 530) && e.Position.X < (this.Position.X + 569)) { this.Typed("]"); } else if (e.Position.X > (this.Position.X + 574) && e.Position.X < (this.Position.X + 613)) { this.Typed("}"); } } // 4th Line else if (e.Position.Y > (this.Position.Y + 915) && e.Position.Y < (this.Position.Y + 954)) { if (e.Position.X > (this.Position.X + 27) && e.Position.X < (this.Position.X + 66)) { this.Typed("\\"); } else if (e.Position.X > (this.Position.X + 71) && e.Position.X < (this.Position.X + 110)) { this.Typed("Z"); } else if (e.Position.X > (this.Position.X + 115) && e.Position.X < (this.Position.X + 154)) { this.Typed("X"); } else if (e.Position.X > (this.Position.X + 159) && e.Position.X < (this.Position.X + 198)) { this.Typed("C"); } else if (e.Position.X > (this.Position.X + 203) && e.Position.X < (this.Position.X + 242)) { this.Typed("V"); } else if (e.Position.X > (this.Position.X + 247) && e.Position.X < (this.Position.X + 283)) { this.Typed("B"); } else if (e.Position.X > (this.Position.X + 291) && e.Position.X < (this.Position.X + 330)) { this.Typed("N"); } else if (e.Position.X > (this.Position.X + 335) && e.Position.X < (this.Position.X + 374)) { this.Typed("M"); } else if (e.Position.X > (this.Position.X + 379) && e.Position.X < (this.Position.X + 418)) { this.Typed("<"); } else if (e.Position.X > (this.Position.X + 423) && e.Position.X < (this.Position.X + 462)) { this.Typed(">"); } else if (e.Position.X > (this.Position.X + 467) && e.Position.X < (this.Position.X + 506)) { this.Typed(","); } else if (e.Position.X > (this.Position.X + 511) && e.Position.X < (this.Position.X + 550)) { this.Typed("."); } else if (e.Position.X > (this.Position.X + 555) && e.Position.X < (this.Position.X + 594)) { this.Typed("/"); } } // 5th Line else if (e.Position.Y > (this.Position.Y + 959) && e.Position.Y < (this.Position.Y + 997)) { if (e.Position.X > (this.Position.X + 115) && e.Position.X < (this.Position.X + 506)) { this.Typed(" "); } } }
/// <summary> /// Input Handling for Cursor Down event. /// </summary> private void CursorDown(object sender, CursorDownArgs e) { // Check if the items can be selected or executed. if (this.Enabled && this.Visible && !this.Freezed) { // Define if the touch was inside the menu x area. float limitX = this.Position.X + TextureManager.Instance.Sprites.Menu.ItemPlayerOne.Width; if (e.Position.X < limitX && e.Position.X > this.Position.X) { // Define if the touch was inside the menu y area. if (e.Position.Y > this.Position.Y && e.Position.Y < IRTSettings.Default.Height) { // Updates the menu. this.ChangedField = true; // Deactivate the aim. if (this.Aim.Enabled) { this.Aim.Deactivate(); } // Deactivate the mover. if (this.Mover.Enabled) { this.Mover.Deactivate(); } // Check if the touch was inside some action item. for (int index = 0; index < this.Actions.Count; index++) { // If action touched. float limitY = this.Actions[index].Position.Y + TextureManager.Instance.Sprites.Menu.ItemPlayerOne.Height; if (e.Position.Y < limitY && e.Position.Y > this.Actions[index].Position.Y) { // Check if its an unselection. if (this.Actions[index].Selected) { this.UnselectAction(this.Actions[index]); } else { this.UnselectMenu(); this.Actions[index].Selected = true; this.Actions[index].RaiseExecute(); } // Action menu was un/selected. return; } } // Check if the touch was inside some command item. for (int index = 0; index < this.Actions.Count; index++) { // Check the childs only if the action menu is selected. if (this.Actions[index].Selected) { // Check all commands. for (int subindex = 0; subindex < this.Actions[index].Commands.Count; subindex++) { // If command touched. float limitY = this.Actions[index].Commands[subindex].Position.Y + TextureManager.Instance.Sprites.Menu.ItemPlayerOne.Height; if (e.Position.Y < limitY && e.Position.Y > this.Actions[index].Commands[subindex].Position.Y) { // Check if the command can be executed. if (this.Actions[index].Commands[subindex].Command.Enabled) { // Check if its an unselection if (this.Actions[index].Commands[subindex].Selected) { this.Actions[index].Commands[subindex].Selected = false; } else { // Unselect all commands. this.UnselectCommands(); this.Actions[index].Commands[subindex].Selected = true; this.Actions[index].Commands[subindex].RaiseExecute(); } } // Command menu was un/selected. return; } } } } // Touch outside the area of the menu. return; } } } }