예제 #1
0
        public IActionResult Interaction(string id)
        {
            string interaction       = id;
            string interactionResult = null;
            Dachi  Billy             = HttpContext.Session.GetObjectFromJson <Dachi>("Billy");

            if (interaction == "Feed")
            {
                interactionResult = Billy.Feed();
            }
            if (interaction == "Play")
            {
                interactionResult = Billy.Play();
            }
            if (interaction == "Sleep")
            {
                interactionResult = Billy.Sleep();
            }
            if (interaction == "Work")
            {
                interactionResult = Billy.Work();
            }
            if (interaction == "Restart")
            {
                HttpContext.Session.Clear(); return(RedirectToAction("Index"));
            }
            HttpContext.Session.SetString("interactionResult", interactionResult);
            HttpContext.Session.SetObjectAsJson("Billy", Billy);
            ViewBag.interactionResult = interactionResult;
            ViewBag.Billy             = Billy;
            return(View("Index"));
        }
예제 #2
0
        public IActionResult Action(string activity)
        {
            switch (activity)
            {
            case "feed":
            {
                Dachi.Feed();
                break;
            }

            case "play":
            {
                Dachi.Play();
                break;
            }

            case "work":
            {
                Dachi.Work();
                break;
            }

            case "sleep":
            {
                Dachi.Sleep();
                break;
            }
            }
            return(RedirectToAction("Index"));
        }
        public IActionResult Sleep()
        {
            Dachi myDachi = HttpContext.Session.GetObjectFromJson <Dachi>("MyDojodachi");

            myDachi.Sleep();
            HttpContext.Session.SetObjectAsJson("MyDojodachi", myDachi);
            return(RedirectToAction("Dojodachi"));
        }
예제 #4
0
        public IActionResult Sleep()
        {
            Dachi dachi = HttpContext.Session.GetObjectFromJson <Dachi>("dachi");

            dachi.Sleep();
            HttpContext.Session.SetObjectAsJson("dachi", dachi);
            return(RedirectToAction("index"));
        }
예제 #5
0
        public IActionResult Sleep()
        {
            Dachi sessionPet = HttpContext.Session.GetObjectFromJson <Dachi>("pet");

            sessionPet.Sleep();
            HttpContext.Session.SetObjectAsJson("pet", sessionPet);
            return(RedirectToAction("Index"));
        }
예제 #6
0
        public IActionResult SleepDachi()
        {
            Dachi CurrDachiData = HttpContext.Session.GetObjectFromJson <Dachi>("DachiData");

            CurrDachiData.Sleep();
            HttpContext.Session.SetObjectAsJson("DachiData", CurrDachiData);
            return(RedirectToAction("Index"));
        }
예제 #7
0
        public IActionResult Nap()
        {
            Dachi DachiInfoUp = HttpContext.Session.GetObjectFromJson <Dachi>("DachiInfo");

            DachiInfoUp.Sleep();
            HttpContext.Session.SetObjectAsJson("DachiInfo", DachiInfoUp);
            return(RedirectToAction("Index"));
        }
예제 #8
0
		public IActionResult Sleep()
		{
			Dachi myDachi = HttpContext.Session.GetObjectFromJson<Dachi>("myDachi");
			string response = myDachi.Sleep();
			HttpContext.Session.SetObjectAsJson("myDachi", myDachi);
			TempData["Response"] = response;
			TempData["Pic"] = "Sleep.gif";
			return RedirectToAction("Index");
		}
        public IActionResult Sleep()
        {
            Dachi dachi = GetDachi();

            TempData["original_fullness"]  = dachi.Fullness;
            TempData["original_happiness"] = dachi.Happiness;
            TempData["original_energy"]    = dachi.Energy;
            dachi.Sleep();
            SetDachi(dachi);
            return(RedirectToAction("Index"));
        }
예제 #10
0
        public IActionResult Sleep()
        {
            Dachi CurrDachiData = HttpContext.Session.GetObjectFromJson <Dachi>("DachiData");

            if (CurrDachiData.Fullness <= 0 || CurrDachiData.Happiness <= 0)
            {
                CurrDachiData.Message = ("Too hungry and sad to sleep!");
            }
            else
            {
                CurrDachiData.Sleep();
                CurrDachiData.Message = "Zzzz..";
            }
            HttpContext.Session.SetObjectAsJson("DachiData", CurrDachiData);
            return(RedirectToAction("Index"));
        }