Пример #1
0
        public static void OnLoad()
        {
            Persistence.Deserialize(
                FilePath,
                reader =>
            {
                int version = reader.ReadInt();

                if (version < 2)
                {
                    reader.ReadBool();
                }

                PointsType loaded = PointsType.None;

                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    try
                    {
                        PointsType type = (PointsType)reader.ReadInt();
                        loaded          = type;
                        PointsSystem s  = GetSystemInstance(type);

                        s.Deserialize(reader);
                    }
                    catch
                    {
                        throw new Exception(string.Format("Points System Failed Load: {0} Last Loaded...", loaded.ToString()));
                    }
                }
            });
        }
Пример #2
0
        public static void OnLoad()
        {
            Persistence.Deserialize(
                FilePath,
                reader =>
            {
                int version = reader.ReadInt();

                if (version < 2)
                {
                    reader.ReadBool();
                }

                List <PointsType> loaded = new List <PointsType>();

                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    try
                    {
                        PointsType type = (PointsType)reader.ReadInt();
                        PointsSystem s  = GetSystemInstance(type);

                        s.Deserialize(reader);

                        if (!loaded.Contains(type))
                        {
                            loaded.Add(type);
                        }
                    }
                    catch (Exception e)
                    {
                        foreach (var success in loaded)
                        {
                            Console.WriteLine("[Points System] Successfully Loaded: {0}", success.ToString());
                        }

                        loaded.Clear();

                        throw new Exception(String.Format("[Points System]: {0}", e));
                    }
                }

                loaded.Clear();
            });
        }
Пример #3
0
        public static void OnLoad()
        {
            Persistence.Deserialize(
                FilePath,
                reader =>
            {
                int version = reader.ReadInt();

                int count = reader.ReadInt();
                for (int i = 0; i < count; i++)
                {
                    PointsType type = (PointsType)reader.ReadInt();
                    PointsSystem s  = GetSystemInstance(type);
                    s.Deserialize(reader);
                }
            });
        }