Example #1
0
        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"));
        }
Example #2
0
        public IActionResult Play()
        {
            Dojodachi hector = HttpContext.Session.GetObjectFromJson <Dojodachi>("pet");

            hector.Play();
            HttpContext.Session.SetObjectAsJson("pet", hector);
            return(RedirectToAction("Index"));
        }
Example #3
0
        public IActionResult Play()
        {
            Dojodachi Dachi = HttpContext.Session.GetObjectFromJson <Dojodachi>("dachi");

            Dachi.Play();

            HttpContext.Session.SetObjectAsJson("dachi", Dachi);
            HttpContext.Session.SetString("message", "You played with Dachi");

            return(RedirectToAction("Index"));
        }
Example #4
0
        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"));
        }