コード例 #1
0
    // Use this for initialization
    void Start()
    {
        guiQuestions = this.GetComponent <GUIQuestions>();
        guiAnswers   = this.GetComponent <GUIAnswers>();
        scorekeeper  = this.GetComponent <Scorekeeper>();

        if (PlayerPrefs.HasKey("deckLocation"))
        {
            string path = PlayerPrefs.GetString("deckLocation");
            WWW    www  = new WWW("file://" + path);
            StartCoroutine(waitForRequest(www));
        }
    }
コード例 #2
0
ファイル: GUIAnswers.cs プロジェクト: zhixu/live2DTest
    void OnGUI()
    {
        buttonStyle.fontSize = Screen.height / 35;

        left   = Screen.width / 16.0f;
        top    = Screen.height / 6.0f;
        width  = Screen.width / 4.0f;
        height = Screen.height / 4.0f;

        answerCount = 0;

        if (isAskingQuestion)
        {
            foreach (string answer in answers)
            {
                if (answer != null)
                {
                    if (GUI.Button(new Rect(left, top, width, height), answer, answerStyle))
                    {
                        if (string.Equals(answer, correctAnswer))
                        {
                            scorekeeper.addPoint();
                        }
                        else
                        {
                            scorekeeper.subtractPoint();
                        }

                        isAskingQuestion = false;
                        GUIQuestions q = this.GetComponent <GUIQuestions>();
                        q.turnOffQuestion();
                    }
                }

                top += heightIncrement;
                answerCount++;

                if (answerCount == answers.Length / 2)
                {
                    left = Screen.width - 5.0f * Screen.width / 16.0f;
                    top  = Screen.height / 6.0f;
                }
            }
        }

        if (GUI.Button(new Rect(Screen.width - width / 3 - 10, Screen.height - width / 4 - 10, width / 3, height / 3), "back", buttonStyle))
        {
            Application.LoadLevel("settings");
        }
    }