public JsonResult Work() { Dachi dachi = HttpContext.Session.GetObjectFromJson <Dachi>("Dachi"); dachi.work(); HttpContext.Session.SetObjectAsJson("Dachi", dachi); return(Json(dachi)); }
public IActionResult Work() { List <Dachi> ret = HttpContext.Session.GetObjectFromJson <List <Dachi> >("dachi"); Dachi dachi = (Dachi)ret[0]; TempData["response"] = dachi.work(); List <object> dachilist = new List <object>(); dachilist.Add(dachi); HttpContext.Session.SetObjectAsJson("dachi", dachilist); return(RedirectToAction("Index")); }
public IActionResult Work() { Dachi CurrDachiData = HttpContext.Session.GetObjectFromJson <Dachi>("DachiData"); if (CurrDachiData.energy > 0) { CurrDachiData.work(); } else { CurrDachiData.status = "No Energy... your Dachi cannot work."; } HttpContext.Session.SetObjectAsJson("DachiData", CurrDachiData); return(RedirectToAction("Index")); }
public IActionResult Work() { Dachi DachiInfo = HttpContext.Session.GetObjectFromJson <Dachi>("DachiInfo"); if (DachiInfo.energy >= 5) { DachiInfo.work(); } else { DachiInfo.status = "Your dachi is too tired to work. It must sleep to gain energy."; } HttpContext.Session.SetObjectAsJson("DachiInfo", DachiInfo); return(RedirectToAction("Index")); }
public IActionResult dachi(string button) { Dachi meep = HttpContext.Session.GetObjectFromJson <Dachi>("dachi"); if (button == "Feed") { meep.feed(meep); List <string> check = meep.status(meep); if (check.Contains("fine")) { HttpContext.Session.SetObjectAsJson("dachi", meep); return(RedirectToAction("page")); } else if (check.Contains("win")) { return(View("win")); } else if (check.Contains("dead")) { return(View("dead")); } } else if (button == "Play") { meep.play(meep); List <string> check = meep.status(meep); if (check.Contains("fine")) { HttpContext.Session.SetObjectAsJson("dachi", meep); return(RedirectToAction("page")); } else if (check.Contains("win")) { return(View("win")); } else if (check.Contains("dead")) { return(View("dead")); } } else if (button == "Work") { meep.work(meep); List <string> check = meep.status(meep); if (check.Contains("fine")) { HttpContext.Session.SetObjectAsJson("dachi", meep); return(RedirectToAction("page")); } else if (check.Contains("win")) { return(View("win")); } else if (check.Contains("dead")) { return(View("dead")); } } else if (button == "Sleep") { meep.sleep(meep); List <string> check = meep.status(meep); if (check.Contains("fine")) { HttpContext.Session.SetObjectAsJson("dachi", meep); return(RedirectToAction("page")); } else if (check.Contains("win")) { return(View("win")); } else if (check.Contains("dead")) { return(View("dead")); } } return(View("index")); }