Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        // Listens in on GameState for the number of rounds
        if ((GameState.Singleton.CurrentState == State.Win ||
             GameState.Singleton.CurrentState == State.Lose) &&
            (!drawGUI && surveyRoundState != SurveyRoundState.SurveyResultsSent))
        {
            // That last clause fixes a bug where the score window can pop up again by accident.
            drawGUI = true;
            if (totalScore == 0)
            {
                totalScore = (int)GameState.Singleton.score + GameRoundCounter.GetTotalScore();
            }
        }

        if (surveyObject != null)
        {
            LikertGUI lc2     = surveyObject.GetComponent <LikertGUI>();
            string    results = lc2.GetResults();
            if (results != null && !surveySent)
            {
                // SEND THE SURVEY RESULTS OFF....
                this.gameObject.GetComponent <DBGameStateManager>().SendSurveyResults(results);
                surveyRoundState = SurveyRoundState.SurveyResultsSent;
                surveySent       = true;
            }
        }
    }
Exemple #2
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();
    }
Exemple #3
0
 private void SetupLikertGUI(ref LikertGUI lg)
 {
     lg.file           = Resources.Load("likert") as TextAsset;
     lg.headerFile     = Resources.Load("likert_header") as TextAsset;
     lg.font           = font;
     lg.fontSize       = fontSize;
     lg.fontColor      = fontColor;
     lg.fontBackground = fontBackground;
     lg.nextSceneName  = titleSceneName;
 }