void HandleTouchpad_TileOperation_PressDown(TouchpadDirection touchpadDirection) { switch (touchpadDirection) { case TouchpadDirection.Up: EnableDepthOcclusion(!occlusionEnabled); SetUI_ToTileSpawn(); break; case TouchpadDirection.Left: if (!isTriggerDown) { TileSpawnerScript.RotateFloatingTile(10.0f); } break; case TouchpadDirection.Right: if (!isTriggerDown) { TileSpawnerScript.RotateFloatingTile(-10.0f); } break; case TouchpadDirection.Down: dartGeneratorMgr.DestroyObjs(); TileSpawnerScript.ClearTiles(); break; } }
public void handleTouchpad_Play(ButtonStage buttonStage, Vector2 axis) { TouchpadDirection touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, false); switch (buttonStage) { case ButtonStage.PressDown: switch (touchpadDirection) { case TouchpadDirection.Up: this.DelayOneFrame(() => { if (isOn) { StaticMeshScript.ClearHintLocators(); PortalScript.PortalManager.gameObject.SetActive(true); ViveSR_DualCameraRig.Instance.VirtualCamera.cullingMask &= ~(1 << LayerMask.NameToLayer("UI")); PortalScript.PortalManager.TurnOnCamera(); portalCamerasEnabledEvent.Invoke(); Transform controller_fwd = PlayerHandUILaserPointer.LaserPointer.gameObject.transform; npcGenerator.Play(controller_fwd.position + controller_fwd.forward * 8, controller_fwd.forward, MR_Chairs); } }); break; } break; } }
public ControllerInputIndex GetCurrentSprite(Vector2 axis) { TouchpadDirection touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, true); switch (touchpadDirection) { case TouchpadDirection.Mid: currentInput = ControllerInputIndex.mid; break; case TouchpadDirection.Right: currentInput = ControllerInputIndex.right; break; case TouchpadDirection.Left: currentInput = ControllerInputIndex.left; break; case TouchpadDirection.Up: currentInput = ControllerInputIndex.up; break; case TouchpadDirection.Down: currentInput = ControllerInputIndex.down; break; } return(currentInput); }
public void StartAnimate(TouchpadDirection inputIndex) { mat.SetInt("_TouchpadDirection", (int)inputIndex); mat.SetFloat("_Animation", 0); if (!isAnimationOn) { StartCoroutine(Animate(inputIndex)); } }
public void SetColor(TouchpadDirection index, Color color) { touchpadImageColors[((int)index) - 1] = color; if (mat == null) { setMat(); } mat.SetColorArray("_colorArray", touchpadImageColors); }
void HandleTouchpadInput_SubMenu(ButtonStage buttonStage, Vector2 axis) { if (isSubMenuOn) { touchpadDirection_prev = touchpadDirection; touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, true); #region VIVEPro if (ViveSR_Experience.instance.CurrentDevice == DeviceType.Vive) { switch (buttonStage) { case ButtonStage.PressDown: if (touchpadDirection == TouchpadDirection.Mid) { Execute(); } if (AllowHover()) { switch (touchpadDirection) { case TouchpadDirection.Up: HoverBtn(false); break; case TouchpadDirection.Down: HoverBtn(true); break; } } break; } } #endregion #region VIVET2 else if (ViveSR_Experience.instance.CurrentDevice == DeviceType.ViveT2) { switch (buttonStage) { case ButtonStage.PressDown: if (touchpadDirection == TouchpadDirection.Mid) { Execute(); } break; } if (AllowHover() && touchpadDirection != touchpadDirection_prev) { switch (touchpadDirection) { case TouchpadDirection.Up: HoverBtn(false); break; case TouchpadDirection.Down: HoverBtn(true); break; } } } #endregion } }
void HandleTouchpad_ResetCameraControlPanel_PressUp(TouchpadDirection touchpadDirection) { isTouchpadDown = false; ViveSR_Experience_HintMessage.instance.SetHintMessage(hintType.onController, "", false); ViveSR_Experience_ControllerDelegate.triggerDelegate += HandleTrigger_AdjustCameraControlSliders; if (!isTriggerDown) { ViveSR_Experience_Demo.instance.Rotator.RenderButtons(true); } }
public void handleTouchpad_MRChair(ButtonStage buttonStage, Vector2 axis) { switch (buttonStage) { case ButtonStage.PressDown: TouchpadDirection touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, false); handleTouchpad_MRChair_Pressdown(touchpadDirection); break; } }
void HandleTouchpad_DartControl(ButtonStage buttonStage, Vector2 axis) { switch (buttonStage) { case ButtonStage.PressDown: TouchpadDirection touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, false); HandleTouchpad_DartControl_PressDown(touchpadDirection); break; } }
public static TouchpadDirection GetTouchpadDirection(Vector2 axis, bool includeMid) { float deg; TouchpadDirection touchpadDirection = TouchpadDirection.None; if (includeMid & Vector2.Distance(axis, Vector2.zero) < 0.5f) { return(TouchpadDirection.Mid); } if (axis.x == 0) { deg = axis.y >= 0 ? 90 : -90; } else { deg = Mathf.Atan(axis.y / axis.x) * Mathf.Rad2Deg; } if (axis.x >= 0) { if (deg >= 45f) { touchpadDirection = TouchpadDirection.Up; } else if (deg < 45f && deg > -45) { touchpadDirection = TouchpadDirection.Right; } else if (deg <= -45) { touchpadDirection = TouchpadDirection.Down; } } else { if (deg >= 45f) { touchpadDirection = TouchpadDirection.Down; } else if (deg < 45f && deg > -45) { touchpadDirection = TouchpadDirection.Left; } else if (deg <= -45) { touchpadDirection = TouchpadDirection.Up; } } return(touchpadDirection); }
void HandleTouchpad_ResetCameraControlPanel_PressDown(TouchpadDirection touchpadDirection) { switch (touchpadDirection) { case TouchpadDirection.Up: isTouchpadDown = true; ViveSR_Experience_HintMessage.instance.SetHintMessage(hintType.onController, "[Camera Control]\nMove the Panel", false); ViveSR_Experience_ControllerDelegate.triggerDelegate -= HandleTrigger_AdjustCameraControlSliders; ViveSR_Experience_Demo.instance.Rotator.RenderButtons(false); StartCoroutine(ResetPanelPos()); break; } }
void HandleTouchpad_ControlPortal_PressDown(TouchpadDirection touchpadDirection) { switch (touchpadDirection) { case TouchpadDirection.Up: PortalScript.ResetPortalPosition(); break; case TouchpadDirection.Down: dartGenerator.DestroyObjs(); break; } }
void HandleTouchpad_MeshOperation_PressDown(TouchpadDirection touchpadDirection) { switch (touchpadDirection) { case TouchpadDirection.Up: Scan(); break; case TouchpadDirection.Left: StopAndReset(); break; case TouchpadDirection.Right: Save(); break; case TouchpadDirection.Down: Load(); break; } }
void handleTouchpad_MRChair_Pressdown(TouchpadDirection touchpadDirection) { switch (touchpadDirection) { case TouchpadDirection.Up: Scan(); break; case TouchpadDirection.Left: StopAndReset(); break; case TouchpadDirection.Right: CheckAndSave(); break; case TouchpadDirection.Down: Play(); break; } }
void HandleTouchpad_DartControl_PressDown(TouchpadDirection touchpadDirection) { switch (touchpadDirection) { case TouchpadDirection.Up: dartPlaceMentmode = dartPlaceMentmode == DartPlacementMode.Raycast ? DartPlacementMode.Throwable : DartPlacementMode.Raycast; SetUI_DartGeneratorType(); break; case TouchpadDirection.Down: dartGeneratorMgr.DestroyObjs(); break; } }
public IEnumerator Animate(TouchpadDirection index) { isAnimationOn = true; mat.SetFloat("_Animation", 0); while (isAnimationOn) { float stripValue = mat.GetFloat("_Animation"); mat.SetFloat("_Animation", stripValue >= 1 ? 0 : (stripValue + 5f * Time.deltaTime)); yield return(new WaitForSeconds(0.1f)); } mat.SetFloat("_Animation", 0); ResetSprite(); }
void HandleTouchpad_ColliderOperation_PressDown(TouchpadDirection touchpadDirection) { switch (touchpadDirection) { case TouchpadDirection.Up: ShowMode newShowMode = StaticMeshScript.MeshShowMode == ShowMode.None ? ShowMode.All : ShowMode.None; StaticMeshScript.SwitchShowCollider(newShowMode); break; case TouchpadDirection.Left: MoveToPreviousShowMode(); break; case TouchpadDirection.Right: MoveToNextShowMode(); SetUI_ToColliderDisplay(); break; } }
private void HandleTouchpad_MeshOperation(ButtonStage buttonStage, Vector2 axis) { if (isTriggerDown) { return; } switch (buttonStage) { case ButtonStage.PressDown: TouchpadDirection touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, false); HandleTouchpad_MeshOperation_PressDown(touchpadDirection); break; } }
void HandleTouchpad_ResetCameraControlPanel(ButtonStage buttonStage, Vector2 axis) { if (!isOn) { return; } TouchpadDirection touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, true); switch (buttonStage) { case ButtonStage.PressDown: HandleTouchpad_ResetCameraControlPanel_PressDown(touchpadDirection); break; case ButtonStage.PressUp: HandleTouchpad_ResetCameraControlPanel_PressUp(touchpadDirection); break; } }
void HandleTouchpad(ButtonStage buttonStage, Vector2 axis) { switch (buttonStage) { case ButtonStage.PressDown: TouchpadDirection touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, false); if (touchpadDirection == TouchpadDirection.Up) { DynamicMeshScript.SetMeshDisplay(!DynamicMeshScript.ShowDynamicCollision); DisplayMesh.text = DisplayMesh.text == "[Show]" ? "[Hide]" : "[Show]"; } else if (touchpadDirection == TouchpadDirection.Down) { dartGenerator.DestroyObjs(); } break; } }
void HandleTouchpad(ButtonStage buttonStage, Vector2 axis) { switch (buttonStage) { case ButtonStage.PressDown: TouchpadDirection touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, true); switch (touchpadDirection) { case TouchpadDirection.Up: PortalScript.ResetPortalPosition(); break; case TouchpadDirection.Down: dartGeneratorMgr.DestroyObjs(); break; } break; } }
void HandleTouchpad_ResetDepthPanel(ButtonStage buttonStage, Vector2 axis) { if (isOn) { TouchpadDirection touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, true); switch (buttonStage) { case ButtonStage.PressDown: switch (touchpadDirection) { case TouchpadDirection.Up: isTouchpadDown = true; ViveSR_Experience_HintMessage.instance.SetHintMessage(hintType.onController, "[Depth Panel]\nMove the Panel", false); ViveSR_Experience_ControllerDelegate.triggerDelegate -= HandleTrigger_AdjustSliders; ViveSR_Experience_Demo.instance.Rotator.RenderButtons(false); StartCoroutine(ResetPanelPos()); break; } break; case ButtonStage.PressUp: isTouchpadDown = false; ViveSR_Experience_ControllerDelegate.triggerDelegate += HandleTrigger_AdjustSliders; if (!isTriggerDown) { ViveSR_Experience_HintMessage.instance.SetHintMessage(hintType.onController, "", false); ViveSR_Experience_Demo.instance.Rotator.RenderButtons(true); } break; } } }
public void SetEnable(TouchpadDirection index, bool enable) { ResetSprite(); isDisabled[((int)index) - 1] = !enable; }
public void HandleTouchpad_RotatorControl(ButtonStage buttonStage, Vector2 axis) { if (!isRotateOn) { return; } touchpadDirection_prev = touchpadDirection; touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, true); #region VIVEPro if (ViveSR_Experience.instance.CurrentDevice == DeviceType.Vive) { switch (buttonStage) { case ButtonStage.PressDown: switch (touchpadDirection) { case TouchpadDirection.Mid: { Debug.Log("[ViveSR Experience] ActOnButton"); ActOnButton(); } break; //Mid: Excute the choosen Button. case TouchpadDirection.Right: isRotateDown = true; break; case TouchpadDirection.Left: isRotateDown = true; break; } break; case ButtonStage.Press: if (isRotateDown) { switch (touchpadDirection) { case TouchpadDirection.Right: StartCoroutine(Rotate(true)); break; case TouchpadDirection.Left: StartCoroutine(Rotate(false)); break; } } break; } switch (buttonStage) { case ButtonStage.PressUp: isRotateDown = false; break; } } #endregion #region VIVET2 else if (ViveSR_Experience.instance.CurrentDevice == DeviceType.ViveT2) { switch (buttonStage) { case ButtonStage.PressDown: switch (touchpadDirection) { case TouchpadDirection.Mid: ActOnButton(); break; //Mid: Excute the choosen Button. case TouchpadDirection.Right: isRotateDown = true; StartCoroutine(Rotate(true)); break; case TouchpadDirection.Left: isRotateDown = true; StartCoroutine(Rotate(false)); break; } break; } if (touchpadDirection_prev != touchpadDirection) { switch (touchpadDirection) { case TouchpadDirection.Right: isRotateDown = true; StartCoroutine(Rotate(true)); break; case TouchpadDirection.Left: isRotateDown = true; StartCoroutine(Rotate(false)); break; } } } #endregion }
void HandleTouchpad_SwitchDart(ButtonStage buttonStage, Vector2 axis) { if (!enabled) { return; } touchpadDirection_prev = touchpadDirection; touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, true); #region VIVEPro if (ViveSR_Experience.instance.CurrentDevice == DeviceType.Vive) { switch (buttonStage) { case ButtonStage.PressDown: switch (touchpadDirection) { case TouchpadDirection.Right: SwitchDart(true); break; case TouchpadDirection.Left: SwitchDart(false); break; case TouchpadDirection.Up: if (allowDefaultSwitchPlacementMode) { dartGeneratorMgr.SwitchPlacementMode(); } ViveSR_Experience_ControllerDelegate.touchpadDelegate -= HandleTouchpad_SwitchDart; break; case TouchpadDirection.Down: if (allowDefaultClear) { dartGeneratorMgr.DestroyObjs(); } break; } break; } } #endregion #region VIVET2 else if (ViveSR_Experience.instance.CurrentDevice == DeviceType.ViveT2) { switch (buttonStage) { case ButtonStage.PressDown: switch (touchpadDirection) { case TouchpadDirection.Right: SwitchDart(true); break; case TouchpadDirection.Left: SwitchDart(false); break; case TouchpadDirection.Up: if (allowDefaultSwitchPlacementMode) { dartGeneratorMgr.SwitchPlacementMode(); } ViveSR_Experience_ControllerDelegate.touchpadDelegate -= HandleTouchpad_SwitchDart; break; case TouchpadDirection.Down: if (allowDefaultClear) { dartGeneratorMgr.DestroyObjs(); } break; } break; } if (touchpadDirection_prev != touchpadDirection) { switch (touchpadDirection) { case TouchpadDirection.Right: SwitchDart(true); break; case TouchpadDirection.Left: SwitchDart(false); break; case TouchpadDirection.Up: if (allowDefaultSwitchPlacementMode) { dartGeneratorMgr.SwitchPlacementMode(); } ViveSR_Experience_ControllerDelegate.touchpadDelegate -= HandleTouchpad_SwitchDart; break; case TouchpadDirection.Down: if (allowDefaultClear) { dartGeneratorMgr.DestroyObjs(); } break; } } } #endregion }
void HandleTouchpadInput_Calibrating(ButtonStage buttonStage, Vector2 axis) { TouchpadDirection touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, true); switch (buttonStage) { case ButtonStage.PressDown: isPressed = true; temptime = Time.timeSinceLevelLoad; if (touchpadDirection == TouchpadDirection.Mid) { CalibrationSubMenu.ReturnToSubMenu(); } break; case ButtonStage.PressUp: isPressed = false; isLongPressing = false; temptime = .0f; break; case ButtonStage.Press: if (Time.time - temptime > 0.5f) //Long press { isLongPressing = true; ViveSR_DualCameraCalibrationTool calibrationTool = ViveSR_DualCameraRig.Instance.DualCameraCalibration; switch (touchpadDirection) { case TouchpadDirection.Right: calibrationTool.Calibration(CalibrationAxis.Y, Time.deltaTime * 2); //Right break; case TouchpadDirection.Left: calibrationTool.Calibration(CalibrationAxis.Y, -Time.deltaTime * 2); //Left break; case TouchpadDirection.Up: calibrationTool.Calibration(CalibrationAxis.X, -Time.deltaTime * 2); //Up break; case TouchpadDirection.Down: calibrationTool.Calibration(CalibrationAxis.X, Time.deltaTime * 2); //Down break; } } break; case ButtonStage.TouchUp: isReset = false; isSpinning = false; break; case ButtonStage.Touch: if (!isReset) { isReset = true; ResetRotation(axis); isSpinning = false; } if (isReset && !isPressed && touchpadDirection != TouchpadDirection.Mid) { Rotate(axis); } break; } }
public Color GetColor(TouchpadDirection index) { return(touchpadImageColors[((int)index) - 1]); }
private void HandleTouchpad_MeshOperation(ButtonStage buttonStage, Vector2 axis) { if (!isTriggerDown) { switch (buttonStage) { case ButtonStage.PressDown: TouchpadDirection touchpadDirection = ViveSR_Experience_ControllerDelegate.GetTouchpadDirection(axis, false); if (touchpadDirection == TouchpadDirection.Up) //[Scan] { if (!ViveSR_RigidReconstruction.IsScanning && !StaticMeshScript.ModelIsLoading && !StaticMeshScript.SemanticMeshIsLoading) { //SemanticDrawer.DestroyAllObjects(); if (StaticMeshScript.CheckModelLoaded()) { StaticMeshScript.LoadMesh(false); } StaticMeshScript.ActivateSemanticMesh(false); DartText.text = ""; HintText.text = ""; GripText.text = ""; //ViveSR_Experience_ControllerDelegate.gripDelegate -= HandleGrip_SwitchMode; StaticMeshScript.SetScanning(true); StaticMeshScript.SetSegmentation(true); LoadText.color = Color.gray; ScanText.color = Color.gray; SaveText.color = Color.white; StopText.color = Color.white; } } else if (touchpadDirection == TouchpadDirection.Left) //[Stop] { if (ViveSR_RigidReconstruction.IsScanning) { StaticMeshScript.SetScanning(false); StaticMeshScript.SetSegmentation(false); if (StaticMeshScript.CheckModelLoaded()) { StaticMeshScript.LoadMesh(true); } if (StaticMeshScript.SemanticMeshIsLoaded) { StaticMeshScript.ActivateSemanticMesh(true); } SetStaticMeshUI(); //ViveSR_Experience_ControllerDelegate.gripDelegate += HandleGrip_SwitchMode; } } else if (touchpadDirection == TouchpadDirection.Right) // [Save] { if (ViveSR_RigidReconstruction.IsScanning) { StaticMeshScript.UnloadSemanticMesh(); LoadText.color = Color.grey; ScanText.color = Color.grey; StopText.color = Color.grey; SaveText.color = Color.grey; ViveSR_Experience_ControllerDelegate.touchpadDelegate -= HandleTouchpad_MeshOperation; ViveSR_SceneUnderstanding.SetAllCustomSceneUnderstandingConfig(10, true); StaticMeshScript.SetSegmentation(false); StaticMeshScript.ExportSemanticMesh(UpdateSegmentationPercentage, () => { StaticMeshScript.ExportModel(UpdateModelPercentage, () => { DartText.text = ""; HintText.text = "Mesh Saved!"; ScanText.color = Color.white; LoadText.color = Color.white; ViveSR_Experience_ControllerDelegate.touchpadDelegate += HandleTouchpad_MeshOperation; } ); } ); } } else if (touchpadDirection == TouchpadDirection.Down) //[Load] { if (!ViveSR_RigidReconstruction.IsScanning && StaticMeshScript.CheckModelExist() && !StaticMeshScript.CheckModelLoaded()) { //ViveSR_Experience_ControllerDelegate.gripDelegate -= HandleGrip_SwitchMode; StaticMeshScript.LoadMesh( true, () => { // step 1 ScanText.color = Color.grey; LoadText.color = Color.grey; HintText.text = "Loading Scene..."; DartText.text = ""; }, () => { // step 2 if (StaticMeshScript.CheckSemanticMeshDirExist()) { LoadSemanticMesh(); StaticMeshScript.collisionMesh.SetActive(false); } else { ScanText.color = Color.white; HintText.text = "No Object is Found.\nPlease Rescan!"; } } ); } } break; } } }
public bool IsDisabled(TouchpadDirection index) { return(isDisabled[((int)index) - 1]); }