Ejemplo n.º 1
0
        public void Deserialize(IReader reader)
        {
            int num = reader.ReadInt32();

            for (int i = 0; i < num; i++)
            {
                string       text     = reader.ReadKleiString();
                int          num2     = reader.ReadInt32();
                int          position = reader.Position;
                InstanceType val      = Get(text);
                if (val == null && resources != null)
                {
                    ModifierType val2 = resources.TryGet(text);
                    if (val2 != null)
                    {
                        val = CreateInstance(val2);
                    }
                }
                if (val == null)
                {
                    if (text != "Condition")
                    {
                        DebugUtil.LogWarningArgs(gameObject.name, "Missing modifier: " + text);
                    }
                    reader.SkipBytes(num2);
                }
                else if (!(val is ISaveLoadable))
                {
                    reader.SkipBytes(num2);
                }
                else
                {
                    Deserializer.DeserializeTypeless(val, reader);
                    if (reader.Position != position + num2)
                    {
                        DebugUtil.LogWarningArgs("Expected to be at offset", position + num2, "but was only at offset", reader.Position, ". Skipping to catch up.");
                        reader.SkipBytes(position + num2 - reader.Position);
                    }
                }
            }
        }