Exemple #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"));
        }
Exemple #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 Play()
        {
            Dachi myDachi = HttpContext.Session.GetObjectFromJson <Dachi>("MyDojodachi");

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

            dachi.Play();
            HttpContext.Session.SetObjectAsJson("dachi", dachi);
            return(RedirectToAction("index"));
        }
        public IActionResult Play(string gameType)
        {
            Dachi currDachi = getDachiFromSession();

            TempData["message"] = currDachi.Play(gameType);
            setDachiSession(currDachi);
            return(RedirectToAction("Index"));
        }
        public IActionResult Play(string gameType)
        {
            Dachi currDachi = getDachiFromSession();        //you're getting the dachi from session into object currDachi

            TempData["message"] = currDachi.Play(gameType); //This invokes the function Play from the currDachi, the dachi model, & returns a string
            setDachiInSession(currDachi);                   //this set the new numbers into session
            return(RedirectToAction("Index"));
        }
        public IActionResult Play()
        {
            Dachi sessionPet = HttpContext.Session.GetObjectFromJson <Dachi>("pet");

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

            TempData["original_happiness"] = dachi.Happiness;
            TempData["original_energy"]    = dachi.Energy;
            dachi.Play();
            SetDachi(dachi);
            return(RedirectToAction("Index"));
        }
        public IActionResult PlayDachi()
        {
            Dachi CurrDachiData = HttpContext.Session.GetObjectFromJson <Dachi>("DachiData");

            if (CurrDachiData.Energy > 0)
            {
                CurrDachiData.Play();
            }
            else
            {
                CurrDachiData.Status = "No Energy... your Dachi cannot work or play. Dachi needs sleep.";
            }
            HttpContext.Session.SetObjectAsJson("DachiData", CurrDachiData);
            return(RedirectToAction("Index"));
        }
Exemple #11
0
        public IActionResult PlayWith()
        {
            Dachi DachiInfoUp = HttpContext.Session.GetObjectFromJson <Dachi>("DachiInfo");

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

            if (CurrDachiData.Energy <= 0)
            {
                CurrDachiData.Message = ("No more energy...Time to sleep!");
            }
            else
            {
                CurrDachiData.Play();
                CurrDachiData.Message = "Play ball!";
            }

            HttpContext.Session.SetObjectAsJson("DachiData", CurrDachiData);
            return(RedirectToAction("Index"));
        }