Exemple #1
0
    private static void SetABName(List <string> files, bool setName = true)
    {
        GLog.Log("BuildAssets Count " + files.Count, true);
        for (int i = 0; i < files.Count; i++)
        {
            string        filePath  = files[i];
            string        assetPath = filePath.Substring(Application.dataPath.Length - "assets".Length);
            AssetImporter ai        = AssetImporter.GetAtPath(assetPath);
            GemaEditor.ShowProgress(i, files.Count, "SetAssetLabels", ai.assetPath);

            string abName = AanalyzeAssetLabels(assetPath);

            GLog.Log(string.Format("No.{0} abName:{1} assetPath:{2}", i + 1, abName, assetPath), true);
            if (setName)
            {
                ai.assetBundleName    = abName;
                ai.assetBundleVariant = "ab";
            }
            else
            {
                ai.assetBundleName = null;
                //ai.assetBundleVariant = null;
            }

            string fileName = Path.GetFileName(ai.assetPath);
            fileName = fileName.Split('.')[0];
            string importerName = ai.GetType().ToString().Split('.')[1];
            string typename     = importerName.Substring(0, importerName.Length - 8);

            List <string> listAsset;
            if (!typeAssets.TryGetValue(typename, out listAsset))
            {
                listAsset = new List <string>();
                typeAssets.Add(typename, listAsset);
            }

            if (listAsset.IndexOf(fileName) != -1)
            {
                GLog.Error("Repeat name " + fileName + " type " + typename, true);
                return;
            }
            listAsset.Add(fileName);


            ABConfigInfo abConfigInfo = abConfig.GetInfoByAB(abName);
            if (abConfigInfo == null)
            {
                abConfigInfo = new ABConfigInfo();
                abConfig.AddInfo(abConfigInfo);
                resourceCount++;
                abConfigInfo.id   = resourceCount;
                abConfigInfo.ab   = abName;
                abConfigInfo.type = typename;
            }
            abConfigInfo.names.Add(fileName);
        }
        EditorUtility.ClearProgressBar();
    }
Exemple #2
0
    static void _ResetAllTexture()
    {
        int count = 0;

        string[] all = AssetDatabase.FindAssets("t:texture2d", new string[1] {
            "Assets/BuildAssets/UISprite"
        });
        foreach (string t in all)
        {
            GemaEditor.ShowProgress(++count, all.Length);
            string  s       = AssetDatabase.GUIDToAssetPath(t);
            Texture texture = AssetDatabase.LoadAssetAtPath <Texture>(s);
            ResetTexture(texture);
        }
        EditorUtility.ClearProgressBar();
    }