Esempio n. 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"));
        }
Esempio n. 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 Work()
        {
            Dachi myDachi = HttpContext.Session.GetObjectFromJson <Dachi>("MyDojodachi");

            myDachi.Work();
            HttpContext.Session.SetObjectAsJson("MyDojodachi", myDachi);
            return(RedirectToAction("Dojodachi"));
        }
Esempio n. 4
0
        public IActionResult Work()
        {
            Dachi dachi = HttpContext.Session.GetObjectFromJson <Dachi>("dachi");

            dachi.Work();
            HttpContext.Session.SetObjectAsJson("dachi", dachi);
            return(RedirectToAction("index"));
        }
Esempio n. 5
0
        public IActionResult Work()
        {
            Dachi sessionPet = HttpContext.Session.GetObjectFromJson <Dachi>("pet");

            sessionPet.Work();
            HttpContext.Session.SetObjectAsJson("pet", sessionPet);
            return(RedirectToAction("Index"));
        }
Esempio n. 6
0
		public IActionResult Work()
		{
			Dachi myDachi = HttpContext.Session.GetObjectFromJson<Dachi>("myDachi");
			string response = myDachi.Work();
			HttpContext.Session.SetObjectAsJson("myDachi", myDachi);
			TempData["Response"] = response;
			TempData["Pic"] = "Work.gif";
			return RedirectToAction("Index");
		}
        public IActionResult Work()
        {
            Dachi dachi = GetDachi();

            TempData["original_energy"] = dachi.Energy;
            TempData["original_meals"]  = dachi.Meals;
            dachi.Work();
            SetDachi(dachi);
            return(RedirectToAction("Index"));
        }
Esempio n. 8
0
        public IActionResult WorkDachi()
        {
            Dachi CurrDachiData = HttpContext.Session.GetObjectFromJson <Dachi>("DachiData");

            if (CurrDachiData.Energy > 0)
            {
                CurrDachiData.Work();
            }
            else
            {
                CurrDachiData.Status = "Your Dojodachi has no more energy.";
            }
            HttpContext.Session.SetObjectAsJson("DachiData", CurrDachiData);
            return(RedirectToAction("Index"));
        }
Esempio n. 9
0
        public IActionResult Slave()
        {
            Dachi DachiInfoUp = HttpContext.Session.GetObjectFromJson <Dachi>("DachiInfo");

            if (DachiInfoUp.Energy > 4)
            {
                DachiInfoUp.Work();
            }
            else
            {
                DachiInfoUp.Message = "Dachi doesn't have the energy to work (he's almost dead).";
            }
            HttpContext.Session.SetObjectAsJson("DachiInfo", DachiInfoUp);
            return(RedirectToAction("Index"));
        }
Esempio n. 10
0
        public IActionResult Work()
        {
            Dachi CurrDachiData = HttpContext.Session.GetObjectFromJson <Dachi>("DachiData");

            if (CurrDachiData.Energy <= 0)
            {
                CurrDachiData.Message = ("Can't work now, not enough energy. Time to sleep!");
            }
            else
            {
                CurrDachiData.Work();
                CurrDachiData.Message = "All work and no play..";
            }
            HttpContext.Session.SetObjectAsJson("DachiData", CurrDachiData);
            return(RedirectToAction("Index"));
        }