public StarSystemsQuery(IStarSystemRepository starSystemRepository) { Field <ListGraphType <StarSystemType>, IEnumerable <StarSystem> >() .Name("starSystems") .Argument <IntGraphType>("WithinLightYearsOfEarth") .Argument <BooleanGraphType>("predictPlanetRadii", "return an estimated planetary radius if an observed radius does not exist") .ResolveAsync(async context => { var starSystems = await starSystemRepository.GetStarSystemsAsync(); var maxDistance = context.GetArgument <int?>("WithinLightYearsOfEarth"); if (maxDistance != null) { starSystems = starSystems.Where(ss => ss.Distance < maxDistance); } return(starSystems); }); Field <StarSystemType, StarSystem>() .Name("starSystem") .Argument <NonNullGraphType <IdGraphType> >("id", "id of the star system") .Argument <BooleanGraphType>("predictPlanetRadii", "return an estimated planetary radius if an observed radius does not exist") .ResolveAsync(async context => { var id = context.GetArgument <int>("id"); return(await starSystemRepository.GetStarSystemAsync(id) !); }); }
public App( IConfiguration configuration, IStarSystemRepository starSystemRepository) { this.configuration = configuration; this.starSystemRepository = starSystemRepository; }
public EconomicSimulator(IStarSystemRepository starSystemRepository, IEmpireRepository empireRepository, IDevelopmentCalculator developmentCalculator, IMilitaryCalculator militaryCalculator) { _starSystemRepository = starSystemRepository; _empireRepository = empireRepository; _developmentCalculator = developmentCalculator; _militaryCalculator = militaryCalculator; }
public NodeHandler( IStarSystemRepository starSystemRepository, IRefuelStarFinder refuelStarFinder, IEnumerable <IEdgeConstraint> edgeConstraints, ShipHandler shipHandler, List <JumpParameters> jumpParameters, StarSystem start, StarSystem goal, Options options) { this.starSystemRepository = starSystemRepository; this.refuelStarFinder = refuelStarFinder; this.edgeConstraints = edgeConstraints; this.shipHandler = shipHandler; this.jumpParameters = jumpParameters; this.start = start; this.goal = goal; this.options = options; this.minimumFuelLevel = this.ship.FSD.MaxFuelPerJump / 16; this.jumpTime = new JumpTime(this.ship); this.neighborsCache = new Dictionary <long, List <StarSystem> >(); }
public ParsePersistentStore(User user) { _expeditionRepository = new ExpeditionRespository(); _starSystemRepository = new StarSystemRepository(); _systemPointerRepository = new SystemPointerRepository(); _user = user; }
private async void GetExpedition() { _expedition = await _expeditionRepository.GetCurrent(_user); LogText(string.Format("{0}: Starting Expedition {1}", DateTime.Now, _expedition.Name), Color.Blue); _starSystemRepository = new StarSystemRepository(_expedition); _systemPointerRepository = new SystemPointerRepository(_expedition); _systemPointer = await _systemPointerRepository.GetCurrent(); }
public RefuelStarFinder( ApplicationDbContext dbContext, IStarSystemRepository starSystemRepository, ShipHandler shipHandler, bool useFsdBoost) { this.dbContext = dbContext; this.starSystemRepository = starSystemRepository; this.shipHandler = shipHandler; this.useFsdBoost = useFsdBoost; }
public StarType(IPlanetRepository planetsRepository, IStarSystemRepository starSystemRepository) { Field(s => s.StarId, nullable: false, type: typeof(IdGraphType)); Field(s => s.StarName, nullable: false).Description("Primary designation of this star"); Field(s => s.SpectralType, nullable: false); Field(s => s.BvColorIndex, type: typeof(FloatGraphType)); Field(s => s.AbsoluteMagnitude, type: typeof(FloatGraphType)); Field(s => s.Mass, type: typeof(FloatGraphType)); Field(s => s.Radius, type: typeof(FloatGraphType)); Field(s => s.Luminosity, type: typeof(FloatGraphType)); Field(s => s.Temperature, type: typeof(FloatGraphType)); Field(s => s.Age, type: typeof(FloatGraphType)); Field(s => s.Metallicity, type: typeof(FloatGraphType)); Field(s => s.DiscoveryYear, nullable: true, type: typeof(IntGraphType)); Field <ListGraphType <PlanetType>, IEnumerable <Planet> >() .Name("planets") .ResolveAsync(context => planetsRepository.GetPlanetsByStarIdAsync(context.Source.StarId)); Field <StarSystemType, StarSystem>() .Name("starSystem") .ResolveAsync(context => starSystemRepository.GetStarSystemAsync(context.Source.StarSystemId) !); }
public StarSystemController(IStarSystemRepository starSystemRepository) { _starSystemRepository = starSystemRepository; }