Exemple #1
0
 private void PortHandler(port_port api)
 {
     System.Runtime.GCSettings.LargeObjectHeapCompactionMode = System.Runtime.GCLargeObjectHeapCompactionMode.CompactOnce;
     GC.Collect();
     Staff.Current.Admiral.BasicHandler(api.api_basic);
     ConditionHelper.Instance.BeginUpdate();
     Staff.Current.Shipyard.RepairDocks.ForEach(x => x.Ship?.IgnoreNextCondition());
     if (Ships == null)
     {
         Ships = new IDTable <int, Ship>(api.api_ship.Select(x => new Ship(x)));
     }
     else
     {
         Ships.UpdateAll(api.api_ship, x => x.api_id);
     }
     ConditionHelper.Instance.EndUpdate();
     Staff.Current.Admiral.ShipCount = api.api_ship.Length;
     Staff.Current.Shipyard.NDockHandler(api.api_ndock);
     DecksHandler(api.api_deck_port);
     if (Fleets.Any(x => x.MissionState == Fleet.FleetMissionState.Complete))
     {
         Logger.Loggers.MaterialLogger.ForceLog = false;
     }
     Material.MaterialHandler(api.api_material);
     CombinedFleet = (CombinedFleetType)api.api_combined_flag;
     Fleets.ForEach(x => x.CheckHomeportRepairingTime(false));
 }
Exemple #2
0
 private void ChargeHandler(hokyu_charge api)
 {
     foreach (var s in api.api_ship)
     {
         var ship = Ships[s.api_id];
         ship.Fuel = new LimitedValue(s.api_fuel, ship.Fuel.Max);
         ship.Bull = new LimitedValue(s.api_bull, ship.Bull.Max);
         for (int i = 0; i < ship.Slots.Count; i++)
         {
             ship.Slots[i].AirCraft = new LimitedValue(s.api_onslot[i], ship.Slots[i].AirCraft.Max);
         }
         ship.UpdateStatus();
     }
     Material.Fuel    = api.api_material[0];
     Material.Bull    = api.api_material[1];
     Material.Steel   = api.api_material[2];
     Material.Bauxite = api.api_material[3];
     Fleets.ForEach(x => x.UpdateStatus());
 }