Пример #1
0
    void OnGUI()
    {
        GUI.skin = skin;

        Rect windowBox = GUIUtilities.getRect(Screen.width * 0.6f, Screen.height * 0.9f);

        GUI.Box(windowBox, "Welcome to Enlightened!");

        float margin  = windowBox.height * 0.07f;
        Rect  textBox = new Rect(windowBox.x + margin, windowBox.y + 60, windowBox.width - (margin * 2), windowBox.height * 0.75f);

        float height    = skin.FindStyle("Label").CalcHeight(new GUIContent(text), textBox.width - 20);
        Rect  insideBox = new Rect(0, 0, textBox.width - 20, height);

        scrollPosition = GUI.BeginScrollView(textBox, scrollPosition, insideBox);
        GUI.Label(insideBox, text);
        GUI.EndScrollView();

        float buttonHeight = 40;
        float buttonYBase  = windowBox.y + windowBox.height - buttonHeight;

        if (GUI.Button(new Rect((Screen.width / 2.0f) - 50, buttonYBase - (windowBox.height * 0.05f), 100, buttonHeight), "Okay"))
        {
            if (ScreenBlocker.instance != null)
            {
                ScreenBlocker.instance.setBlocking(false);
            }
            enabled = false;
        }
    }
Пример #2
0
    void OnGUI()
    {
        if (!show)
        {
            return;
        }

        GUI.skin = skin;
        GUI.Window(0, GUIUtilities.getRect(250, 250), layoutWindow, "Menu");
    }
Пример #3
0
        void OnGUI()
        {
            GUI.skin = skin;
            float x = 0.01f * Screen.height;
            float y = 0.218f * Screen.height;

            x = Screen.width - x;

            float width  = 2000;
            float height = 50;

            GUIStyle playerTurnStyle = new GUIStyle();

            playerTurnStyle.fontSize  = 14;
            playerTurnStyle.alignment = TextAnchor.UpperRight;
            GUI.Label(new Rect(x - width, y, width, height), turnController.CurrentPlayer.PlayerName + "'s Turn", playerTurnStyle);

            float buttonWidth   = 150;
            float buttonHeight  = 50;
            float windowWidth   = 600;
            float windowHeight  = 180;
            float buttonYOffset = windowHeight * 0.1f;
            float buttonXOffset = buttonWidth * 0.8f;

            if (showNextTurnPopup)
            {
                GUI.Box(GUIUtilities.getRect(windowWidth, windowHeight), "" + turnController.CurrentPlayer.PlayerName + "'s Turn");
                if (GUI.Button(GUIUtilities.getRect(buttonWidth, buttonHeight, 0, buttonYOffset), "Okay"))
                {
                    showNextTurnPopup = false;
                    ScreenBlocker.instance.setBlocking(false);
                }
            }

            if (isDoActionCheck)
            {
                GUI.Box(GUIUtilities.getRect(windowWidth, windowHeight), "You have " + turnController.CurrentPlayer.actionPointsRemaining() + " action points left. Execute anyways?");
                if (GUI.Button(GUIUtilities.getRect(buttonWidth, buttonHeight, -buttonXOffset, buttonYOffset), "Execute"))
                {
                    isDoActionCheck = false;
                    turnController.ExecuteActions();
                    ScreenBlocker.instance.setBlocking(false);
                }

                if (GUI.Button(GUIUtilities.getRect(buttonWidth, buttonHeight, buttonXOffset, buttonYOffset), "Cancel"))
                {
                    isDoActionCheck = false;
                    ScreenBlocker.instance.setBlocking(false);
                }
            }
        }
Пример #4
0
 void OnGUI()
 {
     GUI.skin = skin;
     if (won)
     {
         GUI.Box(new Rect(Screen.width / 2.0f - 200, Screen.height / 2.0f - 100, 400, 200), "" + winner.PlayerName + " Wins!");
         if (GUI.Button(new Rect(Screen.width / 2.0f - 75, Screen.height / 2.0f - 20 + 30, 150, 40), "Main Menu"))
         {
             Application.LoadLevel("MainMenu");
         }
     }
     else if (lossMessage != null)
     {
         Vector2 size = GUI.skin.label.CalcSize(new GUIContent(lossMessage));
         GUI.Window(0, GUIUtilities.getRect(300, size.y + 150), layoutWindow, "Breaking News!");
     }
 }
Пример #5
0
    void OnGUI()
    {
        GUI.skin = skin;

        if (!showMenu && !instructions.enabled)
        {
            Vector2 textSize = titleStyle.CalcSize(new GUIContent(title));
            GUI.Label(new Rect((Screen.width / 2.0f) - (textSize.x / 2.0f), (Screen.height * 0.03f), textSize.x, textSize.y), title, titleStyle);

            textSize = skin.button.CalcSize(new GUIContent(play));
            Rect newGameRect = new Rect((Screen.width / 2.0f) - ((textSize.x + 40) / 2.0f), (Screen.height * 0.85f - textSize.y), textSize.x + 40, textSize.y);
            if (GUI.Button(newGameRect, play))
            {
                showMenu = true;
            }

            textSize = skin.button.CalcSize(new GUIContent(instructText));
            Rect instructRect = new Rect((Screen.width / 2.0f) - ((textSize.x + 40) / 2.0f), (Screen.height * 0.91f - textSize.y), textSize.x + 40, textSize.y);
            if (GUI.Button(instructRect, instructText))
            {
                instructions.enabled = true;
            }

            textSize = skin.button.CalcSize(new GUIContent(quitText));
            Rect quitRect = new Rect((Screen.width / 2.0f) - ((textSize.x + 40) / 2.0f), (Screen.height * 0.96f - textSize.y), textSize.x + 40, textSize.y);
            if (GUI.Button(quitRect, quitText))
            {
                Application.Quit();
            }
        }
        else if (showMenu)
        {
            float width  = 700; //Screen.width * 0.6f;
            float height = 600; //Screen.height * 0.9f;
            GUI.Window(0, GUIUtilities.getRect(width, height), layoutWindow, "New Game");
        }
    }