예제 #1
0
    /**
     * Draws the HighScore menu
     */
    private void drawHighScore()
    {
        Color prev = GUI.color;

        GUI.color = Color.magenta;
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 - ScreenUtil.getPixelHeight(100),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "High Scores", style);
        GUI.color = prev;
        GUI.color = Color.green;
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2,
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "1)   " + PlayerPrefs.GetInt("highscorePos" + 1), style);
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(70),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "2)   " + PlayerPrefs.GetInt("highscorePos" + 2), style);
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(140),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "3)   " + PlayerPrefs.GetInt("highscorePos" + 3), style);
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(210),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "4)   " + PlayerPrefs.GetInt("highscorePos" + 4), style);
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(280),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "5)   " + PlayerPrefs.GetInt("highscorePos" + 5), style);

        //Back Button
        GUI.color = Color.white;
        GUI.SetNextControlName("0");
        if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2,
                                ScreenUtil.ScreenHeight - ScreenUtil.getPixelHeight(100), ScreenUtil.getPixelWidth(200), style.fontSize), new GUIContent("Back", "0"), style))
        {
            _displayHighScore = false;
        }
        if (GUI.tooltip == "0")
        {
            _highlightStyle.normal = style.hover;
        }
        if (GameManager.Instance.enableSeebright)
        {
            GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2 + ScreenUtil.ScreenWidth,
                                ScreenUtil.ScreenHeight - ScreenUtil.getPixelHeight(100), ScreenUtil.getPixelWidth(200), style.fontSize), "Back", _highlightStyle);
        }
        _highlightStyle.normal = style.normal;
        //Joystick Menu Navigation
        _focusID = ManageFocus(_focusID, 0);
        if (GameManager.Instance.enableSeebright && SBRemote.remoteStatus)
        {
            if (SBRemote.GetButtonDown(SBRemote.BUTTON_SELECT))
            {
                if (_focusID < 0)
                {
                    return;
                }
                else if (_focusID == 0)
                {
                    _displayHighScore = false;
                }
            }
        }
    }
예제 #2
0
    /**
     * Draws the main menu
     */
    private void drawNormalMenu()
    {
        //Play Game button
        GUI.SetNextControlName("0");
        if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2, ScreenUtil.ScreenHeight / 2 - ScreenUtil.getPixelHeight(50),
                                ScreenUtil.getPixelWidth(400), style.fontSize), new GUIContent("Play Game", "0"), style))
        {
            Application.LoadLevel(1);
        }
        if (GUI.tooltip == "0")
        {
            _highlightStyle.normal = style.hover;
        }
        if (GameManager.Instance.enableSeebright)
        {
            GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth, ScreenUtil.ScreenHeight / 2 - ScreenUtil.getPixelHeight(50),
                                ScreenUtil.getPixelWidth(400), style.fontSize), "Play Game", _highlightStyle);
        }
        _highlightStyle.normal = style.normal;

        //Tutorial Button
        GUI.SetNextControlName("1");
        if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                                ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(50), ScreenUtil.getPixelWidth(400), style.fontSize), new GUIContent("Tutorial", "1"), style))
        {
            Application.LoadLevel(2);
        }
        if (GUI.tooltip == "1")
        {
            _highlightStyle.normal = style.hover;
        }
        if (GameManager.Instance.enableSeebright)
        {
            GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth,
                                ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(50), ScreenUtil.getPixelWidth(400), style.fontSize), "Tutorial", _highlightStyle);
        }
        _highlightStyle.normal = style.normal;

        //Credits Button
        GUI.SetNextControlName("2");
        if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                                ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(250), ScreenUtil.getPixelWidth(400), style.fontSize), new GUIContent("Credits", "2"), style))
        {
            _displayCredits = true;
        }
        if (GUI.tooltip == "2")
        {
            _highlightStyle.normal = style.hover;
        }
        if (GameManager.Instance.enableSeebright)
        {
            GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth,
                                ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(250), ScreenUtil.getPixelWidth(400), style.fontSize), "Credits", _highlightStyle);
        }
        _highlightStyle.normal = style.normal;

        //Options Button
        GUI.SetNextControlName("3");
        if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                                ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(150), ScreenUtil.getPixelWidth(400), style.fontSize), new GUIContent("Options", "3"), style))
        {
            _displayOptions = true;
        }
        if (GUI.tooltip == "3")
        {
            _highlightStyle.normal = style.hover;
        }
        if (GameManager.Instance.enableSeebright)
        {
            GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth,
                                ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(150), ScreenUtil.getPixelWidth(400), style.fontSize), "Options", _highlightStyle);
        }
        _highlightStyle.normal = style.normal;

