Exemplo n.º 1
0
 public FlareLayer(AssetCabinet file, int pathID, UnityClassID classID1, UnityClassID classID2)
 {
     this.file = file;
     this.pathID = pathID;
     this.classID1 = classID1;
     this.classID2 = classID2;
 }
Exemplo n.º 2
0
 public ParticleAnimator(AssetCabinet file, int pathID, UnityClassID classID1, UnityClassID classID2)
 {
     this.file = file;
     this.pathID = pathID;
     this.classID1 = classID1;
     this.classID2 = classID2;
 }
Exemplo n.º 3
0
 public Material(AssetCabinet file, int pathID, UnityClassID classID1, UnityClassID classID2)
 {
     this.file = file;
     this.pathID = pathID;
     this.classID1 = classID1;
     this.classID2 = classID2;
 }
Exemplo n.º 4
0
 public RigidBody(AssetCabinet file, int pathID, UnityClassID classID1, UnityClassID classID2)
 {
     this.file = file;
     this.pathID = pathID;
     this.classID1 = classID1;
     this.classID2 = classID2;
 }
Exemplo n.º 5
0
        public new Cubemap Clone(AssetCabinet file)
        {
            Component cubemap = file.Bundle.FindComponent(m_Name, UnityClassID.Cubemap);
            if (cubemap == null)
            {
                file.MergeTypeDefinition(this.file, UnityClassID.Cubemap);

                Cubemap clone = new Cubemap(file);
                file.Bundle.AddComponent(m_Name, clone);
                CopyAttributesTo(clone);
                CopyImageTo(clone);
                foreach (PPtr<Texture2D> texPtr in m_SourceTextures)
                {
                    if (texPtr.asset != null)
                    {
                        clone.m_SourceTextures.Add(new PPtr<Texture2D>(texPtr.instance.Clone(file)));
                    }
                }
                return clone;
            }
            else if (cubemap is NotLoaded)
            {
                NotLoaded notLoaded = (NotLoaded)cubemap;
                if (notLoaded.replacement != null)
                {
                    cubemap = notLoaded.replacement;
                }
                else
                {
                    cubemap = file.LoadComponent(file.SourceStream, notLoaded);
                }
            }
            return (Cubemap)cubemap;
        }
Exemplo n.º 6
0
 public MonoBehaviour(AssetCabinet file, int pathID, UnityClassID classID1, UnityClassID classID2)
 {
     this.file = file;
     this.pathID = pathID;
     this.classID1 = classID1;
     this.classID2 = classID2;
 }
Exemplo n.º 7
0
 public GameObject(AssetCabinet file, int pathID, UnityClassID classID1, UnityClassID classID2)
 {
     this.file = file;
     this.pathID = pathID;
     this.classID1 = classID1;
     this.classID2 = classID2;
 }
Exemplo n.º 8
0
 public AnimatorController(AssetCabinet file, int pathID, UnityClassID classID1, UnityClassID classID2)
 {
     this.file = file;
     this.pathID = pathID;
     this.classID1 = classID1;
     this.classID2 = classID2;
 }
Exemplo n.º 9
0
        public SpriteRenderer(AssetCabinet file)
            : this(file, 0, UnityClassID.SpriteRenderer, UnityClassID.SpriteRenderer)
        {
            file.ReplaceSubfile(-1, this, null);

            base.SetDefaults();
        }
Exemplo n.º 10
0
 public CapsuleCollider(AssetCabinet file, int pathID, UnityClassID classID1, UnityClassID classID2)
 {
     this.file = file;
     this.pathID = pathID;
     this.classID1 = classID1;
     this.classID2 = classID2;
 }
Exemplo n.º 11
0
 public AudioListener(AssetCabinet file, int pathID, UnityClassID classID1, UnityClassID classID2)
 {
     this.file = file;
     this.pathID = pathID;
     this.classID1 = classID1;
     this.classID2 = classID2;
 }
Exemplo n.º 12
0
        public Shader(AssetCabinet file)
            : this(file, 0, UnityClassID.Shader, UnityClassID.Shader)
        {
            file.ReplaceSubfile(-1, this, null);

            m_Dependencies = new List<PPtr<Shader>>();
        }
