public override void Parse(AssetIdentifier identifier, AssetsFileReader reader, ResourceAssets resourceAssets, Dictionary <int, string> relativeFileIdToPath)
        {
            MonobehaviourAsset monobehaviour = new MonobehaviourAsset();
            int fileId = reader.ReadInt32();

            monobehaviour.GameObjectIdentifier = new AssetIdentifier(relativeFileIdToPath[fileId], reader.ReadInt64());
            monobehaviour.Enabled = reader.ReadBoolean();
            reader.Align();
            monobehaviour.MonoscriptIdentifier = new AssetIdentifier(relativeFileIdToPath[reader.ReadInt32()], reader.ReadInt64());
            monobehaviour.Name = reader.ReadCountStringInt32();

            // Hack - If we have not yet loaded monoscripts then we are currently processing unit monobehaviours
            // that we do not care about.  Monoscripts should be fully loaded before we actually parse anything
            // we do care about in resource.assets.  If this becomes a problem later, we can do two passes and
            // load monobeahviours in the second pass.
            if (!MonoscriptAssetParser.MonoscriptsByAssetId.ContainsKey(monobehaviour.MonoscriptIdentifier))
            {
                return;
            }

            MonoscriptAsset monoscript = MonoscriptAssetParser.MonoscriptsByAssetId[monobehaviour.MonoscriptIdentifier];

            monobehaviour.MonoscriptName = monoscript.Name;


            if (monobehaviourParsersByMonoscriptName.TryGetValue(monoscript.Name, out MonobehaviourParser monoResourceParser))
            {
                monoResourceParser.Parse(identifier, monobehaviour.GameObjectIdentifier, reader, resourceAssets, relativeFileIdToPath);
            }

            MonobehavioursByAssetId.Add(identifier, monobehaviour);
        }
Beispiel #2
0
 public uint   flags;                        //0x14
 public ulong Read(ulong absFilePos, AssetsFileReader reader, bool bigEndian)
 {
     version          = reader.ReadUInt16();
     depth            = reader.ReadByte();
     isArray          = reader.ReadBoolean();
     typeStringOffset = reader.ReadUInt32();
     nameStringOffset = reader.ReadUInt32();
     size             = reader.ReadUInt32();
     index            = reader.ReadUInt32();
     flags            = reader.ReadUInt32();
     return(reader.Position);
 }
Beispiel #3
0
 public ulong Read(ulong absFilePos, AssetsFileReader reader, uint version, bool bigEndian)
 {
     unityVersion  = reader.ReadNullTerminated();
     this.version  = reader.ReadUInt32();
     hasTypeTree   = reader.ReadBoolean();
     fieldCount    = reader.ReadUInt32();
     pTypes_Unity5 = new Type_0D[fieldCount];
     for (int i = 0; i < fieldCount; i++)
     {
         Type_0D type0d = new Type_0D();
         type0d.Read(hasTypeTree, reader.Position, reader, version, version, bigEndian);
         pTypes_Unity5[i] = type0d;
     }
     if (version < 0x0E)
     {
         dwUnknown = reader.ReadUInt32();
     }
     _fmt = version;
     return(reader.Position);
 }
Beispiel #4
0
        public uint   _fmt;      //not stored here in the .assets file, the variable is just to remember the .assets file version

        public ulong Read(ulong absFilePos, AssetsFileReader reader, uint version, bool bigEndian)
        {
            unityVersion  = reader.ReadNullTerminated();
            this.version  = reader.ReadUInt32();
            hasTypeTree   = reader.ReadBoolean();
            fieldCount    = reader.ReadUInt32();
            pTypes_Unity5 = new Type_0D[fieldCount];
            for (int i = 0; i < fieldCount; i++)
            {
                Type_0D type0d = new Type_0D();
                type0d.Read(hasTypeTree, reader.Position, reader, version, version, bigEndian);
                pTypes_Unity5[i] = type0d;
            }
            if (version < 0x0E)
            {
                dwUnknown = reader.ReadUInt24();
            }
            _fmt = version; //-todo: figure out what the heck this is for. if ver = -1 on write does it set it to default or something?
            return(reader.Position);
        }//Minimum AssetsFile format : 6
Beispiel #5
0
        public override void Parse(AssetIdentifier identifier, AssetIdentifier gameObjectIdentifier, AssetsFileReader reader, ResourceAssets resourceAssets, Dictionary <int, string> relativeFileIdToPath)
        {
            reader.Align();
            uint            size = reader.ReadUInt32();
            WorldEntityInfo wei;

            for (int i = 0; i < size; i++)
            {
                wei           = new WorldEntityInfo();
                wei.classId   = reader.ReadCountStringInt32();
                wei.techType  = (TechType)reader.ReadInt32();
                wei.slotType  = (EntitySlot.Type)reader.ReadInt32();
                wei.prefabZUp = reader.ReadBoolean();

                reader.Align();

                wei.cellLevel  = (LargeWorldEntity.CellLevel)reader.ReadInt32();
                wei.localScale = new UnityEngine.Vector3(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle());
                resourceAssets.WorldEntitiesByClassId.Add(wei.classId, wei);
            }
        }