Ejemplo n.º 1
0
    private void Awake()
    {
        Transform = transform;
        navAgent = GetComponent<NavMeshAgent>();
        drone = FindObjectOfType<DroneController>();
        flightView = FindObjectOfType<FlightView>();

        flightView.Keepers.Add(this);

        distortion = transform.Find("vfx/distortion");
    }
Ejemplo n.º 2
0
    void Start()
    {
        flight = this.GetComponent <FlightSystem> ();
        View   = (FlightView)GameObject.FindObjectOfType(typeof(FlightView));


        // setting all Touch screen controller in the position
        controllerTouch = new TouchScreenVal(new Rect(0, 0, Screen.width / 2, Screen.height - 100));
        fireTouch       = new TouchScreenVal(new Rect(Screen.width / 2, 0, Screen.width / 2, Screen.height));
        switchTouch     = new TouchScreenVal(new Rect(0, Screen.height - 100, Screen.width / 2, 100));
        sliceTouch      = new TouchScreenVal(new Rect(0, 0, Screen.width / 2, 50));

        if (flight)
        {
            directVelBack = flight.DirectVelocity;
        }
    }
Ejemplo n.º 3
0
    void Start()
    {
        flight = this.GetComponent <FlightSystem>();
        View   = (FlightView)GameObject.FindObjectOfType(typeof(FlightView));
        // setting all Touch screen controller in the position
        controllerTouch = new TouchScreenVal(new Rect(0, 0, Screen.width / 2, Screen.height));
        fireTouch       = new TouchScreenVal(new Rect(Screen.width / 2, 0, Screen.width / 2, Screen.height));
        switchTouch     = new TouchScreenVal(new Rect(0, Screen.height - 100, Screen.width / 2, 100));

        sliceTouch = new TouchScreenVal(new Rect(0, 0, Screen.width / 2, 50));

        if (flight)
        {
            directVelBack = flight.DirectVelocity;
        }
        Acceleration            = UIController.acceleration;
        AccelerationSensitivity = TiltSensativity.sensativity;

        GameObject.FindObjectOfType <VolumeController> ().Adjust();
    }
Ejemplo n.º 4
0
        /// <summary>
        /// 查询往返第二程航班
        /// </summary>
        public object QueryRTSecondTipFlights(string firstTripPolicyInfoArgs, string firstTripFlightArgs, DateTime flightDate)
        {
            var firstTripFlight = FlightView.Parse(firstTripFlightArgs);
            var firstTripPolicy = PolicyView.Parse(firstTripPolicyInfoArgs);

            if (firstTripFlight == null || firstTripPolicy == null)
            {
                throw new CustomException("缺少去程信息");
            }
            var originalFlights = Service.FlightQueryService.QueryRTSecondTipFlights(firstTripFlight.Arrival.Code,
                                                                                     firstTripFlight.Departure.Code,
                                                                                     flightDate,
                                                                                     firstTripFlight.AirlineCode,
                                                                                     firstTripFlight.Arrival.Time,
                                                                                     firstTripPolicy.Type,
                                                                                     getFirstSelectedBunk(firstTripFlightArgs), BasePage.OwnerOEMId);

            saveFlights(originalFlights, VoyageSerial.Second);
            return(originalFlights.Select(constructFlightQueryResultView).GetEnumerator());
        }
Ejemplo n.º 5
0
        public async Task GetFlightByFlightNumber_Success()
        {
            Mock <FlightService> service = new Mock <FlightService>();

            FlightView returnedFlightView = new FlightView("0", ("Lagos", "LOS"), ("Marrakesh", "RAK"));

            service.Setup(s => s.GetFlightByFlightNumber(0)).Returns(Task.FromResult(returnedFlightView));

            FlightController controller = new FlightController(service.Object);

            ObjectResult response = await controller.GetFlightByFlightNumber(0) as ObjectResult;

            Assert.IsNotNull(response);
            Assert.AreEqual((int)HttpStatusCode.OK, response.StatusCode);

            FlightView content = response.Value as FlightView;

            Assert.IsNotNull(content);

            Assert.AreEqual(returnedFlightView, content);
        }
        public async Task <IActionResult> GetFlightByFlightNumber(int flightNumber)
        {
            try
            {
                if (!flightNumber.IsPositiveInteger())
                {
                    throw new Exception();
                }

                FlightView flight = await _service.GetFlightByFlightNumber(flightNumber);

                return(StatusCode((int)HttpStatusCode.OK, flight));
            }
            catch (FlightNotFoundException)
            {
                return(StatusCode((int)HttpStatusCode.NotFound, "The flight was not found in the database"));
            }
            catch (Exception)
            {
                return(StatusCode((int)HttpStatusCode.BadRequest, "Bad request"));
            }
        }
Ejemplo n.º 7
0
        internal static OneWay CreateOneWay(FlightView flightView, PassengerType passengerType, PolicyMatch.MatchedPolicy policy)
        {
            var carrier = new Carrier(flightView.Airline);

            return(new OneWay(carrier, Flight.GetFlight(flightView, passengerType, policy)));
        }
