/// <summary> /// Tests for long-press and activates global platform menu when detected. /// as per the Unity integration doc, the back button responds to "mouse 1" button down/up/etc /// </summary> void Update() { #if UNITY_ANDROID eBackButtonAction action = HandleBackButtonState(); if (action == eBackButtonAction.DOUBLE_TAP) { ResetCursor(); } else if (action == eBackButtonAction.SHORT_PRESS) { ResetCursor(); //Show quit menu on first scene if (SceneManager.GetActiveScene().buildIndex == 0) { ShowConfirmQuitMenu(); } else // Else go to the previous scene { SceneHandler.GetInstance().LoadScene(LevelManager.PreviousSceneType); } } else if (action == eBackButtonAction.LONG_PRESS) { ShowGlobalMenu(); } #endif }
eBackButtonAction ResetAndSendAction(eBackButtonAction action) { print("ResetAndSendAction( " + action + " );"); downCount = 0; upCount = 0; initialDownTime = -1.0f; return(action); }
/// <summary> /// Tests for long-press and activates global platform menu when detected. /// as per the Unity integration doc, the back button responds to "mouse 1" button down/up/etc /// </summary> void Update() { #if UNITY_ANDROID eBackButtonAction action = HandleBackButtonState(); if (action == eBackButtonAction.SHORT_PRESS) { DoHandler(shortPressHandler); } #endif }
eBackButtonAction HandleBackButtonState() { eBackButtonAction action = eBackButtonAction.NONE; if (OVRInput.GetDown(inputCode)) { action = eBackButtonAction.SHORT_PRESS; } return(action); }
/// <summary> /// Tests for long-press and activates global platform menu when detected. /// as per the Unity integration doc, the back button responds to "mouse 1" button down/up/etc /// </summary> void Update() { #if UNITY_ANDROID eBackButtonAction action = HandleBackButtonState(); if (action == eBackButtonAction.SHORT_PRESS) { if (OnShortPress == null || OnShortPress()) { ShowConfirmQuitMenu(); } } #endif }
eBackButtonAction ResetAndSendAction(eBackButtonAction action) { print("ResetAndSendAction( " + action + " );"); downCount = 0; upCount = 0; initialDownTime = -1.0f; waitForUp = false; ResetCursor(); if (action == eBackButtonAction.LONG_PRESS) { // since a long press triggers off of time and not an up, // wait for an up to happen before handling any more key state. waitForUp = true; } return(action); }
eBackButtonAction ResetAndSendAction( eBackButtonAction action ) { print( "ResetAndSendAction( " + action + " );" ); downCount = 0; upCount = 0; initialDownTime = -1.0f; waitForUp = false; ResetCursor(); if ( action == eBackButtonAction.LONG_PRESS ) { // since a long press triggers off of time and not an up, // wait for an up to happen before handling any more key state. waitForUp = true; } return action; }
/// <summary> /// Tests for long-press and activates global platform menu when detected. /// as per the Unity integration doc, the back button responds to "mouse 1" button down/up/etc /// </summary> void Update() { #if UNITY_ANDROID eBackButtonAction action = HandleBackButtonState(); if (action == eBackButtonAction.SHORT_PRESS) { if (SceneManager.GetActiveScene().buildIndex > 1) { SceneManager.LoadScene(1); } PCPlayerControl.txt.text = "Back button short press"; //if (OnShortPress == null || OnShortPress()) //ShowConfirmQuitMenu(); } #endif }
/// <summary> /// Tests for long-press and activates global platform menu when detected. /// as per the Unity integration doc, the back button responds to "mouse 1" button down/up/etc /// </summary> void Update() { #if UNITY_ANDROID eBackButtonAction action = HandleBackButtonState(); if (action == eBackButtonAction.DOUBLE_TAP) { ResetCursor(); } else if (action == eBackButtonAction.SHORT_PRESS) { if (showMenuEnabledAtInitialDownTime) { ResetCursor(); ShowConfirmQuitMenu(); } } #endif }
/// <summary> /// Tests for long-press and activates global platform menu when detected. /// as per the Unity integration doc, the back button responds to "mouse 1" button down/up/etc /// </summary> void Update() { #if UNITY_ANDROID eBackButtonAction action = HandleBackButtonState(); if (action == eBackButtonAction.DOUBLE_TAP) { DoHandler(doubleTapHandler); } else if (action == eBackButtonAction.SHORT_PRESS) { DoHandler(shortPressHandler); } else if (action == eBackButtonAction.LONG_PRESS) { DoHandler(longPressHandler); } #endif }
/// <summary> /// Tests for long-press and activates global platform menu when detected. /// as per the Unity integration doc, the back button responds to "mouse 1" button down/up/etc /// </summary> void Update() { #if UNITY_ANDROID eBackButtonAction action = HandleBackButtonState(); if (action == eBackButtonAction.DOUBLE_TAP) { ResetCursor(); } else if (action == eBackButtonAction.SHORT_PRESS) { ResetCursor(); ShowConfirmQuitMenu(); } else if (action == eBackButtonAction.LONG_PRESS) { ShowGlobalMenu(); } #endif }