示例#1
0
        public override HashSet <string> Process(string entryPath, GameObject go, StrategyNode node)
        {
            HashSet <string> result = new HashSet <string>();
            Text             text   = go.GetComponent <Text>();

            if (text != null && text.font != null)
            {
                string fontPath = AssetDatabase.GetAssetPath(text.font);
                if (node.pattern.IsMatch(fontPath))
                {
                    text.fontKey = AssetPathHelper.GetObjectKey(entryPath, fontPath, text.font, node);
                    text.font    = null;
                    result.Add(fontPath);
                }
            }
            return(result);
        }
        // TODO 看不懂
        public override HashSet <string> Process(string entryPath, GameObject go, StrategyNode node)
        {
            HashSet <string> result    = new HashSet <string>();
            Animation        animation = go.GetComponent <Animation>();

            if (animation != null)
            {
                AnimationClip[] clips       = AnimationUtility.GetAnimationClips(go);
                AnimationClip   defaultClip = animation.clip;
                VerifyClipsName(entryPath, clips);
                string[] clipTokens = GetClipTokens(go, clips.Length);
                if (defaultClip != null)
                {
                    string defaultClipPath = AssetDatabase.GetAssetPath(defaultClip);
                    if (node.pattern.IsMatch(defaultClipPath))
                    {
                        string defaultClipKey = AssetPathHelper.GetObjectKey(entryPath, defaultClipPath, defaultClip, node);
                        result.Add(defaultClipPath);
                        animation.clip = null;
                        clipTokens[0]  = defaultClipKey;
                    }
                }

                for (int i = 0; i < clips.Length; i++)
                {
                    AnimationClip clip = clips[i];
                    if (clip != null)
                    {
                        string clipPath = AssetDatabase.GetAssetPath(clip);
                        if (node.pattern.IsMatch(clipPath))
                        {
                            string clipKey = AssetPathHelper.GetObjectKey(entryPath, clipPath, clip, node);
                            result.Add(clipPath);
                            animation.RemoveClip(clip);
                            clipTokens[i + 1] = clipKey;
                        }
                    }
                }
                if (IsClipTokensEmpty(clipTokens) == false)
                {
                    AssetBridgeHelper.AddEntry(go, this.Name, clipTokens);
                }
            }
            return(result);
        }
示例#3
0
        public override HashSet <string> Process(string entryPath, GameObject go, StrategyNode node)
        {
            HashSet <string> result = new HashSet <string>();
            Image            image  = go.GetComponent <Image>();

            if (image != null && image.material != null)
            {
                string materialPath = MaterialAssetProcessor.GetMaterialPath(image.material);
                if (node.pattern.IsMatch(materialPath))
                {
                    result.Add(materialPath);
                    image.materialKey = AssetPathHelper.GetObjectKey(entryPath, materialPath, image.material, node);
                    image.material    = null;
                    image.spriteKey   = AssetPathHelper.GetObjectKey(entryPath, materialPath, image.sprite, node);
                    image.sprite      = null;
                }
            }
            return(result);
        }
示例#4
0
        public HashSet <string> Process(string entryPath, Material material, StrategyNode node)
        {
            HashSet <string> result = new HashSet <string>();

            if (material == null)
            {
                Debug.LogError("资源打包出错, 缺少Material:" + entryPath);
            }
            string materialPath = MaterialAssetProcessor.GetMaterialPath(material);
            string shaderPath   = MaterialAssetProcessor.GetShaderPath(material.shader);

            if (node.pattern.IsMatch(shaderPath))
            {
                MaterialJsonData jsonData = MaterialJsonData.GetMaterialJsonData(materialPath);
                jsonData.shaderFileName = GetShaderFileName(material.shader);
                jsonData.shaderKey      = AssetPathHelper.GetObjectKey(entryPath, shaderPath, material.shader, node);
                jsonData.FillNoTexturePropertyData(material, node);
                result.Add(shaderPath);
            }
            return(result);
        }