protected override GameQuery _HandleQuery(GameQuery q) { if (q is GameQuery_SubEntities) this.HandleQuerySubEntities((GameQuery_SubEntities)q); return q; }
public async Task <List <Game> > GetGames(GameQuery query) { var content = await RepositoryParser.ParseRepository <List <Game> >(filePaths.Games); var queryedItems = FilterGames(content, query); return(queryedItems); }
protected override GameQuery _HandleQuery(GameQuery q) { foreach (var effect in this.activeEffects) { effect.HandleQuery(q); } return(q); }
protected override GameQuery _HandleQuery(GameQuery q) { if (this.Pilot == null) { throw new InvalidOperationException("Can't query piloted " + this.Parent + " with no Pilot assigned!"); } return(Pilot.HandleQuery(q)); }
protected override GameQuery _HandleQuery(GameQuery q) { if (q is GameQuery_EntityAttribute) { this.HandleQueryEntityAttribute((GameQuery_EntityAttribute)q); } return(q); }
protected override GameQuery _HandleQuery(GameQuery q) { if (q is GameQuery_Position) { this.HandleQueryPosition((GameQuery_Position)q); } return(q); }
public IActionResult Games([FromQuery] GameQuery query) { var games = GetGames(query); return(GetResult(games.Select(game => new SelectListItem { Value = Convert.ToString(game.Id), Text = game.Name }))); }
public void TestValidQuest() { GameQuery query = new GameQuery(GetPath("test1.quest")); Assert.IsTrue(query.Initialise()); Assert.AreEqual("Test ASLX Game", query.GameName); Assert.AreEqual(520, query.ASLVersion); Assert.AreEqual("33cb328d-bf80-42f7-a136-e916e7b45ed8", query.GameID); Assert.AreEqual("Test Category", query.Category); Assert.AreEqual("Test Description", query.Description); }
public void TestValidASL() { GameQuery query = new GameQuery(GetPath("test1.asl")); Assert.IsTrue(query.Initialise()); Assert.AreEqual("Test ASL Game", query.GameName); Assert.AreEqual(410, query.ASLVersion); Assert.AreEqual("ACAB148143981E8F7F9A95151F4CB9F3", query.GameID); Assert.AreEqual(null, query.Category); Assert.AreEqual(null, query.Description); }
protected override GameQuery _HandleQuery(GameQuery q) { if (q is GameQuery_Command) { this.HandleQueryCommand((GameQuery_Command)q); } else if (q is GameQuery_EntityAttribute) { this.HandleEntityAttribute((GameQuery_EntityAttribute)q); } return(q); }
protected override GameQuery _HandleQuery(GameQuery q) { if (q is GameQuery_TicksToLive) { this.HandleQueryTicksToLive((GameQuery_TicksToLive)q); } if (q is GameQuery_TicksCooldown) { this.HandleQueryTicksCooldown((GameQuery_TicksCooldown)q); } return(q); }
public async Task <IActionResult> Index(GameQuery query) { bool isMulti = query.Type.Equals("Yes"); var computerGamesShopContext = _context.Game.Where((Game game) => game.Price <= query.Price && (query.Text == null || game.Title.Contains(query.Text)) && (query.Type.Equals("Both") || game.IsMultiplayer == isMulti)) .Include(g => g.Publisher); ViewBag.MaxPrice = _context.Game.Select(x => x.Price).Max(); return(View(await computerGamesShopContext.ToListAsync())); }
public async Task <IActionResult> GetGames([FromQuery] GameQuery query) { try { return(Ok(await this.gamesService.GetGames(query))); } catch (FileNotFoundException ex) { return(BadRequest(ex)); } catch (Exception ex) { return(BadRequest(ex)); } }
protected override GameQuery _HandleQuery(GameQuery q) { // TODO: Move off inheritance base._HandleQuery(q); if (q is GameQuery_EntityAttribute) { this.HandleQueryEntityAttribute((GameQuery_EntityAttribute)q); } else if (q is GameQuery_SubEntities) { this.HandleQuerySubEntities((GameQuery_SubEntities)q); } else if (q is GameQuery_Destroyed) { this.HandleQueryDestroyed((GameQuery_Destroyed)q); } return(q); }
public async Task <IActionResult> QueryGame([FromQuery] string userId) { var query = new GameQuery(userId); GameView gameView; try { gameView = await _queryProcessor.ExecuteAsync <GameView>(query); } catch (Exception ex) { _logger.LogError($"Error occurred in game query for user {query.UserId}: {ex.Message}."); return(new StatusCodeResult(StatusCodes.Status500InternalServerError)); } return(Ok(gameView)); }
private IEnumerable <Game> GetGames(GameQuery query) { IEnumerable <Game> games = null; if (query.OperatorId.HasValue) { games = cachedSettings.Games .Select(kv => kv.Value) .Where(game => !game.IsDisabled && !game.DisableOperators.Contains(Convert.ToString(query.OperatorId))); } else { games = cachedSettings.Games .Select(kv => kv.Value) .Where(game => !game.IsDisabled); } return(games .OrderBy(game => game.Name)); }
private List <Game> FilterGames(List <Game> games, GameQuery query) { if (query == null) { return(games); } if (query.Id != null) { games = games.Where(x => query.Id.IndexOf(x.Id) >= 0).ToList(); } if (query.Name != null) { games = games.Where(x => query.Name.Any(y => x.Name.ToLower() .Contains(y.ToLower() ) ) ).ToList(); } if (query.Platform != null) { games = games.Where(x => query.Platform.ToLower().Contains(x.Platform.ToLower()) ).ToList(); } if (query.Released != null) { games = games.Where(x => query.Released == x.Released).ToList(); } if (query.GameId != null) { games = games.Where(x => query.GameId.Any(id => x.Id == id ) ).ToList(); } if (query.LevelId != null) { games = games.Where(x => query.LevelId.Any(id => x.Levels.Any( y => y.Contains(id.ToString()) ) ) ).ToList(); } if (query.CharacterId != null) { games = games.Where(x => query.CharacterId.Any(id => x.Characters.Any( y => y.Contains(id.ToString()) ) ) ).ToList(); } if (query.CollectableId != null) { games = games.Where(x => query.CollectableId.Any(id => x.Collectables.Any( y => y.Contains(id.ToString()) ) ) ).ToList(); } return(games); }
public void TestInvalidQuest() { GameQuery query = new GameQuery(GetPath("test2.quest")); Assert.IsFalse(query.Initialise()); }
public GameQuery HandleQuery(GameQuery q) { return(this._HandleQuery(q)); }
protected virtual GameQuery _HandleQuery(GameQuery q) { return(q); }