コード例 #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));
            }
        }
コード例 #2
0
        private static void OnSaveData()
        {
            FastList <byte> data = new FastList <byte>();

            try
            {
                SerializableDataExtension.WriteString(CachedNodeData._dataVersion, data);
                for (int index = 0; index < 32768; ++index)
                {
                    if (!CachedNodeData.m_cachedNodeData[index].IsEmpty)
                    {
                        SerializableDataExtension.WriteInt32(index, data);
                        SerializableDataExtension.WriteInt32(CachedNodeData.m_cachedNodeData[index].PassengersIn, data);
                        SerializableDataExtension.WriteInt32(CachedNodeData.m_cachedNodeData[index].PassengersOut, data);
                        SerializableDataExtension.WriteInt32(CachedNodeData.m_cachedNodeData[index].LastWeekPassengersIn, data);
                        SerializableDataExtension.WriteInt32(CachedNodeData.m_cachedNodeData[index].LastWeekPassengersOut, data);
                        SerializableDataExtension.WriteFloatArray(CachedNodeData.m_cachedNodeData[index].PassengerInData, data);
                        SerializableDataExtension.WriteFloatArray(CachedNodeData.m_cachedNodeData[index].PassengerOutData, data);
                        SerializableDataExtension.WriteBool(CachedNodeData.m_cachedNodeData[index].Unbunching, data);
                    }
                }
                SerializableDataExtension.instance.SerializableData.SaveData(CachedNodeData._dataID, data.ToArray());
            }
            catch (Exception ex)
            {
                Utils.LogError((object)("Error while saving net node data! " + ex.Message + " " + (object)ex.InnerException));
            }
        }
コード例 #3
0
 public static void WriteFloatArray(float[] array, FastList <byte> data)
 {
     SerializableDataExtension.WriteInt32(array.Length, data);
     for (ushort index = 0; (int)index < array.Length; ++index)
     {
         SerializableDataExtension.WriteFloat(array[(int)index], data);
     }
 }
コード例 #4
0
 public static void WriteString(string s, FastList <byte> data)
 {
     char[] charArray = s.ToCharArray();
     SerializableDataExtension.WriteInt32(charArray.Length, data);
     for (ushort index = 0; (int)index < charArray.Length; ++index)
     {
         SerializableDataExtension.AddToData(BitConverter.GetBytes(charArray[(int)index]), data);
     }
 }