void addEventTriggers() { GvrPointerInputModule globalInputModule = (GvrPointerInputModule)FindObjectOfType(typeof(GvrPointerInputModule)); globalInputModule.EventExecutor.OnPointerDown += startRewind; globalInputModule.EventExecutor.OnPointerUp += stopRewind; }
private void Start() { this.inputModule = GvrPointerInputModule.FindInputModule(); if (!this.inputModule) { Debug.Log("Cannot find GvrPointerInputModule in scene on Start!"); } }
// Update is called once per frame void Update() { rp = GvrPointerInputModule.FindInputModule().Impl.Pointer as GvrReticlePointer; RectTransform rt = GetComponent <RectTransform>(); Vector3 pos = new Vector3(rt.localPosition.x, rt.localPosition.y, rp.ReticleDistanceInMeters); rt.anchoredPosition3D = pos; }
public void OnPointerEnter(BaseEventData data) { inp = data.currentInputModule as GvrPointerInputModule; if (inp != null && inp.transform.position != Vector3.zero) { newPositionHandle.transform.position = new Vector3( inp.transform.position.x, newPositionHandle.transform.position.y, newPositionHandle.transform.position.z); } newPositionHandle.SetActive(true); }
/// Helper function to find the Event Executor that is part of /// the input module if one exists in the scene. public static GvrEventExecutor FindEventExecutor() { GvrPointerInputModule gvrInputModule = FindInputModule(); if (gvrInputModule == null) { return(null); } return(gvrInputModule.EventExecutor); }
private void RemoveListeners() { GvrEventExecutor executor = GvrPointerInputModule.FindEventExecutor(); if (executor == null) { return; } executor.OnPointerClick -= OnPointerClick; }
public static bool IsPointerOverUIObject() { if (_GvrInputModule == null) { _GvrInputModule = FindObjectOfType <GvrPointerInputModule>(); } if (_GvrInputModule == null) { return(false); } return(_GvrInputModule.Impl.CurrentEventData != null && _GvrInputModule.Impl.CurrentEventData.pointerEnter != null); }
/// GvrBasePointer calls this when it is created. /// If a pointer hasn't already been assigned, it /// will assign the newly created one by default. /// /// This simplifies the common case of having only one /// GvrBasePointer so is can be automatically hooked up /// to the manager. If multiple GvrBasePointers are in /// the scene, the app has to take responsibility for /// setting which one is active. public static void OnPointerCreated(GvrBasePointer createdPointer) { GvrPointerInputModule module = FindInputModule(); if (module == null || module.Impl == null) { return; } if (module.Impl.Pointer == null) { module.Impl.Pointer = createdPointer; } }
private void AddListeners() { GvrEventExecutor eventExecutor = GvrPointerInputModule.FindEventExecutor(); if (eventExecutor == null) { return; } eventExecutor.OnPointerClick += OnPointerClickHandler; eventExecutor.OnPointerDown += OnPointerDownHandler; eventExecutor.OnPointerUp += OnPointerUpHandler; eventExecutor.OnPointerEnter += OnPointerEnterHandler; eventExecutor.OnPointerExit += OnPointerExitHandler; }
private void RemoveListeners() { GvrEventExecutor eventExecutor = GvrPointerInputModule.FindEventExecutor(); if (eventExecutor == null) { return; } eventExecutor.OnPointerClick -= OnPointerClickHandler; eventExecutor.OnPointerDown -= OnPointerDownHandler; eventExecutor.OnPointerUp -= OnPointerUpHandler; eventExecutor.OnPointerEnter -= OnPointerEnterHandler; eventExecutor.OnPointerExit -= OnPointerExitHandler; }
/// Helper function to find the input module if one exists in the /// scene and it is the active module. public static GvrPointerInputModule FindInputModule() { if (EventSystem.current == null) { return(null); } BaseInputModule inputModule = EventSystem.current.currentInputModule; if (inputModule == null) { return(null); } GvrPointerInputModule gvrInputModule = inputModule as GvrPointerInputModule; return(gvrInputModule); }
/// Helper function to find the input module if one exists in the /// scene and it is the active module. public static GvrPointerInputModule FindInputModule() { if (EventSystem.current == null) { return(null); } EventSystem eventSystem = EventSystem.current; if (eventSystem == null) { return(null); } GvrPointerInputModule gvrInputModule = eventSystem.GetComponent <GvrPointerInputModule>(); return(gvrInputModule); }
private void Awake() { vrMenuController = vrControls.GetComponent <MenuController>(); portraitMenuController = portraitControls.GetComponent <MenuController>(); startMenu = GetComponentInChildren <StartMenu>(); menuPivot = vrControls.transform.parent; cameraTrans = GetComponentInChildren <Camera>().gameObject.transform; vrInputModule = eventSystem.GetComponent <GvrPointerInputModule>(); touchInputModule = eventSystem.GetComponent <StandaloneInputModule>(); if (deviceName != "Oculus") { StartCoroutine(ChangeToPortrait()); } else { StartCoroutine(ChangeToVr()); } }
private void GvrReticlePointer_OnPointerEnterEvent(RaycastResult raycastResult) { raycastResultObj = null; mEnterTime = Time.time; MaterialComp.SetFloat("_FillAmount", 0); manger = 0; //EventExcuted = false; EventExcuteCount = 0; GvrPointerInputModule module = EventSystem.current.currentInputModule as GvrPointerInputModule; GameObject click = module.EventExecutor.GetEventHandler <IPointerClickHandler>(raycastResult.gameObject); if (click) { bool canOperation = false; Selectable selectable = click.GetComponent <Selectable>(); if (selectable != null) { if (selectable.interactable) { canOperation = true; } } else { canOperation = true; } if (canOperation) { raycastResultObj = click; UICountDown mUICountDown = click.GetComponent <UICountDown>(); if (mUICountDown != null) { mTargetTime = mUICountDown.Count; mIsContitnue = mUICountDown.Continue; } else { mTargetTime = DEFALUTCOUNT; } } } }
void Start() { _trigger = GetComponent <EventTrigger>(); EventTrigger.Entry entry = new EventTrigger.Entry(); entry.eventID = EventTriggerType.PointerDown; entry.callback.AddListener((data) => OnClick()); _trigger.triggers.Add(entry); EventTrigger.Entry entry2 = new EventTrigger.Entry(); entry2.eventID = EventTriggerType.PointerUp; entry2.callback.AddListener((data) => OnExit()); _trigger.triggers.Add(entry2); rb = GetComponent <Rigidbody>(); GvrEventExecutor eventExecutor = GvrPointerInputModule.FindEventExecutor(); eventExecutor.OnPointerClick += OnItemInterract; }
// ------------------------------------------- /* * Getting the reference of the input controllers */ public void Initialitzation() { if (m_hasBeenInitialized) { return; } m_hasBeenInitialized = true; m_standAloneInputModule = this.gameObject.GetComponent <StandaloneInputModule>(); if (m_standAloneInputModule == null) { this.gameObject.AddComponent <StandaloneInputModule>(); m_standAloneInputModule = this.gameObject.GetComponent <StandaloneInputModule>(); } #if !ENABLE_OCULUS && !ENABLE_HTCVIVE && !ENABLE_PICONEO && UNITY_HAS_GOOGLEVR && ENABLE_PARTY_2018 m_gazeInputModule = this.gameObject.GetComponent <GvrPointerInputModule>(); if (m_gazeInputModule == null) { Debug.LogError("WARNNING: The project can work in a non-VR related project, but it's meant to run mainly for VR projects"); } #endif UIEventController.Instance.UIEvent += new UIEventHandler(OnBasicEvent); }
// Update is called once per frame void Update() { if (!this.inputModule) { this.inputModule = GvrPointerInputModule.FindInputModule(); if (!unfoundInputModule && !this.inputModule) { Debug.LogError("Must have a GvrPointerInputModule in scene for GVR usage!"); this.unfoundInputModule = true; } else if (this.inputModule) { Debug.Log("Found a GvrPointerInputModule on Update."); } } if (BlockedInput()) { this.blocked = true; } ProcessInput(); // Set downtime if (pressedDown) { this.downTime += Time.deltaTime; if (firstFrame) { this.firstFrameTime = this.downTime; } else { this.firstFrameTime = -1; } } // Processed inputs if (!blocked) { if (pressedDown) { if (!this.held && this.downTime > 0 && this.downTime > this.tapDuration) { if (onHoldDown != null) { onHoldDown(); } } } else if ((this.downTime > 0 && this.downTime <= this.tapDuration) || this.firstFrameTime == this.downTime) { if (onTap != null) { onTap(); } } else if (this.downTime > 0 && this.downTime > this.tapDuration) { if (onHoldUp != null) { onHoldUp(); } } } if (!pressedDown) { blocked = false; } // Raw inputs if (pressedDown) { if (!this.held && this.downTime > 0 && this.downTime > this.tapDuration) { if (onHoldDownRaw != null) { onHoldDownRaw(); } this.held = true; } } else if ((this.downTime > 0 && this.downTime <= this.tapDuration) || this.firstFrameTime == this.downTime) { if (onTapRaw != null) { onTapRaw(); } this.downTime = 0; this.firstFrameTime = -1; } else if (this.downTime > 0 && this.downTime > this.tapDuration) { if (onHoldUpRaw != null) { onHoldUpRaw(); } this.downTime = 0; this.held = false; } }
public void OnPointerExit(BaseEventData data) { inp = null; newPositionHandle.SetActive(false); }
/// @cond /// <summary> /// This MonoBehavior's Start() implementation. /// </summary> protected virtual void Start() { GvrPointerInputModule.OnPointerCreated(this); }
public static void OnPointerCreated(GvrBasePointer createdPointer) { GvrPointerInputModule.OnPointerCreated(createdPointer); }