123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- using KYFramework;
- using KYFramework.Network;
- using Model;
- using MongoDB.Bson;
- namespace SimulationServer;
- public static class XHRescueMissionSystem
- {
-
-
-
-
- public static void StartAsyncXH(this XHRescueMission self)
- {
- foreach (var aircraft in self.AircraftXHs)
- {
- var location = FXJHGenerate.GetAllCurrentLocation(aircraft.turningPoints, self.SimulationTime);
-
-
-
- self.SyncLocation(location.Item1, aircraft);
-
- if (location.Item2)
- {
- aircraft.SyncOver = true;
- }
-
- }
-
-
- self.AircraftXHs.RemoveAll(a => a.SyncOver);
-
- if (self.AircraftXHs.Count == 0)
- {
-
- Game.EventSystem.Publish(new XHSimulationOver{ Mission = self});
- return;
- }
-
- self.SimulationTime += Init.SimulationSpeed;
- Task.Delay(TimeSpan.FromSeconds(1f)).ContinueWith(t => self.StartAsyncXH());
- }
-
- public static void SyncLocation(this XHRescueMission self,CurrentLocation location,AircraftXH aircraft)
- {
-
- if (location != null)
- {
-
- S2C_TurningPointOutput s2CTurningPointOutput = new S2C_TurningPointOutput();
- s2CTurningPointOutput.AircraftID = aircraft.AircraftId;
-
- s2CTurningPointOutput.PresentMission = location.PresentMission;
-
- s2CTurningPointOutput.PresentLocation = new Point
- {
- Altitude = location.CurrentHei,
- Latitude = location.CurrentLat,
- Longitude = location.CurrentLon
- };
- s2CTurningPointOutput.PresentVelocity = location.Currentvelo;
- SessionComponent.Instance.Session.Send(s2CTurningPointOutput);
- Log.Info($"飞机{aircraft.Name} 当前位置: {location.ToJson()}");
- }
- }
- }
|