void ProcessClick() { //Get the 2D colliders hit by the cam ray Ray camRay = m_cam.ScreenPointToRay(Input.mousePosition); RaycastHit2D hit = Physics2D.GetRayIntersection(camRay); //If any ui element hit if (eventSystem.IsPointerOverGameObject()) { onMouseClick.Invoke(ClickType.UI, hit.rigidbody); } //if something with a rigibody is hit else if (hit.rigidbody != null) { onMouseClick.Invoke(ClickType.Character, hit.rigidbody); } else if (hit.collider != null && hit.collider.tag == "Ground") { onMouseClick.Invoke(ClickType.World, null); } else if (hit.collider != null && hit.collider.tag == "Water") { onMouseClick.Invoke(ClickType.Water, null); } else { onMouseClick.Invoke(ClickType.Sky, null); } }
public void render(Vector2 wndSize) { Color last = GUI.backgroundColor; if (bound) { GUI.backgroundColor = Color.black; } EditorGUI.BeginDisabledGroup(disabled); EditorGUILayout.BeginHorizontal(GUILayout.Height(25f)); if (type == Type.Input) { if (GUILayout.Button("", GUILayout.Width(10), GUILayout.Height(10))) { onClick.Invoke(this); } position = parent.pos + new Vector2(5f, 27f * (index + 1)); EditorGUILayout.LabelField(text, GUILayout.Width(wndSize.x / 2 - 20f)); } else if (type == Type.Output) { EditorGUILayout.LabelField(text, NodeGrid.rightLabel, GUILayout.Width(wndSize.x / 2 - 23f)); if (GUILayout.Button("", GUILayout.Width(10), GUILayout.Height(10))) { onClick.Invoke(this); } position = parent.pos + new Vector2(wndSize.x - 5f, 27f * (index + 1)); } EditorGUILayout.EndHorizontal(); EditorGUI.EndDisabledGroup(); GUI.backgroundColor = last; }
public void Click() { // изменяем р-р и цвет если надо //if (clickButtonDelegate!=null) //clickButtonDelegate(new OurButtonEventArgs()); ClickEvent?.Invoke(new OurButtonEventArgs()); }
private void ShowPictures() { try { if (picInfoList.Count == 0) { return; } var picInfo = picInfoList[picIndex]; if (File.Exists(picInfo.FullName)) { var currentGirl = Image.FromStream(new MemoryStream(File.ReadAllBytes(picInfo.FullName))); instance.PicPanel.BackgroundImage = currentGirl; ClickEvent?.Invoke(new Notify { Command = 2, ImageUrl = currentGirl }); } FormMain.Instance.CloseDialogTimerReset(); } catch { } }
private void command_Click(object sender, EventArgs e) { int.TryParse(((Label)sender).AccessibleName, out var cmd); //领导批示 if (cmd == 2) { ShowDialogProcess(FormLeadGuide.Instance); } //税收宣传 else if (cmd == 4) { ShowDialogProcess(FormTaxPublicity.Instance); } //区局十大事件 else if (cmd == 5) { ShowDialogProcess(FormBigEvent.Instance); } //区局内网 else if (cmd == 6) { ShowDialogProcess(FormNetInner.Instance); } else { ClickEvent?.Invoke(new Notify { Command = cmd }); } }
public void OnPointerClick(PointerEventData eventData) { if (onClick != null) { onClick.Invoke(this); } }
public override void Update(GameTime gameTime) { var mouseState = Mouse.GetState(); var mousePos = new Vector2(mouseState.X, mouseState.Y); if (mouseState.LeftButton == ButtonState.Pressed) { if (BoundingBox.Intersects(new Rectangle((int)Camera.GetWorldPosition(mousePos).X, (int)Camera.GetWorldPosition(mousePos).Y, 1, 1))) { _pressed = true; } else { _pressed = false; } _previousUpdateMouseDown = true; } //click if (mouseState.LeftButton == ButtonState.Released && _previousUpdateMouseDown) { if (_pressed) { ClickEvent?.Invoke(this, null); //Debug.WriteLine("CLICK ON BUTTON"); } } if (mouseState.LeftButton == ButtonState.Released) { _previousUpdateMouseDown = false; } }
private void ButtonImage_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (ClickEvent != null) { ClickEvent.Invoke(); } }
private void OnClickInternal(ClickEventArgs eventArgs) { Command?.Execute(CommandParameter); OnClick(eventArgs); Extension?.OnClick(this, eventArgs); ClickEvent?.Invoke(this, eventArgs); }
// After mouse released private void FloatButton_Click(object sender, RoutedEventArgs e) { tokenSource.Cancel(); tokenSource = new CancellationTokenSource(); CancellationToken cancelToken = tokenSource.Token; if (newPos.Equals(oldPos)) { // Fire MouseClickEvent, no use for me ClickEvent?.Invoke(sender, e); } else { // Disable flyout popup e.Handled = true; } Task.Run(async() => { await Task.Delay(5000).ConfigureAwait(false); Application.Current.Dispatcher.Invoke(() => { if (move == false && !cancelToken.IsCancellationRequested) { FloatButton.Opacity = opacityValue; } }); }, cancelToken); }
public void OnPointerClick(PointerEventData eventData) { if (eventData.button != PointerEventData.InputButton.Left) { return; } Vector2 lp; //eventData.position是屏幕坐标下的位置。 RectTransformUtility.ScreenPointToLocalPointInRectangle(rectTransform, eventData.position, eventData.pressEventCamera, out lp); foreach (var hrefInfo in m_HrefInfos) { var boxes = hrefInfo.boxes; for (var i = 0; i < boxes.Count; ++i) { if (boxes[i].Contains(lp)) { m_OnClick.Invoke(hrefInfo.parameter); //print(hrefInfo.content); //print(hrefInfo.parameter); return; } } } }
//变换也修改的样式 private void btn_switch_Click(object sender, EventArgs e) { if (isModifing) { //那就保存 //通过委托把要修改的东西传出去 ClickEvent?.Invoke(0, new [] { eName, tb_weihao.Text, tb_count.Text }); tb_weihao.Enabled = false; tb_count.Enabled = false; btn_switch.Text = "/"; if (!tb_ePrice.Text.Equals("未知")) { tb_zongJia.Text = (float.Parse(eCount) * int.Parse(eCount)).ToString(); } isModifing = false; } else { //那就进入修改模式 tb_weihao.Enabled = true; tb_weihao.Focus(); tb_count.Enabled = true; btn_switch.Text = "√"; isModifing = true; } }
void Update() { if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out var hit, 50, clickableLayer.value)) { if (hit.collider.gameObject.CompareTag("Doorway")) { Cursor.SetCursor(doorway, new Vector2(16, 16), CursorMode.Auto); } else if (hit.collider.gameObject.CompareTag("Item")) { Cursor.SetCursor(item, new Vector2(16, 16), CursorMode.Auto); } else { Cursor.SetCursor(target, new Vector2(16, 16), CursorMode.Auto); } if (Input.GetMouseButtonDown(0)) { if (Vector3.Distance(hit.point, _player.transform.position) < interactionDistance) { if (hit.collider.gameObject.CompareTag("PickableItem")) { InventoryMenu.Instance.AddObject(hit.collider.gameObject); } onClickEnvironment.Invoke(hit.collider.gameObject.transform.position); } else { _player.GetComponent <NavMeshAgent>().destination = hit.point; } } }
private void UpdateTile(float x, float z) { var coords = GetCoordinatesFromPosition(x, z); OnClick?.Invoke(mGridNodes[coords.x, coords.z]); Debug.Log($"X: {coords.x} | Z: {coords.z}"); }
private void OnMouseUpAsButton() { if (!clicked) { clicked = true; onClick.Invoke(); } }
public virtual void OnPointerClick(PointerEventData eventData) { eventData.Use(); if (RestrictClickDuration) { var clickDuration = (DateTime.UtcNow - _downTime).TotalMilliseconds; if (clickDuration < MaxClickDuration) { _onClick.Invoke(eventData); } } else { _onClick.Invoke(eventData); } }
/// <summary> /// Handles button clicks /// </summary> /// <param name="keyInfo">ConsoleKeyInfo instance</param> public override void OnKeyPress(ConsoleKeyInfo keyInfo) { switch (keyInfo.Key) { case ConsoleKey.Enter: ClickEvent?.Invoke(this); break; } }
public void OnPointerDown(PointerEventData p) { Debug.Log("CLICK"); go = true; startingTime = Time.time; progress = 0f; startClickEvent.Invoke(); }
public void OnClickEvent() { if (index < 0 || clickEvent == null) { return; } clickEvent.Invoke(index); }
public void Initialize(Station data) { _data = data; GetComponentInChildren <Text>().text = name = _data.Name; _btn = GetComponent <Button>(); _btn.onClick.AddListener(() => OnClick.Invoke(this)); }
public void OnPointerClick(PointerEventData eventData) { //po wykryciu kliknięcia, event onClick i przekaż wszystkie dane kliknięcia //skrypt który jest podpiętu może sam sprawdzić czy to lewy czy prawy przycisk if (onClick != null) { onClick.Invoke(eventData); } }
public void OnPointerUp(PointerEventData p) { Debug.Log("UP TO LATE"); if (go) { midClickEvent.Invoke(); go = false; } }
public void OnClick() { //way to pass in multipel args clearly myCustomArgs myCustomArgs = new myCustomArgs(); myCustomArgs.Name = "Mimi"; myCustomArgs.num = 19; //runs all events named clickEvent ClickEvent?.Invoke(this, myCustomArgs); }
void ClickCallback(Vehicle car) { onClick.Invoke(car); //car.rigidbody.AddForce(Vector3.up * 5, ForceMode.VelocityChange); var position = car.transform.position; position.y = 1; car.transform.position = position; }
public static void Start() { if (!Run) { Run = true; IntPtr handleIn = GetStdHandle(STD_INPUT_HANDLE); new Thread(() => { while (true) { uint numRead = 0; INPUT_RECORD[] record = new INPUT_RECORD[1]; record[0] = new INPUT_RECORD(); ReadConsoleInput(handleIn, record, 1, ref numRead); if (Run) { switch (record[0].EventType) { case INPUT_RECORD.MOUSE_EVENT: MouseEvent?.Invoke(record[0].MouseEvent); switch (record[0].MouseEvent.dwButtonState) { case MOUSE_EVENT_RECORD.FROM_LEFT_1ST_BUTTON_PRESSED: ClickEvent?.Invoke(record[0].MouseEvent); break; case MOUSE_EVENT_RECORD.SCROLLED_UP: ScrollUpEvent?.Invoke(record[0].MouseEvent); break; case MOUSE_EVENT_RECORD.SCROLLED_DOWN: ScrollDownEvent?.Invoke(record[0].MouseEvent); break; } break; case INPUT_RECORD.KEY_EVENT: KeyEvent?.Invoke(record[0].KeyEvent); break; case INPUT_RECORD.WINDOW_BUFFER_SIZE_EVENT: WindowBufferSizeEvent?.Invoke(record[0].WindowBufferSizeEvent); break; } } else { uint numWritten = 0; WriteConsoleInput(handleIn, record, 1, ref numWritten); return; } } }).Start(); } }
private void OnClickedInternal(ClickedEventArgs eventArgs) { Command?.Execute(CommandParameter); OnClicked(eventArgs); Extension?.OnClicked(this, eventArgs); ClickEventArgs nestedEventArgs = new ClickEventArgs(); ClickEvent?.Invoke(this, nestedEventArgs); Clicked?.Invoke(this, eventArgs); }
private void ThumbPlay_Click(object sender, EventArgs e) { var thumbPlay = (PictureBox)sender; var sourceUrl = thumbPlay.Tag?.ToString(); ClickEvent?.Invoke(new Notify { Command = 4, VideoUrl = sourceUrl }); }
public void OnPointerClick(PointerEventData eventData) { if (onClick != null) { onClick.Invoke(); } if (passEvent) { UITools.Instance.PassPointerEvent(eventData, ExecuteEvents.pointerClickHandler); } }
public void OnPointerDown(PointerEventData eventData) { int linkIndex = TMP_TextUtilities.FindIntersectingLink(tmpText, Input.mousePosition, _camera); Debug.Log($"Click Index: {linkIndex}"); if (linkIndex != -1) { TMP_LinkInfo linkInfo = tmpText.textInfo.linkInfo[linkIndex]; onLinkClicked.Invoke(linkInfo.GetLinkID()); } }
private void Thumb_Click(object sender, EventArgs e) { FormMain.Instance.CloseDialogTimerReset(); var thumb = (PictureBox)sender; ClickEvent?.Invoke(new Notify { Command = 5, ImageUrl = thumb.BackgroundImage }); }