Exemplo n.º 1
0
    private void DisplayContinueOrQuitDialogue(string text)
    {
        // Otherwise, spawn a box that lets the player quit or continue
        GUILayout.BeginArea(new Rect((Screen.width - width) / 2.0f, (Screen.height - height) / 2.0f, width, height), GUI.skin.box);

        scrollPosition = GUILayout.BeginScrollView(scrollPosition, boxStyle);
        GUILayout.Label(text, textStyle);
        GUILayout.EndScrollView();

        // BUTTONS
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("Continue!", buttonStyle))
        {
            drawGUI = false;
            GameRoundCounter.AdvanceRound();
            GameRoundCounter.AddScore((int)GameState.Singleton.score);
            Application.LoadLevel(gameSceneName);
        }
        if (GUILayout.Button("Finish!", buttonStyle))
        {
            surveyObject = new GameObject();
            surveyObject.transform.position = new Vector3(0, 0, -5f);
            surveyObject.AddComponent <LikertGUI>();
            LikertGUI lc = surveyObject.GetComponent <LikertGUI>();
            SetupLikertGUI(ref lc);
            surveyRoundState = SurveyRoundState.SurveyObjectSpawned;
        }
        GUILayout.EndHorizontal();
        GUILayout.EndArea();
    }
Exemplo n.º 2
0
    void OnGUI()
    {
        if (drawGUI)
        {
            if (boxStyle == null)
            {
                boxStyle = new GUIStyle(GUI.skin.box);
                boxStyle.normal.background = GUIUtils.MakeBlankTexture(width, height, fontBackground);
                buttonStyle          = new GUIStyle(GUI.skin.button);
                buttonStyle.font     = font;
                buttonStyle.fontSize = fontSize;
            }

            string scoreText = GenerateScoreText();

            if (GameRoundCounter.GetCurrentRound() < surveyRound)
            {
                // Draw continue dialogue
                GUILayout.BeginArea(new Rect((Screen.width - width) / 2.0f, (Screen.height - height) / 2.0f, width, height), GUI.skin.box);

                scrollPosition = GUILayout.BeginScrollView(scrollPosition, boxStyle);
                GUILayout.Label(scoreText, textStyle);
                GUILayout.EndScrollView();

                // BUTTONS
                if (GUILayout.Button("Continue!", buttonStyle))
                {
                    drawGUI = false;
                    GameRoundCounter.AdvanceRound();
                    GameRoundCounter.AddScore((int)GameState.Singleton.score);
                    // The following line is a hack to keep the survey from drawing after the round changes.
                    surveyRoundState = SurveyRoundState.SurveyObjectSpawned;
                    Application.LoadLevel(gameSceneName);
                }
                GUILayout.EndArea();
            }
            else
            {
                // Spawn the survey object
                switch (surveyRoundState)
                {
                case SurveyRoundState.WaitingToSpawn:
                    string text = '\n' + "Feel free to continue or finish up with the post-game survey.";
                    // Otherwise, spawn a box that lets the player quit or continue
                    DisplayContinueOrQuitDialogue(scoreText + text);
                    break;

                case SurveyRoundState.SurveyObjectSpawned:
                case SurveyRoundState.SurveyResultsSent:
                    // Draw nothing
                    break;
                }
            }
        }
    }