// ***********************************************************************
// Assembly : Unity
// Author : HJ
// Created : 2019-07-25
// Description :
// Last Modified By :
// Last Modified On :
// ***********************************************************************
//
//
// ***********************************************************************
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
using System.IO;
using System.Text.RegularExpressions;
using UnityEditor.U2D;
using UnityEngine.U2D;
public class AutoCreateAtlas : Editor
{
private const string ATLAS_PATH = "Assets/Ryff/Arts/Textures/Atlas";
private const string TEXTURE_PATH = "Assets/Ryff/Arts/Textures/UI";
[MenuItem("Game/图集处理")]
public static void CreateAtlas()
{
var rootDirInfo = new DirectoryInfo(TEXTURE_PATH);
var spts = new List();
foreach (DirectoryInfo dirInfo in rootDirInfo.GetDirectories())
{
//spts.Clear();
//foreach (FileInfo pngFile in dirInfo.GetFiles("*.png", SearchOption.AllDirectories))
//{
// string allPath = pngFile.FullName;
// string assetPath = allPath.Substring(allPath.IndexOf("Assets"));
// Sprite sprite = AssetDatabase.LoadAssetAtPath(assetPath);
// if (IsPackable(sprite) && !ContainChinese(sprite.name))
// spts.Add(sprite);
//}
string atlasName = dirInfo.Name + ".spriteatlas";
var atlasPath = CreateAtlas(string.Format("{0}/{1}", ATLAS_PATH, atlasName));
var sptAtlas = AssetDatabase.LoadAssetAtPath(atlasPath);
Debug.Log(sptAtlas.tag);
var obj = AssetDatabase.LoadAssetAtPath