Beispiel #1
0
    void DrawButton()
    {
        if (isShow)
        {
            Time.timeScale = 0;
        }
        //if(isShow)
        {
            //Draw background
            GUI.DrawTexture(new Rect(maxRight, -Screen.height / 20.0f, Screen.width / 4.0f, Screen.height * 1.1f), boxBg);
            //Draw level label
            GUI.Label(new Rect(maxButtonRight + Screen.width / 8 - 75, Screen.height / 8f, 150, Screen.height / 12f), "");
            //Calculate buttons' width
            scaleWidth = Screen.height / 6f;
            //Draw list levels button
            if (GUI.Button(new Rect(maxButtonRight + Screen.width / 8 - scaleWidth / 2, Screen.height * 2 / 10.0f, scaleWidth, scaleWidth), textures[0], "trans_button"))
            {
                Debug.Log("menu");
                Time.timeScale = 1;
                GameplayScript.DoChooseLevels();
                isShow = false;

                //--------------------------------
                //Load list level in here
                //--------------------------------
            }
            //Draw replay button
            if (GUI.Button(new Rect(maxButtonRight + Screen.width / 8 - scaleWidth / 2, Screen.height * 4 / 10.0f, scaleWidth, scaleWidth), textures[1], "trans_button"))
            {
                Debug.Log("restart");
                Time.timeScale = 1;
                GameplayScript.DoReplay();
                isShow = false;

                //------------------------------
                //Do replay function in here
                //-----------------------------
            }
            //Draw sound button
            Texture soundButton = SoundEffect.isMute?textures[2]:textures[3];
            if (GUI.Button(new Rect(maxButtonRight + Screen.width / 8 - scaleWidth / 2, Screen.height * 6 / 10.0f, scaleWidth, scaleWidth), new GUIContent(soundButton), "trans_button"))
            {
                Debug.Log("som");
                Time.timeScale     = 1;
                isShow             = false;
                SoundEffect.isMute = !SoundEffect.isMute;
                if (!SoundEffect.isMute)
                {
                    SoundEffect.Stop();
                }
                else
                {
                    SoundEffect.Play(Sound.tone);
                }
                MusicEffect.isMute = !MusicEffect.isMute;
                if (MusicEffect.isMute)
                {
                    MusicEffect.Stop();
                }
                else
                {
                    MusicEffect.Play(Music.tone);
                }
            }
            //Draw how to play button
            Texture helpButton = textures[4];
            if (GUI.Button(new Rect(maxButtonRight + Screen.width / 16 - scaleWidth / 2, Screen.height * 8 / 10.0f, scaleWidth, scaleWidth), new GUIContent(helpButton), "trans_button"))
            {
                Debug.Log("?");

                //isShow = false;
                isShowHelp = true;
            }
            //Draw info button
            Texture infoButton = textures[5];
            if (GUI.Button(new Rect(maxButtonRight + Screen.width * 3 / 16 - scaleWidth / 2, Screen.height * 8 / 10.0f, scaleWidth, scaleWidth), new GUIContent(infoButton), "trans_button"))
            {
                Debug.Log("!");
                Time.timeScale = 1;
                isShow         = false;
                //Application.OpenURL("http://www.odigamestudio.com");
            }
            //Draw transparent area
            if (isShow && GUI.Button(new Rect(maxLeft, 0, Screen.width * 3 / 4.0f, Screen.height), "", "trans_button"))
            {
                Debug.Log("fora");
                Time.timeScale = 1;
                isShow         = false;
            }
        }
        //Draw pauseButton
        if (GUI.Button(new Rect(5, 5, scaleWidth * 5 / 7f, scaleWidth * 5 / 7f), pauseButton, "trans_button"))
        {
            Debug.Log("pause");
            isShow         = !isShow;
            Time.timeScale = 1;
        }
    }