public async Task <GameViewModel> InsertGame(GameInputModel game) { var entityGame = await _gameRepository.GetGames(game.Title, game.Producer); if (entityGame.Count > 0) { throw new GameAlreadyExistException(); } var gameInsert = new Game { Id = Guid.NewGuid(), Title = game.Title, Producer = game.Producer, Price = game.Price, Description = game.Description }; await _gameRepository.InsertGames(gameInsert); return(new GameViewModel { Id = gameInsert.Id, Title = gameInsert.Title, Producer = gameInsert.Producer, Price = gameInsert.Price, Description = gameInsert.Description }); }
public Game(GameInputModel model) { this.Id = Guid.NewGuid(); this.Name = model.Name; this.Producer = model.Producer; this.Price = model.Price; }
/// <summary> /// フィールドに対する入力 /// </summary> /// <param name="model"></param> public void GameInput(GameInputModel model) { if (model.InputMode == InputMode.PlaceTile) { if (SelectedTile == null) { return; } PlaceTileMode = SelectedTile.PlaceMode; switch (PlaceTileMode) { case PlaceTileMode.PlaceTileSingle: PlaceTileSingle(model); break; case PlaceTileMode.PlaceTileDraw: PlaceTileDraw(model); break; case PlaceTileMode.PlaceTileRect: PlaceTileRect(model); break; default: throw new ArgumentOutOfRangeException(); } } }
public async Task <GameViewModel> Insert(GameInputModel game) { var gameEntity = await _gameRepository.Get(game.Name, game.Producer); if (gameEntity.Count > 0) { throw new GameAlreadyRegisteredExeption(); } var gameInsert = new Game { Id = Guid.NewGuid(), Name = game.Name, Producer = game.Producer, Price = game.Price }; await _gameRepository.Insert(gameInsert); return new GameViewModel { Id = gameInsert.Id, Name = game.Name, Producer = game.Producer, Price = game.Price } }
/// <summary> /// ボタン以外の点でインプットがあったら発火 /// </summary> /// <param name="model"></param> public void InputOnGame(GameInputModel model) { foreach (var gameInputReceivable in _gameInputReceivables) { gameInputReceivable?.GameInput(model); } }
public void GameInput(GameInputModel model) { if (model.InputMode == InputMode.MoveCamera) { MoveCamera(_target.gameObject.transform.position - model.WorldDelta); } }
public static TilePlaceModel PlaceTileRect(this GameInputModel model) { return(model.ToPlaceModelInternal( new Vector3(model.WorldCurrentPos.x, model.WorldCurrentPos.y, 0), new Vector3(model.WorldDownPos.x, model.WorldDownPos.y, 0), PlaceTileMode.PlaceTileRect)); }
void SetPreview(GameInputModel model) { _tilemap.ClearAllTiles(); var placeModel = model.ToPlaceModel(_placeUseCase.PlaceTileMode); placeModel.Model = _allowTile; _tilemap.SetTileModel(placeModel); }
void PlaceTileRect(GameInputModel model) { if (model.State == GameInputState.PointerUp) { var placeModel = model.ToPlaceModel(PlaceTileMode.PlaceTileRect); placeModel.Model = SelectedTile; PlaceTile(placeModel); SelectedTile = null; } }
private static TilePlaceModel ToPlaceModelInternal(this GameInputModel model, Vector3 spos, Vector3 epos, PlaceTileMode mode) { return(new TilePlaceModel() { StartWorldPos = spos, EndWorldPos = epos, PlaceMode = mode, Model = null }); }
public async Task <ActionResult> UpdateGame([FromRoute] Guid idGame, [FromRoute] GameInputModel gameInputModel) { try{ await _gameService.Update(idGame, gameInputModel); return(Ok()); } catch (GameNotRegisteredException) { return(NotFound("Jogo inexistente")); } }
public async Task <ActionResult <GameViewModel> > CreateGame([FromBody] GameInputModel gameInputModel) { try{ var game = await _gameService.Insert(gameInputModel); return(Ok(game)); } catch (GameAlreadyRegisteredExeption) { return(UnprocessableEntity("Já existe um jogo com este nome para esta produtora")); } }
public async Task <IActionResult> Edit(GameInputModel input) { if (!this.ModelState.IsValid) { return(this.View(input)); } var id = await this.gamesService.Update(input); return(this.RedirectToAction("Details", new { area = "", id })); }
public async Task <IActionResult> Create(GameInputModel input) { if (!this.ModelState.IsValid) { return(this.View(input)); } var rootPath = this.environment.WebRootPath; var id = await this.gamesService.Create(input, rootPath); return(this.RedirectToAction(nameof(Details), new { id })); }
public async Task <ActionResult> UpdateGame([FromRoute] Guid idGame, [FromBody] GameInputModel gameInputModel) { try { await _gameService.Update(idGame, gameInputModel); return(Ok()); } catch (GameNotRegisteredException ex) { return(NotFound("There is no such game.")); } }
public async Task <ActionResult <GameViewModel> > Create([FromBody] GameInputModel game) { try { var savedGame = await gameService.Create(game); return(Ok(savedGame)); } catch (GameAlreadyExistException) { return(UnprocessableEntity("Já existe um jogo com este nome para esta produtora")); } }
public async Task <ActionResult <GameViewModel> > Post([FromBody] GameInputModel gameInputModel) { try { var game = await _gameService.Post(gameInputModel); return(Ok(game)); } catch (Exception ex) { return(UnprocessableEntity("Já existe um jogo com este nome para esta produtora")); } }
public async Task <ActionResult> Put([FromRoute] Guid gameId, [FromBody] GameInputModel gameInputModel) { try { await _gameService.Put(gameId, gameInputModel); return(Ok()); } catch (Exception ex) { return(NotFound("Não existe este jogo")); } }
public async Task Update(Guid id, GameInputModel game) { var savedGame = await gameRepository.Get(id); if (savedGame == null) { throw new GameNotFoundException(); } savedGame.UpdateFromGameInputModel(game); await gameRepository.Update(savedGame); }
/// <summary> /// フィールド入力があったとき /// </summary> /// <param name="model"></param> public void GameInput(GameInputModel model) { //タイプだけ選択解除 if (model.State == GameInputState.PointerDown) { foreach (Transform o in _tileList.transform) { Destroy(o.gameObject); } SelectedType = TileType.None; } }
public async Task <ActionResult> Update([FromRoute] Guid id, [FromBody] GameInputModel game) { try { await gameService.Update(id, game); return(Ok()); } catch (GameNotFoundException) { return(NotFound("Jogo não encontrado")); } }
public async Task <ActionResult <GameViewModel> > InsertGame([FromBody] GameInputModel gameInputModel) { try { var game = await _gameService.InsertGame(gameInputModel); return(Ok(game)); } catch (GameAlreadyExistException ex) { return(UnprocessableEntity("There's alreade a game with that name for this producer.")); } }
void Inject( ITilemapView tilemapView, ICameraView cameraView, IGameInputManager inputManager, IPlaceTileUseCase mapPlaceUseCase, ITileSelectView tileSelectView) { _tilemapView = tilemapView; _cameraView = cameraView; _inputManager = inputManager; _tileSelectView = tileSelectView; _mapPlaceUseCase = mapPlaceUseCase; _model = new GameInputModel(); }
public async Task <GameViewModel> Create(GameInputModel game) { var gamesWithNameAndProducer = await gameRepository.Get(game.Name, game.Producer); if (gamesWithNameAndProducer.Count > 0) { throw new GameAlreadyExistException(); } var newGame = new Game(game); await gameRepository.Create(newGame); return(newGame.ToGameViewModel()); }
public async Task Update(Guid id, GameInputModel game) { var gameEntity = await _gameRepository.Get(id); if (gameEntity == null) { throw new GameNotRegisteredException(); } gameEntity.Name = game.Name; gameEntity.Producer = game.Producer; gameEntity.Price = game.Price; await _gameRepository.Update(gameEntity); }
public async Task Update(Guid id, GameInputModel game) { var entityGame = await _gameRepository.GetGames(id); if (entityGame == null) { throw new GameAlreadyExistException(); } entityGame.Title = game.Title; entityGame.Producer = game.Producer; entityGame.Price = game.Price; await _gameRepository.UpdateGames(entityGame); }
public async Task <int> Update(GameInputModel input) { var game = gamesRepository.AllAsNoTrackingWithDeleted().FirstOrDefault(x => x.Id == input.Id); if (game == null) { throw new InvalidOperationException("The game could not be found"); } game = AutoMapperConfig.MapperInstance.Map <Game>(input); gamesRepository.Update(game); await gamesRepository.SaveChangesAsync(); // TODO: Fix Update of Genres //await genresService.RelateGameWithGenres(game.Id, input.GenreIds); return(input.Id); }
public async Task <int> Create(GameInputModel input, string rootPath) { var game = AutoMapperConfig.MapperInstance.Map <Game>(input); await gamesRepository.AddAsync(game); await gamesRepository.SaveChangesAsync(); await genresService.RelateGameWithGenres(game.Id, input.GenreIds); if (input.MediaFiles.Any()) { // TODO: Implement uploading of videos as well game.Images = await imageService.SaveImageFiles(input.MediaFiles, game.Id, rootPath); await gamesRepository.SaveChangesAsync(); } return(game.Id); }
public void GameInput(GameInputModel model) { if (model.InputMode != InputMode.PlaceTile) { return; } switch (model.State) { case GameInputState.PointerDown: case GameInputState.Drug: SetPreview(model); break; case GameInputState.PointerUp: _tilemap.ClearAllTiles(); break; default: throw new ArgumentOutOfRangeException(); } }
public static TilePlaceModel ToPlaceModel(this GameInputModel model, PlaceTileMode mode) { switch (mode) { case PlaceTileMode.PlaceTileSingle: return(model.PlaceTileSingle()); break; case PlaceTileMode.PlaceTileDraw: return(PlaceTileDraw(model)); break; case PlaceTileMode.PlaceTileRect: return(PlaceTileRect(model)); break; default: throw new ArgumentOutOfRangeException(); } }