public void OnRrfresh() { if (this.data == null) { return; } unitUIEventArgs = this.data as MouseClickEventArgs; if (Unit == unitUIEventArgs.dataGameobject || unitUIEventArgs.dataGameobject == null) { return; } Unit = unitUIEventArgs.dataGameobject; unitUIData = UIManager.Instance.GetUnitUIData(unitUIEventArgs.dataGameobject.tag); txtUnitName.text = unitUIData.unit_UIName; unit_Icon.url = "ui://UI/" + unitUIData.unit_Icon; txtUnitInf.text = " " + unitUIData.unit_UIInf; string[] icon = unitUIData.unit_ProdIcon.Split(','); string[, ] name = new string[icon.Length, 2]; for (int i = 0; i < icon.Length; ++i) { name[i, 0] = icon[i].Split('|')[0]; name[i, 1] = icon[i].Split('|')[1]; } listProducting.numItems = icon.Length; for (int i = 0; i < icon.Length; i++) { GComponent gComponent = listProducting.GetChildAt(i).asCom; gComponent.data = new ComponentData(name[i, 0], unitUIEventArgs.dataGameobject, Convert.ToBoolean(Convert.ToInt32(name[i, 1]))); } }
private async void FileSave_Click(object sender, MouseClickEventArgs e) { if (string.IsNullOrEmpty(this._CurrentFileName)) { SaveFileDialog sfd = new SaveFileDialog { Title = "Save file as...", Filter = "All Files(*.*)\0*.*\0Text(*.txt)\0*.txt\0", DefaultFilterIndex = 2 }; if (sfd.Show(this)) { this._CurrentFileName = sfd.File; string text = this._TextBox.Text; await File.WriteAllTextAsync(this._CurrentFileName, text); this.Text = "Little Edit:" + this._CurrentFileName; } } else { string text = this._TextBox.Text; File.WriteAllText(this._CurrentFileName, text); this.Text = "Little Edit:" + this._CurrentFileName; } }
private void onMouseClicked(MouseClickEventArgs args) { var dragHandle = _dragHandle; if (args.Button != MouseButton.Left || dragHandle == null) { return; } const long millis = 300; if (args.ClickTimeInMilliseconds > millis && dragHandle.LastDragged > DateTime.Now.AddMilliseconds(-millis)) { //Checking against "false alarms" -> the user meant to do a quick drag of the object, not to change between scale/rotate handles return; } _resizeVisible = !_resizeVisible; foreach (var handle in _resizeHandles) { handle.SetVisible(_resizeVisible); } foreach (var handle in _rotateHandles) { handle.SetVisible(!_resizeVisible); } }
protected override void MouseDownEvent(MouseClickEventArgs args) { if (Start != null && args.Button == MouseButton.Left) { AudioStateGraphEditor editor = Start.FindInParents <AudioStateGraphEditor>(); if (editor != null) { if (args.Ctrl) { if (this.IsSelected) { editor.Selection.Remove(this); } else { editor.Selection.Add(this); } } else if (args.Shift) { if (!this.IsSelected) { editor.Selection.Add(this); } } else { editor.Selection.Select(this); } args.Handled = true; } } base.MouseDownEvent(args); }
public void HandleMouseClick(MouseClickEventArgs e) { if (MouseClick != null) { MouseClick.Invoke(this, e); } }
protected override void MouseDownEvent(MouseClickEventArgs args) { if (args.Button == MouseButton.Left) { GraphEditor editor = _Item.FindInParents <GraphEditor>(); if (editor != null) { if (args.Ctrl) { if (_Item.IsSelected) { editor.Selection.Remove(_Item); } else { editor.Selection.Add(_Item); } } else if (args.Shift) { if (!_Item.IsSelected) { editor.Selection.Add(_Item); } } else { editor.Selection.Select(_Item); } } } base.MouseDownEvent(args); }
public override void ClickRightMouseEvent(object sender, GameEventArgs e) { if (!IsSelected || !IsPlayerCamp) { return; } MouseClickEventArgs m = e as MouseClickEventArgs; if (m.dataGameobject.layer == 11) { MoveToTarget(m.ClickPosition); } else if (m.dataGameobject.layer == EnemyLayer) { enemyDetection.SetPlayerSelectEnemy(m.dataGameobject); float distance = Vector3.Distance(gameObject.transform.position, m.dataGameobject.transform.position); if (distance > StopToAttackDistance) { MoveToTarget(m.dataGameobject.transform.position, true, distance, StopToAttackDistance); } else { navMeshAgent.enabled = false; IsMove = false; } } }
protected virtual void OnClick(MouseClickEventArgs e) { if (MouseClick != null) { MouseClick(this, e); } }
private void OnJoinMouseClick(object sender, MouseClickEventArgs e) { if (box[0].Text().Length > 0 && box[1].Text().Length > 0 && box[2].Text().Length > 0) { name = box[1].Text(); try { port = Convert.ToInt32(box[0].Text()); joinButton.MouseClick -= OnJoinMouseClick; box[0].IsSelect = false; box[1].IsSelect = false; box[2].IsSelect = false; IsJoin = true; box.Add(new TextBox(new Vector2(Bounds.X + 20, box[2].Bound.Bottom + 10), 20, 10, TexturesManager.Menu, Color.Blue, Color.Red)); client = new Client(name); client.Connect(box[2].Text(), port); client.SendData(); client.StartReadThread(); //client.StartWaitStart(); } catch (Exception) { box[0].RemoveAll(); } } }
private void MouseButtonPressed(MouseClickEventArgs e) { if (e.buttonType == ButtonType.LeftButton && e.buttonEventType == ButtonEventType.Down) { dragLocationStart = e.screenPosition; } else if (e.buttonType == ButtonType.LeftButton && e.buttonEventType == ButtonEventType.Holding) { dragLocationEnd = e.screenPosition; } else if (e.buttonType == ButtonType.LeftButton && e.buttonEventType == ButtonEventType.Up) { dragLocationStart = Vector2.zero; dragLocationEnd = Vector2.zero; } if (Mathf.Abs(dragLocationStart.x - dragLocationEnd.x) > threshold || Mathf.Abs(dragLocationStart.y - dragLocationEnd.y) > threshold) { if (dragLocationEnd != Vector2.zero) { isDragging = true; } } else { isDragging = false; } }
private void OnCreateMouseClick(object sender, MouseClickEventArgs e) { if (box[0].Text().Length > 0 && box[1].Text().Length > 0) { name = box[1].Text(); try { port = Convert.ToInt32(box[0].Text()); StartButton.MouseClick += OnStartMouseClick; createButton.MouseClick -= OnCreateMouseClick; isCreate = true; box[0].IsSelect = false; box[1].IsSelect = false; serveur = new Serveur("test", port, 100); serveur.Start(); localClient = new Client(name, true); localClient.Connect("127.0.0.1", port); localClient.SendData(); localClient.StartReadThread(); //localClient.StartWaitStart(); box.Add(new TextBox(new Vector2(Bounds.X + 20, box[0].Bound.Bottom + 10), 20, 10, TexturesManager.Menu, Color.Blue, Color.Red)); } catch (Exception) { box[0].RemoveAll(); } } }
private void Window1_DblClick(object sender, MouseClickEventArgs e) { Window2 win2 = new Window2(this); //this.Controls.Add(win2); win2.Show(); MessageBox.Show("Nach Show"); }
public override Boolean OnInput(MouseClickEventArgs args) { base.OnInput(args); IsChecked = !IsChecked; return(true); }
private void ManagerMouse_MouseClickEventHandler(object sender, MouseClickEventArgs e) { if (selected) { target = new Point(e.XTile, e.YTile); } }
public override void ClickRightMouseEvent(object sender, GameEventArgs e) { base.ClickRightMouseEvent(sender, e); if (!IsSelected || IsOnBuilding) { return; } MouseClickEventArgs m = e as MouseClickEventArgs; if (m.dataGameobject.layer == 11) { _navMeshAgent.enabled = false; _FSMSystemManager.ControlStateTransition(StateID.Move); Vector3 pos = CrowdBehaviorManager.Instance.GetBattle_FormationPos(); Debug.Log(pos); moveState.SetMoveTargetPos(m.ClickPosition); } else if (m.dataGameobject.tag == "Mine") { _navMeshAgent.enabled = false; miningState.MinePosition = m.dataGameobject.transform.position; _FSMSystemManager.ControlStateTransition(StateID.Mining); harvesterState = HarvesterState.mine; } }
private async void FileOpen_Click(object sender, MouseClickEventArgs e) { OpenFileDialog ofd = new OpenFileDialog { Title = "Open a Text File...", Filter = "All File(*.*)\0*.*\0Text(*.txt)\0*.txt\0", DefaultFilterIndex = 2 }; //Title of the Dialog //All Values have to be separated with \0 //Shows Text(*.txt) as default //Show the Dialog modal to the current Form. if (ofd.Show(this)) { this._TextBox.Enabled = false; //Read the selected Path string fileName = ofd.File; //File Actions. string text = await File.ReadAllTextAsync(fileName); this._CurrentFileName = fileName; this._TextBox.Text = text; this._TextBox.Enabled = true; this.Text = "Little Edit:" + fileName; } }
private void MouseClicked(object o, MouseClickEventArgs e) { player.holdingBall = false; if (player.canShoot) { GameEvent(GameEventEnum.SHOOT); listOfLasers.Add(new Laser(new Rectangle(paddle.position.Center.X, paddle.position.Y - 20, 4, 15))); } if (showScoreboard) { if (option != 0) { showScoreboard = false; } if (option == 1) { game.ShowGameMode(); } if (option == 2) { game.ShowMainMenu(); } } }
/// <summary> /// MouseDownEvent /// </summary> /// <param name="args">args</param> protected override void MouseDownEvent(MouseClickEventArgs args) { if (args.Button == MouseButton.Left) { Frame of = OwnerFrame; if (of != null) { _IsMouseDown = OwnerFrame.RegisterPrecedenceEvent(this); _StartSelection = _EndSelection = args.MousePosition; _DeltaSelection = Vector2.zero; _Shift = args.Shift; _KeepKeysSelected.Clear(); if (!_Shift) { _Selection.Clear(); } else { foreach (var ki in _Selection) { _KeepKeysSelected.Add(ki); } } args.Handled = true; } } base.MouseDownEvent(args); }
/// <summary> /// Occurs when mouse button was released.(if WantsMouseEvents = true) /// </summary> /// <param name="args"> MouseClickEventArgs </param> protected override void MouseUpEvent(MouseClickEventArgs args) { if (args.Button == MouseButton.Left) { _IsMouseDown = false; } base.MouseUpEvent(args); }
protected override void MouseDownEvent(MouseClickEventArgs args) { if (args.Button == MouseButton.Left) { OnClick(); } base.MouseDownEvent(args); }
public void Notify(object sender, MouseClickEventArgs args) { if (Rectangle.Intersects(new Rectangle((int)args.ClickPosition.X, (int)args.ClickPosition.Y, 1, 1))) { // TODO: Make a button for many clicks. MouseClickDetector.LeftButtonDown -= Notify; Click?.Invoke(); } }
/// <summary> /// MouseDownEvent /// </summary> /// <param name="args">args</param> protected override void MouseDownEvent(MouseClickEventArgs args) { if (args.Button == MouseButton.Left && args.Ctrl) { _IsMouseDown = true; _DeltaX = 0; _StartTime = OwnerEvent.FireTime; } base.MouseDownEvent(args); }
/// <inheritdoc /> protected override void OnClick(object sender, MouseClickEventArgs e) { base.OnClick(sender, e); if (Checked) { return; } UncheckNeighbors(); Checked = true; }
protected override void OnMouseClick(MouseEventArgs e) { base.OnMouseClick(e); if (null != MouseClickEvent) { MouseClickEventArgs args = new MouseClickEventArgs(); args.ScreenLocation = PointToScreen(e.Location); MouseClickEvent(this, args); } }
public override void Click(MouseClickEventArgs e) { if (!displayRectangle.Contains(e.location)) { return; } check = !check; OnClickHandler(e); }
/// <summary> /// MouseDownEvent /// </summary> /// <param name="args">args</param> protected override void MouseDownEvent(MouseClickEventArgs args) { if (args.Button == MouseButton.Left) { if (Contains(args.MousePosition)) { if (OwnerFrame.RegisterPrecedenceEvent(this)) { _MouseButton = MouseButton.Left; } TimeLine.TimePosition = GetTime(args.MousePosition.x); args.Handled = true; } else { if (_MouseButton != MouseButton.None) { OwnerFrame.UnregisterPrecedenceEvent(this); } _MouseButton = MouseButton.None; } } else if (args.Button == MouseButton.Right) { if (Contains(args.MousePosition)) { double time = GetTime(args.MousePosition.x); if (args.Shift && TimeLine.SelectionLenght > 0) { AddTime(time); } else { _StartSelectionTime = time; TimeLine.SelectTime(time, time); } if (OwnerFrame.RegisterPrecedenceEvent(this)) { _MouseButton = MouseButton.Right; } args.Handled = true; } else { if (_MouseButton != MouseButton.None) { OwnerFrame.UnregisterPrecedenceEvent(this); } _MouseButton = MouseButton.None; } } base.MouseDownEvent(args); }
/// <summary>Invokes the onClick event</summary> /// <param name="e">The Mouse Click Event Args of the event</param> protected void OnClickHandler(MouseClickEventArgs e) { if (timeSinceLastClick.TotalSeconds <= TIME_FOR_DOUBLE_CLICK_IN_SECONDS) { DoubleClick(e); } onClick?.Invoke(this, e); timeSinceLastClick = TimeSpan.Zero; }
public void OnInfoPlayerMouseClick(object sender, MouseClickEventArgs e) { showInfoWindow.IsOpened = !showInfoWindow.IsOpened; if (showInfoWindow.IsOpened) { Parent.Windows.Add(showInfoWindow); } else { Parent.Windows.Remove(showInfoWindow); } }
/// <summary> /// Occurs when mouse button was released.(if WantsMouseEvents = true) /// </summary> /// <param name="args"> MouseClickEventArgs </param> protected override void MouseUpEvent(MouseClickEventArgs args) { if (args.Button == _MouseButton) { if (_MouseButton != MouseButton.None) { OwnerFrame.UnregisterPrecedenceEvent(this); } _MouseButton = MouseButton.None; args.Handled = true; } base.MouseUpEvent(args); }
private void OnResolutionMouseClick(object sender, MouseClickEventArgs e) { // if (MainGame.ScreenX != 1024) // { // MainGame.GetInstance().graphics.IsFullScreen = false; // MainGame.SetGraphics(1024, 768); // } // else // { // MainGame.GetInstance().graphics.IsFullScreen = true; // MainGame.SetGraphics(MainGame.GetInstance().graphics.GraphicsDevice.DisplayMode.Width, MainGame.GetInstance().graphics.GraphicsDevice.DisplayMode.Height); // } }
/// <summary> /// The 'done' button has been clicked. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event's arguments.</param> public virtual void OnDoneButtonClick(object obj, MouseClickEventArgs e) { //If an animation has been selected for loading, invoke the event. if (_Textbox.Text != null) { AnimationSavedInvoke(_Textbox.Text); } //Invoke the dispose event. DisposeInvoke(); }
/// <summary> /// The 'done' button has been clicked. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event's arguments.</param> public virtual void OnDoneButtonClick(object obj, MouseClickEventArgs e) { //Invoke the sprite picked event. SpritePickedInvoke(_Picturebox.Name, CalculateSpriteOrigin(), CalculateSpriteEnd()); //Invoke the dispose event. DisposeInvoke(); }
/// <summary> /// The label has been clicked. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event's arguments.</param> private void OnLabelClick(object obj, MouseClickEventArgs e) { //Bring the list to front. _List.DrawOrder = 0; //Request a change in focus. _GUI.RequestFocus(_List); }
/// <summary> /// The picturebox has been clicked. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event's arguments.</param> private void OnPictureboxClick(object obj, MouseClickEventArgs e) { //If the left button was pressed, update the origin. if (e.Button == MouseButton.Left) { _StartPosition = e.Position; _BoneSprite[0].Origin = CalculateSpriteOrigin(); } //If the right button was pressed, update the end position. else if (e.Button == MouseButton.Right) { _EndPosition = e.Position; _BoneSprite.RotationOffset = Helper.CalculateRotationOffset(CalculateSpriteOrigin(), CalculateSpriteEnd()); } //Update the bone length. _Bone.Length = Vector2.Distance(CalculateSpriteOrigin(), CalculateSpriteEnd()); }
/// <summary> /// When the button has been pressed, check the checkbox. /// </summary> /// <param name="obj">The object whose bounds changed.</param> /// <param name="e">The event arguments.</param> private void OnButtonClicked(object obj, MouseClickEventArgs e) { //Tick the checkbox. CheckboxTickedInvoke(!_IsChecked); }
/// <summary> /// The 'add sprite' button has been clicked. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event's arguments.</param> private void OnAddSpriteButtonClick(object obj, MouseClickEventArgs e) { //Display a sprite dialog. GUI.AddItem(new SpriteDialog(GUI, new Vector2(350, 150), 500, 400)); (GUI.LastItem as SpriteDialog).LoadContent(); //Subscribe to some events. (GUI.LastItem as SpriteDialog).SpritePicked += OnSpritePicked; }
/// <summary> /// The 'close' button has been clicked. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event's arguments.</param> private void OnCloseButtonClick(object obj, MouseClickEventArgs e) { //Invoke the bone created event. BoneEditedInvoke(); //Invoke the dispose event. DisposeInvoke(); }
/// <summary> /// The picturebox has been clicked. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event's arguments.</param> private void OnPictureboxClick(object obj, MouseClickEventArgs e) { //If the left button was pressed, update the origin. if (e.Button == MouseButton.Left) { _StartPosition = e.Position; } //If the right button was pressed, update the end position. else if (e.Button == MouseButton.Right) { _EndPosition = e.Position; } }
/// <summary> /// The 'done' button has been clicked. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event's arguments.</param> public virtual void OnDoneButtonClick(object obj, MouseClickEventArgs e) { //If an animation hasbeen selected for loading, invoke the event. if (_SelectedIndex != -1) { AnimationLoadedInvoke(_Animations[_SelectedIndex]); } //Invoke the dispose event. DisposeInvoke(); }
/// <summary> /// The backward button has been held down by the mouse. /// </summary> /// <param name="obj">The object that fired this event.</param> /// <param name="e">The event's arguments.</param> private void OnBackwardDown(object obj, MouseClickEventArgs e) { //Scroll backward a bit. ValueChangeInvoke(_Value - 1); }
/// <summary> /// An item of this GUI has been clicked on, deal with it. /// </summary> /// <param name="obj">The object that fired this event.</param> /// <param name="e">The event's arguments.</param> private void OnItemClick(object obj, MouseClickEventArgs e) { //Invoke the appropriate event. ItemClickedInvoke(e.Position, e.Button); }
/// <summary> /// The thumb button has been held down by the mouse. /// </summary> /// <param name="obj">The object that fired this event.</param> /// <param name="e">The event's arguments.</param> private void OnThumbDown(object obj, MouseClickEventArgs e) { //The thumb is down. _IsThumbDown = true; //Check the scroller type and set the correct value. if (_Type == ScrollerType.Horizontal) { ValueChangeInvoke(((e.Position.X - (Position.X + 25)) / (Width - 50)) * 100); } else { ValueChangeInvoke(((e.Position.Y - (Position.Y + 25)) / (Height - 50)) * 100); } }
/// <summary> /// A tab has been clicked. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event's arguments.</param> private void OnTabClick(object obj, MouseClickEventArgs e) { //Select the tab's item. TabSelectInvoke((TabPage)obj); }
/// <summary> /// If the node's button has been clicked, either expand or collapse its list of children. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event arguments.</param> private void OnButtonMouseClick(object obj, MouseClickEventArgs e) { //Change the sprite of the button. if (_Button.Sprite[0].CurrentFrameIndex < (_Button.Sprite[0].Frames.Count - 1)) { _Button.Sprite[0].IncrementFrameIndex(); } else { _Button.Sprite[0].CurrentFrameIndex = 0; } //Change the NodeState. if (_NodeState == TreeNodeState.Collapsed) { NodeStateChangedInvoke(TreeNodeState.Expanded); } else { NodeStateChangedInvoke(TreeNodeState.Collapsed); } }
/// <summary> /// This tab page's button has been clicked. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event's arguments.</param> protected void OnButtonClick(object obj, MouseClickEventArgs e) { //Invoke the tab page's mouse click method. MouseClickInvoke(e.Position, e.Button); }
/// <summary> /// A menu item has been clicked on by a mouse. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event arguments.</param> private void OnMenuItemClick(object obj, MouseClickEventArgs e) { //Save the clicked node as the selected node. MenuItemSelectInvoke(obj as MenuItem); }
/// <summary> /// The forward button has been held down by the mouse. /// </summary> /// <param name="obj">The object that fired this event.</param> /// <param name="e">The event's arguments.</param> private void OnForwardDown(object obj, MouseClickEventArgs e) { //Scroll forward a bit. ValueChangeInvoke(_Value + 1); }
/// <summary> /// The 'done' button has been clicked, close the form. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event's arguments.</param> public virtual void OnDoneButtonClick(object obj, MouseClickEventArgs e) { Close(); }
/// <summary> /// A node has been clicked on by a mouse. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event arguments.</param> private void OnChildNodeMouseClick(object obj, MouseClickEventArgs e) { //Save the clicked node as the selected node. _SelectedNode = (obj as TreeNode); }
/// <summary> /// The header has been clicked. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event's arguments.</param> private void OnHeaderClick(object obj, MouseClickEventArgs e) { //Either expand or contract the control. SwitchState(); }
/// <summary> /// The play button has been clicked on by a mouse. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event arguments.</param> private void OnPlayButtonClick(object obj, MouseClickEventArgs e) { //Either turn on or off the animation. PlayStateChangeInvoke(!_IsPlaying); }
/// <summary> /// An item has been clicked on by a mouse. /// </summary> /// <param name="obj">The object that fired the event.</param> /// <param name="e">The event arguments.</param> protected virtual void OnItemClick(object obj, MouseClickEventArgs e) { //Save the clicked node as the selected node. ItemSelectInvoke(obj as ListItem); }