Exemple #1
0
        void Update()
        {
            if (Application.isPlaying)
            {
                //the autohide cursor should still allow it to toggle on by hitting escape
                if (Input.GetKeyDown(KeyCode.Escape) && autoHideCursor && !Application.isEditor)
                {
                    Cursor.visible = !Cursor.visible;
                }

                if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) &&
                    Input.GetKeyDown(KeyCode.F10))
                {
                    configPrintout = !configPrintout;
                }

                //exiting using the holoplay home button
                if (HoloPlayButton.GetButton(HP_Button.HOME))
                {
                    quitting   = true;
                    quitTimer -= Time.deltaTime;
                    if (quitTimer <= 0)
                    {
                        //if from launcher
                        if (quitToLauncher)
                        {
                            if (!HoloPlayLauncher.Instance.currentlyQuittingToLauncher)
                            {
                                HoloPlayLauncher.Instance.StartLoadingApp("launcher");
                            }
                        }
                        //otherwise just quit the app
                        else
                        {
                            Application.Quit();
                        }
                    }
                }
                else
                {
                    quitting  = false;
                    quitTimer = quitTime;
                }

                // if (Input.GetKeyDown(KeyCode.F9))
                // {
                //     StartCoroutine(LenticularPrint());
                // }

                if (Input.GetKeyDown(KeyCode.F6))
                {
                    screenshot3DQueued = true;
                }
                if (Input.GetKeyDown(KeyCode.F5))
                {
                    wiggleGifQueued = true;
                }
            }
        }
Exemple #2
0
        void Update()
        {
            // clear guiaction
            guiAction = null;

            if (currentlyQuittingToLauncher && HoloPlayButton.GetButtonDown(HP_Button.HOME))
            {
                currentlyQuittingToLauncher = false;
            }
        }
Exemple #3
0
        IEnumerator ScanForHoloPlayJoystickEvery()
        {
            WaitForSeconds waitTime = new WaitForSeconds(5f);

            while (true)
            {
                HoloPlayButton.ScanForHoloPlayerJoystick();
                yield return(waitTime);
            }
        }
Exemple #4
0
        void Update()
        {
            if (activelyCalibrating)
            {
                var calib = HoloPlay.Config.realsense;
                if ((Input.GetKeyDown(KeyCode.Space) || HoloPlayButton.GetAnyButtonDown()) && calibrationState != -1)
                {
                    AdvanceCalibration();
                }

                else if (Input.GetKey(KeyCode.RightArrow))
                {
                    calib.offset.x -= offsetTweakSpeed * Time.deltaTime;
                }
                else if (Input.GetKey(KeyCode.LeftArrow))
                {
                    calib.offset.x += offsetTweakSpeed * Time.deltaTime;
                }
                else if (Input.GetKey(KeyCode.UpArrow))
                {
                    calib.offset.y += offsetTweakSpeed * Time.deltaTime;
                }
                else if (Input.GetKey(KeyCode.DownArrow))
                {
                    calib.offset.y -= offsetTweakSpeed * Time.deltaTime;
                }
                else if (Input.GetKey(KeyCode.A))
                {
                    calib.offset.z += offsetTweakSpeed * Time.deltaTime;
                }
                else if (Input.GetKey(KeyCode.Z))
                {
                    calib.offset.z -= offsetTweakSpeed * Time.deltaTime;
                }

                if (Input.GetKeyDown(KeyCode.Y))
                {
                    calib.offset = calib.defaultOffset;
                }

                if (Input.anyKeyDown)
                {
                    saveTimerFloat = 0.5f;
                    if (!saveTimerIsRunning)
                    {
                        StartCoroutine(SaveTimer());
                    }
                }
            }

            UpdateDetectionRange();
        }
Exemple #5
0
        void Update()
        {
            if (Application.isPlaying)
            {
                if ((Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift)) &&
                    Input.GetKeyDown(KeyCode.F10))
                {
                    configPrintout = !configPrintout;
                }

                //exiting using the holoplay home button
                if (HoloPlayButton.GetButton(HP_Button.HOME))
                {
                    quitting   = true;
                    quitTimer -= Time.deltaTime;
                    if (quitTimer <= 0)
                    {
                        //if from launcher
                        if (quitToLauncher)
                        {
                            if (!HoloPlayLauncher.Instance.currentlyQuittingToLauncher)
                            {
                                HoloPlayLauncher.Instance.StartLoadingApp("launcher");
                            }
                        }
                        //otherwise just quit the app
                        else
                        {
                            Application.Quit();
                        }
                    }
                }
                else
                {
                    quitting  = false;
                    quitTimer = quitTime;
                }

                // if (Input.GetKeyDown(KeyCode.F9))
                // {
                //     StartCoroutine(LenticularPrint());
                // }

                if (Input.GetKeyDown(KeyCode.F6))
                {
                    screenshot3DQueued = true;
                }
            }
        }
        void Update()
        {
            var buttonNames = Enum.GetNames(typeof(HP_Button));

            //get button
            for (int i = 0; i < buttonNames.Length; i++)
            {
                bool   button  = HoloPlayButton.GetButton((HP_Button)i);
                string btnName = buttonNames[i];
                IMGUIManager.AddLabel(
                    btnName + " = " + button,
                    button ? Color.green : Color.white
                    );
            }

            IMGUIManager.AdvanceColumn();

            //handling both button down and button up here like an idiot
            for (int i = 0; i < buttonNames.Length * 2; i++)
            {
                int              j            = i;
                string           action       = " Down";
                Func <int, bool> buttonAction = (x) => HoloPlayButton.GetButtonDown((HP_Button)x);
                Color            downColor    = Color.red;
                if (i == buttonNames.Length)
                {
                    IMGUIManager.AdvanceColumn();
                }
                if (i >= buttonNames.Length)
                {
                    j            = i - buttonNames.Length;
                    action       = " Up";
                    buttonAction = (x) => HoloPlayButton.GetButtonUp((HP_Button)x);
                    downColor    = Color.blue;
                }

                bool  button    = buttonAction(j);
                Color textColor = Color.white;
                if (buttonDownDict.ContainsKey(i))
                {
                    if (button)
                    {
                        buttonDownDict[i] = 1f;
                    }
                    textColor = Color.Lerp(Color.white, downColor, buttonDownDict[i]);
                }
                else
                {
                    if (button)
                    {
                        buttonDownDict.Add(i, 1f);
                        textColor = downColor;
                    }
                }
                string btnName = buttonNames[j];
                IMGUIManager.AddLabel(
                    btnName + action,
                    textColor
                    );
            }

            IMGUIManager.AdvanceIndex();

            IMGUIManager.AddLabel(
                "Holo Joy num = " + HoloPlayButton.holoPlayerJoystickNum
                );

            var keys     = buttonDownDict.Keys.ToArray();
            var toRemove = new List <int>();

            for (int i = 0; i < keys.Length; i++)
            {
                buttonDownDict[keys[i]] -= Time.deltaTime * fadeSpeed;
                if (buttonDownDict[keys[i]] < 0)
                {
                    toRemove.Add(keys[i]);
                }
            }
            foreach (var remove in toRemove)
            {
                buttonDownDict.Remove(remove);
            }
        }