Exemplo n.º 1
0
    public virtual void Update()
    {
        AdNetworks.HandleAdUpdate();

        #if !UNITY_IPHONE
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            QuitGame();
            //if(AlertDialog.Instance.IsReady()) {
            //  AlertDialog.Instance.ShowAlertQuitDialog();
            //}
        }
        #endif

        if (Application.isEditor)
        {
            if (Input.GetKeyDown(KeyCode.Comma))
            {
                string sceneName = "Panel";

                if (GameUIController.Instance != null)
                {
                    sceneName = GameUIController.Instance.currentPanel;
                }

                string filename = "../screenshots/" + sceneName +
                                  "-" + Screen.width.ToString() + "x" + Screen.height.ToString()
                                  + "-" + (screenshotCount++).ToString() + ".png";

                if (GameController.IsGameRunning)
                {
                    filename = "../screenshots/" + sceneName + "-gameplay-" +
                               "-" + Screen.width.ToString() + "x" + Screen.height.ToString()
                               + "-" + (screenshotCount++).ToString() + ".png";
                }
                Application.CaptureScreenshot(filename);
            }
        }
    }
Exemplo n.º 2
0
    public virtual void Update()
    {
        AdNetworks.HandleAdUpdate();

#if !UNITY_IPHONE
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            QuitGame();
            //if(AlertDialog.Instance.IsReady()) {
            //  AlertDialog.Instance.ShowAlertQuitDialog();
            //}
        }
#endif

        if (Application.isEditor)
        {
            if ((Input.GetKey(KeyCode.LeftControl) ||
                 Input.GetKey(KeyCode.RightControl)))
            {
                if (Input.GetKeyDown(KeyCode.P))
                {
#if UNITY_EDITOR
                    // Toggle paused
                    //UnityEditor.EditorApplication.isPaused =
                    //    !UnityEditor.EditorApplication.isPaused ? true : false;

                    UnityEditor.EditorApplication.isPaused =
                        !UnityEditor.EditorApplication.isPaused;
#endif
                }
                else if (Input.GetKeyDown(KeyCode.E) &&
                         (Input.GetKeyDown(KeyCode.Plus) ||
                          Input.GetKeyDown(KeyCode.KeypadPlus)))
                {
                    // volume up for effects
                    currentVolumeEffects += currentVolumeInc;
                    UpdateAudio(currentVolumeMusic, currentVolumeEffects);
                }
                else if (Input.GetKeyDown(KeyCode.E) &&
                         (Input.GetKeyDown(KeyCode.Minus) ||
                          Input.GetKeyDown(KeyCode.KeypadMinus)))
                {
                    // volume up for effects
                    currentVolumeEffects -= currentVolumeInc;
                    UpdateAudio(currentVolumeMusic, currentVolumeEffects);
                }
                else if (Input.GetKeyDown(KeyCode.M) &&
                         (Input.GetKeyDown(KeyCode.Plus) ||
                          Input.GetKeyDown(KeyCode.KeypadPlus)))
                {
                    // volume up for music
                    currentVolumeMusic += currentVolumeInc;
                    UpdateAudio(currentVolumeMusic, currentVolumeEffects);
                }
                else if (Input.GetKeyDown(KeyCode.M) &&
                         (Input.GetKeyDown(KeyCode.Minus) ||
                          Input.GetKeyDown(KeyCode.KeypadMinus)))
                {
                    // volume up for music
                    currentVolumeMusic -= currentVolumeInc;
                    UpdateAudio(currentVolumeMusic, currentVolumeEffects);
                }
            }

            if (Input.GetKeyDown(KeyCode.Comma))
            {
                string sceneName = "Panel";

                if (GameUIController.Instance != null)
                {
                    sceneName = GameUIController.Instance.currentPanel;
                }

                string filename = "../screenshots/" + sceneName +
                                  "-" + Screen.width.ToString() + "x" + Screen.height.ToString()
                                  + "-" + (screenshotCount++).ToString() + ".png";

                if (GameController.IsGameRunning)
                {
                    filename = "../screenshots/" + sceneName + "-gameplay-" +
                               "-" + Screen.width.ToString() + "x" + Screen.height.ToString()
                               + "-" + (screenshotCount++).ToString() + ".png";
                }
                Application.CaptureScreenshot(filename);
            }
        }
    }