private void OnPointerDown(UIPointerEventArgs e) { BsJsInterop.SetPointerCapture(jsRuntimeCurrent, bSplitter.bsbSettings.ID, e.PointerId); DragMode = true; if (bsSettings.IsDiagonal) { bSplitter.PreviousPosition = (int)e.ClientX; bSplitter.PreviousPosition2 = (int)e.ClientY; } else { if (bsSettings.VerticalOrHorizontal) { bSplitter.PreviousPosition = (int)e.ClientY; bSplitter.PreviousPosition2 = (int)e.ClientX; } else { bSplitter.PreviousPosition = (int)e.ClientX; bSplitter.PreviousPosition2 = (int)e.ClientY; } } OnDragStart?.Invoke(bSplitter.bsbSettings.index, (int)e.ClientX, (int)e.ClientY); }
public virtual void OnUIPointerElementDragStart(UIPointerEventArgs e) { if (UIPointerElementDragStart != null) { UIPointerElementDragStart(this, e); } }
private void OnPointerUp(UIPointerEventArgs e) { BsJsInterop.releasePointerCapture(jsRuntimeCurrent, bSplitter.bsbSettings.ID, e.PointerId); DragMode = false; OnDragEnd?.Invoke(bSplitter.bsbSettings.index, (int)e.ClientX, (int)e.ClientY); }
public virtual void OnUIPointerElementDragEnd(UIPointerEventArgs e) { if (UIPointerElementDragEnd != null) { UIPointerElementDragEnd(this, e); } }
public void OnUIPointerElementClick(object sender, UIPointerEventArgs e) { //添加手柄震动效果 VRTK_ControllerReference controllerReference = new VRTK_ControllerReference(SDK_BaseController.ControllerHand.Right); VRTK_ControllerHaptics.TriggerHapticPulse(controllerReference, 0.1f, 0.1f, 0.01f); }
private void HandleTriggerClicked(object sender, UIPointerEventArgs e) { if (EventSystem.current.currentSelectedGameObject != null) { ExecuteEvents.Execute(EventSystem.current.currentSelectedGameObject, new PointerEventData(EventSystem.current), ExecuteEvents.submitHandler); } }
private void OnPointerMove(UIPointerEventArgs e) { if (DragMode) { if (e.Buttons == 1) { int NewPosition; int NewPosition2; if (_parent.bsbScrollbar.bsbSettings.VerticalOrHorizontal) { NewPosition = (int)e.ClientY; NewPosition2 = (int)e.ClientX; } else { NewPosition = (int)e.ClientX; NewPosition2 = (int)e.ClientY; } if (Math.Abs(bsbThumb.PreviousPosition2 - NewPosition2) < 300) //300 is outside limit { if (bsbThumb.PreviousPosition != NewPosition) { _parent.bsbScrollbar.ThumbMove(NewPosition - bsbThumb.PreviousPosition); bsbThumb.PreviousPosition = NewPosition; } } //else //{ // BsbJsInterop.StopDrag(bsbThumb.id); //} } } }
public void HandlePointerOut(object sender, UIPointerEventArgs e) { VRTK_Logger.Info("UI Pointer exited " + e.previousTarget.name + " on Controller index [" + VRTK_ControllerReference.GetRealIndex(e.controllerReference) + "] and the state was " + e.isActive); if (GetComponent <VRTK_Pointer>()) { GetComponent <VRTK_Pointer>().Toggle(false); } }
public void HandlePointerIn(object sender, UIPointerEventArgs e) { print("UI Pointer entered " + e.currentTarget.name + " on Controller index [" + VRTK_ControllerReference.GetRealIndex(e.controllerReference) + "] and the state was " + e.isActive + " ### World Position: " + e.raycastResult.worldPosition); if (GetComponent <VRTK_Pointer>()) { GetComponent <VRTK_Pointer>().Toggle(true); } }
private void VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementExit(object sender, UIPointerEventArgs e) { Debug.Log("UI Pointer exited " + e.previousTarget.name + " on Controller index [" + e.controllerIndex + "] and the state was " + e.isActive); if (togglePointerOnHit && GetComponent<VRTK_SimplePointer>()) { GetComponent<VRTK_SimplePointer>().ToggleBeam(false); } }
private void UIPointerElementDragEnd(object o, UIPointerEventArgs e) { OnUIPointerElementDragEnd.Invoke(o, e); if (debug) { Debug.Log("<Color=yellow>UIPointerElementDragEnd: </Color>\n" + e); } }
private void OnPointerMove(UIPointerEventArgs e) { if (DragMode) { if (e.Buttons == 1) { int NewPosition = 0; int NewPosition2 = 0; if (bsSettings.IsDiagonal) { NewPosition = (int)e.ClientX; NewPosition2 = (int)e.ClientY; if (bSplitter.PreviousPosition != NewPosition || bSplitter.PreviousPosition2 != NewPosition2) { OnDiagonalPositionChange?.Invoke(bsSettings.index, NewPosition - bSplitter.PreviousPosition, NewPosition2 - bSplitter.PreviousPosition2); bSplitter.PreviousPosition = NewPosition; bSplitter.PreviousPosition2 = NewPosition2; } } else { if (bsSettings.VerticalOrHorizontal) { NewPosition = (int)e.ClientY; NewPosition2 = (int)e.ClientX; } else { NewPosition = (int)e.ClientX; NewPosition2 = (int)e.ClientY; } if (Math.Abs(bSplitter.PreviousPosition2 - NewPosition2) < 100) { if (bSplitter.PreviousPosition != NewPosition) { OnPositionChange?.Invoke(bsSettings.VerticalOrHorizontal, bsSettings.index, NewPosition - bSplitter.PreviousPosition); bSplitter.PreviousPosition = NewPosition; } } //else //{ // //BsJsInterop.StopDrag(bSplitter.bsbSettings.ID); //} } } } }
public void OnUIElementClicked(object o, UIPointerEventArgs e) { Debug.Log(e.currentTarget.name + " clicked"); if (e.currentTarget.name == "InputField") { SetTarget(e.currentTarget.GetComponent <InputField>()); targetObject = e.currentTarget; uiController.Show(); } }
public void HandleTriggerClicked(object sender, UIPointerEventArgs e) { print("Clicked" + e.currentTarget.name + "UIPointerArgs"); if (GameObject.Find("[VRTK][AUTOGEN][RightController][StraightPointerRenderer_Cursor]") != null) { if (!GameObject.Find("[VRTK][AUTOGEN][RightController][StraightPointerRenderer_Cursor]").GetComponent <cursordebug>()) { GameObject.Find("[VRTK][AUTOGEN][RightController][StraightPointerRenderer_Cursor]").AddComponent <cursordebug>(); } } }
public virtual void OnUIPointerElementExit(UIPointerEventArgs e) { if (e.previousTarget == currentTarget) { ResetHoverTimer(); } if (UIPointerElementExit != null) { UIPointerElementExit(this, e); } }
private void HandlePointerOut(object sender, UIPointerEventArgs e) { // var button = e.previousTarget.GetComponent<Button>(); // if (button != null) //{ EventSystem.current.SetSelectedGameObject(null); //Debug.Log("HandlePointerOut"); // } }
public virtual void OnUIPointerElementExit(UIPointerEventArgs e) { if (UIPointerElementExit != null) { UIPointerElementExit(this, e); if (!e.isActive && e.previousTarget) { pointerEventData.pointerPress = e.previousTarget; } } }
public virtual void OnUIPointerElementClick(UIPointerEventArgs e) { if (e.currentTarget == currentTarget) { ResetHoverTimer(); } if (UIPointerElementClick != null) { UIPointerElementClick(this, e); } }
public void OnDirectoryClick(object object_inp, UIPointerEventArgs args) { GameObject clickedObject = args.currentTarget; if (clickedObject.name.Contains("DirectoryItem")) { string clickedDirectoryName = clickedObject.GetComponentInChildren <Text>().text; Instance.currentDirectoryPath = Instance.directoryItems.First(entry => entry.Key.GetComponentInChildren <Text>().text == clickedDirectoryName).Value; Instance.fileText.text = ""; UpdateFileBrowser(); } }
public virtual void OnUIPointerElementEnter(UIPointerEventArgs e) { if (e.currentTarget != currentTarget) { ResetHoverTimer(); } currentTarget = e.currentTarget; if (UIPointerElementEnter != null) { UIPointerElementEnter(this, e); } }
private void OnPointerDown(UIPointerEventArgs e) { BsbJsInterop.SetPointerCapture(jsRuntimeCurrent, bsbThumb.id, e.PointerId); DragMode = true; if (_parent.bsbScrollbar.bsbSettings.VerticalOrHorizontal) { bsbThumb.PreviousPosition = (int)e.ClientY; bsbThumb.PreviousPosition2 = (int)e.ClientX; } else { bsbThumb.PreviousPosition = (int)e.ClientX; bsbThumb.PreviousPosition2 = (int)e.ClientY; } }
public virtual void OnUIPointerElementExit(UIPointerEventArgs e) { if (e.previousTarget == currentTarget) { ResetHoverTimer(); } if (UIPointerElementExit != null) { UIPointerElementExit(this, e); if (attemptClickOnDeactivate && !e.isActive && e.previousTarget) { pointerEventData.pointerPress = e.previousTarget; } } }
public virtual void OnUIPointerElementEnter(UIPointerEventArgs e) { if (e.currentTarget != currentTarget) { ResetHoverTimer(); } if (clickAfterHoverDuration > 0f && hoverDurationTimer <= 0f) { canClickOnHover = true; hoverDurationTimer = clickAfterHoverDuration; } currentTarget = e.currentTarget; if (UIPointerElementEnter != null) { UIPointerElementEnter(this, e); } }
public void OnFileClick(object object_inp, UIPointerEventArgs args) { GameObject clickedObject = args.currentTarget; if (clickedObject.name.Contains("FileItem")) { string clickedDirectoryName = clickedObject.GetComponentInChildren <Text>().text; Instance.currentFilePath = Instance.fileItems.First(entry => entry.Key.GetComponentInChildren <Text>().text == clickedDirectoryName).Value; if (Instance.fileText.text == Instance.currentFilePath) { Instance.fileText.text = ""; } else { Instance.fileText.text = Instance.currentFilePath; } } }
public void OnInputfieldClick(object objectInp, UIPointerEventArgs args) { GameObject clickedObject = args.currentTarget; if (MenuManager.Instance.menuStack.Peek() != Instance) { //this menu is not visible return; } InputField clickedInputField = clickedObject.GetComponent <InputField>(); if (clickedInputField != null) { currentInputfield = clickedInputField; string userInput = "Enter the desired Value!"; NumPad.Show(FillInputfield, userInput); } }
private void HandlePointerIn(object sender, UIPointerEventArgs e) { var button = e.currentTarget.GetComponent <Button>(); if (button != null) { button.Select(); // EventSystem.current.SetSelectedGameObject(null); // button.Select(); // EventSystem.current.SetSelectedGameObject(e.currentTarget); // button.Select(); //Debug.Log("HandlePointerIn", e.currentTarget.gameObject); } else { //print("Button " + e.currentTarget.gameObject.name + " is null"); } }
public void OnInputFieldClick(object obj, UIPointerEventArgs args) { GameObject clickedObject = args.currentTarget; if (MenuManager.Instance.menuStack.Peek() != Instance) { //this menu is not visible return; } InputField clickedInputField = clickedObject.GetComponent <InputField>(); if (clickedInputField != null) { if (clickedInputField.name.Contains("ID")) { NumPad.Show(EditID, "Set desired ID!"); } else if (clickedInputField.name.Contains("Name")) { KeyboardManager.Show(EditName, "Set desired Name!"); } } }
private void VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementDragEnd(object sender, UIPointerEventArgs e) { VRTK_Logger.Info("UI Pointer stopped dragging " + e.currentTarget.name + " on Controller index [" + VRTK_ControllerReference.GetRealIndex(e.controllerReference) + "] and the state was " + e.isActive + " ### World Position: " + e.raycastResult.worldPosition); }
private void VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementExit(object sender, UIPointerEventArgs e) { VRTK_Logger.Info("UI Pointer exited " + e.previousTarget.name + " on Controller index [" + VRTK_ControllerReference.GetRealIndex(e.controllerReference) + "] and the state was " + e.isActive); if (togglePointerOnHit && GetComponent <VRTK_Pointer>()) { GetComponent <VRTK_Pointer>().Toggle(false); } }
private void VRTK_ControllerUIPointerEvents_ListenerExample_UIPointerElementEnter(object sender, UIPointerEventArgs e) { //VRTK_Logger.Info("UI Pointer entered " + e.currentTarget.name + " on Controller index [" + VRTK_ControllerReference.GetRealIndex(e.controllerReference) + "] and the state was " + e.isActive + " ### World Position: " + e.raycastResult.worldPosition); if (togglePointerOnHit && GetComponent <VRTK_Pointer>()) { GetComponent <VRTK_Pointer>().Toggle(true); } }
private void UIPointerElementExit(object o, UIPointerEventArgs e) { OnUIPointerElementExit.Invoke(e); }