2x2匹配的Visual Studio 2017

时间:2019-01-10 16:19:44

标签: webforms visual-studio-2017 matching

我的任务是: 创建一个简单的匹配游戏。从启动屏幕开始。然后转到2 X 2的一组图片,当您单击它们时它们将“翻转”。首先进行匹配工作,然后再进行第二部分工作。 如果有任何区别,我还需要以Web形式进行。 我当前的代码是:

Public Class SimpleMatching
    Inherits System.Web.UI.Page

    ' Declare and sets variables.


    Protected Sub TopLeftImage_Click(sender As Object, e As ImageClickEventArgs) Handles TopLeftImage.Click

        ' Flip over card
        If TopLeftImage.ImageUrl = "~/BackCard.png" Then

            TopLeftImage.ImageUrl = "~/star.png"
        Else

            TopLeftImage.ImageUrl = "~/BackCard.png"

        End If

        If BottomRightImage.ImageUrl = "~star.png" And TopLeftImage.ImageUrl IsNot "BackCard.png" Then

            MatchMadeLabelStar.Text = "Congratulations, you made the star match"

        End If

    End Sub

    Protected Sub BottomRightImage_Click(sender As Object, e As ImageClickEventArgs) Handles BottomRightImage.Click

        ' Flip over card
        If BottomRightImage.ImageUrl = "~/BackCard.png" Then

            BottomRightImage.ImageUrl = "~/star.png"
        Else

            BottomRightImage.ImageUrl = "~/BackCard.png"

        End If

        If TopLeftImage.ImageUrl = "~star.png" And BottomRightImage.ImageUrl IsNot "BackCard.png" Then

            MatchMadeLabelStar.Text = "Congratulations, you made the star match"

        End If

    End Sub

    Protected Sub BottomLeftImage_Click(sender As Object, e As ImageClickEventArgs) Handles BottomLeftImage.Click

        ' Flip over card
        If BottomLeftImage.ImageUrl = "~/BackCard.png" Then

            BottomLeftImage.ImageUrl = "~/sun.png"
        Else

            BottomLeftImage.ImageUrl = "~/BackCard.png"

        End If

        If TopRightImage.ImageUrl = "~sun.png" And BottomLeftImage.ImageUrl = "~sun.png" Then

            MatchMadeLabelSun.Text = "Congratulations, you made the sun match"

        End If

    End Sub

    Protected Sub TopRightImage_Click(sender As Object, e As ImageClickEventArgs) Handles TopRightImage.Click

        ' Flip over card
        If TopRightImage.ImageUrl = "~/BackCard.png" Then

            TopRightImage.ImageUrl = "~/sun.png"
        Else

            TopRightImage.ImageUrl = "~/BackCard.png"

        End If

        If TopRightImage.ImageUrl = "~sun.png" And BottomLeftImage.ImageUrl = "~sun.png" Then

            MatchMadeLabelSun.Text = "Congratulations, you made the sun match"

        End If

    End Sub

End Class

我很难将其标记为匹配,而不是将它们标记为匹配,我可以前后翻转很好地工作,但是匹配部分并没有那么多。如果您还需要其他信息,请告诉我,我一定会尽力帮助解决该问题!

0 个答案:

没有答案