#if !UNITY_WEBPLAYER
        //HighScore Display Button
        GUI.SetNextControlName("4");
        if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                                ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(350), ScreenUtil.getPixelWidth(400), style.fontSize), new GUIContent("High Scores", "4"), style))
        {
            _displayHighScore = true;
        }
        if (GUI.tooltip == "4")
        {
            _highlightStyle.normal = style.hover;
        }
        if (GameManager.Instance.enableSeebright)
        {
            GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth,
                                ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(350), ScreenUtil.getPixelWidth(400), style.fontSize), "High Scores", _highlightStyle);
        }
        _highlightStyle.normal = style.normal;
#endif

        //Joystick Menu Navigation
        if (GameManager.Instance.enableSeebright && SBRemote.remoteStatus)
        {
            _focusID = ManageFocus(_focusID, 4);
            if (SBRemote.GetButtonDown(SBRemote.BUTTON_SELECT))
            {
                if (_focusID < 0)
                {
                    return;
                }
                else if (_focusID == 0)
                {
                    Application.LoadLevel(1);
                }
                else if (_focusID == 1)
                {
                    Application.LoadLevel(2);
                }
                else if (_focusID == 2)
                {
                    _displayCredits = true;
                    _focusID        = -1;
                }
                else if (_focusID == 3)
                {
                    _displayOptions = true;
                    _focusID        = -1;
                }
                else if (_focusID == 4)
                {
                    _displayHighScore = true;
                    _focusID          = -1;
                }
            }
        }
    }
예제 #3
0
    /**
     * Draws the options menu
     */
    private void drawOptions()
    {
        Color prev = GUI.color;

        GUI.color = Color.magenta;
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 -
                                      ScreenUtil.getPixelHeight(100), 3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "Options", style);
        GUI.color = prev;
        if (!GameManager.Instance.enableSeebright)
        {
            //SFX Volume
            GUI.Label(new Rect((ScreenUtil.ScreenWidth + ScreenUtil.getPixelWidth(200)) / 2, ScreenUtil.ScreenHeight / 2 - ScreenUtil.getPixelHeight(50),
                               ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(200)), "Effects Volume", style);
            GameManager.effectsVolume = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth + ScreenUtil.getPixelWidth(200)) / 2,
                                                                      ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(50), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                             GameManager.effectsVolume, 0f, 1.0f);
            //Music Volume
            GUI.Label(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(1000)) / 2, ScreenUtil.ScreenHeight / 2 - ScreenUtil.getPixelHeight(50),
                               ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(200)), "Music Volume", style);
            GameManager.musicVolume = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(1000)) / 2,
                                                                    ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(50), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                           GameManager.musicVolume, 0f, 1.0f);
#if !UNITY_IPHONE
            //Sensitivity Control
            GUI.Label(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                               ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(100), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(200)),
                      "Sensitivity", style);
            GameManager.mouseSensitivity = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                                                                         ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(180), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                                GameManager.mouseSensitivity, 0.1f, 0.5f);
