Ejemplo n.º 1
0
 //clipTokens记录AnimationClip的Key,其中第一个值默认clip的key值
 private string[] GetClipTokens(GameObject go, int clipCount)
 {
     string[] clipTokens = AssetBridgeHelper.GetEntryTokens(go, this.Name);
     if (clipTokens == null)
     {
         clipTokens = new string[clipCount + 1];
         for (int i = 0; i < clipTokens.Length; i++)
         {
             clipTokens[i] = string.Empty;
         }
     }
     return(clipTokens);
 }
Ejemplo n.º 2
0
        // 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);
        }