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

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

            Dachi.Feed();

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

            return(RedirectToAction("Index"));
        }
예제 #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"));
        }