#endif
        }
        else
        {
            //SeeBright Enabled
            //SFX Volume
            GUI.SetNextControlName("0");
            GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2, ScreenUtil.ScreenHeight / 2,
                                ScreenUtil.getPixelWidth(400), style.fontSize), new GUIContent("Effects Volume", "0"), style);
            GameManager.effectsVolume = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                                                                      ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(70), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                             GameManager.effectsVolume, 0f, 1.0f);
            if (GUI.tooltip == "0")
            {
                _highlightStyle.normal = style.hover;
            }
            GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth, ScreenUtil.ScreenHeight / 2,
                                ScreenUtil.getPixelWidth(400), style.fontSize), "Effects Volume", _highlightStyle);
            _highlightStyle.normal    = style.normal;
            GameManager.effectsVolume = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth,
                                                                      ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(70), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                             GameManager.effectsVolume, 0f, 1.0f);

            //Music Volume
            GUI.SetNextControlName("1");
            GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(120),
                                ScreenUtil.getPixelWidth(400), style.fontSize), new GUIContent("Music Volume", "1"), style);
            GameManager.musicVolume = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                                                                    ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(190), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                           GameManager.musicVolume, 0f, 1.0f);
            if (GUI.tooltip == "1")
            {
                _highlightStyle.normal = style.hover;
            }
            GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(120),
                                ScreenUtil.getPixelWidth(400), style.fontSize), "Music Volume", _highlightStyle);
            _highlightStyle.normal  = style.normal;
            GameManager.musicVolume = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth,
                                                                    ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(190), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                           GameManager.musicVolume, 0f, 1.0f);
        }

        if (GameManager.Instance)
        {
            GameManager.Instance.updateMusicVolume();
        }

#if UNITY_IPHONE
        GUI.SetNextControlName("3");
        if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2,
                                ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(230), ScreenUtil.getPixelWidth(200),
                                style.fontSize), new GUIContent((GameManager.invertedJoystick) ? "Inverted Joystick: On" : "Inverted Joystick: Off", "3"), style))
        {
            GameManager.invertedJoystick = !GameManager.invertedJoystick;
        }
        if (GUI.tooltip == "3")
        {
            _highlightStyle.normal = style.hover;
        }
        if (GameManager.Instance.enableSeebright)
        {
            GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2 + ScreenUtil.ScreenWidth,
                                ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(230), ScreenUtil.getPixelWidth(200), style.fontSize),
                       (GameManager.invertedJoystick) ? "Inverted Joystick: On" : "Inverted Joystick: Off", _highlightStyle);
        }
        _highlightStyle.normal = style.normal;
        _focusID = ManageFocus(_focusID, 3);

        if (!GameManager.Instance.enableSeebright)
        {
            if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2,
                                    ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(330), ScreenUtil.getPixelWidth(200),
                                    style.fontSize), new GUIContent((GameManager.invertedControls) ? "Inverted Controls: On" : "Inverted Controls: Off"), style))
            {
                GameManager.invertedControls = !GameManager.invertedControls;
            }
        }
#endif

        GUI.SetNextControlName("4");
        if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2,
                                (GameManager.Instance.enableSeebright) ? ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(330) : ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(430),
                                ScreenUtil.getPixelWidth(200), style.fontSize), new GUIContent("Back", "4"), style))
        {
            _displayOptions = false;
            // update sensitivity when options are closed
            if (GameManager.Instance != null)
            {
                foreach (Player player in GameManager.Instance.CurrentPlayerShips)
                {
                    player.UpdateSensitivity();
                }
            }
        }
        if (GUI.tooltip == "4")
        {
            _highlightStyle.normal = style.hover;
        }
        GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2 + ScreenUtil.ScreenWidth,
                            ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(430), ScreenUtil.getPixelWidth(200), style.fontSize), "Back", _highlightStyle);
        _highlightStyle.normal = style.normal;
        _focusID = ManageFocus(_focusID, 4);



        if (!GameManager.Instance.enableSeebright || !SBRemote.remoteStatus)
        {
            return;
        }
        if (SBRemote.GetButtonDown(SBRemote.BUTTON_SELECT))
        {
            if (_focusID < 0)
            {
                return;
            }
            else if (_focusID == 3)
            {
                _displayOptions = false;
                _focusID        = -1;
            }
        }
        if (SBRemote.GetAxis(SBRemote.JOY_HORIZONTAL) > 0.5f)
        {
            if (_focusID == 0 && GameManager.effectsVolume < 1)
            {
                GameManager.effectsVolume += .01f;
            }
            else if (_focusID == 1 && GameManager.musicVolume < 1)
            {
                GameManager.musicVolume += .01f;
            }
            else if (_focusID == 2 && GameManager.mouseSensitivity < .5f)
            {
                GameManager.mouseSensitivity += .005f;
            }
        }
        if (SBRemote.GetAxis(SBRemote.JOY_HORIZONTAL) < -0.5f)
        {
            if (_focusID == 0 && GameManager.effectsVolume > 0)
            {
                GameManager.effectsVolume -= .01f;
            }
            else if (_focusID == 1 && GameManager.musicVolume > 0)
            {
                GameManager.musicVolume -= .01f;
            }
            else if (_focusID == 2 && GameManager.mouseSensitivity > .1f)
            {
                GameManager.mouseSensitivity -= .005f;
            }
        }
    }
