Esempio n. 1
0
    private void StartQuestion() // 問題を出力します。
    {
        quizCount++;
        if (selectedItem == null)
        {
            selectedItem = piQuiz.GetItem();
        }

        if (PiQuizOpener.GameMode == PiQuizOpener.Mode.ScoreAttack)
        {
            if (quizCount > PiQuizOpener.QuestionSize)
            {
                FinishGame();
                return;
            }
        }

        if (!FileScaner.ChkFile(selectedItem.ImagePath))
        {
            if (tryNullCount < 10)
            {
                Debug.LogWarning("Error. No File." + selectedItem.ImagePath);
                selectedItem = piQuiz.GetItem();
                tryNullCount++;
            }
        }

        rawImage.color    = new Color(-0.2f, -0.2f, -0.2f);
        rawImage.texture  = FileUniTexture.PNGToUniTex(selectedItem.ImagePath);
        startQuestionTime = piQuiz.stopWatch.ElapsedMilliseconds;
        piQuiz.stopWatch.Start();

        acceptAnswer = true;
        if (IsMulti)
        {
            if (acceptAnswerPlayer == null)
            {
                acceptAnswerPlayer = new bool[PlayerNameOnMulti.Length];
            }
            for (int i = 0; i < acceptAnswerPlayer.Length; i++)
            {
                acceptAnswerPlayer[i] = true;
            }
        }

        updateAction += GameRunning;

        if (IsMulti)
        {
            if (PlayerNameOnMulti.Length >= 3)
            {
                SetRundomRotate(rawImage.rectTransform);
            }
        }
    }
Esempio n. 2
0
    private void ChackAnswer(string str, int pushUser) // 回答を確認
    {
        var ans = this.gameObject.AddComponent <AnswerResultDialog>();

        if (selectedItem.ChackAnswer(str)) // Hit
        {
            sound.Sound(0);

            ans.Set(AnswerResultDialog.Result.Success);
            ans.SetTex(rawImage.texture);
            ans.NextAction = () => StartQuestion();
            rawImage.color = Color.white;
            if (IsMulti)
            {
                GetScore(pushUser);
            }
            else
            {
                GetScore();
            }

            selectedItem = piQuiz.GetItem(); // 正解後次の問題に備える
        }
        else
        {
            sound.Sound(1);

            if (IsMulti)
            {
                ans.Set(AnswerResultDialog.Result.FailureMulti);
            }
            else
            {
                ans.Set(AnswerResultDialog.Result.Failure);
            }

            piQuiz.stopWatch.Start();
            updateAction += GameRunning;
            acceptAnswer  = true;

            if (IsMulti)
            {
                if (acceptAnswerPlayer.All((x) => x == false))
                {
                    QuestionTimeOut();
                }
            }
        }
    }
Esempio n. 3
0
    void QuestionTimeOut() // 問題スキップ
    {
        rawImage.color = Color.white;
        Debug.Log("Question_TimeOut");
        updateAction -= GameRunning;
        acceptAnswer  = false;

        var ans = this.gameObject.AddComponent <AnswerResultDialog>();

        ans.Set(AnswerResultDialog.Result.TimeOutFailure);
        ans.SetMessage("答え : " + selectedItem.ItemName[0] + " など...");
        ans.NextAction += () => StartQuestion();

        selectedItem = piQuiz.GetItem();
    }