コード例 #1
0
ファイル: CameraMenu.cs プロジェクト: seth-cohen/peg_popper
    void OnGUI()
    {
        Color oldGUIColor = GUI.color;

        // fade the game screen behind the GUI menu
        if (fadeTexture)
        {
            GUI.color = new Color(0, 0, 0, 1.0f - scene.GetScreenFade());
            GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), fadeTexture);

            GUI.color = oldGUIColor;
        }
    }
コード例 #2
0
    void OnGUI()
    {
        Color oldGUIColor = GUI.color;

        // fade the game screen behind the GUI menu
        if (fadeTexture)
        {
            GUI.color = new Color(0, 0, 0, 1.0f - scene.GetScreenFade());
            GUI.DrawTexture(new Rect(-1, -1, Screen.width * 2, Screen.height * 2), fadeTexture);

            GUI.color = oldGUIColor;
        }

        if (scene.showingAd)
        {
            return;
        }

        if (boardManager != null)
        {
            if (boardManager.state != GameState.Paused)
            {
                return;
            }
        }

        if (boardManagerSquare != null)
        {
            if (boardManagerSquare.state != GameState.Paused)
            {
                return;
            }
        }

        if (boardManagerEuropean != null)
        {
            if (boardManagerEuropean.state != GameState.Paused)
            {
                return;
            }
        }

        // Assign the custom GUI Skin used by our game
        if (myGUISkin)
        {
            GUI.skin = myGUISkin;
        }

        oldGUIColor = GUI.color;
        // fade the game screen behind the GUI menu
        if (fadeTexture)
        {
            GUI.color = new Color(0, 0, 0, 0.7f);
            GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), fadeTexture);

            GUI.color = oldGUIColor;
        }

        //Set up scaling matrix so we can work in EASY coordinates
        float rx = Screen.width / 1080.0f;
        float ry = Screen.height / 1920.0f;

        // Backup the current GUI matrix as we are about to change it so we can work
        // in standard coordinates for all resolutions
        Matrix4x4 oldMat = GUI.matrix;

        // Set up the scaling matrix
        GUI.matrix = Matrix4x4.TRS(new Vector3(0, 0, 0), Quaternion.identity, new Vector3(rx, ry, 1));

        // Create the transparent options box below the header
        GUI.Box(PauseBox_ScreenRect, "Game Paused");

        // Create and react to the Continue button being pressed
        if (GUI.Button(Continue_ScreenRect, "Continue"))
        {
            scene.OnButtonSelect("Continue");
        }
        // Create and react to the Quit button
        if (GUI.Button(Quit_ScreenRect, "Main Menu"))
        {
            scene.OnButtonSelect("Main Menu");
        }
        GUI.enabled = (data.userWantsAchievements == 1);
        // Create and react to the Quit button
        if (GUI.Button(Ach_ScreenRect, "Achievements"))
        {
            scene.OnButtonSelect("Achievements");
        }
        // Create and react to the Quit button
        if (GUI.Button(Leader_ScreenRect, "Leaderboards"))
        {
            scene.OnButtonSelect("Leaders");
        }
        GUI.enabled = true;

//		// Create and react to the Quit button
//		if (GUI.Button( Signout_ScreenRect, "Signout"))
//		{
//			scene.OnButtonSelect("Signout");
//		}

        // Restore the matrix
        GUI.matrix = oldMat;
    }