public IActionResult GoDachi(string activity) { for (int i = 0; i < 10; i++) { Console.WriteLine("$$$$$$$$$$$$$$$$$$$$$$$$$"); Console.WriteLine(activity); } if (activity.Equals("Feed")) { Console.WriteLine("1111111111111"); x.Feed(); } switch (activity) { case "Sleep": x.Sleep(); break; case "Feed": Console.WriteLine("1111111111111"); break; case "Play": x.Play(); break; case "Work": x.Work(); break; } return(RedirectToAction("Index")); }
public IActionResult Work() { Dojodachi hector = HttpContext.Session.GetObjectFromJson <Dojodachi>("pet"); hector.Work(); HttpContext.Session.SetObjectAsJson("pet", hector); return(RedirectToAction("Index")); }
public IActionResult Work() { Dojodachi Dachi = HttpContext.Session.GetObjectFromJson <Dojodachi>("dachi"); Dachi.Work(); HttpContext.Session.SetObjectAsJson("dachi", Dachi); HttpContext.Session.SetString("message", "You made Dachi work for food"); return(RedirectToAction("Index")); }
public IActionResult Process(string action) { // Random rand = new Random(); // string action = "earn"; // int goldThisTime = 0; Dojodachi game = HttpContext.Session.GetObjectAsJson <Dojodachi>("game"); switch (action) { case "Feeding": game.Feed(); break; case "Playing": game.Play(); break; case "Working": game.Work(); break; default: game.Sleep(); break; } // Golding game = HttpContext.Session.GetObjectAsJson<Golding>("game"); // action = goldThisTime < 0 ? "lose" : action; // game.Gold += goldThisTime; // game.Activities.Add( // $"You {action} {goldThisTime} from the {building} ({DateTime.Now.ToString("g")})" // ); game.CheckDojodachi(); HttpContext.Session.SetObjectAsJson("game", game); return(RedirectToAction("Index")); }