예제 #4
0
    /**
     * Draws the credits menu
     */
    private void drawCredits()
    {
        Color prev = GUI.color;

        GUI.color = Color.magenta;
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 - ScreenUtil.getPixelHeight(100),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "Credits", style);
        GUI.color = prev;
        GUI.color = Color.green;
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 - ScreenUtil.getPixelHeight(60),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "Anthony Dao", style);
        style.fontSize /= 2;
        GUI.color       = Color.white;
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 - ScreenUtil.getPixelHeight(5),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "Programming ( Enemies-Menus-GUI ) / Design", style);
        style.fontSize *= 2;
        GUI.color       = Color.green;
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(60),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "Chase Khamashta", style);
        style.fontSize /= 2;
        GUI.color       = Color.white;
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(110),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "Programming ( Player-Controls-Enemies-Powerups ) / Design", style);
        style.fontSize *= 2;
        GUI.color       = Color.green;
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(180),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "Orlando Salvatore", style);
        style.fontSize /= 2;
        GUI.color       = Color.white;
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(230),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "Programming", style);
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(260),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)),
                             "( Enemies-Level Generation-Transitions-Tutorial-Menus-Scoring )", style);
        GUIManager.DrawLabel(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(290),
                                      3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)),
                             "Art / Music / Design", style);

        style.fontSize *= 2;
        GUI.SetNextControlName("0");
        if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2,
                                ScreenUtil.ScreenHeight - ScreenUtil.getPixelHeight(100), ScreenUtil.getPixelWidth(200), style.fontSize), new GUIContent("Back", "0"), style))
        {
            _displayCredits = false;
        }
        if (GUI.tooltip == "0")
        {
            _highlightStyle.normal = style.hover;
        }
        if (GameManager.Instance.enableSeebright)
        {
            GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2 + ScreenUtil.ScreenWidth,
                                ScreenUtil.ScreenHeight - ScreenUtil.getPixelHeight(100), ScreenUtil.getPixelWidth(200), style.fontSize), "Back", _highlightStyle);
        }
        _highlightStyle.normal = style.normal;
        //Joystick Menu Navigation
        _focusID = ManageFocus(_focusID, 0);
        if (!SBRemote.remoteStatus || GameManager.Instance.enableSeebright)
        {
            return;
        }
        if (SBRemote.GetButtonDown(SBRemote.BUTTON_SELECT))
        {
            if (_focusID < 0)
            {
                return;
            }
            else if (_focusID == 0)
            {
                _displayCredits = false;
            }
        }
    }
