Exemplo n.º 1
0
        private void CollectAnimationClip(Animator m_Animator)
        {
            if (assetsfileList.TryGetPD(m_Animator.m_Controller, out var assetPreloadData))
            {
                if (assetPreloadData.Type == ClassIDReference.AnimatorOverrideController)
                {
                    var m_AnimatorOverrideController = new AnimatorOverrideController(assetPreloadData);
                    if (assetsfileList.TryGetPD(m_AnimatorOverrideController.m_Controller, out assetPreloadData))
                    {
                        var m_AnimatorController = new AnimatorController(assetPreloadData);
                        foreach (var m_AnimationClip in m_AnimatorController.m_AnimationClips)
                        {
                            if (assetsfileList.TryGetPD(m_AnimationClip, out assetPreloadData))
                            {
                                animationClipHashSet.Add(assetPreloadData);
                            }
                        }
                    }

                    /*foreach (var clip in m_AnimatorOverrideController.m_Clips)
                     * {
                     *  if (assetsfileList.TryGetPD(clip[1], out assetPreloadData))
                     *  {
                     *      animationList.Add(new AnimationClip(assetPreloadData));
                     *  }
                     * }*/
                }
                else if (assetPreloadData.Type == ClassIDReference.AnimatorController)
                {
                    var m_AnimatorController = new AnimatorController(assetPreloadData);
                    foreach (var m_AnimationClip in m_AnimatorController.m_AnimationClips)
                    {
                        if (assetsfileList.TryGetPD(m_AnimationClip, out assetPreloadData))
                        {
                            animationClipHashSet.Add(assetPreloadData);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void CollectAnimationClip(Animator m_Animator)
        {
            if (m_Animator.m_Controller.TryGet(out var objectReader))
            {
                if (objectReader.type == ClassIDType.AnimatorOverrideController)
                {
                    var m_AnimatorOverrideController = new AnimatorOverrideController(objectReader);
                    if (m_AnimatorOverrideController.m_Controller.TryGet(out objectReader))
                    {
                        var m_AnimatorController = new AnimatorController(objectReader);
                        foreach (var m_AnimationClip in m_AnimatorController.m_AnimationClips)
                        {
                            if (m_AnimationClip.TryGet(out objectReader))
                            {
                                animationClipHashSet.Add(objectReader);
                            }
                        }
                    }

                    /*foreach (var clip in m_AnimatorOverrideController.m_Clips)
                     * {
                     *  if (assetsfileList.TryGetPD(clip[1], out assetPreloadData))
                     *  {
                     *      animationList.Add(new AnimationClip(assetPreloadData));
                     *  }
                     * }*/
                }
                else if (objectReader.type == ClassIDType.AnimatorController)
                {
                    var m_AnimatorController = new AnimatorController(objectReader);
                    foreach (var m_AnimationClip in m_AnimatorController.m_AnimationClips)
                    {
                        if (m_AnimationClip.TryGet(out objectReader))
                        {
                            animationClipHashSet.Add(objectReader);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void ReadAssets()
        {
            Logger.Info("Read assets...");

            var progressCount = assetsFileList.Sum(x => x.m_Objects.Count);
            int i             = 0;

            Progress.Reset();
            foreach (var assetsFile in assetsFileList)
            {
                foreach (var objectInfo in assetsFile.m_Objects)
                {
                    var objectReader = new ObjectReader(assetsFile.reader, assetsFile, objectInfo);
                    try
                    {
                        Object obj;
                        switch (objectReader.type)
                        {
                        case ClassIDType.Animation:
                            obj = new Animation(objectReader);
                            break;

                        case ClassIDType.AnimationClip:
                            obj = new AnimationClip(objectReader);
                            break;

                        case ClassIDType.Animator:
                            obj = new Animator(objectReader);
                            break;

                        case ClassIDType.AnimatorController:
                            obj = new AnimatorController(objectReader);
                            break;

                        case ClassIDType.AnimatorOverrideController:
                            obj = new AnimatorOverrideController(objectReader);
                            break;

                        case ClassIDType.AssetBundle:
                            obj = new AssetBundle(objectReader);
                            break;

                        case ClassIDType.AudioClip:
                            obj = new AudioClip(objectReader);
                            break;

                        case ClassIDType.Avatar:
                            obj = new Avatar(objectReader);
                            break;

                        case ClassIDType.Font:
                            obj = new Font(objectReader);
                            break;

                        case ClassIDType.GameObject:
                            obj = new GameObject(objectReader);
                            break;

                        case ClassIDType.Material:
                            obj = new Material(objectReader);
                            break;

                        case ClassIDType.Mesh:
                            obj = new Mesh(objectReader);
                            break;

                        case ClassIDType.MeshFilter:
                            obj = new MeshFilter(objectReader);
                            break;

                        case ClassIDType.MeshRenderer:
                            obj = new MeshRenderer(objectReader);
                            break;

                        case ClassIDType.MonoBehaviour:
                            obj = new MonoBehaviour(objectReader);
                            break;

                        case ClassIDType.MonoScript:
                            obj = new MonoScript(objectReader);
                            break;

                        case ClassIDType.MovieTexture:
                            obj = new MovieTexture(objectReader);
                            break;

                        case ClassIDType.PlayerSettings:
                            obj = new PlayerSettings(objectReader);
                            break;

                        case ClassIDType.RectTransform:
                            obj = new RectTransform(objectReader);
                            break;

                        case ClassIDType.Shader:
                            obj = new Shader(objectReader);
                            break;

                        case ClassIDType.SkinnedMeshRenderer:
                            obj = new SkinnedMeshRenderer(objectReader);
                            break;

                        case ClassIDType.Sprite:
                            obj = new Sprite(objectReader);
                            break;

                        case ClassIDType.SpriteAtlas:
                            obj = new SpriteAtlas(objectReader);
                            break;

                        case ClassIDType.TextAsset:
                            obj = new TextAsset(objectReader);
                            break;

                        case ClassIDType.Texture2D:
                            obj = new Texture2D(objectReader);
                            break;

                        case ClassIDType.Transform:
                            obj = new Transform(objectReader);
                            break;

                        case ClassIDType.VideoClip:
                            obj = new VideoClip(objectReader);
                            break;

                        default:
                            obj = new Object(objectReader);
                            break;
                        }
                        assetsFile.AddObject(obj);
                    }
                    catch (Exception e)
                    {
                        /*var sb = new StringBuilder();
                         * sb.AppendLine("Unable to load object")
                         *  .AppendLine($"Assets {assetsFile.fileName}")
                         *  .AppendLine($"Type {objectReader.type}")
                         *  .AppendLine($"PathID {objectInfo.m_PathID}")
                         *  .Append(e);
                         * Logger.Error(sb.ToString());*/
                    }

                    Progress.Report(++i, progressCount);
                }
            }
        }