Exemplo n.º 13
0
 public MeshRenderer(AssetCabinet file, int pathID, UnityClassID classID1, UnityClassID classID2)
 {
     this.file = file;
     this.pathID = pathID;
     this.classID1 = classID1;
     this.classID2 = classID2;
 }
Exemplo n.º 14
0
        public MeshRenderer(AssetCabinet file)
            : this(file, 0, UnityClassID.MeshRenderer, UnityClassID.MeshRenderer)
        {
            file.ReplaceSubfile(-1, this, null);

            SetDefaults();
        }
Exemplo n.º 15
0
 public NotLoaded(AssetCabinet file, int pathID, UnityClassID classID1, UnityClassID classID2)
 {
     this.file = file;
     this.pathID = pathID;
     this.classID1 = classID1;
     this.classID2 = classID2;
 }
Exemplo n.º 16
0
        public TextAsset Clone(AssetCabinet file)
        {
            Component text = file.Components.Find
            (
                delegate(Component asset)
                {
                    return asset.classID1 == UnityClassID.TextAsset &&
                        (asset is NotLoaded ? ((NotLoaded)asset).Name : ((TextAsset)asset).m_Name) == m_Name;
                }
            );
            if (text == null)
            {
                file.MergeTypeDefinition(this.file, UnityClassID.TextAsset);

                TextAsset dest = new TextAsset(file);
                using (MemoryStream mem = new MemoryStream())
                {
                    this.WriteTo(mem);
                    mem.Position = 0;
                    dest.LoadFrom(mem);
                }
                return dest;
            }
            else if (text is NotLoaded)
            {
                NotLoaded notLoaded = (NotLoaded)text;
                text = file.LoadComponent(file.SourceStream, notLoaded);
            }
            return (TextAsset)text;
        }
Exemplo n.º 17
0
 public EllipsoidParticleEmitter(AssetCabinet file, int pathID, UnityClassID classID1, UnityClassID classID2)
 {
     this.file = file;
     this.pathID = pathID;
     this.classID1 = classID1;
     this.classID2 = classID2;
 }
Exemplo n.º 18
0
        public MeshFilter Clone(AssetCabinet file)
        {
            file.MergeTypeDefinition(this.file, UnityClassID.MeshFilter);

            MeshFilter filter = new MeshFilter(file);
            filter.m_Mesh = new PPtr<Mesh>(m_Mesh.instance != null ? m_Mesh.instance.Clone(file) : null);
            return filter;
        }
Exemplo n.º 19
0
 public GameObject(AssetCabinet file)
     : this(file, 0, UnityClassID.GameObject, UnityClassID.GameObject)
 {
     file.ReplaceSubfile(-1, this, null);
     m_Component = new List<KeyValuePair<UnityClassID, PPtr<Component>>>(1);
     m_Layer = 20;
     m_isActive = true;
 }
Exemplo n.º 20
0
        public AssetBundle(AssetCabinet file, int pathID, UnityClassID classID1, UnityClassID classID2)
        {
            this.file = file;
            this.pathID = pathID;
            this.classID1 = classID1;
            this.classID2 = classID2;

            NeedsUpdate = new HashSet<Component>();
        }
Exemplo n.º 21
0
 UClass GenerateType(AssetCabinet.TypeDefinition typeDef)
 {
     UClass cls = new UClass(typeDef.definitions.type, typeDef.definitions.identifier);
     for (int i = 0; i < typeDef.definitions.children.Length; i++)
     {
         AssetCabinet.TypeDefinitionString memberDef = typeDef.definitions.children[i];
         UType member = GetMember(memberDef);
         cls.Members.Add(member);
     }
     return cls;
 }
Exemplo n.º 22
0
Arquivo: Mesh.cs Projeto: kkdevs/sb3u
        public Mesh(AssetCabinet file) :
            this(file, 0, UnityClassID.Mesh, UnityClassID.Mesh)
        {
            file.ReplaceSubfile(-1, this, null);

            m_Shapes = new BlendShapeData();
            if (file.VersionNumber >= AssetCabinet.VERSION_5_0_0)
            {
                m_StreamCompression = 1;
            }
            m_IsReadable     = true;
            m_KeepVertices   = true;
            m_KeepIndices    = true;
            m_CompressedMesh = new CompressedMesh(file.VersionNumber);
            m_LocalAABB      = new AABB();
            m_MeshUsageFlags = 1;
            if (file.VersionNumber >= AssetCabinet.VERSION_5_0_0)
            {
                m_BakedConvexCollisionMesh   = new byte[0];
                m_BakedTriangleCollisionMesh = new byte[0];
            }
        }
