예제 #1
0
    static void DoPackerCommond(AtlasConfig config)
    {
        if (config == null)
        {
            return;
        }
        string cmd = TexturePackerCommond.GetPackCommond(config.PhotosFolderPath, config.PhotoFullPath, config.AtlasTxtFullPath);

        ShellHelper.ShellRequest request = ShellHelper.ProcessCommand(cmd, null);
        EditorUtility.DisplayProgressBar("批量处理中...", "Shell脚本生成图集信息...", 0);
        request.onDone += () =>
        {
            if (replaceAtlasConfigList.Count > 0)
            {
                AtlasConfig next_config = replaceAtlasConfigList.Dequeue();
                DoPackerCommond(next_config);
            }
            else
            {
                EditorUtility.DisplayProgressBar("批量处理中...", "Shell脚本执行完毕...开始打图集...", 0);
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
                BatchCreateUIAtlasPrefabs();
            }
        };
        request.onError += () =>
        {
            Debug.LogError("Texture Packer Error!!! Please Check Your Config");
        };
    }
예제 #2
0
    /// <summary>
    /// 打Unity格式图集
    /// </summary>
    private void UnitySpriteTexturePacker()
    {
        curTime = System.DateTime.Now;
        string cmd = TexturePackerCommond.GetPackCommond(arangeSpritesFolderPath, arrangeIconAtlasPngPath, arrangeIconAtlasTpsheetFilePath);

        ShellHelper.ShellRequest request = ShellHelper.ProcessCommand(cmd, null);
        EditorUtility.DisplayProgressBar("批量处理中...", "Shell脚本生成Json图集信息...", 0);
        request.onDone += () =>
        {
            {
                EditorUtility.DisplayProgressBar("批量处理中...", "Shell脚本执行完毕...开始打图集...", 0);
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
                CreateUIAtlas();
            }
        };
        request.onError += () =>
        {
            Debug.LogError("Texture Packer Error!!! Please Check Your Config");
            EditorUtility.ClearProgressBar();
        };
    }