public static List <Tuple <DateTime, string> > GetRaces(BetfairClient client, string venueId) { var marketFilter = new MarketFilter(); marketFilter.EventIds = new HashSet <string>() { venueId }; marketFilter.MarketTypeCodes = new HashSet <String>() { "WIN" }; //var events = client.ListEvents(marketFilter).Result; List <MarketCatalogue> marketCatalogues = client.ListMarketCatalogue( marketFilter, BFHelpers.HorseRaceProjection(), MarketSort.FIRST_TO_START, 100).Result.Response; VenueEngine venueEngine = new VenueEngine(); var venue = venueEngine.GetFromApiId(venueId); RaceEngine raceEngine = new RaceEngine(); raceEngine.Execute(marketCatalogues, venue); var races = marketCatalogues.Select(race => new Tuple <DateTime, String> (race.Description.MarketTime, race.MarketName + "|" + "|" + race.MarketId) ); return(races.ToList()); }
public override void LoadContent() { if (m_content == null) { m_content = new ContentManager(Game.Services, "Content"); } string selectedTrack = SelectionScreen.SelectedTrack; string selectedCar = SelectionScreen.SelectedCar; var carTypes = SelectionScreen.CarTypes; var obstacleMap = m_content.Load <ObstacleMap>(string.Format("DataMaps/Obstacles/{0}", selectedTrack)); m_trackImage = m_content.Load <Texture2D>(string.Format("Images/RaceTracks/{0}", selectedTrack)); m_background = m_content.Load <Texture2D>("Images/Backgrounds/DefaultBackground"); m_obstacleImage = m_content.Load <Texture2D>("Images/BorderingTire"); m_raceEngine = new RaceEngine(); m_raceEngine.AddObstacles(obstacleMap); CarSprite player = new CarSprite(); player.Data = new RaceCar(); m_raceEngine.AddCar(player.Data); player.Image = m_content.Load <Texture2D>(string.Format("Images/Cars/{0}", selectedCar)); m_carSprites.Add(player); player.Data.CarControls = new CarController_Player(this.ScreenManager.InputState, this.ControllingPlayer.Value); base.LoadContent(); }
public CarController_Player(InputState input, PlayerIndex playerIndex) { this.m_input = input; this.m_playerIndex = playerIndex; this.BreakPedalPosition = 0f; this.GasPedalPosition = 0f; this.IsInReverse = false; this.RaceCar = null; this.RaceEngine = null; this.SteeringPosition = 0f; }
public static List <string> GetRunners(BetfairClient client, string raceId) { var marketFilter = new MarketFilter(); marketFilter.MarketIds = new HashSet <string>() { raceId }; marketFilter.MarketTypeCodes = new HashSet <String>() { "WIN" }; List <MarketCatalogue> marketCatalogues = client.ListMarketCatalogue( marketFilter, BFHelpers.HorseRaceProjection(), MarketSort.FIRST_TO_START, 100).Result.Response; var marketIds = new HashSet <String>() { raceId }; var marketBooks = client.ListMarketBook(marketIds).Result.Response; List <Runner> runnersForMarket = marketBooks.First().Runners; RunnerEngine runnerEngine = new RunnerEngine(); RaceEngine raceEngine = new RaceEngine(); var race = raceEngine.GetFromApiId(raceId); runnerEngine.Execute(marketCatalogues.First().Runners, runnersForMarket, race); var runners = marketCatalogues.First().Runners.Select(runner => runner.RunnerName + "|" + runner.Metadata.GetValueOrDefault("JOCKEY_NAME") + "^" + runner.Metadata.GetValueOrDefault("TRAINER_NAME") + "^" + runner.Metadata.GetValueOrDefault("WEIGHT_VALUE") + "^" + runner.Metadata.GetValueOrDefault("FORM") + "^" + runner.Metadata.GetValueOrDefault("STALL_DRAW") + "|" + runner.SelectionId + "|" + runnersForMarket.Find(rfm => rfm.SelectionId == runner.SelectionId).LastPriceTraded );; //{[WEIGHT_VALUE,]} //{[JOCKEY_NAME, T P Mccarthy]} //{[TRAINER_NAME, T J Munday]} //{[FORM, 83]} //{[STALL_DRAW, 3]} return(runners.ToList()); }
protected Race(double distance) { Distance = distance; RaceEngine = new RaceEngine(); }