Exemplo n.º 23
0
        public UnityParser(UnityParser source)
        {
            FilePath = source.FilePath;

            if (source.ExtendedSignature != null)
            {
                ExtendedSignature = (byte[])source.ExtendedSignature.Clone();
                HeaderLength      = source.HeaderLength;
                Unknown1          = source.Unknown1;
                Unknown2          = source.Unknown2;
                CabinetOffset     = source.CabinetOffset;
                LastByte          = source.LastByte;

                Unknown3 = source.Unknown3;
                Name     = (string)source.Name.Clone();
                Offset   = source.Offset;
            }
            Cabinet = new AssetCabinet(source.Cabinet, this);

            InitTextures();
            DeleteModFiles = new HashSet <AssetCabinet>();
        }
Exemplo n.º 24
0
 public static MonoBehaviour Import(string filePath, AssetCabinet file)
 {
     for (int i = 0; i < file.Types.Count; i++)
     {
         var typeDef = file.Types[i];
         if (typeDef.definitions.type == UnityClassID.MonoBehaviour.ToString() &&
             typeDef.definitions.children.Length > 4)
         {
             var member = typeDef.definitions.children[4];
             if (member.type == "Param" && member.identifier == "list")
             {
                 MonoBehaviour m = new MonoBehaviour(null, 0, file.VersionNumber < AssetCabinet.VERSION_5_5_0 ? (UnityClassID)typeDef.typeId : (UnityClassID)i, UnityClassID.MonoBehaviour);
                 m.Parser = new TypeParser(file, typeDef);
                 m.m_Name = Path.GetFileNameWithoutExtension(filePath);
                 StringToParamList(m, LoadLines(filePath));
                 return(m);
             }
         }
     }
     Report.ReportLog("Warning! No definition of required type found!");
     return(null);
 }
Exemplo n.º 25
0
        public void CopyTo(Animator dest)
        {
            if (file.Bundle.numContainerEntries(m_GameObject.instance.m_Name, UnityClassID.GameObject) > 1)
            {
                Report.ReportLog("Warning! Animator " + m_GameObject.instance.m_Name + " has multiple entries in the AssetBundle's Container.");
            }
            dest.file.Bundle.AddComponent(m_GameObject.instance.m_Name, dest.m_GameObject.instance);
            dest.m_Enabled = m_Enabled;
            dest.m_Avatar  = new PPtr <Avatar>(m_Avatar.instance != null ? m_Avatar.instance.Clone(dest.file) : null);

            dest.m_Controller = new PPtr <RuntimeAnimatorController>((Component)null);
            if (m_Controller.asset != null)
            {
                Report.ReportLog("Warning! " + m_Controller.asset.classID1 + " " + AssetCabinet.ToString(m_Controller.asset) + " not duplicated!");
            }

            dest.m_CullingMode           = m_CullingMode;
            dest.m_UpdateMode            = m_UpdateMode;
            dest.m_ApplyRootMotion       = m_ApplyRootMotion;
            dest.m_HasTransformHierarchy = m_HasTransformHierarchy;
            dest.m_AllowConstantClipSamplingOptimization = m_AllowConstantClipSamplingOptimization;
        }
Exemplo n.º 26
0
        private void editTextBoxValue_AfterEditTextChanged(object sender, EventArgs e)
        {
            try
            {
                if (treeViewMembers.SelectedNode == null)
                {
                    ReselectEditedNode();
                }

                int line = int.Parse(treeViewMembers.SelectedNode.Name);
                Gui.Scripting.RunScript(EditorVar + ".SetAttributes(line=" + line + ", value=\"" + editTextBoxValue.Text + "\")");
                Changed = Changed;

                AddChange(new Tuple <int, string, int>(line, editTextBoxValue.Text, 0));

                TreeNode node = treeViewMembers.SelectedNode;
                if (((string)node.Tag).Contains("PPtr<"))
                {
                    string name   = null;
                    Int64  pathID = 0;
                    if (Int64.TryParse(editTextBoxValue.Text, out pathID) && pathID != 0)
                    {
                        Component asset = Editor.Parser.file.findComponent[pathID];
                        name = (asset is NotLoaded ? ((NotLoaded)asset).Name : AssetCabinet.ToString(asset)) + " PathID=";
                    }
                    node.Text = node.Tag + ": " + name + editTextBoxValue.Text;
                }
                else
                {
                    node.Text = node.Tag + ": " + editTextBoxValue.Text;
                }
                node.BackColor = Color.SeaGreen;
                treeViewMembers.SelectedNode = null;
            }
            catch (Exception ex)
            {
                Utility.ReportException(ex);
            }
        }
