Esempio n. 1
0
    void OnGUI()
    {
        GUI.skin.font     = defaultFont;
        myStyle           = new GUIStyle(GUI.skin.textField); // Set Text GUI Style
        myStyle.alignment = TextAnchor.MiddleCenter;          // Set Text to Center Alignment

        GUI.DrawTexture(new Rect(0, 0, Screen.width, Screen.height), mainMenubackground, ScaleMode.StretchToFill);

        if (adultOverlayShown == 0 || clearCheck)         // Disable Play Button and Options Button if a pop-up needs to come up
        {
            GUI.enabled = false;
        }
        playerName = GUI.TextField(new Rect(347, 310, 105, 20), playerName, 10, myStyle);         // Draw Player Name Text Field

        if (GUI.Button(new Rect(325, 350, 150, 33), playButtonImage, GUIStyle.none))
        {
            if (playerName.Equals("Name?"))             //If name hasn't been changed from default text
            {
                PlayerPrefs.SetString("PlayerName", "Player");
            }
            else               //If Name has been changed
            {
                PlayerPrefs.SetString("PlayerName", playerName);
            }
            //PlayerPrefs.SetInt("Gender", gender);//Sets Gender
            soundControllerScript.playSFX("bubbleClick");
            Application.LoadLevel("Instructions");
        }

        if (optionsOverlayController.getDisplayOverlay())
        {
            GUI.enabled = false;
        }

        if (GUI.Button(new Rect(325, 400, 150, 33), optionsButtonImage, GUIStyle.none))                 // On Right
        {
            optionsOverlayController.displayOverlayOn();
            displayOptions = true;
            soundControllerScript.playSFX("bubbleClick");
        }
        GUI.enabled = true;
        if (displayOptions)
        {
            optionsOverlayController.display();                                      // Display Options Overlay - Calling it from here so it displayed above background texture
        }
        if (GUI.Button(new Rect(325, 450, 150, 33), exitButtonImage, GUIStyle.none)) // On Right
        {
            soundControllerScript.playSFX("bubbleClick");
            Application.Quit();
        }
        GUI.enabled = true;
        if (adultOverlayShown == 0)
        {
            GUI.depth = -1;
            //GUI.DrawTexture (new Rect (275, 285, 250, 170), adultOverlayBackground, ScaleMode.StretchToFill);
            GUI.Label(new Rect(105, 305, 600, 135), new GUIContent("This game may include content not suitable for children and \n deleting cookies and/or temporary files may delete game data.\n You also agree to the terms set forth in our End User License Agreement & Terms of Service. \n Are you ok with this?"), myStyle); //Draw Scraps Number

            if (GUI.Button(new Rect(120, 395, 39, 39), checkMarkButton, GUIStyle.none))                                                                                                                                                                                                                                              // On Right
            {
                optionsOverlayController.setAdultContentOn();
                PlayerPrefs.SetInt("AdultOverlay", 1);
                adultOverlayShown = 1;
                soundControllerScript.playSFX("bubbleClick");
            }

            /*if (GUI.Button (new Rect (230, 400, 75, 33), tosButton, GUIStyle.none)) {	// On Right
             *      Application.ExternalEval("window.open('http://www.playeditstudios.com/termsofservice.html','_blank')");
             *      soundControllerScript.playSFX("bubbleClick");
             * }
             *
             * if (GUI.Button (new Rect (500, 400, 75, 33), eulaButton, GUIStyle.none)) {	// On Right
             *      Application.ExternalEval("window.open('http://www.playeditstudios.com/Ranger/Ranger_EULA.html','_blank')");
             *      soundControllerScript.playSFX("bubbleClick");
             * }*/

            if (GUI.Button(new Rect(650, 395, 39, 39), xButton, GUIStyle.none))                 // On Right
            {
                PlayerPrefs.SetInt("AdultOverlay", 1);
                adultOverlayShown = 1;
                optionsOverlayController.setAdultContentOff();
                soundControllerScript.playSFX("bubbleClick");
            }

            GUI.depth = 0;
        }

        if (clearCheck)
        {
            GUI.depth = -1;
            GUI.Label(new Rect(105, 305, 600, 135), new GUIContent("This will clear all data including items purchased with real money.\n Are you ok with this?"), myStyle); //Draw Scraps Number

            if (GUI.Button(new Rect(120, 395, 39, 39), checkMarkButton, GUIStyle.none))                                                                                      // On Right
            {
                PlayerPrefs.DeleteAll();                                                                                                                                     //Delete all PlayerPrefs
                if (rpController != null)
                {
                    rpControllerScript = rpController.GetComponent <RPController>();
                    rpControllerScript.setRP(2200);
                }
                Start();
                clearCheck = false;
                soundControllerScript.playSFX("bubbleClick");
            }

            if (GUI.Button(new Rect(650, 395, 39, 39), xButton, GUIStyle.none))                 // On Right
            {
                clearCheck = false;
                soundControllerScript.playSFX("bubbleClick");
            }
            GUI.depth = 0;
        }
        GUI.Label(new Rect(5, 575, 90, 20), "Ranger v1");          //Draw Scraps Number
    }
