我希望你们能够帮助我! 我正试图把游戏简单化到死地。 当用户点击纽子时,我想死去。 选择随机编号,根据该数字,冰 d显示了该数字的形象。 工作! 然后,我希望我们的用户能够根据他们回过来的眼光向前迈进,增加他们所pin的东西,并看到这一景象。 当 de笑时,一切都是完美的,但出于某种原因,pa子永远不会走! 请告诉我,为什么。 我随函附上以下守则。 谢谢你!
protected void btnSpin_Click(object sender, EventArgs e)
{
Random randomNumber = new Random();
int x = randomNumber.Next(1, 6);
switch (x)
{
case 1:
//imgDie.ImageUrl = "~/Images/dice1.jpg";
Session["Die"] = "~/Images/dice1.jpg";
break;
case 2:
Session["Die"] = "~/Images/dice2.jpg";
break;
case 3:
Session["Die"] = "~/Images/dice3.jpg";
break;
case 4:
Session["Die"] = "~/Images/dice4.jpg";
break;
case 5:
Session["Die"] = "~/Images/dice5.jpg";
break;
case 6:
Session["Die"] = "~/Images/dice6.jpg";
break;
}
imgDie.ImageUrl = (string)Session["Die"];
place = place + x;
switch (place)
{
case 2:
img2.Visible = true;
img2.ImageUrl = (string)Session["Imagesrc"];
break;
case 3:
img3.Visible = true;
img3.ImageUrl = (string)Session["Imagesrc"];
break;
case 4:
img4.Visible = true;
img4.ImageUrl = (string)Session["Imagesrc"];
break;
case 5:
img5.Visible = true;
img5.ImageUrl = (string)Session["Imagesrc"];
break;
case 6:
img6.Visible = true;
img6.ImageUrl = (string)Session["Imagesrc"];
break;
case 7:
img7.Visible = true;
img7.ImageUrl = (string)Session["Imagesrc"];
break;
case 8:
img8.ImageUrl = (string)Session["Imagesrc"];
img8.Visible = true;
break;