Exemple #1
0
        public static SmartPtr <T> Read(AssetsFile assetsFile, AssetsObject owner, AssetsReader reader)
        {
            if (owner == null)
            {
                Log.LogErr("WARNING: SmartPtr created without an owner!");
            }
            int fileID = reader.ReadInt32();

            reader.AlignTo(4);
            Int64 pathID = reader.ReadInt64();

            if (fileID == 0 && pathID == 0)
            {
                return(null);
            }

            var objInfo = assetsFile.GetObjectInfo <T>(fileID, pathID);

            if (objInfo == null)
            {
                Log.LogErr($"WARNING: Could not find objectinfo for creating SmartPtr of type {typeof(T).Name} on owner type {owner?.GetType()?.Name ?? "(null owner)"}!  Returned a null pointer instead.");
                return(null);
            }

            SmartPtr <T> ptr = new SmartPtr <T>(owner, assetsFile.GetObjectInfo <T>(fileID, pathID));

            //TODO: not sure this is only ever called by existing objects
            ptr.IsNew = false;

            return(ptr);
        }
Exemple #2
0
        public override void Parse(AssetsReader reader)
        {
            base.ParseBase(reader);
            IsEnabled            = reader.ReadBoolean();
            CastShadows          = reader.ReadByte();
            ReceiveShadows       = reader.ReadByte();
            DynamicOcclude       = reader.ReadByte();
            MotionVectors        = reader.ReadByte();
            LightProbeUsage      = reader.ReadByte();
            ReflectionProbeUsage = reader.ReadByte();
            reader.AlignTo(4);
            RenderingLayerMask = reader.ReadUInt32();
            if (ObjectInfo.ParentFile.Metadata.VersionGte("2018.3"))
            {
                RendererPriority = reader.ReadInt32();
            }
            LightmapIndex               = reader.ReadUInt16();
            LightmapIndexDynamic        = reader.ReadUInt16();
            LightmapTilingOffset        = new Vector4F(reader);
            LightmapTilingOffsetDynamic = new Vector4F(reader);
            Materials       = reader.ReadArrayOf(r => (ISmartPtr <MaterialObject>)SmartPtr <MaterialObject> .Read(ObjectInfo.ParentFile, this, r));
            StaticBatchInfo = new StaticBatchInfo(reader);
            StaticBatchRoot = SmartPtr <Transform> .Read(ObjectInfo.ParentFile, this, reader);

            ProbeAnchor = SmartPtr <Transform> .Read(ObjectInfo.ParentFile, this, reader);

            LightProbeVolumeOverride = SmartPtr <GameObject> .Read(ObjectInfo.ParentFile, this, reader);

            SortingLayerID          = reader.ReadInt32();
            SortingLayer            = reader.ReadInt16();
            SortingOrder            = reader.ReadInt16();
            AdditionalVertexStreams = SmartPtr <MeshObject> .Read(ObjectInfo.ParentFile, this, reader);
        }
Exemple #3
0
        public void Parse(AssetsFile file, AssetsObject owner, AssetsReader reader)
        {
            Texture = SmartPtr <Texture2DObject> .Read(file, owner, reader);

            Scale  = new Vector2F(reader);
            Offset = new Vector2F(reader);
        }
Exemple #4
0
        protected override void Parse(AssetsReader reader)
        {
            base.Parse(reader);
            Enabled           = reader.ReadInt32();
            MonoscriptTypePtr = SmartPtr <MonoScriptObject> .Read(ObjectInfo.ParentFile, this, reader);

            Name = reader.ReadString();
        }
