Ejemplo n.º 1
0
        public static Game CreateGame(IEnumerable<IPlayer> players)
        {
            var dice = new MonopolyDice();

            var banker = new Banker(players);
            var realEstateHandler = new OwnableHandler(BoardFactory.CreateRealEstate(dice), banker);
            var spaces = BoardFactory.CreateNonRealEstateSpaces(banker);
            var spaceHandler = new UnownableHandler(spaces);

            var boardHandler = new BoardHandler(players, realEstateHandler, spaceHandler, banker);
            var jailHandler = new JailHandler(dice, boardHandler, banker);
            var turnHandler = new TurnHandler(dice, boardHandler, jailHandler, realEstateHandler, banker);

            var deckFactory = new DeckFactory(players, jailHandler, boardHandler, realEstateHandler, banker);
            var communityChest = deckFactory.BuildCommunityChestDeck();
            var chance = deckFactory.BuildChanceDeck(dice);

            foreach (var space in spaces.Values.OfType<DrawCard>())
            {
                if (space.ToString() == "Community Chest")
                    space.AddDeck(communityChest);
                else
                    space.AddDeck(chance);
            }

            return new Game(players, turnHandler, banker);
        }
        public void Init()
        {
            ninject = new StandardKernel(new BindingsModule());

            deckFactory = ninject.Get<DeckFactory>();
            chanceDeck = deckFactory.BuildChanceDeck();
            chestDeck = deckFactory.BuildCommunitiyChestDeck();
        }
        public void Setup()
        {
            var players = new[] { new Player("Player") };
            var dice = new ControlledDice();
            var realEstateHandler = FakeHandlerFactory.CreateEmptyRealEstateHandler(players);
            var banker = new Banker(players);
            var boardHandler = FakeHandlerFactory.CreateBoardHandlerForFakeBoard(players, realEstateHandler, banker);
            var jailHandler = new JailHandler(dice, boardHandler, banker);
            var deckFactory = new DeckFactory(players, jailHandler, boardHandler, realEstateHandler, banker);

            deck = deckFactory.BuildCommunityChestDeck();
        }
Ejemplo n.º 4
0
        public void Setup()
        {
            player = new Player("name");
            var players = new[] { player };
            var realEstateHandler = FakeHandlerFactory.CreateEmptyRealEstateHandler(players);
            var boardHandler = FakeHandlerFactory.CreateBoardHandlerForFakeBoard(players, realEstateHandler, banker);
            var dice = new ControlledDice();
            banker = new Banker(players);
            var jailHandler = new JailHandler(dice, boardHandler, banker);
            var deckFactory = new DeckFactory(players, jailHandler, boardHandler, realEstateHandler, banker);

            deck = deckFactory.BuildCommunityChestDeck();
            drawCard = new DrawCard("draw card");
            drawCard.AddDeck(deck);
        }
Ejemplo n.º 5
0
        public void Setup()
        {
            var players = new[] { new Player("Player") };
            var banker = new Banker(players);
            var realEstateHandler = new OwnableHandler(new Dictionary<Int32, OwnableSpace>(), banker);
            var boardHandler = FakeHandlerFactory.CreateBoardHandlerForFakeBoard(players, realEstateHandler, banker);
            var dice = new ControlledDice();
            var jailHandler = new JailHandler(dice, boardHandler, banker);
            var deckFactory = new DeckFactory(players, jailHandler, boardHandler, realEstateHandler, banker);

            deck = deckFactory.BuildChanceDeck(dice);
        }