public BattleshipsGameBoard(IGameResources resx, IGameOptions opt, IGameRepository repo) { GameResources = resx; GameOptions = opt; GameRepository = repo; InputValidator = new InputValidator(resx, repo, opt); }
public static ICodemaker CreateCodemaker(IGameOptions options, ICodemaker lastCodemaker) { var type = ShellEx.PromptPlayerType("Codemaker", lastCodemaker?.Type); ShellEx.WriteKeyValue("Codemaker", type.ToString().ToLower()); switch (type) { case PlayerType.Human: return(new HumanCodemaker(options)); case PlayerType.Computer: PegPattern code; var codeType = Shell.PromptEnum <ComputerCodeType>("Choose secret code", ComputerCodeType.Random); switch (codeType) { case ComputerCodeType.Random: code = options.Palette.GetRandomPattern(options); break; case ComputerCodeType.Custom: code = ShellEx.PromptPegPattern("Enter secret code", options); break; default: throw new Exception($"Unknown code type"); } ShellEx.WriteKeyValue("Code", codeType.ToString().ToLower()); return(new ComputerCodemaker(options, code)); default: throw new Exception($"Unknown player type: {type}"); } }
public void Load(IUserProfileModel userProfileModel) { IUserInventory inventory = LoadInventory(); IUserStats userStats = LoadUserStats(); IGameOptions gameOptions = LoadGameOptions(); userProfileModel.UserProfile = new UserProfile(inventory, userStats, gameOptions); }
public Game(ICommander console, IServiceProvider gameServices, CommandMap allCommands, CommandMap globalCommands, ISet <Type> areas, IGameOptions gameOptions) { Commander = console; GameOptions = gameOptions; _gameServices = gameServices; _allCommands = allCommands; _globalCommands = globalCommands; _areas = areas; }
/// <inheritdoc/> public async Task <int> Start(IEnumerable <IPlayer> players, IGameOptions options = null) { if (options == null) { gameOptions = GameOptions.Default; } var pack = await gamePackLoader.Load(); Pack = await ShuffleCards(pack); GameArea = options.GameArea; GameSquares = await gameMapLoader.Load(); return(CurrentGameId++); }
public IGame Build(IGameOptions gameOptions = null) { LoadAreas(); LoadCommands(); _startup.ConfigureCommands(this); _serviceCollection.AddSingleton <IGame, Game>(services => new Game(services.GetService <ICommander>(), GameServices, _commands, _globalCommands, _areas, gameOptions ?? new GameOptions())); GameServices = _serviceCollection.BuildServiceProvider(); var game = GameServices.GetService <IGame>(); _startup.ConfigureGame(game); GameServices.GetRequiredService <ICommander>().OnGameCreated(game); return(game); }
public GameManager( IGameOptions gameOptions, IDebug debug, IItemManager itemManager, IEntityManager entityManager, IHud hud, IPlayer player, IInventory inventory, IActiveGear activeGear ) { // components _debug = debug ?? throw new ArgumentNullException(ComponentStrings.Debug); _gameOptions = gameOptions ?? throw new ArgumentNullException(ComponentStrings.GameOptions); _hud = hud ?? throw new ArgumentNullException(ComponentStrings.HUD); _inventory = inventory ?? throw new ArgumentNullException(ComponentStrings.Inventory); _itemManager = itemManager ?? throw new ArgumentNullException(ComponentStrings.ItemManager); _entityManager = entityManager ?? throw new ArgumentNullException(ComponentStrings.EntityManager); _player = player ?? throw new ArgumentNullException(ComponentStrings.Player); _activeGear = activeGear ?? throw new ArgumentNullException(ComponentStrings.ActiveGear); }
public static ICodebreaker CreateCodebreaker(IGameOptions options, ICodebreaker lastCodebreaker) { var type = ShellEx.PromptPlayerType("Codebreaker", lastCodebreaker?.Type); ShellEx.WriteKeyValue("Codebreaker", type.ToString().ToLower()); switch (type) { case PlayerType.Human: return(new HumanCodebreaker(options)); case PlayerType.Computer: PegPattern initialGuess; var initialGuessType = Shell.PromptEnum <ComputerInitialGuessType>("Choose initial guess", ComputerInitialGuessType.Default); switch (initialGuessType) { case ComputerInitialGuessType.Default: initialGuess = null; break; case ComputerInitialGuessType.Random: initialGuess = options.Palette.GetRandomPattern(options); break; case ComputerInitialGuessType.Custom: initialGuess = ShellEx.PromptPegPattern("Enter initial guess", options); break; default: throw new Exception($"Unknown initial guess type"); } ShellEx.WriteKeyValue("Initial guess", initialGuessType.ToString().ToLower()); return(new ComputerCodebreaker(options, initialGuess)); default: throw new Exception($"Unknown player type: {type}"); } }
private void SaveGameOptions(IGameOptions gameOptions) { CustomPlayerPrefs.SetBool(StringConstants.PlayerPrefsKeys.IsSoundOn, gameOptions.IsSoundOn); CustomPlayerPrefs.SetBool(StringConstants.PlayerPrefsKeys.IsMusicOn, gameOptions.IsMusicOn); }
protected Codebreaker(IGameOptions options) : base(options) { }
public HumanCodemaker(IGameOptions options) : base(options) { }
public InputValidator(IGameResources resx, IGameRepository repo, IGameOptions opt) { GameResources = resx; GameRepository = repo; GameOptions = opt; }
public GameController(IGameOptions gameOptions) { _gameOptions = gameOptions; }
protected Player(IGameOptions options) { Options = options; }
public Game2048(IGameEngine engine, IGameOptions options, IStatefullBoard board) { m_engine = engine; m_options = options; m_board = board; }
public ComputerCodemaker(IGameOptions options, PegPattern code) : base(options) { _code = code ?? throw new ArgumentNullException(nameof(code)); }
public ComputerCodemaker(IGameOptions options) : base(options) { _code = Options.Palette.GetRandomPattern(Options); }
public ComputerCodebreaker(IGameOptions options, PegPattern initialGuess = null) : base(options) { _initialGuess = initialGuess; }
public UserProfile(IUserInventory inventory, IUserStats userStats, IGameOptions gameOptions) { UserInventory = inventory; UserStats = userStats; GameOptions = gameOptions; }