コード例 #1
0
ファイル: PsdImporter.cs プロジェクト: neilyodamp/PSD2UGUI
        public static void CreateSprite(Layer layer, Image img)
        {
            Match match = PsdControl.colorImgRegex.Match(layer.Name);

            if (match.Success)
            {
                string numStr = match.Groups[1].Value;
                float  alpha  = float.Parse(numStr) / 100.0f;
                img.color = new Color(0, 0, 0, alpha);
            }
            else if (!layer.Name.StartsWith(PsdImporter.IMG_REF))
            {
                img.sprite = PsdImporter.CreateSpriteInternal(layer);
            }
            else
            {
                layer.Name = layer.Name.Replace(PsdImporter.IMG_REF, string.Empty);
                string writePath;
                string path = PsdImporter.GetFilePath(layer, out writePath);
                PsdImporter.AddScaleImg(path, img);
            }
        }