示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="fs"></param>
        public bool StartFlight()
        {
            try
            {
                PirepID = FlightDatabase.StartFlight(this);
                Telemetry.SetValue(FSUIPCOffsets.engine1, false);
                Telemetry.SetValue(FSUIPCOffsets.engine2, false);
                Telemetry.SetValue(FSUIPCOffsets.engine3, false);
                Telemetry.SetValue(FSUIPCOffsets.engine4, false);
                Telemetry.SetValue(FSUIPCOffsets.parkingBrake, true);

                Telemetry.SetValue(FSUIPCOffsets.environmentDateTimeHour, DateTime.UtcNow.Hour);
                Telemetry.SetValue(FSUIPCOffsets.environmentDateTimeMinute, DateTime.UtcNow.Minute);
                Telemetry.SetValue(FSUIPCOffsets.environmentDateTimeDayOfYear, DateTime.UtcNow.DayOfYear);
                Telemetry.SetValue(FSUIPCOffsets.environmentDateTimeYear, DateTime.UtcNow.Year);

                string Message = "Welcome to FlyAtlantic Acars";
                FSUIPCOffsets.messageWrite.Value    = Message;
                FSUIPCOffsets.messageDuration.Value = 10;
                FSUIPCConnection.Process();

                phase         = FlightPhases.PREFLIGHT;
                FlightRunning = true;
            }
            catch (Exception crap)
            {
                throw new Exception("Failed to start flight.", crap);
            }

            // TODO: do all stuff via telemetry to force desired values


            return(FlightRunning);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        public void EndFlight()
        {
            AnalyseFlightLog(true);

            // calculate flight efficiency
            EfficiencyPoints = Convert.ToInt32(Math.Round((ActualTimeEnRoute.TotalMinutes / 10) * (FinalScore * 0.01)));

            // do database stuff
            FlightDatabase.EndFlight(this);
        }
示例#3
0
        public void UpdateFlight()
        {
            if (IsUpdateRequired())
            {
                CheckFlightOnVatsim();

                FlightDatabase.UpdateFlight(this);

                lastUpdateId = TelemetryLog.Count - 1;
            }
        }
示例#4
0
        public void CheckFlightOnVatsim()
        {
            if (Events.Count(t => t.Event.Code == "5A") > 0)
            {
                return;
            }

            if (!FlightDatabase.IsPilotOnVatsim(this))
            {
                Events.Add(new EventOccurrence(lastUpdateId, lastUpdateId, new FlightEvent("5A", 900, "Offline From Vatsim", 10, 30, (t) => { return(false); })));
            }
        }
示例#5
0
        public void UpdateFlight()
        {
            if (IsUpdateRequired())
            {
                FlightDatabase.UpdateFlight(this);

                lastUpdateId = TelemetryLog.Count - 1;

                bool onVatsim = FlightDatabase.IsPilotOnVatsim(this);
                if (!onVatsim && Events.Count(t => t.Event.Code == "5A") == 0)
                {
                    Events.Add(new EventOccurrence(lastUpdateId, lastUpdateId, new FlightEvent("5A", 900, "Offline From Vatsim", 10, 30, (t) => { return(false); })));
                }
            }
        }
示例#6
0
        public FlightPlan GetFlightPlan()
        {
            LoadedFlightPlan = FlightDatabase.GetFlightPlan();

            return(LoadedFlightPlan);
        }