Beispiel #1
0
        public ActionResult Play(string id, int?indexOfCard, bool?willPick, string buriedCardIndicies)
        {
            var repository = new OldGameRepository(GameDictionary.Instance.Dictionary);
            var game       = repository.GetById(Guid.Parse(id));

            switch (game.TurnType)
            {
            case TurnType.BeginHand:
                break;

            case TurnType.Pick:
                Pick(game, willPick.Value);
                break;

            case TurnType.Bury:
                Bury(game, buriedCardIndicies, false);
                break;

            case TurnType.PlayTrick:
                if (indexOfCard.HasValue)
                {
                    PlayTrick(game, indexOfCard.Value);
                }
                break;
            }
            return(RedirectToAction("Play", new { id = game.Id }));
        }
Beispiel #2
0
        public ActionResult Create(GameModel model)
        {
            var repository = new OldGameRepository(GameDictionary.Instance.Dictionary);
            var newGame    = repository.Create(1, model.SimpleCount, model.IntermediateCount, model.AdvancedCount, PartnerMethod.JackOfDiamonds, true);

            return(RedirectToAction("Play", new { id = newGame.Id }));
        }
Beispiel #3
0
        public ActionResult Play(string id)
        {
            var repository = new OldGameRepository(GameDictionary.Instance.Dictionary);
            var game       = repository.GetById(Guid.Parse(id));
            var turnState  = game.TurnState;

            switch (game.TurnType)
            {
            case TurnType.BeginHand:
                turnState.Hand = new Hand(game, _rnd);
                break;

            case TurnType.Pick:
                game.PlayNonHumanPickTurns(true);
                break;

            case TurnType.PlayTrick:
                game.PlayNonHumansInTrick();
                break;
            }
            return(View(turnState));
        }
Beispiel #4
0
        public ActionResult Index()
        {
            var repository = new OldGameRepository(GameDictionary.Instance.Dictionary);

            return(View());
        }