Exemplo n.º 27
0
        UType GetMember(AssetCabinet.TypeDefinitionString member)
        {
            switch (member.type)
            {
            case "char":
                return new Uchar(member.identifier);
            case "bool":
            case "UInt8":
                return new Uint8(member.identifier);
            case "int":
                return new Uint32(member.identifier);
            case "unsigned int":
                return new Uuint32(member.identifier);
            case "float":
                return new Ufloat(member.identifier);
            }

            UType cls;
            if (member.type.StartsWith("PPtr<") && member.type.EndsWith(">"))
            {
                cls = new UPPtr(file, member.identifier);
            }
            else if (member.type == "Array")
            {
                cls = new Uarray();
            }
            else
            {
                cls = new UClass(member.type, member.identifier);
            }
            for (int i = 0; i < member.children.Length; i++)
            {
                AssetCabinet.TypeDefinitionString memberDef = member.children[i];
                UType submember = GetMember(memberDef);
                cls.Members.Add(submember);
            }
            return cls;
        }
Exemplo n.º 28
0
        public MonoBehaviour Clone(AssetCabinet file)
        {
            AssetCabinet.TypeDefinition srcDef = this.file.Types.Find
                                                 (
                delegate(AssetCabinet.TypeDefinition def)
            {
                return(def.typeId == (int)this.classID1);
            }
                                                 );
            int destId = 0, minId = 0;

            AssetCabinet.TypeDefinition destDef = null;
            for (int i = 0; i < file.Types.Count; i++)
            {
                if (AssetCabinet.CompareTypes(srcDef, file.Types[i]))
                {
                    destDef = file.Types[i];
                    destId  = destDef.typeId;
                    break;
                }
                if (file.Types[i].typeId < minId)
                {
                    minId = file.Types[i].typeId;
                }
            }
            if (destId == 0)
            {
                destDef = srcDef.Clone();
                destId  = destDef.typeId = minId - 1;
                file.Types.Add(destDef);
            }

            MonoBehaviour dest = new MonoBehaviour(file, (UnityClassID)destId);

            dest.Parser = new TypeParser(file, destDef);
            AssetCabinet.IncompleteClones.Add(new Tuple <Component, Component>(this, dest));
            return(dest);
        }
Exemplo n.º 29
0
        public void CopyTo(Animator dest)
        {
            bool multiEntry = file.Bundle != null && file.Bundle.numContainerEntries(m_GameObject.instance.m_Name, UnityClassID.GameObject) > 1;

            dest.m_Enabled = m_Enabled;
            dest.m_Avatar  = new PPtr <Avatar>
                             (
                m_Avatar.instance != null && m_Avatar.instance.classID() == UnityClassID.Avatar
                                ? m_Avatar.instance.Clone(dest.file) : null
                             );
            if (dest.file.Bundle != null)
            {
                if (multiEntry)
                {
                    dest.file.Bundle.AddComponents(m_GameObject.instance.m_Name,
                                                   new List <Component>(new Component[2] {
                        dest.m_GameObject.instance, dest.m_Avatar.instance
                    }));
                }
                else
                {
                    dest.file.Bundle.AddComponent(m_GameObject.instance.m_Name, dest.m_GameObject.instance);
                }
            }

            dest.m_Controller = new PPtr <AnimatorController>((Component)null);
            if (m_Controller.asset != null)
            {
                Report.ReportLog("Warning! " + m_Controller.asset.classID() + " " + AssetCabinet.ToString(m_Controller.asset) + " not duplicated!");
            }

            dest.m_CullingMode            = m_CullingMode;
            dest.m_UpdateMode             = m_UpdateMode;
            dest.m_ApplyRootMotion        = m_ApplyRootMotion;
            dest.m_LinearVelocityBlending = m_LinearVelocityBlending;
            dest.m_HasTransformHierarchy  = m_HasTransformHierarchy;
            dest.m_AllowConstantClipSamplingOptimization = m_AllowConstantClipSamplingOptimization;
        }
