コード例 #1
0
ファイル: OVRPlatformMenu.cs プロジェクト: Alacrious/RetailVR
    /// <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
    }
コード例 #2
0
 eBackButtonAction ResetAndSendAction(eBackButtonAction action)
 {
     print("ResetAndSendAction( " + action + " );");
     downCount       = 0;
     upCount         = 0;
     initialDownTime = -1.0f;
     return(action);
 }
コード例 #3
0
    /// <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
    }
コード例 #4
0
    eBackButtonAction HandleBackButtonState()
    {
        eBackButtonAction action = eBackButtonAction.NONE;

        if (OVRInput.GetDown(inputCode))
        {
            action = eBackButtonAction.SHORT_PRESS;
        }

        return(action);
    }
コード例 #5
0
    /// <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
    }
コード例 #6
0
 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);
 }
コード例 #7
0
	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;
	}
コード例 #8
0
    /// <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
    }
コード例 #9
0
    /// <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
    }
コード例 #10
0
    /// <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
    }
コード例 #11
0
ファイル: OVRPlatformMenu.cs プロジェクト: monszy/AskSocrates
    /// <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
    }