Beispiel #1
0
    void OnGUI()
    {
        //pause
        if (CMainData.getPause() == true)
        {
            if (buttonType == (int)BUTTON.G_PAUSE)
            {
                return;
            }
        }
        else if (CMainData.getGameState() == GameData.GAME_STATE_TIMEUP)
        {
            if (buttonType == (int)BUTTON.G_PAUSE ||
                buttonType == (int)BUTTON.G_RESUME)
            {
                return;
            }
        }
        else
        {
            if (buttonType == (int)BUTTON.G_RESUME ||
                buttonType == (int)BUTTON.G_RESTART ||
                buttonType == (int)BUTTON.G_MAINMENU)
            {
                return;
            }
        }
        //sound
        if (CMainData.getSound() == true)
        {
            if (buttonType == (int)BUTTON.G_SOUND_OFF)
            {
                return;
            }
        }
        else
        {
            if (buttonType == (int)BUTTON.G_SOUND_ON)
            {
                return;
            }
        }

        //check button
        if (img == null)
        {
            //set button background color
            GUI.backgroundColor = Color.white;

            if (GUI.Button(rect, text))
            {
                //button processing
                buttonProcessing(buttonType);
            }
        }
        else
        {
            //none show button background window
            GUI.backgroundColor = Color.clear;

            if (GUI.Button(rect, img))
            {
                //button processing
                buttonProcessing(buttonType);
            }
        }
    }