Exemplo n.º 30
0
        public AssetInfo(AssetCabinet file, Stream stream)
        {
            this.file = file;
            BinaryReader reader = new BinaryReader(stream);

            preloadIndex = reader.ReadInt32();
            preloadSize  = reader.ReadInt32();
            PPtr <Object> objPtr = new PPtr <Object>(stream);

            if (objPtr.m_FileID == 0 && objPtr.m_PathID != 0)
            {
                Component comp = file.FindComponent(objPtr.m_PathID, false);
                if (comp == null)
                {
                    comp = new NotLoaded(file, objPtr.m_PathID, 0, 0);
                }
                asset = new PPtr <Object>(comp);
            }
            else
            {
                asset = objPtr;
            }
        }
Exemplo n.º 31
0
        public AssetCabinet(AssetCabinet source, UnityParser parser)
        {
            Parser = parser;

            Format   = source.Format;
            Unknown6 = source.Unknown6;
            Version  = (string)source.Version.Clone();

            Unknown7 = source.Unknown7;

            int numTypes = source.Types.Count;

            Types = new List <TypeDefinition>(numTypes);
            for (int i = 0; i < numTypes; i++)
            {
                TypeDefinition t = source.Types[i];
                Types.Add(t);
            }

            Unknown8 = source.Unknown8;

            int numComponents = source.Components.Count;

            Components = new List <Component>(numComponents);

            int numRefs = source.References.Length;

            References = new Reference[numRefs];
            for (int i = 0; i < numRefs; i++)
            {
                References[i] = source.References[i];
            }

            RemovedList         = new List <NotLoaded>();
            loadingReferencials = false;
            reported            = new HashSet <string>();
        }
Exemplo n.º 32
0
        public AnimationClip Clone(AssetCabinet file)
        {
            Component clip = file.Components.Find
                             (
                delegate(Component asset)
            {
                if (asset.classID1 == UnityClassID.AnimationClip)
                {
                    if (asset is NotLoaded && ((NotLoaded)asset).Name == m_Name || ((AnimationClip)asset).m_Name == m_Name)
                    {
                        return(true);
                    }
                }
                return(false);
            }
                             );

            if (clip == null)
            {
                file.MergeTypeDefinition(this.file, UnityClassID.AnimationClip);

                clip = new AnimationClip(file);
            }
            else if (clip is NotLoaded)
            {
                NotLoaded notLoaded = (NotLoaded)clip;
                clip = file.LoadComponent(file.SourceStream, notLoaded);
            }
            using (MemoryStream mem = new MemoryStream())
            {
                WriteTo(mem);
                mem.Position = 0;
                clip.LoadFrom(mem);
            }
            return((AnimationClip)clip);
        }
Exemplo n.º 33
0
 public Projector(AssetCabinet file) :
     this(file, 0, UnityClassID.Projector, UnityClassID.Projector)
 {
     file.ReplaceSubfile(-1, this, null);
 }
Exemplo n.º 34
0
 public PPtrCurve(AssetCabinet file, Stream stream)
 {
     this.file = file;
 }
Exemplo n.º 35
0
        public static bool CompareTypes(AssetCabinet.TypeDefinitionString tds1, AssetCabinet.TypeDefinitionString tds2)
        {
            if (tds1.type != tds2.type || tds1.identifier != tds2.identifier || tds1.children.Length != tds2.children.Length)
            {
                return false;
            }

            for (int i = 0; i < tds1.children.Length; i++)
            {
                if (!CompareTypes(tds1.children[i], tds2.children[i]))
                {
                    return false;
                }
            }
            return true;
        }
Exemplo n.º 36
0
 public AssetInfo(AssetCabinet file)
 {
     this.file = file;
 }
Exemplo n.º 37
0
        public MeshRenderer Clone(AssetCabinet file)
        {
            file.MergeTypeDefinition(this.file, UnityClassID.MeshRenderer);

            MeshRenderer meshR = new MeshRenderer(file);
            AssetCabinet.IncompleteClones.Add(new Tuple<Component, Component>(this, meshR));
            return meshR;
        }