예제 #5
0
    /*
     * OnGUI is called for rendering and handling GUI events.
     * Buttons for 'Resume Game', 'Main Menu', and 'Options'
     * As well as buttons for Options menu
     */
    void OnGUI()
    {
        GUIStyle _highlightStyle = new GUIStyle(style);

        if (!currentlyActive)
        {
            return;
        }
        if (!_displayOptions)
        {
            // Resume Game Button
            GUI.SetNextControlName("0");
            if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2, ScreenUtil.ScreenHeight / 2,
                                    ScreenUtil.getPixelWidth(400), style.fontSize), new GUIContent("Resume Game", "0"), style))
            {
                exit();
            }
            if (GUI.tooltip == "0")
            {
                _highlightStyle.normal = style.hover;
            }
            GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth, ScreenUtil.ScreenHeight / 2,
                                ScreenUtil.getPixelWidth(400), style.fontSize), "Resume Game", _highlightStyle);
            _highlightStyle.normal = style.normal;

            //Main Menu Button
            GUI.SetNextControlName("1");
            if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                                    ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(100), ScreenUtil.getPixelWidth(400),
                                    style.fontSize), new GUIContent("Main Menu", "1"), style))
            {
                Application.LoadLevel(0);
            }
            if (GUI.tooltip == "1")
            {
                _highlightStyle.normal = style.hover;
            }
            if (GameManager.Instance.enableSeebright)
            {
                GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth,
                                    ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(100), ScreenUtil.getPixelWidth(400),
                                    style.fontSize), "Main Menu", _highlightStyle);
            }
            _highlightStyle.normal = style.normal;

            //Options Button
            GUI.SetNextControlName("2");
            if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                                    ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(200), ScreenUtil.getPixelWidth(400),
                                    style.fontSize), new GUIContent("Options", "2"), style))
            {
                _displayOptions = true;
            }
            if (GUI.tooltip == "2")
            {
                _highlightStyle.normal = style.hover;
            }
            if (GameManager.Instance.enableSeebright)
            {
                GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth,
                                    ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(200), ScreenUtil.getPixelWidth(400),
                                    style.fontSize), "Options", _highlightStyle);
            }
            _highlightStyle.normal = style.normal;

            //Joystick Menu Navigation
            if (GameManager.Instance.enableSeebright)
            {
                _focusID = ManageFocus(_focusID, 2);
                if (SBRemote.GetButtonDown(SBRemote.BUTTON_SELECT))
                {
                    if (_focusID < 0)
                    {
                        return;
                    }
                    else if (_focusID == 0)
                    {
                        exit();
                    }
                    else if (_focusID == 1)
                    {
                        Application.LoadLevel(0);
                    }
                    else if (_focusID == 2)
                    {
                        _displayOptions = true;
                        _focusID        = -1;
                    }
                }
            }
        }
        //In option Menu
        else if (_displayOptions)
        {
            Color prev = GUI.color;
            GUI.color = Color.magenta;

            if (GameManager.Instance.enableSeebright == false)
            {
                GUI.Label(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 -
                                   ScreenUtil.getPixelHeight(100), 3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "Options", style);
                GUI.color = prev;
                GUI.Label(new Rect((ScreenUtil.ScreenWidth + ScreenUtil.getPixelWidth(200)) / 2, ScreenUtil.ScreenHeight / 2,
                                   ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(200)), "Effects Volume", style);
                GameManager.effectsVolume = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth + ScreenUtil.getPixelWidth(200)) / 2,
                                                                          ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(100), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                                 GameManager.effectsVolume, 0f, 1.0f);
                GUI.Label(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(1000)) / 2, ScreenUtil.ScreenHeight / 2,
                                   ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(200)), "Music Volume", style);
                GameManager.musicVolume = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(1000)) / 2,
                                                                        ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(100), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                               GameManager.musicVolume, 0f, 1.0f);
#if !UNITY_IPHONE
                GUI.Label(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                                   ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(150), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(200)),
                          "Sensitivity", style);
                GameManager.mouseSensitivity = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                                                                             ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(230), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                                    GameManager.mouseSensitivity, 0.1f, 0.5f);
