Beispiel #1
0
        private static void OnSaveData()
        {
            FastList <byte> data = new FastList <byte>();

            try
            {
                SerializableDataExtension.WriteString(CachedVehicleData._dataVersion, data);
                for (int index = 0; index < CachedVehicleData.MaxVehicleCount; ++index)
                {
                    if (!CachedVehicleData.m_cachedVehicleData[index].IsEmpty)
                    {
                        SerializableDataExtension.WriteInt32(index, data);
                        SerializableDataExtension.WriteInt32(CachedVehicleData.m_cachedVehicleData[index].LastStopNewPassengers, data);
                        SerializableDataExtension.WriteInt32(CachedVehicleData.m_cachedVehicleData[index].LastStopGonePassengers, data);
                        SerializableDataExtension.WriteInt32(CachedVehicleData.m_cachedVehicleData[index].PassengersThisWeek, data);
                        SerializableDataExtension.WriteInt32(CachedVehicleData.m_cachedVehicleData[index].PassengersLastWeek, data);
                        SerializableDataExtension.WriteInt32(CachedVehicleData.m_cachedVehicleData[index].IncomeThisWeek, data);
                        SerializableDataExtension.WriteInt32(CachedVehicleData.m_cachedVehicleData[index].IncomeLastWeek, data);
                        SerializableDataExtension.WriteFloatArray(CachedVehicleData.m_cachedVehicleData[index].PassengerData, data);
                        SerializableDataExtension.WriteFloatArray(CachedVehicleData.m_cachedVehicleData[index].IncomeData, data);
                        SerializableDataExtension.WriteUInt16(CachedVehicleData.m_cachedVehicleData[index].CurrentStop, data);
                    }
                }
                SerializableDataExtension.instance.SerializableData.SaveData(CachedVehicleData._dataID, data.ToArray());
            }
            catch (Exception ex)
            {
                Utils.LogError((object)("Error while saving vehicle data! " + ex.Message + " " + (object)ex.InnerException));
            }
        }