public void Update(KaroGameManager manager, MouseClick click) { IEnumerable<MoveWrapper> legalMoves = manager.FindLegalMoves(manager.CurrentPlayer); MoveWrapper move = legalMoves.FirstOrDefault(m => m.GetFromCell() == manager.CurrentMove.GetFromCell() && m.GetToCell() == manager.CurrentMove.GetToCell() && m.HasUsedCell() && m.GetUsedCell() == new Vector2DWrapper(click.Position.X, click.Position.Y)); if (move != null) { CommunicationProtocolConversionUtility util = new CommunicationProtocolConversionUtility(manager.Game); //Debug.WriteLine(util.MoveWrapperToString(move)); Debug.WriteLine(util.TurnToString(util.ConvertMoveToTurn(move))); // We now have a valid move. Execute it! Debug.WriteLine("Clicked on moveable tile."); manager.ExecuteMove(move); manager.CurrentMove = null; if (!(manager.CurrentState is ComputerState) && !(manager.CurrentState is WaitForUndoState)) { manager.ChangeState(PieceSourceState.Instance); } } else { // Clicked on invalid tile. Back to PieceSourceState. Debug.WriteLine("Clicked on a non moveable tile."); manager.SendMoveIsNotValid(); manager.CurrentMove = null; manager.ChangeState(PieceSourceState.Instance); } }
public void Update(KaroGameManager manager, MouseClick click) { IEnumerable<MoveWrapper> legalMoves = manager.FindLegalMoves(manager.CurrentPlayer); MoveWrapper move = legalMoves.FirstOrDefault(m => m.GetToCell() == new Vector2DWrapper(click.Position.X, click.Position.Y)); // We have a valid move. if (move != null) { Debug.WriteLine(move.GetToCell()); CommunicationProtocolConversionUtility util = new CommunicationProtocolConversionUtility(manager.Game); Debug.WriteLine(util.TurnToString(util.ConvertMoveToTurn(move))); manager.ExecuteMove(move); Debug.WriteLine("Placed a new piece."); } else { manager.SendMoveIsNotValid(); Debug.WriteLine("Can't place a new piece"); } // Change state to Piece source state if all 6 pieces are on the board. if (manager.Board.GetOccupiedCells().Count == MaxPieceCount) { if (!(manager.CurrentState is ComputerState) && !(manager.CurrentState is WaitForUndoState)) { Debug.WriteLine("All {0} pieces are placed at the board.", MaxPieceCount); manager.ChangeState(PieceSourceState.Instance); } } }
// Use this for initialization public Initiative() { advancement = -1; adv = 0; agendaPts = -1; trashCost = -1; cost = -1; rezCost = -1; iceStr = -1; rezzed = false; inHand = true; mouse = GameObject.FindObjectOfType<MouseClick>(); }
private void NUMPadUI_MouseUp(object sender, MouseEventArgs e) { var parentForm = ParentForm; if (parentForm == null || new Rectangle(parentForm.Location, parentForm.Size).Contains(MousePosition)) { var k = sender != this ? VKeys[Controls.IndexOf((Control)sender)] : Keys.None; if (e.Button == MouseButtons.Left) { LayoutMenuShow?.Invoke(k, MousePosition); } MouseClick?.Invoke(k, e.Button); } }
public void Update(KaroGameManager manager, MouseClick click) { IEnumerable<MoveWrapper> legalMoves = manager.FindLegalMoves(manager.CurrentPlayer); // Get the move with the correct source tile from the last click. IEnumerable<MoveWrapper> sourceLegalMoves = legalMoves.Where(m => m.GetFromCell() == manager.CurrentMove.GetFromCell()); // Get the move (if it exists) with the correct destination tile. MoveWrapper move = sourceLegalMoves.FirstOrDefault(m => m.GetToCell() == new Vector2DWrapper(click.Position.X, click.Position.Y)); if (move != null) { var usedTile = move.HasUsedCell(); Debug.WriteLine("Clicked on valid destination"); // Check if the destination tile exists or if a tile has to be moved. if (move.HasUsedCell()) { Debug.WriteLine("Empty tile must be moved to destination"); manager.CurrentMove = move; manager.ChangeState(CellSourceState.Instance); } // Valid move, execute it. else { Debug.WriteLine("Moving tile at {0} to {1}", move.GetFromCell(), move.GetToCell()); manager.ExecuteMove(move); CommunicationProtocolConversionUtility util = new CommunicationProtocolConversionUtility(manager.Game); Debug.WriteLine(util.TurnToString(util.ConvertMoveToTurn(move))); if (!(manager.CurrentState is ComputerState) && !(manager.CurrentState is WaitForUndoState)) { manager.ChangeState(PieceSourceState.Instance); } //Debug.WriteLine(move.GetToCell()); } } else { // Clicked on invalid destination tile. Get rid of the current // move and go back to PieceSourceState. Debug.WriteLine("Can't move selected piece to tile.", click); manager.SendMoveIsNotValid(); manager.CurrentMove = null; manager.ChangeState(PieceSourceState.Instance); } }
public bool PreFilterMessage(ref Message m) { if (m.Msg == WM_LBUTTONDOWN || m.Msg == WM_RBUTTONDOWN || m.Msg == WM_MBUTTONDOWN) { if (MouseClick != null) { int x = m.LParam.ToInt32() & 0xFFFF; int y = (m.LParam.ToInt32() >> 16) & 0xFFFF; MouseEventArgs mea = new MouseEventArgs(MouseButtons.None, 0, x, y, 0); MouseClick.Invoke(null, mea); } } return(false); }
private void InitializeBackingControl(Control textBox) { Controls.Add(textBox); textBox.Dock = DockStyle.Fill; textBox.Enter += (sender, args) => { BackColor = SystemColors.Highlight; }; textBox.Leave += (sender, args) => { BackColor = SystemColors.WindowFrame; }; textBox.TextChanged += (sender, args) => { TextChanged?.Invoke(sender, args); }; textBox.KeyDown += (sender, args) => { KeyDown?.Invoke(sender, args); }; textBox.MouseClick += (sender, args) => { MouseClick?.Invoke(sender, args); }; textBox.Enter += (sender, args) => { Enter?.Invoke(sender, args); }; textBox.KeyUp += (sender, args) => { KeyUp?.Invoke(sender, args); }; textBox.Leave += (sender, args) => { Leave?.Invoke(sender, args); }; textBox.MouseMove += (sender, args) => { MouseMove?.Invoke(sender, args); }; }
public void MouseClickTestSimplePasses3() { var engine = new MouseClick(); bool _click = false; int num = 7; var resultado = engine.RevisarClicks(_click); var res = engine.RevisarClicks(_click); Assert.AreEqual(_click, false); }
public void Interact(GameObject user, MouseClick mouseClick) { if (!rotating) { if (mouseClick == MouseClick.Left) { Rotate(-RotateValue); } if (mouseClick == MouseClick.Right) { Rotate(RotateValue); } } }
public void SendKeyUp(string key, MouseClick mouse, Modifiers modifier) { if (mouse != MouseClick.None) { SendClickUp(mouse); } if (!String.IsNullOrEmpty(key)) { keybd_event((byte)ARPGGamepadKeys.GetLetterKey(key), 0, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0); } if (modifier != Modifiers.None) { SendModifierUp(modifier); } }
private void OnMouseClick(object sender, MouseEventArgs e) { var now = DateTime.Now; var time = now - _referenceStartTime; var mouseClick = new MouseClick { Time = time, Button = e.Button, X = e.X, Y = e.Y }; Notify(mouseClick); }
public Button(Rectangle rectangle, string text, MouseClick onClick) { base.zOrder = 0; this.text = text; this.areaRectangle = rectangle; base.mouseClick = onClick; texNormalS = "normal"; texPressedS = "pressed"; textHoverS = "hover"; texCurrent = texNormal; font = Sprite.SpriteFont; textSize = font.MeasureString(text); textPosition = new Vector2(areaRectangle.X + (areaRectangle.Width - textSize.X) / 2, areaRectangle.Y + ((areaRectangle.Height - textSize.Y) / 2)); }
private void HandleMouseButtonClick(int mouseButton) { if (uiManager.IsMouseOverUI()) { return; } var mousePos = Input.mousePosition; var ray = camera.ScreenPointToRay(mousePos); var hits = Physics.RaycastAll(ray, clickMaxDistance); if (hits.Length > 0) { MouseClick?.Invoke(this, new MouseClickEventArgs(mouseButton, hits)); } }
public void Update() { if (Input.GetMouseButtonUp(0)) { MouseUp.Invoke(); } if (Input.GetMouseButtonDown(0)) { MouseClick.Invoke(); } if (Input.GetMouseButton(0)) { MouseDown.Invoke(); } OnUpdate.Invoke(); }
public void Update(KaroGameManager manager, MouseClick click) { if (click.Button != MouseButton.RIGHT) { return; } manager.UndoLastMove(); if (manager.Board.GetOccupiedCells().Count == 12) { manager.ChangeState(PieceSourceState.Instance); } else { manager.ChangeState(PlaceState.Instance); } }
public void SavePrevious(bool performClear) { previousClicks = currentClicks; if (performClear) { currentClicks.leftCount = currentClicks.middleCount = currentClicks.rightCount = currentClicks.fourthCount = currentClicks.fifthCount = currentClicks.wUpCount = currentClicks.wDownCount = currentClicks.toggleCount = 0; } foreach (KeyPresses kp in keyPresses.Values) { kp.previous = kp.current; if (performClear) { kp.current.repeatCount = kp.current.scanCodeCount = kp.current.vkCount = kp.current.toggleCount = 0; } } }
public void SendClickUp(MouseClick button) { switch (button) { case MouseClick.LeftClick: mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, new System.IntPtr()); break; case MouseClick.MiddleClick: mouse_event(MOUSEEVENTF_MIDDLEUP, 0, 0, 0, new System.IntPtr()); break; case MouseClick.RightClick: mouse_event(MOUSEEVENTF_RIGHTUP, 0, 0, 0, new System.IntPtr()); break; } }
private void Box_Click(object sender, System.Windows.Forms.MouseEventArgs e) { try { // Console.WriteLine(UnClick) // Console.WriteLine() if (!UnClick) { if (e.Button == System.Windows.Forms.MouseButtons.Right && !UnClick && (!Done || MineBoard.clickCount() >= (TotalHeight * TotalWidth) - 1)) { Flagged = !Flagged; } if (e.Button == System.Windows.Forms.MouseButtons.Left && (!Done || MineBoard.clickCount() >= (TotalHeight * TotalWidth) - 1)) { UnClick = true; if (IsBomb & !Flagged) { FaceChange?.Invoke(FaceType.Dead, new EventArgs()); BackColor = Color.Red; } else { int c = MineBoard.CountMines(X - 0, Y - 0); // Console.WriteLine(X & "," & Y) if (c == 0 && !Flagged) { CheckSurround(X, Y); } else if ((!Done) || Flagged || MineBoard.clickCount() >= (TotalHeight * TotalWidth) - 1) { //lbl = new Label() { ForeColor = numColours[c - 1], Text = c.ToString(), TextAlign = ContentAlignment.MiddleCenter, Font = new System.Drawing.Font("Arial", 12), Location = new Point(2, -1), BackColor = Color.Transparent, Size = new Size(12, 15), Padding = new System.Windows.Forms.Padding(0), Margin = new System.Windows.Forms.Padding(0) }; NumLabel(c);//this.Controls.Add(lbl); } } } if (!Done) { MouseClick?.Invoke(this, e); } } } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
private void Viewport_MouseClick(Ray3 ray, System.Windows.Forms.MouseEventArgs e) { if (SurfaceMesh == null) { return; } List <Intersection> Intersections = new List <Intersection>(); Intersections.AddRange(SurfaceMesh.Intersect(ray)); if (Intersections.Count > 0) { Intersections.Sort((i1, i2) => i1.Distance.CompareTo(i2.Distance)); MouseClick?.Invoke(this, Intersections, e); } }
public static void MouseDoubleClick(MouseClick button) { SwitchToInputDesktop(); switch (button) { case Helpers.MouseClick.Left: simulator.Mouse.LeftButtonDoubleClick(); break; case Helpers.MouseClick.Middle: simulator.Mouse.MiddleButtonDoubleClick(); break; case Helpers.MouseClick.Right: simulator.Mouse.RightButtonDoubleClick(); break; } }
public MouseKeyHook() { _hook = Hook.GlobalEvents(); _hook.KeyUp += (S, E) => KeyUp?.Invoke(this, E); _hook.KeyDown += (S, E) => KeyDown?.Invoke(this, E); _hook.MouseUp += (S, E) => MouseUp?.Invoke(this, E); _hook.MouseDown += (S, E) => MouseDown?.Invoke(this, E); _hook.MouseClick += (S, E) => MouseClick?.Invoke(this, E); _hook.MouseDoubleClick += (S, E) => MouseDoubleClick?.Invoke(this, E); _hook.MouseWheel += (S, E) => MouseWheel?.Invoke(this, E); _hook.MouseMove += (S, E) => MouseMove?.Invoke(this, E); _hook.MouseDragStarted += (S, E) => MouseDragStarted?.Invoke(this, E); _hook.MouseDragFinished += (S, E) => MouseDragFinished?.Invoke(this, E); _hook.KeyPress += (S, E) => KeyPress?.Invoke(this, E); }
/// <summary> /// Проверяет изменения в ячейке и возвращает тип изменений (одиночное \ двойное) /// </summary> /// <param name="Click">Параметры щелчка мыши</param> /// <returns></returns> private CellChangies ChangiesStatus(MouseClick Click) { if (!Blocked & !Marked) { return(CellChangies.OneWay); } else { if (Blocked & Click == MouseClick.RightButton) { return(CellChangies.TwoWays); } if (Marked & Click == MouseClick.LeftButton) { return(CellChangies.TwoWays); } return(CellChangies.OneWay); } }
public void Update(InputStates bef) { // Input Variables to not reinitialize InputStates input = new InputStates( ); MouseClick mr = input.MouseReleased(bef); MouseClick mp = input.MousePressed(bef); if (Game.Vars["langChoose"] == "true") { // Check for LANGCHOOSE inputs if (input.KeyUp(bef, Keys.Enter)) { // Clicked confirm Game.Vars["LANG"] = "1"; Game.Vars["langChoose"] = "false"; Game.Vars.ToggleDebug("langChoose"); Game.RefreshLanguage( ); CL_Action?.Invoke( ); } if (mr.Button == MouseButton.LEFT) { int z = 0; foreach (StringDrawn s in languagesDrawn) { if (input.MouseRectangle.Intersects(s.Border ?? new Rectangle(0, 0, 0, 0))) { Game.Vars["LANG"] = $"{languagesIDs[z]}"; Game.Vars["langChoose"] = "false"; Game.Vars.ToggleDebug("langChoose"); Game.RefreshLanguage( ); CL_Action?.Invoke( ); } z++; } } } else { // Check Game.Vars["UpdateState"] to check what types of input to check } }
private float m_LeftDownListener = 0, m_RightDownListener = 0; //左右键按住监听 /// <summary> /// 按住不放攻击判断 /// </summary> /// <param name="MC">鼠标点击键</param> private void ShotContinueFire(MouseClick MC) { if (MC == MouseClick.MouseLeft) //左键 { if (Input.GetMouseButton(0)) //按住 { m_LeftDownListener += Time.deltaTime; if (m_LeftDownListener > CHICK_INTERVAL) //确认是长按 { LeftDowning = true; //确认是长按 LeftOnce = false; //确认不是按一下 } } if (LeftDowning && Input.GetMouseButtonUp(0))//抬起 { m_LeftDownListener = 0; LeftDownUping = true; LeftDowning = false; } } else if (MC == MouseClick.MouseRight) //右键 { if (Input.GetMouseButton(1)) //按住 { m_RightDownListener += Time.deltaTime; if (m_RightDownListener > CHICK_INTERVAL) //确认是长按 { RightDowning = true; //确认是长按 RightOnce = false; //确认不是按一下 } } if (RightDowning && Input.GetMouseButtonUp(1))//抬起 { m_RightDownListener = 0; RightDownUping = true; RightDowning = false; } } else if (MC == MouseClick.MouseMiddle) //中键 { } }
/// <summary> /// 点射(点一下)攻击判断 /// </summary> /// <param name="MC">鼠标点击键</param> private void ShotFixedFire(MouseClick MC) { if (MC == MouseClick.MouseLeft) //左键 { if (Input.GetMouseButtonDown(0)) { LeftOnce = true; } } else if (MC == MouseClick.MouseRight) //右键 { if (Input.GetMouseButtonDown(1)) { RightOnce = true; } } else if (MC == MouseClick.MouseMiddle) //中键 { } }
public void Update(KaroGameManager manager, MouseClick click) { IEnumerable<MoveWrapper> legalMoves = manager.FindLegalMoves(manager.CurrentPlayer); // See if there is any move with the same source as the clicked tile. MoveWrapper move = legalMoves.FirstOrDefault(m => m.GetFromCell() == new Vector2DWrapper(click.Position.X, click.Position.Y)); // Valid source piece clicked, save the move. if (move != null) { Debug.WriteLine("Valid source piece selected"); manager.CurrentMove = move; manager.ChangeState(PieceDestinationState.Instance); } else { Debug.WriteLine("Clicked tile does not have a moveable piece"); } }
protected override void OnUpdate(float dT) { Vector3 mousePos = Input.mousePosition; if (Input.touchCount > 0) { mousePos = Input.GetTouch(0).position; } WorldPos = Camera.main.ScreenToWorldPoint(mousePos); bool didClick = Input.GetButtonDown("Click"); bool clickHeld = Input.GetButton("Click") && Input.touchCount < 2; bool clickHandled = false; if (!clickHeld) { wasLastClickHandled = false; } if (didClick) { MouseClick clickObject = new MouseClick(); clickObject.pos = WorldPos; clickObject.hits = Physics2D.RaycastAll(WorldPos, Vector2.zero, 0.001f); Dispatch(responder => { if (!clickHandled) { responder.DidMouseClick(clickObject, ref clickHandled); } }); if (clickHandled) { wasLastClickHandled = true; } } if (clickHeld && !wasLastClickHandled) { MouseClick clickObject = new MouseClick(); clickObject.pos = WorldPos; Dispatch(responder => responder.DidMouseHeld(clickObject)); } }
public override void Update() { UpdateState(); if (_isPressed) { _sprite.Color = StateColors.ClickedColor ?? _sprite.Color; if (!_isPressedLastFrame) { MouseClick?.Invoke(_input.LastMouseButton); } } else if (_isHovered) { _sprite.Color = StateColors.HoveredColor ?? _sprite.Color; } else { _sprite.Color = StateColors.DefaultColor ?? _sprite.Color; } }
private void InitializeBackingControl(Control textBox) { textBox.AllowDrop = true; textBox.DragEnter += SETextBox_DragEnter; textBox.DragDrop += SETextBox_DragDrop; textBox.GotFocus += (sender, args) => { _gotFocusTicks = DateTime.UtcNow.Ticks; }; textBox.MouseDown += SETextBox_MouseDown; textBox.MouseUp += SETextBox_MouseUp; textBox.TextChanged += TextChangedHighlight; Controls.Add(textBox); textBox.Dock = DockStyle.Fill; textBox.Enter += (sender, args) => { BackColor = SystemColors.Highlight; }; textBox.Leave += (sender, args) => { BackColor = SystemColors.WindowFrame; }; textBox.TextChanged += (sender, args) => { TextChanged?.Invoke(sender, args); }; textBox.KeyDown += (sender, args) => { KeyDown?.Invoke(sender, args); }; textBox.MouseClick += (sender, args) => { MouseClick?.Invoke(sender, args); }; textBox.Enter += (sender, args) => { Enter?.Invoke(sender, args); }; textBox.KeyUp += (sender, args) => { KeyUp?.Invoke(sender, args); }; textBox.Leave += (sender, args) => { Leave?.Invoke(sender, args); }; textBox.MouseMove += (sender, args) => { MouseMove?.Invoke(sender, args); }; }
public int MouseHookProc(int nCode, IntPtr wParam, IntPtr lParam) { //Marshall the data from the callback. MouseHookStruct MyMouseHookStruct = (MouseHookStruct)Marshal.PtrToStructure(lParam, typeof(MouseHookStruct)); if (nCode < 0) { return(CallNextHookEx(hHook, nCode, wParam, lParam)); } if (MouseClick != null) { if (((long)wParam == 161 || (long)wParam == 163 || (long)wParam == 165)) { int x = lParam.ToInt32() & 0xFFFF; int y = (lParam.ToInt32() >> 16) & 0xFFFF; MouseEventArgs mea = new MouseEventArgs(MouseButtons.None, 0, x, y, 0); MouseClick.Invoke(null, mea); } } return(CallNextHookEx(hHook, nCode, wParam, lParam)); }
private static IntPtr HookCallback( int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0 && MouseMessages.WM_LBUTTONDOWN == (MouseMessages)wParam) { MSLLHOOKSTRUCT hookStruct = (MSLLHOOKSTRUCT)Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT)); MouseClickEventArgs e = new MouseClickEventArgs { Location = new Point(hookStruct.pt.x, hookStruct.pt.y) }; MouseClick?.Invoke(null, e); if (e.Handled == true) { return((IntPtr)1); } // Console.WriteLine(hookStruct.pt.x + ", " + hookStruct.pt.y); } return(CallNextHookEx(_hookID, nCode, wParam, lParam)); }
public static Boolean ClickItemInBag(int bag, int slot, MouseClick mouseClick) { Int32 MaxSlot = 16; if(bag == 1) { MaxSlot = Bag1.MaxSlot; } else if(bag == 2) { MaxSlot = Bag2.MaxSlot; } else if(bag == 3) { MaxSlot = Bag3.MaxSlot; } else if(bag == 4) { MaxSlot = Bag4.MaxSlot; } Int32 RealSlot = MaxSlot - ( slot - 1 ); var ContainerFrame1Item = MyWoW.Helpers.UIFrame.GetFrameByName("ContainerFrame" + ( bag + 1 ).ToString() + "Item" + RealSlot.ToString()); if(ContainerFrame1Item == null) { //CloseAllBags(); return false; } else if(!ContainerFrame1Item.IsVisible) { return false; } else { System.Threading.Thread.Sleep(250); switch(mouseClick) { case MouseClick.LEFT: ContainerFrame1Item.LeftClick(); break; case MouseClick.RIGHT: ContainerFrame1Item.RightClick(); break; default: break; } //CloseAllBags(); return true; } }
/// <summary> /// Moves the mouse to a control and sends the specified mouse click. /// </summary> /// <param name="control">The UI Automation element to click</param> /// <param name="clickType">Type of the click. <see cref="MouseClick"/></param> /// <exception cref="ProdOperationException">Examine inner exception</exception> public static void SendMouseClick(AutomationElement control, MouseClick clickType) { try { Point p = new Point((int)control.GetClickablePoint().X, (int)control.GetClickablePoint().Y); control.SetFocus(); InternalUtilities.MoveMouseToPoint(p); switch (clickType) { case MouseClick.Left: InternalUtilities.SendMouseInput(p.X, p.Y, 0, MOUSEEVENTF.MOUSEEVENTFLEFTDOWN | MOUSEEVENTF.MOUSEEVENTFABSOLUTE); InternalUtilities.SendMouseInput(p.X, p.Y, 0, MOUSEEVENTF.MOUSEEVENTFLEFTUP | MOUSEEVENTF.MOUSEEVENTFABSOLUTE); break; case MouseClick.Right: InternalUtilities.SendMouseInput(p.X, p.Y, 0, MOUSEEVENTF.MOUSEEVENTFRIGHTDOWN | MOUSEEVENTF.MOUSEEVENTFABSOLUTE); InternalUtilities.SendMouseInput(p.X, p.Y, 0, MOUSEEVENTF.MOUSEEVENTFRIGHTUP | MOUSEEVENTF.MOUSEEVENTFABSOLUTE); break; case MouseClick.Middle: InternalUtilities.SendMouseInput(p.X, p.Y, 0, MOUSEEVENTF.MOUSEEVENTFMIDDLEDOWN | MOUSEEVENTF.MOUSEEVENTFABSOLUTE); InternalUtilities.SendMouseInput(p.X, p.Y, 0, MOUSEEVENTF.MOUSEEVENTFMIDDLEUP | MOUSEEVENTF.MOUSEEVENTFABSOLUTE); break; default: throw new ArgumentOutOfRangeException("clickType"); } } catch (NoClickablePointException err) { throw new ProdOperationException(err.Message, err); } catch (ElementNotAvailableException err) { throw new ProdOperationException(err.Message, err); } }
private void Update() { if (Input.GetKeyDown(KeyCode.S)) { autoClick = true; } if (Input.GetKeyDown(KeyCode.D) || Input.GetKeyDown(KeyCode.Escape)) { autoClick = false; } if (Input.GetKeyDown(KeyCode.Alpha9) || Input.GetKeyDown(KeyCode.Keypad9)) { Vector2Int pos = MouseClick.GetMousePosition(); min = Vector2Int.Min(min, pos); max = Vector2Int.Max(max, pos); Vector2 posInView = MouseClick.GetMousePositionInView(); rectInView.min = Vector2.Min(rectInView.min, posInView); rectInView.max = Vector2.Max(rectInView.max, posInView); } if (Input.GetKeyDown(KeyCode.Alpha0) || Input.GetKeyDown(KeyCode.Keypad0)) { Vector2Int pos = MouseClick.GetMousePosition(); Vector2 posInView = MouseClick.GetMousePositionInView(); min = pos; max = pos; rectInView = new Rect(posInView, Vector2.zero); } if (autoClick && Application.isFocused) { MouseClick.Click(new Vector2Int( UnityEngine.Random.Range(min.x, max.x), UnityEngine.Random.Range(min.y, max.y))); } }
protected virtual void OnMouseClickCore(MouseClickEventArgs args) { if (args == null || args.Cancel) { return; } MouseClick?.Invoke(this, args); if (args.Cancel) { return; } foreach (var mouseClick in Renderables.OfType <ISupportMouseClick>()) { mouseClick.OnMouseClick(args); if (args.Cancel) { return; } } }
public static void CallClick() { try { while (true) { Random rnd = new Random(); // int time = rnd.Next(1, 2); MouseClick.LeftMouseClick(); // Thread.Sleep(2); } } catch (ThreadAbortException e) { MouseClick.LeftMouseRelease(); } finally { } }
public override void OnInspectorGUI() { if(myScript==null) myScript = (MouseClick)target; myScript.ChoiceIndex = EditorGUILayout.Popup("Mode", myScript.ChoiceIndex, myScript._choices); switch (myScript.ChoiceIndex) { case 1 : ParametorScale(); break; case 2: ParametorRotation(); break; case 3: ParametorDragDrop(); break; default: break; } DrawDefaultInspector(); }
public void Set(string mesaj) { mouse.MousePosX = Convert.ToInt32(mesaj.Split(",")[0]); mouse.MousePosY = Convert.ToInt32(mesaj.Split(",")[1]); mouse.IsMouseLeftClik = Convert.ToString(mesaj.Split(",")[2]); mouse.IsMouseRightClik = Convert.ToString(mesaj.Split(",")[3]); if (mouse.IsMouseLeftClik != "0") { MouseClick mouseClick = new MouseClick(); mouseClick.ClickMouseLeftPoint(); } if (mouse.IsMouseRightClik != "0") { MouseClick mouseClick = new MouseClick(); mouseClick.ClickMouseRightPoint(); } GetMousePosition getMousePosition = new GetMousePosition(); Console.WriteLine((int)Math.Abs(mouse.MousePosX - getMousePosition.GetCursorPosition().X) + "," + (int)Math.Abs(mouse.MousePosY - getMousePosition.GetCursorPosition().Y)); Console.WriteLine("Gelen mesaj: " + (int)Math.Abs(mouse.MousePosX - getMousePosition.GetCursorPosition().X) + "," + (int)Math.Abs(mouse.MousePosY - getMousePosition.GetCursorPosition().Y) + "," + mouse.IsMouseLeftClik); using (var mousemove = new MouseMove((int)Math.Abs(mouse.MousePosX + Window.OranSize().Item1), (int)Math.Abs(mouse.MousePosY + Window.OranSize().Item2))) { } }
public void Set(List <UserControl> selections, int selected = -1, MouseEnter enterFunc = null, MouseLeave leaveFunc = null, MouseClick clickFunc = null) { mSelections = selections; mEnterFunc = enterFunc; mLeaveFunc = leaveFunc; mClickFunc = clickFunc; for (int i = 0; i < mSelections.Count; i++) { mSelections[i].MouseEnter += new System.Windows.Input.MouseEventHandler(CompSelectionGroup_MouseEnter); mSelections[i].MouseLeave += new System.Windows.Input.MouseEventHandler(CompSelectionGroup_MouseLeave); mSelections[i].MouseDown += new System.Windows.Input.MouseButtonEventHandler(CompSelectionGroup_MouseDown); } mSelIdx = selected; if (mSelIdx > -1) { SetUISelected(mSelIdx); } }
/// <summary> /// Initializes a new instance of the <see cref="InputValue"/> struct. /// </summary> /// <param name="mouseClick"> /// The mouse click. /// </param> internal InputValue(MouseClick mouseClick) { this.value = mouseClick; }
/// <summary> /// ComputerState doesn't listen to clickevents. The entry method will /// do everything AI related. /// </summary> public void Update(KaroGameManager manager, MouseClick click) { }
/// <summary> /// Processes a mouse click. /// </summary> /// <param name="mouseClick"> /// The mouse click. /// </param> /// <returns> /// A value indicating whether the input operation terminated. /// </returns> protected virtual bool ProcessMouseClick(MouseClick mouseClick) { var zsciiClick = (Zscii)mouseClick.ClickType; if (this.ValidMouseClick(zsciiClick)) { this.WriteMouseClickPosition(mouseClick.ClickPosition); var inputOperation = this.InputOperation; if (inputOperation.ReadCharacter) { this.FinishInputCharacterOperation(new InputValue(mouseClick)); return true; } if (this.IsTerminator(zsciiClick)) { this.FinishInputLineOperation(inputOperation.InputText, new InputValue(mouseClick)); return true; } } return false; }
/// <summary> /// Determines whether two mouse clicks are equal. /// </summary> /// <param name="mouseClick"> /// The mouse click to compare. /// </param> /// <returns> /// A value indicating whether two mouse clicks are equal. /// </returns> public bool Equals(MouseClick mouseClick) { return this.clickType == mouseClick.clickType && this.clickPosition == mouseClick.clickPosition; }
/// <summary> /// Processes a mouse click. /// </summary> /// <param name="mouseClick"> /// The mouse click. /// </param> /// <returns> /// A value indicating whether the input operation terminated. /// </returns> protected override bool ProcessMouseClick(MouseClick mouseClick) { return this.MouseWindow.ContainsPosition(mouseClick.ClickPosition) && base.ProcessMouseClick(mouseClick); }
public void clickMouse(MouseClick click) { if (SetForegroundWindow(hwnd)) { switch (click) { case MouseClick.LEFT_CLICK: simulator.Mouse.LeftButtonClick(); break; case MouseClick.RIGHT_CLICK: simulator.Mouse.RightButtonClick(); break; default: break; } } }
/// <summary> /// Catches the mouse click activity. /// </summary> /// <param name="mouse">The mouse.</param> public void CatchMouseClickActivity(MouseClick mouse) { mouse.Catched = true; mouse.StateString = judge.CurState.ToString(); judge.ResetDormantTimer(); }
/// <summary> /// Perfoms a specified button click. /// </summary> /// <param name="button"> The type of click event to invoke. </param> public void PerformClick(MouseClick button = MouseClick.Default) { switch (button) { case MouseClick.Default: base.PerformClick(); return; case MouseClick.Left: Invoke(LeftClick, this, GetMouseEventArgs()); return; case MouseClick.Right: Invoke(RightClick, this, GetMouseEventArgs()); return; case MouseClick.Double: Invoke(DoubleClick, this, GetMouseEventArgs()); return; } }
void Awake() { mouseClick = GameObject.FindObjectOfType<MouseClick>() as MouseClick; corp = GameObject.FindObjectOfType<Corp>() as Corp; gameController = GameObject.FindObjectOfType<GameController>() as GameController; }