#endif
            }
            else if (GameManager.Instance.enableSeebright == true)
            {
                GUI.Label(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16, ScreenUtil.ScreenHeight / 2 -
                                   ScreenUtil.getPixelHeight(200), 3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "Options", style);
                GUI.Label(new Rect(ScreenUtil.ScreenWidth / 2 - 3 * ScreenUtil.ScreenWidth / 16 + ScreenUtil.ScreenWidth, ScreenUtil.ScreenHeight / 2 -
                                   ScreenUtil.getPixelHeight(200), 3 * ScreenUtil.ScreenWidth / 8, ScreenUtil.getPixelHeight(200)), "Options", style);
                GUI.color = prev;
                //SFX Volume
                GUI.SetNextControlName("0");
                GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2, ScreenUtil.ScreenHeight / 2 - ScreenUtil.getPixelHeight(100),
                                    ScreenUtil.getPixelWidth(400), style.fontSize), new GUIContent("Effects Volume", "0"), style);
                GameManager.effectsVolume = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                                                                          ScreenUtil.ScreenHeight / 2 - ScreenUtil.getPixelHeight(30), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                                 GameManager.effectsVolume, 0f, 1.0f);
                if (GUI.tooltip == "0")
                {
                    _highlightStyle.normal = style.hover;
                }
                GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth, ScreenUtil.ScreenHeight / 2 - ScreenUtil.getPixelHeight(100),
                                    ScreenUtil.getPixelWidth(400), style.fontSize), "Effects Volume", _highlightStyle);
                _highlightStyle.normal    = style.normal;
                GameManager.effectsVolume = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth,
                                                                          ScreenUtil.ScreenHeight / 2 - ScreenUtil.getPixelHeight(30), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                                 GameManager.effectsVolume, 0f, 1.0f);
                //Music Volume
                GUI.SetNextControlName("1");
                GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(20),
                                    ScreenUtil.getPixelWidth(400), style.fontSize), new GUIContent("Music Volume", "1"), style);
                GameManager.musicVolume = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                                                                        ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(90), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                               GameManager.musicVolume, 0f, 1.0f);
                if (GUI.tooltip == "1")
                {
                    _highlightStyle.normal = style.hover;
                }
                GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth, ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(20),
                                    ScreenUtil.getPixelWidth(400), style.fontSize), "Music Volume", _highlightStyle);
                _highlightStyle.normal  = style.normal;
                GameManager.musicVolume = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth,
                                                                        ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(90), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                               GameManager.musicVolume, 0f, 1.0f);
                //Sensitivity Control
                GUI.SetNextControlName("2");
                GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                                    ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(140), ScreenUtil.getPixelWidth(400), style.fontSize),
                           new GUIContent("Sensitivity", "2"), style);
                GameManager.mouseSensitivity = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2,
                                                                             ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(210), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                                    GameManager.mouseSensitivity, 0.1f, 0.5f);
                if (GUI.tooltip == "2")
                {
                    _highlightStyle.normal = style.hover;
                }
                GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth,
                                    ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(140), ScreenUtil.getPixelWidth(400), style.fontSize),
                           "Sensitivity", _highlightStyle);
                _highlightStyle.normal       = style.normal;
                GameManager.mouseSensitivity = GUI.HorizontalSlider(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(400)) / 2 + ScreenUtil.ScreenWidth,
                                                                             ScreenUtil.ScreenHeight / 2 + ScreenUtil.getPixelHeight(210), ScreenUtil.getPixelWidth(400), ScreenUtil.getPixelHeight(50)),
                                                                    GameManager.mouseSensitivity, 0.1f, 0.5f);
            }
            if (GameManager.Instance)
            {
                GameManager.Instance.updateMusicVolume();
            }


