public GameCoordinator(IConnectionsManager connectionManager, IGameInstanceFactory gameInstanceFactory) { _connectionManager = connectionManager; _gameInstanceFactory = gameInstanceFactory; _games = new List <IGameInstance>(); _clients = new List <GameClient>(); }
public Ruleset(int id, string name, string description, IGameInstanceFactory factory) { this.id = id; this.name = name ?? throw new ArgumentNullException(); this.description = description ?? throw new ArgumentNullException(); this.factory = factory ?? throw new ArgumentNullException(); }
public RulesetList(IReadOnlyServiceLocator serviceLocator) { //RulesetNameとの相互依存関係を明確化する IGameInstanceFactory[] factories = new IGameInstanceFactory[] { new DefaultGameInstanceFactory <Domain.Entities.StandardizedRule.StandardizedRuleGame>(firstPlayerEncampment => new Domain.Entities.StandardizedRule.StandardizedRuleGame(firstPlayerEncampment, serviceLocator)), new DefaultGameInstanceFactory <Domain.Entities.StandardizedRule.StandardizedRuleGame>(firstPlayerEncampment => new Domain.Entities.StandardizedRule.StandardizedRuleGame(firstPlayerEncampment, serviceLocator)), new DefaultGameInstanceFactory <Domain.Entities.NoRule.NoRuleGame>(firstPlayerEncampment => new Domain.Entities.NoRule.NoRuleGame(firstPlayerEncampment)), }; int i = 0; rulesets = factories.Select(factory => { RulesetName rulesetName = (RulesetName)i; return(new Ruleset(i++, rulesetName.ToString(), "", factory)); }).ToDictionary(ruleset => ruleset.id); }