Exemplo n.º 38
0
 public AnimatorOverrideController(AssetCabinet file) :
     this(file, 0, UnityClassID.AnimatorOverrideController, UnityClassID.AnimatorOverrideController)
 {
     file.ReplaceSubfile(-1, this, null);
 }
Exemplo n.º 39
0
 public AnimationClipBindingConstant(AssetCabinet file, Stream stream)
 {
     this.file = file;
     LoadFrom(stream);
 }
Exemplo n.º 40
0
 public GenericBinding(AssetCabinet file, Stream stream)
 {
     this.file = file;
     LoadFrom(stream);
 }
Exemplo n.º 41
0
 public void AddComponent(Component asset)
 {
     AddComponent(AssetCabinet.ToString(asset), asset);
 }
Exemplo n.º 42
0
 public MeshFilter(AssetCabinet file)
     : this(file, 0, UnityClassID.MeshFilter, UnityClassID.MeshFilter)
 {
     file.ReplaceSubfile(-1, this, null);
 }
Exemplo n.º 43
0
 public Canvas(AssetCabinet file) :
     this(file, 0, UnityClassID.Canvas, UnityClassID.Canvas)
 {
     file.ReplaceSubfile(-1, this, null);
 }
Exemplo n.º 44
0
        public AssetCabinet(AssetCabinet source, UnityParser parser)
        {
            Parser = parser;

            Format = source.Format;
            Unknown6 = source.Unknown6;
            Version = (string)source.Version.Clone();

            Unknown7 = source.Unknown7;

            int numTypes = source.Types.Count;
            Types = new List<TypeDefinition>(numTypes);
            for (int i = 0; i < numTypes; i++)
            {
                TypeDefinition t = source.Types[i];
                Types.Add(t);
            }

            Unknown8 = source.Unknown8;

            int numComponents = source.Components.Count;
            Components = new List<Component>(numComponents);

            int numRefs = source.References.Length;
            References = new Reference[numRefs];
            for (int i = 0; i < numRefs; i++)
            {
                References[i] = source.References[i];
            }

            RemovedList = new List<NotLoaded>();
            loadingReferencials = false;
            reported = new HashSet<string>();
        }
Exemplo n.º 45
0
 public void MergeTypeDefinition(AssetCabinet file, UnityClassID cls)
 {
     AssetCabinet.TypeDefinition clsDef = Types.Find
     (
         delegate(AssetCabinet.TypeDefinition def)
         {
             return def.typeId == (int)cls;
         }
     );
     if (clsDef == null)
     {
         clsDef = file.Types.Find
         (
             delegate(AssetCabinet.TypeDefinition def)
             {
                 return def.typeId == (int)cls;
             }
         );
         if (clsDef == null)
         {
             Report.ReportLog("Warning! Class Definition for " + cls + " not found!");
             return;
         }
         Types.Add(clsDef);
     }
 }
Exemplo n.º 46
0
 public AnimationClipOverride(AssetCabinet file, Stream stream)
 {
     this.file = file;
     LoadFrom(stream);
 }
Exemplo n.º 47
0
 public AnimationClipOverride(AssetCabinet file, AnimationClip original, AnimationClip overrideClip)
 {
     this.file      = file;
     m_OriginalClip = new PPtr <AnimationClip>(original);
     m_OverrideClip = new PPtr <AnimationClip>(overrideClip);
 }
Exemplo n.º 48
0
 public AnimationEvent(AssetCabinet file, Stream stream)
 {
     this.file = file;
     LoadFrom(stream);
 }
Exemplo n.º 49
0
 public EllipsoidParticleEmitter(AssetCabinet file) :
     this(file, 0, UnityClassID.EllipsoidParticleEmitter, UnityClassID.EllipsoidParticleEmitter)
 {
     file.ReplaceSubfile(-1, this, null);
 }
Exemplo n.º 50
0
 public AnimationClip(AssetCabinet file) :
     this(file, 0, UnityClassID.AnimationClip, UnityClassID.AnimationClip)
 {
     file.ReplaceSubfile(-1, this, null);
 }
