Esempio n. 1
0
        public List <Sprite> MakeSortedSprites(AvatarPattern pattern)
        {
            List <Sprite> sprites = new List <Sprite>();

            foreach (var category in categories)
            {
                if (category.Tag != optionTag)
                {
                    //アクセサリなどのオプションではないので
                    //パターンデータに一致するスプライトを追加していく
                    foreach (var data in pattern.DataList)
                    {
                        //カテゴリタグがあうものを取得
                        if (category.Tag != data.tag)
                        {
                            continue;
                        }
                        //パタ―ン名が一致する一つだけを取得
                        sprites.Add(category.GetSprite(data.patternName));
                    }
                }
                else
                {
                    //アクセサリなどのオプションの場合は、パターン名に一致するものはすべて取得
                    foreach (var optionPattern in pattern.OptionPatternNameList)
                    {
                        sprites.AddRange(category.Sprites.FindAll(x => AvatarData.ToPatternName(x) == optionPattern));
                    }
                }
            }
            return(sprites);
        }
Esempio n. 2
0
        bool CheckPatternError(AvatarPattern pattern, AvatarPattern.PartternData patternData)
        {
            if (string.IsNullOrEmpty(patternData.patternName))
            {
                return(false);
            }

            foreach (var category in categories)
            {
                if (category.Tag != optionTag)
                {
                    if (category.Tag != patternData.tag)
                    {
                        continue;
                    }
                    if (category.GetSprite(patternData.patternName) != null)
                    {
                        return(false);
                    }
                }
                else
                {
                    foreach (var optionPattern in pattern.OptionPatternNameList)
                    {
                        if (category.Sprites.Exists(x => AvatarData.ToPatternName(x) == optionPattern))
                        {
                            return(false);
                        }
                    }
                }
            }
            return(true);
        }
Esempio n. 3
0
 public void CheckPatternError(AvatarPattern pattern)
 {
     foreach (var patternData in pattern.DataList)
     {
         if (CheckPatternError(pattern, patternData))
         {
             Debug.LogErrorFormat("Tag:{0} Pattern:{1} is not found in AvatorData {2}", patternData.tag, patternData.patternName, this.name);
         }
     }
 }
Esempio n. 4
0
            public void OnPreviewGUI(AvatarData data, AvatarPattern pattern, Rect r, GUIStyle background)
            {
                List <Sprite> parts = data.MakeSortedSprites(pattern);

                foreach (var part in  parts)
                {
                    if (part == null)
                    {
                        continue;
                    }
                    GUI.DrawTexture(r, AssetDatabase.LoadAssetAtPath <Texture2D>(AssetDatabase.GetAssetPath(part)), ScaleMode.ScaleToFit, true);
                }
            }
Esempio n. 5
0
        public List <Sprite> MakeSortedSprites(AvatarPattern pattern)
        {
            List <Sprite> list = new List <Sprite>();

            foreach (Category category in this.categories)
            {
                if (category.Tag != this.optionTag)
                {
                    foreach (AvatarPattern.PartternData data in pattern.DataList)
                    {
                        if (category.Tag == data.tag)
                        {
                            list.Add(category.GetSprite(data.patternName));
                        }
                    }
                }
                else
                {
                    using (List <string> .Enumerator enumerator3 = pattern.OptionPatternNameList.GetEnumerator())
                    {
                        while (enumerator3.MoveNext())
                        {