Exemple #5
0
 protected override void Parse(AssetsReader reader)
 {
     base.Parse(reader);
     LocalRotation = new QuaternionF(reader);
     LocalPosition = new Vector3F(reader);
     LocalScale    = new Vector3F(reader);
     Children      = reader.ReadArrayOf(x => (ISmartPtr <Transform>)SmartPtr <Transform> .Read(ObjectInfo.ParentFile, this, reader));
     Father        = SmartPtr <AssetsObject> .Read(ObjectInfo.ParentFile, this, reader);
 }
        //public SpriteObject(IObjectInfo<AssetsObject> objectInfo) : base(objectInfo)
        //{ }

        protected override void Parse(AssetsReader reader)
        {
            base.Parse(reader);
            int startPosition = reader.Position;

            Name          = reader.ReadString();
            UnparsedData1 = reader.ReadBytes(100);
            Texture       = SmartPtr <Texture2DObject> .Read(ObjectInfo.ParentFile, this, reader);

            int readLen = ObjectInfo.DataSize - (reader.Position - startPosition);

            UnparsedData2 = reader.ReadBytes(readLen);
        }
Exemple #7
0
 protected override void Parse(AssetsReader reader)
 {
     base.Parse(reader);
     try
     {
         GameObject = SmartPtr <GameObject> .Read(ObjectInfo.ParentFile, this, reader);
     }
     catch (Exception ex)
     {
         Log.LogErr("Component failed to load its GameObject... allowing it to continue because this happens with bundles?");
         GameObject = null;
     }
 }
Exemple #8
0
        protected void ParseDetails(AssetsReader reader)
        {
            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                Components.Add(SmartPtr <AssetsObject> .Read(ObjectInfo.ParentFile, this, reader));
            }
            Layer    = reader.ReadUInt32();
            Name     = reader.ReadString();
            Tag      = reader.ReadUInt16();
            IsActive = reader.ReadBoolean();
        }
Exemple #9
0
        public override void Parse(AssetsReader reader)
        {
            base.ParseBase(reader);
            int count = reader.ReadInt32();

            for (int i = 0; i < count; i++)
            {
                Components.Add(SmartPtr <AssetsObject> .Read(ObjectInfo.ParentFile, this, reader));
            }
            Layer    = reader.ReadUInt32();
            Name     = reader.ReadString();
            Tag      = reader.ReadUInt16();
            IsActive = reader.ReadBoolean();
        }
Exemple #10
0
        public override void Parse(AssetsReader reader)
        {
            base.ParseBase(reader);
            Name   = reader.ReadString();
            Shader = SmartPtr <AssetsObject> .Read(this.ObjectInfo.ParentFile, this, reader);

            ShaderKeywords           = reader.ReadString();
            LightmapFlags            = reader.ReadUInt32();
            EnableInstancingVariants = reader.ReadBoolean();
            DoubleSidedGI            = reader.ReadBoolean();
            reader.AlignTo(4);
            CustomRenderQueue    = reader.ReadInt32();
            StringTagMap         = reader.ReadArrayOf(r => new Map <string, string>(reader.ReadString(), reader.ReadString()));
            DisabledShaderPasses = reader.ReadArrayOf(r => r.ReadString());
            SavedProperties      = new PropertySheet(this.ObjectInfo.ParentFile, this, reader);
        }
            public void Parse(AssetsFile assetsFile, AssetsObject owner, AssetsReader reader)
            {
                Texture = SmartPtr <Texture2DObject> .Read(assetsFile, owner, reader);

                AlphaTexture = SmartPtr <Texture2DObject> .Read(assetsFile, owner, reader);

                SubMeshes   = reader.ReadArrayOf(r => new Submesh(reader));
                IndexBuffer = reader.ReadArray();
                reader.AlignTo(4);
                VertexData          = new VertexData(reader);
                BindPose            = reader.ReadArrayOf(r => r.ReadSingle());
                TextureRect         = new RectF(reader);
                TextureRectOffset   = new Vector2F(reader);
                AtlasRectOffset     = new Vector2F(reader);
                SettingsRaw         = reader.ReadUInt32();
                UVTransform         = new Vector4F(reader);
                DownscaleMultiplier = reader.ReadSingle();
            }