Exemplo n.º 51
0
 public AudioListener(AssetCabinet file)
     : this(file, 0, UnityClassID.AudioListener, UnityClassID.AudioListener)
 {
     file.ReplaceSubfile(-1, this, null);
 }
Exemplo n.º 52
0
 public FloatCurve(AssetCabinet file, Stream stream)
 {
     this.file = file;
     LoadFrom(stream);
 }
Exemplo n.º 53
0
 public AssetBundle(AssetCabinet file) :
     this(file, 0, UnityClassID.AssetBundle, UnityClassID.AssetBundle)
 {
     file.Components.Insert(0, this);
     file.Bundle = this;
 }
Exemplo n.º 54
0
 public PPtrKeyframe(AssetCabinet file, Stream stream)
 {
     this.file = file;
     LoadFrom(stream);
 }
Exemplo n.º 55
0
 public MultiLink(AssetCabinet file) :
     this(file, 0, UnityClassID.MultiLink, UnityClassID.MultiLink)
 {
     file.ReplaceSubfile(-1, this, null);
 }
Exemplo n.º 56
0
        public void Dump()
        {
            string msg = String.Empty;

            for (int i = 0; i < m_PreloadTable.Count; i++)
            {
                PPtr <Object> objPtr = m_PreloadTable[i];
                if (objPtr.m_FileID == 0)
                {
                    Component comp = file.FindComponent(objPtr.asset.pathID);
                    if (comp == null)
                    {
                        comp = new NotLoaded(file, objPtr.asset.pathID, 0, 0);
                    }
                    //if (comp.classID1 == UnityClassID.Material // comp.pathID != 0 && comp.classID1 != UnityClassID.GameObject && comp.classID1 != UnityClassID.Transform)
                    {
                        msg += i + " PathID=" + objPtr.asset.pathID + " " + comp.classID1 + " " + (!(comp is NotLoaded) ? AssetCabinet.ToString(comp) : ((NotLoaded)comp).Name) + "\r\n";
                    }
                }
                else
                {
                    msg += i + " external FileID=" + objPtr.m_FileID + " PathID=" + objPtr.m_PathID + "\r\n";
                }
            }
            Report.ReportLog(msg);

            msg = string.Empty;
            for (int i = 0; i < m_Container.Count; i++)
            {
                if (m_Container[i].Value.asset.asset.pathID != 0)
                {
                    Component asset = file.FindComponent(m_Container[i].Value.asset.asset.pathID);
                    msg += i + " " + m_Container[i].Key + " PathID=" + m_Container[i].Value.asset.asset.pathID + " i=" + m_Container[i].Value.preloadIndex + " s=" + m_Container[i].Value.preloadSize + " " + asset.classID1.ToString() + " " + (asset is NotLoaded ? ((NotLoaded)asset).Name : AssetCabinet.ToString(asset)) + "\r\n";
                }
                else
                {
                    msg += "NULL! " + i + " " + m_Container[i].Key + " PathID=" + m_Container[i].Value.asset.asset.pathID + " i=" + m_Container[i].Value.preloadIndex + " s=" + m_Container[i].Value.preloadSize + " NULL!\r\n";
                }
            }
            Report.ReportLog(msg);

            if (m_MainAsset.asset.asset != null)
            {
                Component asset = file.FindComponent(m_MainAsset.asset.asset.pathID);
                msg = "Main Asset i=" + m_MainAsset.preloadIndex + " s=" + m_MainAsset.preloadSize + " " + asset.classID1.ToString() + " " + (asset is NotLoaded ? ((NotLoaded)asset).Name : AssetCabinet.ToString(asset));
                Report.ReportLog(msg);
            }
        }
