private static ICueBallGame CreatePoolGame(CueBallGameType gameType, ICueBallGameReferee referee, IPlayer player1, IPlayer player2) { LazyInitializer.EnsureInitialized(ref _gameCreationDelegates, SetupGameCreationalDelegates); var game = _gameCreationDelegates[gameType](referee, player1, player2); return(game); }
protected CueBallGame(ICueBallGameReferee cueBallGameReferee, CueBallGameType gameType, IPlayer player1, IPlayer player2) { _cueBallGameReferee = cueBallGameReferee; _ballsOnTable = new List <Ball>(); foreach (var ballType in gameType.GetAllGameBalls()) { AddBall(ballType); } _cueBallGameReferee.Initialize(this); _cueBallGameReferee.SetPlayers(player1, player2); }
private static IEnumerable <Ball> GetGameBallOfType(CueBallGameType cueBallGameType) { return(GetAllBalls().Where(gameBall => gameBall.IsBallOfGameType(cueBallGameType))); }
public static IEnumerable <Ball> GetAllGameBalls(this CueBallGameType cueBallGameType) { return(_gameBallCreators[cueBallGameType]()); }
public bool IsBallOfGameType(CueBallGameType cueBallGameType) { return(CueBallGameType.HasFlag(cueBallGameType)); }
public Ball(BallTypes ballType, CueBallGameType cueBallGameType, byte weight, BallGroupTypes ballGroupType) : this(ballType, cueBallGameType, weight) { BallGroupType = ballGroupType; }
public Ball(BallTypes ballType, CueBallGameType cueBallGameType, byte weight) : this(ballType) { CueBallGameType = cueBallGameType; Weight = weight; }
private static IShotHistoryProvider CreateShotHistoryProvider(CueBallGameType gameType) { LazyInitializer.EnsureInitialized(ref _shotHistoryProvider, SetupGameStatusProviderStatus); return(_shotHistoryProvider[gameType]()); }
public static TGameType CreatePoolGame <TGameType>(CueBallGameType cueBallGameType, IPlayer player1, IPlayer player2) { return((TGameType)CreatePoolGame(cueBallGameType, CreateGameReferee(cueBallGameType), player1, player2)); }
public static ICueBallGameReferee CreateGameReferee(CueBallGameType gameType) { LazyInitializer.EnsureInitialized(ref _gameReferee, SetupGameRefereeCreationalDelegates); return(_gameReferee[gameType](CreateShotHistoryProvider(gameType))); }