Ejemplo n.º 8
0
        public static void Demo_SingleObject()
        {
            CUI.MainHeadline(nameof(Demo_SingleObject));

            // take the first flight as an example
            var ctx    = new WWWingsContext();
            var flight = ctx.FlightSet.Include(x => x.Pilot).Include(x => x.AircraftType).ThenInclude(y => y.Detail).FirstOrDefault();

            Console.WriteLine(flight);

            //##################################################

            //Mapper.Initialize(cfg =>
            //{
            // cfg.CreateMap<Flight, FlightView>();
            // cfg.CreateMap<FlightView, Flight>();
            // cfg.CreateMap<Passenger, PassangerView>();
            // cfg.CreateMap<PassangerView, Passenger>();
            // cfg.CreateMap<Pilot, Pilot>();
            // cfg.CreateMap<Pilot, Pilot>();

            // cfg.CreateMap<Flight, FlightDTOShort>();
            // cfg.CreateMap<Flight, FlightDTO>();
            //});

            //Mapper.Initialize(cfg =>
            //{
            // cfg.CreateMap<Flight, FlightView>().ReverseMap();
            // cfg.CreateMap<Passenger, PassangerView>().ReverseMap();
            // cfg.CreateMap<Pilot, Pilot>().ReverseMap();
            //});


            Mapper.Initialize(cfg =>
            {
                //cfg.SourceMemberNamingConvention = new NoNamingConvention();
                //cfg.DestinationMemberNamingConvention = new NoNamingConvention();

                cfg.CreateMap <Flight, FlightView>().ReverseMap();
                cfg.CreateMap <Passenger, PassengerView>().ReverseMap();
                cfg.CreateMap <Pilot, PilotView>().ReverseMap();

                cfg.CreateMap <Flight, FlightDTOShort>();
                cfg.CreateMap <Flight, FlightDTO>();
            });



            //Mapper.Initialize(cfg =>
            //{
            // cfg.AddProfile<AutoMapperProfile1>();
            //});

            Mapper.Initialize(cfg =>
            {
                cfg.AddProfile <AutoMapperProfile2>();
            });


            // ----------------------
            CUI.Headline("Mapping to new object");
            FlightView flightView1 = Mapper.Map <FlightView>(flight);

            Console.WriteLine(flightView1);
            Console.WriteLine(flightView1.PilotSurname);
            Console.WriteLine(flightView1.SmokerInfo);
            Console.WriteLine(flightView1.PilotInfo);
            if (flightView1.Pilot == null)
            {
                CUI.PrintError("No pilot!");
            }
            else
            {
                Console.WriteLine(flightView1.Pilot?.Surname + " born " + flightView1.Pilot?.Birthday);
            }
            Console.WriteLine(flightView1.Memo);
            Console.WriteLine(flightView1.AircraftTypeDetailLength);

            FlightView flightView2 = (FlightView)Mapper.Map(flight, flight.GetType(), typeof(FlightView));

            Console.WriteLine(flightView2);
            Console.WriteLine(flightView2.PilotSurname);
            Console.WriteLine(flightView2.SmokerInfo);
            Console.WriteLine(flightView2.PilotInfo);
            if (flightView2.Pilot == null)
            {
                CUI.PrintError("No pilot!");
            }
            else
            {
                Console.WriteLine(flightView2.Pilot?.Surname + " born " + flightView2.Pilot?.Birthday);
            }
            Console.WriteLine(flightView2.AircraftTypeDetailLength);
            Console.WriteLine(flightView2.Memo);
            Console.WriteLine(flightView2.Copilot);

            // ----------------------
            CUI.Headline("Mapping to existing object");
            var flightView3 = new FlightView();

            Mapper.Map(flight, flightView3);

            Console.WriteLine(flightView3);
            Console.WriteLine(flightView3.PilotSurname);
            Console.WriteLine(flightView3.SmokerInfo);
            Console.WriteLine(flightView3.PilotInfo);
            if (flightView3.Pilot == null)
            {
                CUI.PrintError("No pilot!");
            }
            else
            {
                Console.WriteLine(flightView3.Pilot?.Surname + " born " + flightView3.Pilot?.Birthday);
            }
            Console.WriteLine(flightView3.Memo);



            CUI.Headline("Mapping with non-static types");
            var config = new MapperConfiguration(cfg => {
                cfg.CreateMap <Flight, FlightView>();
                cfg.CreateMap <Pilot, PilotView>();
                cfg.CreateMap <Passenger, PassengerView>();
                cfg.AddProfile <AutoMapperProfile2>();
            });
            // config.AssertConfigurationIsValid();

            IMapper mapper      = config.CreateMapper();
            var     flightView4 = mapper.Map <Flight, FlightView>(flight);

            Console.WriteLine(flightView4.PilotSurname);
            Console.WriteLine(flightView4.SmokerInfo);
            Console.WriteLine(flightView4.PilotInfo);
            if (flightView4.Pilot == null)
            {
                CUI.PrintError("No pilot!");
            }
            else
            {
                Console.WriteLine(flightView4.Pilot?.Surname + " born " + flightView4.Pilot?.Birthday);
            }
            Console.WriteLine(flightView4.Memo);

            // ------------------ Umgekehrtes Mapping
            CUI.Headline("Reverse Mapping");
            var flight2 = Mapper.Map <Flight>(flightView3);

            Console.WriteLine(flight2);
        }