Exemplo n.º 57
0
        private void UpdateComponent(Component asset, List <Tuple <List <PPtr <Object> >, List <KeyValuePair <string, AssetInfo> > > > containerGroups)
        {
            List <Component> assets           = new List <Component>();
            List <Component> transforms       = new List <Component>();
            List <Component> containerRelated = new List <Component>();

            GetDependantAssets(asset, assets, transforms, containerRelated);
            if (asset.classID1 == UnityClassID.GameObject)
            {
                GameObject gameObj  = (GameObject)asset;
                Animator   animator = gameObj.FindLinkedComponent(UnityClassID.Animator);
                if (animator == null)
                {
                    foreach (Component trans in transforms)
                    {
                        GetDependantAssets(trans, assets, null, null);
                    }
                    animator              = new Animator(null, 0, UnityClassID.Animator, UnityClassID.Animator);
                    animator.m_Avatar     = new PPtr <Avatar>((Component)null);
                    animator.m_Controller = new PPtr <RuntimeAnimatorController>((Component)null);
                    GetDependantAssets(animator, assets, transforms, containerRelated);
                    assets.Remove(animator);
                }
            }
            foreach (var group in containerGroups)
            {
                var preloadPart      = group.Item1;
                var containerEntries = group.Item2;
                for (int i = 0; i < containerEntries.Count; i++)
                {
                    var assetPair = containerEntries[i];
                    if (assetPair.Value.asset.asset == asset)
                    {
                        preloadPart.Clear();
                        for (int j = 0; j < assets.Count; j++)
                        {
                            if (assets[j] is ExternalAsset)
                            {
                                ExternalAsset extAsset     = (ExternalAsset)assets[j];
                                PPtr <Object> preloadEntry = new PPtr <Object>((Component)null);
                                preloadEntry.m_FileID = extAsset.FileID;
                                preloadEntry.m_PathID = extAsset.PathID;
                                preloadPart.Add(preloadEntry);
                            }
                            else
                            {
                                preloadPart.Add(new PPtr <Object>(assets[j]));
                            }
                        }

                        string groupName = containerEntries[0].Key;
                        string assetName = AssetCabinet.ToString(asset);
                        if (String.Compare(groupName, assetName, true) != 0)
                        {
                            groupName = assetName.ToLower();
                        }
                        if (containerEntries.Count > 1)
                        {
                            for (int j = 0; j < containerEntries.Count; j++)
                            {
                                switch (containerEntries[j].Value.asset.asset.classID1)
                                {
                                case UnityClassID.Mesh:
                                case UnityClassID.AnimationClip:
                                    containerEntries.RemoveAt(j);
                                    j--;
                                    break;
                                }
                            }
                            for (int j = containerRelated.Count - 1; j >= 0; j--)
                            {
                                AnimationClip clip = containerRelated[j] as AnimationClip;
                                if (clip != null)
                                {
                                    AssetInfo info = new AssetInfo(file);
                                    info.asset = new PPtr <Object>(clip);
                                    containerEntries.Insert(1, new KeyValuePair <string, AssetInfo>(groupName, info));
                                }
                            }
                            for (int j = containerRelated.Count - 1; j >= 0; j--)
                            {
                                MeshRenderer meshR = containerRelated[j] as MeshRenderer;
                                if (meshR != null)
                                {
                                    Mesh mesh = Operations.GetMesh(meshR);
                                    if (mesh != null)
                                    {
                                        AssetInfo info = new AssetInfo(file);
                                        info.asset = new PPtr <Object>(mesh);
                                        containerEntries.Insert(1, new KeyValuePair <string, AssetInfo>(groupName, info));
                                    }
                                }
                            }
                            for (int j = 0; j < containerEntries.Count; j++)
                            {
                                containerEntries[j].Value.preloadSize = assets.Count;
                            }
                        }
                        else
                        {
                            containerEntries[0].Value.preloadSize = assets.Count;
                        }
                        for (int j = 0; j < containerEntries.Count; j++)
                        {
                            if (containerEntries[j].Key != groupName)
                            {
                                containerEntries[j] = new KeyValuePair <string, AssetInfo>(groupName, containerEntries[j].Value);
                            }
                        }
                        return;
                    }
                }
            }
        }
Exemplo n.º 58
0
 public ParticleRenderer(AssetCabinet file, int pathID, UnityClassID classID1, UnityClassID classID2)
     : base(file, pathID, classID1, classID2)
 {
 }
Exemplo n.º 59
0
 public Avatar(AssetCabinet file) :
     this(file, 0, UnityClassID.Avatar, UnityClassID.Avatar)
 {
     file.ReplaceSubfile(-1, this, null);
 }
Exemplo n.º 60
0
 public static bool CompareTypes(AssetCabinet.TypeDefinition td1, AssetCabinet.TypeDefinition td2)
 {
     return CompareTypes(td1.definitions, td2.definitions);
 }