#if UNITY_IPHONE
            if (!GameManager.Instance.enableSeebright)
            {
                GUI.SetNextControlName("3");
                if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2,
                                        ScreenUtil.ScreenHeight - ScreenUtil.getPixelHeight(300), ScreenUtil.getPixelWidth(200),
                                        style.fontSize), new GUIContent((GameManager.invertedJoystick) ? "Inverted Joystick: On" : "Inverted Joystick: Off", "3"), style))
                {
                    GameManager.invertedJoystick = !GameManager.invertedJoystick;
                }
                if (GUI.tooltip == "3")
                {
                    _highlightStyle.normal = style.hover;
                }
                if (GameManager.Instance.enableSeebright)
                {
                    GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2 + ScreenUtil.ScreenWidth,
                                        ScreenUtil.ScreenHeight - ScreenUtil.getPixelHeight(300), ScreenUtil.getPixelWidth(200), style.fontSize), "Back", _highlightStyle);
                }
                _highlightStyle.normal = style.normal;
                _focusID = ManageFocus(_focusID, 3);


                GUI.SetNextControlName("4");
                if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2,
                                        ScreenUtil.ScreenHeight - ScreenUtil.getPixelHeight(200), ScreenUtil.getPixelWidth(200),
                                        style.fontSize), new GUIContent((GameManager.invertedControls) ? "Inverted Controls: On" : "Inverted Controls: Off", "3"), style))
                {
                    GameManager.invertedControls = !GameManager.invertedControls;
                    GameManager.Instance.joystickLeft.SetActive(GameManager.invertedControls);
                    GameManager.Instance.joystickRight.SetActive(!GameManager.invertedControls);
                }
                if (GUI.tooltip == "4")
                {
                    _highlightStyle.normal = style.hover;
                }
                if (GameManager.Instance.enableSeebright)
                {
                    GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2 + ScreenUtil.ScreenWidth,
                                        ScreenUtil.ScreenHeight - ScreenUtil.getPixelHeight(200), ScreenUtil.getPixelWidth(200), style.fontSize), "Back", _highlightStyle);
                }
                _highlightStyle.normal = style.normal;
                _focusID = ManageFocus(_focusID, 4);
            }
#endif


            GUI.SetNextControlName("5");
            if (GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2,
                                    ScreenUtil.ScreenHeight - ScreenUtil.getPixelHeight(100), ScreenUtil.getPixelWidth(200), style.fontSize), new GUIContent("Back", "3"), style))
            {
                _displayOptions = false;
                // update sensitivity when options are closed
                if (GameManager.Instance != null)
                {
                    foreach (Player player in GameManager.Instance.CurrentPlayerShips)
                    {
                        player.UpdateSensitivity();
                    }
                }
            }
            if (GUI.tooltip == "5")
            {
                _highlightStyle.normal = style.hover;
            }
            GUI.Button(new Rect((ScreenUtil.ScreenWidth - ScreenUtil.getPixelWidth(200)) / 2 + ScreenUtil.ScreenWidth,
                                ScreenUtil.ScreenHeight - ScreenUtil.getPixelHeight(100), ScreenUtil.getPixelWidth(200), style.fontSize), "Back", _highlightStyle);
            _highlightStyle.normal = style.normal;
            _focusID = ManageFocus(_focusID, 5);

            if (GameManager.Instance.enableSeebright)
            {
                if (SBRemote.GetButtonDown(SBRemote.BUTTON_SELECT))
                {
                    if (_focusID < 0)
                    {
                        return;
                    }
                    else if (_focusID == 3)
                    {
                        _displayOptions = false;
                        _focusID        = -1;
                    }
                }
                if (SBRemote.GetJoystickDelta(SBRemote.JOY_HORIZONTAL) > 2048 * 4 * 2)
                {
                    if (_focusID == 0 && GameManager.effectsVolume < 1)
                    {
                        GameManager.effectsVolume += .01f;
                    }
                    else if (_focusID == 1 && GameManager.musicVolume < 1)
                    {
                        GameManager.musicVolume += .01f;
                    }
                    else if (_focusID == 2 && GameManager.mouseSensitivity < .5f)
                    {
                        GameManager.mouseSensitivity += .005f;
                    }
                }
                if (SBRemote.GetJoystickDelta(SBRemote.JOY_HORIZONTAL) < -2048 * 4 * 2)
                {
                    if (_focusID == 0 && GameManager.effectsVolume > 0)
                    {
                        GameManager.effectsVolume -= .01f;
                    }
                    else if (_focusID == 1 && GameManager.musicVolume > 0)
                    {
                        GameManager.musicVolume -= .01f;
                    }
                    else if (_focusID == 2 && GameManager.mouseSensitivity > .1f)
                    {
                        GameManager.mouseSensitivity -= .005f;
                    }
                }
            }
        }
        else
        {
            _focusID = -1;
        }
    }