Пример #1
0
        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) !);
            });
        }
Пример #2
0
 public App(
     IConfiguration configuration,
     IStarSystemRepository starSystemRepository)
 {
     this.configuration        = configuration;
     this.starSystemRepository = starSystemRepository;
 }
Пример #3
0
 public EconomicSimulator(IStarSystemRepository starSystemRepository, IEmpireRepository empireRepository, IDevelopmentCalculator developmentCalculator, IMilitaryCalculator militaryCalculator)
 {
     _starSystemRepository  = starSystemRepository;
     _empireRepository      = empireRepository;
     _developmentCalculator = developmentCalculator;
     _militaryCalculator    = militaryCalculator;
 }
Пример #4
0
        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> >();
        }
Пример #5
0
 public ParsePersistentStore(User user)
 {
     _expeditionRepository    = new ExpeditionRespository();
     _starSystemRepository    = new StarSystemRepository();
     _systemPointerRepository = new SystemPointerRepository();
     _user = user;
 }
Пример #6
0
 public ParsePersistentStore(User user) {
     _expeditionRepository = new ExpeditionRespository();
     _starSystemRepository = new StarSystemRepository();
     _systemPointerRepository = new SystemPointerRepository();
     _user = user;
   
 }
Пример #7
0
        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();

        }
Пример #8
0
        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();
        }
Пример #9
0
 public RefuelStarFinder(
     ApplicationDbContext dbContext,
     IStarSystemRepository starSystemRepository,
     ShipHandler shipHandler,
     bool useFsdBoost)
 {
     this.dbContext            = dbContext;
     this.starSystemRepository = starSystemRepository;
     this.shipHandler          = shipHandler;
     this.useFsdBoost          = useFsdBoost;
 }
Пример #10
0
        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) !);
        }
Пример #11
0
 public StarSystemController(IStarSystemRepository starSystemRepository)
 {
     _starSystemRepository = starSystemRepository;
 }