コード例 #1
0
 static void GetSceneAssets()
 {
     assetScenes.Clear();
     GetAssetsRecursively("Assets/Environment/Scenes/", "*.unity", "scene/", "s", ref assetScenes);
     for (int i = 0; i < excludeScenes.Count; i++)
     {
         string path = EUtil.StandardlizePath("Assets/Environment/Scenes/" + excludeScenes[i] + ".unity");
         if (assetScenes.ContainsKey(path))
         {
             assetScenes.Remove(path);
         }
     }
 }
コード例 #2
0
ファイル: ExportResource.Base.cs プロジェクト: atom-chen/luxa
    /// <summary>
    /// 获取目录下指定格式资源,包含子目录
    /// </summary>
    /// <param name="srcFolder"></param>
    /// <param name="searchPattern"></param>
    /// <param name="dstFolder"></param>
    /// <param name="prefix"></param>
    /// <param name="assets"></param>
    static void GetAssetsRecursively(string srcFolder, string searchPattern, string dstFolder, string prefix, ref Dictionary <string, string> assets)
    {
        string searchFolder = EUtil.StandardlizePath(srcFolder);

        if (!Directory.Exists(searchFolder))
        {
            return;
        }

        string suffix = "bundle";
        string srcDir = searchFolder;

        string[] files = Directory.GetFiles(srcDir, searchPattern);
        foreach (string oneFile in files)
        {
            string srcFile = EUtil.StandardlizePath(oneFile);
            if (!File.Exists(srcFile))
            {
                continue;
            }

            string dstFile;
            if (string.IsNullOrEmpty(prefix))
            {
                dstFile = Path.Combine(dstFolder, string.Format("{0}.{1}", Path.GetFileNameWithoutExtension(srcFile), suffix));
            }
            else
            {
                dstFile = Path.Combine(dstFolder, string.Format("{0}_{1}.{2}", prefix, Path.GetFileNameWithoutExtension(srcFile), suffix));
            }
            dstFile         = EUtil.StandardlizePath(dstFile);
            assets[srcFile] = dstFile;
            UnityEngine.Debug.Log("srcFile: " + srcFile + " => dstFile: " + dstFile);
        }

        string[] dirs = Directory.GetDirectories(searchFolder);
        foreach (string oneDir in dirs)
        {
            GetAssetsRecursively(oneDir, searchPattern, dstFolder, prefix, ref assets);
        }
    }
コード例 #3
0
ファイル: ExportResource.Base.cs プロジェクト: atom-chen/luxa
 /// <summary>
 /// 标准化路径,'\'转化'/'
 /// </summary>
 /// <param name="obj">资源对象</param>
 /// <returns></returns>
 static string StandardlizePath(UnityEngine.Object obj)
 {
     return(EUtil.StandardlizePath(AssetDatabase.GetAssetPath(obj)));
 }