Exemple #12
0
        public static SmartPtr <T> Read(AssetsFile assetsFile, AssetsObject owner, AssetsReader reader)
        {
            int fileID = reader.ReadInt32();

            reader.AlignTo(4);
            Int64 pathID = reader.ReadInt64();

            if (fileID == 0 && pathID == 0)
            {
                return(null);
            }

            SmartPtr <T> ptr = new SmartPtr <T>(owner, assetsFile.GetObjectInfo <T>(fileID, pathID));

            //TODO: not sure this is only ever called by existing objects
            ptr.IsNew = false;

            return(ptr);
        }
        public override void Parse(AssetsReader reader)
        {
            base.ParseBase(reader);
            Name          = reader.ReadString();
            Rect          = new RectF(reader);
            Offset        = new Vector2F(reader);
            Border        = new Vector4F(reader);
            PixelsToUnits = reader.ReadSingle();
            Pivot         = new Vector2F(reader);
            Extrude       = reader.ReadUInt32();
            IsPolygon     = reader.ReadBoolean();
            reader.AlignTo(4);
            RenderDataKey = new Map <Guid, long>(reader.ReadGuid(), reader.ReadInt64());
            AtlasTags     = reader.ReadArrayOf(r => r.ReadString());
            SpriteAtlas   = SmartPtr <AssetsObject> .Read(ObjectInfo.ParentFile, this, reader);

            RenderData   = new SpriteRenderData(ObjectInfo.ParentFile, this, reader);
            PhysicsShape = reader.ReadArrayOf(r => r.ReadArrayOf(r2 => new Vector2F(r2)));
            Bones        = reader.ReadArrayOf(r => (ISmartPtr <Transform>)SmartPtr <Transform> .Read(ObjectInfo.ParentFile, this, reader));
        }
Exemple #14
0
 protected override void Parse(AssetsReader reader)
 {
     base.Parse(reader);
     Name                       = reader.ReadString();
     PreloadTable               = reader.ReadArrayOf <ISmartPtr <AssetsObject> >(x => SmartPtr <AssetsObject> .Read(ObjectInfo.ParentFile, this, x));
     Container                  = reader.ReadArrayOf(x => new Map(ObjectInfo.ParentFile, this, x));
     MainAsset                  = new AssetInfo(ObjectInfo.ParentFile, this, reader);
     RuntimeCompatibility       = reader.ReadUInt32();
     AssetBundleName            = reader.ReadString();
     Dependencies               = reader.ReadArrayOf <ISmartPtr <AssetsObject> >(x => SmartPtr <AssetsObject> .Read(ObjectInfo.ParentFile, this, x));
     IsStreamedSceneAssetBundle = reader.ReadBoolean();
     reader.AlignTo(4);
     ExplicitDataLayout = reader.ReadInt32();
     PathFlags          = reader.ReadInt32();
     SceneHashes        = reader.ReadArrayOf(x => new Map(ObjectInfo.ParentFile, this, x));
 }
Exemple #15
0
 public MonoBehaviourObject(AssetsFile assetsFile, MonoScriptObject scriptObject) : base(assetsFile, scriptObject.PropertiesHash)
 {
     Enabled           = 1;
     MonoscriptTypePtr = new SmartPtr <MonoScriptObject>(this, (IObjectInfo <MonoScriptObject>)scriptObject.ObjectInfo);
 }
Exemple #16
0
 private void Parse(AssetsFile assetsFile, AssetsObject owner, AssetsReader reader)
 {
     PreloadIndex = reader.ReadInt32();
     PreloadSize  = reader.ReadInt32();
     Asset        = SmartPtr <AssetsObject> .Read(assetsFile, owner, reader);
 }
Exemple #17
0
 protected override void Parse(AssetsReader reader)
 {
     base.Parse(reader);
     Mesh = SmartPtr <MeshObject> .Read(ObjectInfo.ParentFile, this, reader);
 }