Пример #1
0
 protected override void DoRead(StateBinaryReader reader, VehicleSchedule schedule, VehicleScheduleData data)
 {
     base.DoRead(reader, schedule, data);
     _startDistance = null;
     if (ScheduleStopwatch.GetSchemaVersion(typeof(VehicleScheduleData)) >= 2)
     {
         if (reader.ReadBool())
         {
             _startDistance = reader.ReadFloat();
         }
     }
 }
Пример #2
0
        internal void Read(StateBinaryReader reader)
        {
            _connectedBuildings.Clear();
            _additionalDemands.Clear();
            _connectedStations.Clear();

            if (ScheduleStopwatch.GetSchemaVersion(typeof(StationDemandManager)) >= 3)
            {
                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    VehicleStation station = reader.ReadBuilding <VehicleStation>();
                    UniqueList <IStorageNetworkNode> demandList = null;
                    int countList = reader.ReadInt();
                    if (countList > 0 && station != null)
                    {
                        demandList = GetOrCreateDemandsList(station);
                    }

                    for (int j = 0; j < countList; j++)
                    {
                        IStorageNetworkNode node = reader.ReadBuilding <Building>() as IStorageNetworkNode;
                        if (demandList != null && node != null)
                        {
                            demandList.Add(node);
                            _connectedBuildings.Add(node.Building);
                        }
                    }
                }

                count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    VehicleStation station = reader.ReadBuilding <VehicleStation>();
                    UniqueList <VehicleStation> stationList = null;
                    int countList = reader.ReadInt();
                    if (countList > 0 && station != null)
                    {
                        stationList = GetOrCreateConnectedStationsList(station);
                    }

                    for (int j = 0; j < countList; j++)
                    {
                        VehicleStation connStation = reader.ReadBuilding <VehicleStation>();
                        if (stationList != null && connStation != null)
                        {
                            stationList.Add(connStation);
                            _connectedBuildings.Add(connStation);
                        }
                    }
                }
            }
        }
Пример #3
0
        protected override void DoRead(StateBinaryReader reader, VehicleSchedule schedule)
        {
            base.DoRead(reader, schedule);
            if (ScheduleStopwatch.GetSchemaVersion(typeof(TaskDurationDataSet)) >= 2)
            {
                int count = reader.ReadInt();

                for (int i = 0; i < count; i++)
                {
                    int   taskIndex = reader.ReadInt();
                    float value     = reader.ReadFloat();
                    if (taskIndex > -1)
                    {
                        _distanceData.Add(schedule.GetTasks()[taskIndex], value);
                    }
                    else
                    {
                        ScheduleStopwatch.logger.Log(UnityEngine.LogType.Warning, "RootTask index = -1");
                    }
                }
            }
        }