Esempio n. 2
0
    public void displayHUD(bool roundEndedCheck, float timeUntilRoundStarts)
    {
        displayTopLeft();

        if (storeControllerScript.getDisplayStore() == false)
        {
            //GUI.Label (new Rect (380, 250, 150, 25), playerName);
            //GUI.Label (new Rect (380, 250, 200, 50), "" + FB.UserId);//Time before next round begins

            if (GUI.Button(new Rect(770, 5, 23, 23), pauseButton, GUIStyle.none))                 // Pause Button Top-Right
            {
                soundControllerScript.playSFX("bubbleClick");
                playerScript.pauseGame();                //When Opening menu, options overlay should start closed - even if it had been opened previously
                optionsOverlayController.displayOverlayOff();
                displayOptions = false;
            }
        }

        if (playerScript.getPaused())                                                       // If Paused
        {
            if (GUI.Button(new Rect(325, 250, 150, 50), unPauseButtonImage, GUIStyle.none)) // Pause Button Top-Right
            {
                playerScript.pauseGame();
                soundControllerScript.playSFX("bubbleClick");
            }

            if (GUI.Button(new Rect(325, 325, 150, 33), mainMenuButtonImage, GUIStyle.none))                    // On Right
            {
                optionsOverlayController.displayOverlayOff();
                soundControllerScript.playSFX("bubbleClick");
                //Load Main Menu but do not duplicate Sound Controller or OptionsOverlay
                Application.LoadLevel("MainMenu");
            }

            if (optionsOverlayController.getDisplayOverlay())
            {
                GUI.enabled = false;
            }
            if (GUI.Button(new Rect(325, 400, 150, 33), optionsButtonImage, GUIStyle.none))                     // On Right
            {
                optionsOverlayController.displayOverlayOn();
                displayOptions = true;
                soundControllerScript.playSFX("bubbleClick");
            }
            GUI.enabled = true;
            if (displayOptions)
            {
                optionsOverlayController.display();
            }

            /*if (GUI.Button (new Rect (325, 475, 150, 33), buyRPButtonImage,GUIStyle.none)){//Main Menu Button
             *      soundControllerScript.playSFX("bubbleClick");
             *      /*FB.Canvas.Pay(product: "https://www.playeditstudios.com/ranger/purchaserp.html",
             *                    action: "purchaseitem",
             *                    quantity: 1,
             *                    callback: PayCallback);
             *      rpControllerScript.paymentDialog();//rp controller call for pay
             * }*/
        }
        ///Top Buttons Start
        if (storeControllerScript.getDisplayStore() == false)
        {
            if (roundEndedCheck == false) //If In the Middle of a Round
            {
                drawZombieIcon();         //Draw Zombie Icon On Right
                drawCurrentRound();       //Draw Current Round Icon on Left
            }
            else                          //Round Over
            {
                if (runOnce)
                {
                    if (GUI.Button(new Rect(400, 0, 64, 64), startButtonIcon, GUIStyle.none))                         // On Right
                    {
                        playerScript.setRoundEndedCheck(false);
                        playerScript.setStartRoundTimer(true);
                        runOnce = false;
                        soundControllerScript.playSFX("bubbleClick");
                    }
                }
                else
                {
                    if (GUI.Button(new Rect(400, 0, 64, 64), nextWaveButtonIcon, GUIStyle.none))                                // On Right
                    //spawnerScript.setRoundTimerToZero();
                    {
                        playerScript.resetTimeUntilRoundStarts();

                        soundControllerScript.playSFX("bubbleClick");
                    }
                }
                drawTimerTillRoundStart(timeUntilRoundStarts);                //Draw Timer Until Round Starts on Left
            }
        }
        ///Top Buttons End

        //HUD Tool Tips Start
        if (storeControllerScript.getDisplayStore() == false)
        {
            if (GUI.tooltip == "Scraps are earned from killing zombies, you can spend the scraps in the store.")
            {
                GUI.Label(new Rect(10, 60, 130, 75), GUI.tooltip);               // tool tip Draw
            }
            else if (GUI.tooltip == "Research Points (RP)- gathered every minute, to spend visit the store")
            {
                GUI.Label(new Rect(60, 60, 130, 75), GUI.tooltip);               // tool tip Draw
            }
            else if (GUI.tooltip == "Ammo")
            {
                GUI.Label(new Rect(200, 55, 130, 75), GUI.tooltip);               // tool tip Draw
            }
        }
        //HUD Tool Tips End
    }    //On GUI End