/// <summary> /// 返回玩家下注的乌龟和票数 /// </summary> /// <param name="userName"></param> /// <param name="guessWg"></param> /// <param name="guessPolls"></param> public void GetGuessInfo(string wgName, out GuessingNumber guessWg, out int guessPolls) { int polls; userGuessInfoDic.TryGetValue(wgName, out polls); switch (wgName) { case "Tog_WG1": guessWg = GuessingNumber.GuessingFirst; break; case "Tog_WG2": guessWg = GuessingNumber.GuessingSecond; break; case "Tog_WG3": guessWg = GuessingNumber.GuessingThird; break; default: guessWg = GuessingNumber.GuessingFirst; break; } guessPolls = polls; }
public ActionResult GessingGame(int guess = 0) { ViewBag.found = false; int randomNumberFromSession = int.Parse(Session["randomNumber"].ToString()); GuessingNumber gessingList = new GuessingNumber(); Session["GuessList"] = new List <GuessingNumber>(); List <GuessingNumber> myList = new List <GuessingNumber>(); gessingList.Id++; gessingList.GuessingNum = guess; if (guess > randomNumberFromSession) { ViewBag.message = "too high, try again with lower num"; gessingList.Description = "Try down"; // gessingList.Guess.Add(gessingList); } else if (guess < randomNumberFromSession) { ViewBag.message = "too low, try again with higher num"; gessingList.Description = "Try height"; // gessingList.Guess.Add(gessingList); } else { ViewBag.message = "Congratulations,\n you won please reset to start new game againg!"; gessingList.Description = "you won"; ViewBag.found = true; } myList.Add(gessingList); return(View(gessingList)); }