GUI.displayQuestionResults C# (CSharp) Méthode

displayQuestionResults() public méthode

public displayQuestionResults ( Results, theResults ) : void
theResults Results,
Résultat void
    public void displayQuestionResults(Results theResults)
    {
        // Audio to play on question load
        GameObject myViewGradeResult = GameObject.Find ("viewGradeResult");
        // Gives feedback on correctness
        GameObject myViewGradeText = GameObject.Find ("viewGradeText");
        // Moves on to next question ("Onwards!")
        GameObject myViewNextButton = GameObject.Find ("viewNextButton");

        //Image myViewGradeResultImage = myViewGradeResult.GetComponents<Image> ();
        Text myViewGradeTextComponent = myViewGradeText.GetComponent<Text> ();

        // Update the contents depending on whether you got it right or not
        if (theResults.isCorrect [0]) {
            myViewGradeTextComponent.text = "Hey, " + theResults.players [0].playerName + " got this correct!";
            myViewGradeTextComponent.color = Color.green;
            // Change the graphic to HAPPY
            //(GameObject.Find ("playerReaction")).GetComponent<Image>().sprite = Resources.Load("Cerulean_Happy") as Sprite;
        } else {
            myViewGradeTextComponent.text = theResults.players [0].playerName + " got this wrong. You suck.";
            myViewGradeTextComponent.color = Color.red;
            // Change the graphic to SAD
            //(GameObject.Find ("playerReaction")).GetComponent<Image>().sprite = Resources.Load ("Cerulean_Sad") as Sprite;
        }
        // Make things appear.
        // TODO: REFACTORING, I CALL DIBS, HANDS OFF NICK -- Watson
        myViewGradeTextComponent.enabled = true;
        (myViewNextButton.GetComponent<Image> ()).enabled = true;
        ((GameObject.Find ("viewNextButtonText")).GetComponent<Text>()).enabled = true;
    }