} // For use when inflating from file. public ComputerPlayer(string name, GameBoard gameBoard, LocalGameController localGameController, INumberGenerator numberGenerator) : base(name) { this.gameBoard = gameBoard; this.numberGenerator = numberGenerator; this.decisionMaker = new DecisionMaker(this.numberGenerator); this.localGameController = localGameController; }
public static void LaunchGameAndCompleteSetup(LocalGameController localGameController) { localGameController.JoinGame(); localGameController.LaunchGame(); localGameController.StartGameSetup(); localGameController.ContinueGameSetup(LocalGameControllerTestCreator.MainSettlementOneLocation, LocalGameControllerTestCreator.MainRoadOneEnd); localGameController.CompleteGameSetup(LocalGameControllerTestCreator.MainSettlementTwoLocation, LocalGameControllerTestCreator.MainRoadTwoEnd); }
protected void CompleteGameSetup(LocalGameController localGameController) { localGameController.JoinGame(); localGameController.LaunchGame(); localGameController.StartGameSetup(); localGameController.ContinueGameSetup(MainSettlementOneLocation, MainRoadOneEnd); localGameController.CompleteGameSetup(MainSettlementTwoLocation, MainRoadTwoEnd); }
public static ControllerViewModel Load(string filePath) { var localGameController = new LocalGameController(new TestNumberGenerator(), null, true); var controller = new ControllerViewModel(localGameController); localGameController.Load(filePath); return(controller); }
public TestInstances(LocalGameController localGameController, MockPlayer player, MockComputerPlayer firstOpponent, MockComputerPlayer secondOpponent, MockComputerPlayer thirdOpponent, MockDice dice) { this.MainPlayer = player; this.FirstOpponent = firstOpponent; this.SecondOpponent = secondOpponent; this.ThirdOpponent = thirdOpponent; this.Dice = dice; this.LocalGameController = localGameController; }
public static TestInstances CreateTestInstances(MockDice mockNumGenerator, PlayerSetup playerSetup, IDevelopmentCardHolder developmentCardHolder, GameBoard gameBoard) { MockDice mockNumberGenerator = null; if (mockNumGenerator != null) { mockNumberGenerator = mockNumGenerator; } else { mockNumberGenerator = LocalGameControllerTestCreator.CreateMockNumberGenerator(); } MockPlayer player; MockComputerPlayer firstOpponent, secondOpponent, thirdOpponent; IPlayerFactory playerPool = null; if (playerSetup != null) { player = playerSetup.Player; firstOpponent = playerSetup.FirstOpponent; secondOpponent = playerSetup.SecondOpponent; thirdOpponent = playerSetup.ThirdOpponent; playerPool = playerSetup.PlayerPool; } else { LocalGameControllerTestCreator.CreateDefaultPlayerInstances(out player, out firstOpponent, out secondOpponent, out thirdOpponent); playerPool = LocalGameControllerTestCreator.CreateMockPlayerPool(player, firstOpponent, secondOpponent, thirdOpponent); } if (developmentCardHolder == null) { developmentCardHolder = new DevelopmentCardHolder(); } if (gameBoard == null) { gameBoard = new GameBoard(BoardSizes.Standard); } var localGameController = new LocalGameController(mockNumberGenerator, playerPool, gameBoard, developmentCardHolder); localGameController.ErrorRaisedEvent = (ErrorDetails e) => { throw new Exception(e.Message); }; var testInstances = new TestInstances(localGameController, player, firstOpponent, secondOpponent, thirdOpponent, mockNumberGenerator); return(testInstances); }
private ControllerViewModel(LocalGameController localGameController) { this.localGameController = localGameController; this.localGameController.DiceRollEvent = this.DiceRollEventHandler; this.localGameController.ErrorRaisedEvent = this.ErrorRaisedEventHandler; this.localGameController.GameEvents = this.GameEventsHandler; this.localGameController.GameJoinedEvent = this.GameJoinedEventHandler; this.localGameController.StartPlayerTurnEvent = this.StartPlayerTurnEventHandler; this.localGameController.InitialBoardSetupEvent = this.InitialBoardSetupEventHandler; this.localGameController.RobberEvent = this.RobberEventHandler; this.localGameController.ResourcesLostEvent = this.ResourcesLostEventHandler; this.localGameController.RobbingChoicesEvent = this.RobbingChoicesEventHandler; this.localGameController.ResourcesTransferredEvent = this.ResourcesTransferredEventHandler; this.localGameController.RoadSegmentBuiltEvent = this.RoadSegmentBuiltEventHandler; this.SetupMessage = "Select location for FIRST Settlement and Road Segment"; }
public IGameController Create(GameOptions gameOptions, GameControllerSetup gameControllerSetup) { this.VerifyControllerSetup(gameControllerSetup); IGameController gameController = null; if (gameOptions == null || gameOptions.Connection == GameConnectionTypes.Local) { gameController = new LocalGameController(this.diceRollerFactory.Create(), this.computerPlayerFactory, new GameBoards.GameBoard(BoardSizes.Standard), null); } else { throw new NotImplementedException(); } gameController.GameJoinedEvent = gameControllerSetup.GameJoinedEventHandler; gameController.InitialBoardSetupEvent = gameControllerSetup.InitialBoardSetupEventHandler; gameController.LoggedInEvent = gameControllerSetup.LoggedInEventHandler; gameController.StartInitialSetupTurnEvent = gameControllerSetup.StartInitialSetupTurnEvent; return(gameController); }
// TODO: Pass in interface that only contains the methods required by the computer player e.g build settlement public PlayerAction PlayTurn(PlayerDataModel[] otherPlayerData, LocalGameController localGameController) { throw new NotImplementedException(); }
public IPlayer CreateComputerPlayer(GameBoard gameBoard, LocalGameController localGameController, INumberGenerator numberGenerator) { var player = new ScenarioComputerPlayer(this.names.Dequeue(), gameBoard, localGameController, numberGenerator); return(player); }
public PlayAreaViewModel(LocalGameController localGameController) { this.localGameController = localGameController; }
public ScenarioComputerPlayer(string name, GameBoard gameBoard, LocalGameController localGameController, INumberGenerator numberGenerator) : base(name, gameBoard, localGameController, numberGenerator) { }
public IPlayer CreateComputerPlayer(GameBoard gameBoard, LocalGameController localGameController, INumberGenerator numberGenerator) { return(new ComputerPlayer(this.names.Dequeue(), gameBoard, null, numberGenerator)); }