0

プレイヤーが質問に答え、正解した場合、2 枚のカードを裏返して一致するかどうかを確認するゲームを作成しています (ペア ゲームのようなものです)。ただし、入力ボックス (ユーザーが回答を入力する方法) を停止する方法 (ユーザーが回答を入力する方法) を理解するのに苦労しています。

私は 2 つの配列を使用しています。1 つは質問を保持するため、もう 1 つは回答を保持するためです。Ps 最後のいくつかの質問を失礼します。すべてを完了する前に、それを機能させようとしています。

Private Sub Questions()

    strQuestions(0) = "A common noun refers to the name of things."
    strQuestions(1) = "A pronoun is a word that takes the place of nouns."
    strQuestions(2) = "'She' is a pronoun that would replace a woman's name."
    strQuestions(3) = "The days of the week are proper nouns."
    strQuestions(4) = "'He', 'She' and 'them' are all pronouns."
    strQuestions(5) = "Spain is a proper noun."
    strQuestions(6) = "Proper nouns always start with a capital letter."
    strQuestions(7) = "The place 'England' is referred to as a proper noun."
    strQuestions(8) = "A 'camera' is a common noun."
    strQuestions(9) = "FE"
    strQuestions(10) = "GR"

    strAnswers(0) = "TRUE"
    strAnswers(1) = "TRUE"
    strAnswers(2) = "TRUE"
    strAnswers(3) = "TRUE"
    strAnswers(4) = "TRUE"
    strAnswers(5) = "TRUE"
    strAnswers(6) = "TRUE"
    strAnswers(7) = "TRUE"
    strAnswers(8) = "TRUE"
    strAnswers(9) = "TRUE"
    strAnswers(10) = "TRUE"

    Dim userAnswer As String

    For i = 0 To UBound(strQuestions)
        userAnswer = InputBox(strQuestions(i))
        If userAnswer <> strAnswers(i) Then
            MsgBox("Incorrect. Try again.")
        Else
            MsgBox("Correct! Make your move.")
            WHAT GOES HERE?
        End If
    Next i
End Sub

Private Sub label_click(ByVal sender As System.Object,
                        ByVal e As System.EventArgs) Handles Label9.Click, Label8.Click, Label7.Click, Label6.Click, Label5.Click,
                    Label4.Click, Label3.Click, Label2.Click, Label16.Click, Label15.Click, Label14.Click, Label13.Click, Label12.Click,
                    Label11.Click, Label10.Click, Label1.Click

    ' The timer is only on after two non-matching 
    ' icons have been shown to the player, 
    ' so ignore any clicks if the timer is running
    If Timer1.Enabled Then Exit Sub

    Dim clickedLabel = TryCast(sender, Label)

    If clickedLabel IsNot Nothing Then

    End If
    ' If the clicked label is black, the player clicked
    ' an icon that's already been revealed --
    ' ignore the click
    If clickedLabel.ForeColor = Color.Black Then Exit Sub

    ' If firstClicked is Nothing, this is the first icon 
    ' in the pair that the player clicked, 
    ' so set firstClicked to the label that the player 
    ' clicked, change its color to black, and return
    If firstClicked Is Nothing Then
        firstClicked = clickedLabel
        firstClicked.ForeColor = Color.Black
        Exit Sub
    End If

    ' If the player gets this far, the timer isn't 
    ' running and firstClicked isn't Nothing, 
    ' so this must be the second icon the player clicked
    ' Set its color to black
    secondClicked = clickedLabel
    secondClicked.ForeColor = Color.Black

    CheckForWinner()

    ' If the player clicked two matching icons, keep them 
    ' black and reset firstClicked and secondClicked 
    ' so the player can click another icon
    If firstClicked.Text = secondClicked.Text Then
        firstClicked = Nothing
        secondClicked = Nothing
        Questions()
        Exit Sub
    End If

    ' If the player gets this far, the player 
    ' clicked two different icons, so start the 
    ' timer (which will wait three quarters of 
    ' a second, and then hide the icons)
    Timer1.Start()

    Questions()
Exit Sub
4

1 に答える 1