Esempio n. 1
0
    private static void InitConfig()
    {
        m_configFileList.Clear();
        //m_configTabFileList.Clear();
        m_totalFileCount = 0;
        m_curIndex       = 0;

        string TargetPath = AssetBundleCtrl_Windows.GetPlatformPath(AssetBundleCtrl_Windows.buildTarget);

        m_targetPackagePath = PathUtility.CombinePath(Application.dataPath, TargetPath.Substring(7));
        PathUtility.CreateDirInPath(m_targetPackagePath);
    }
Esempio n. 2
0
    //列出在AllResources目录下所有Resources目录
    public static List <string> ListResourcesDirInAllResources()
    {
        string        rootPath = PathUtility.CombinePath(Application.dataPath, AssetBundleCtrl_Windows.g_rootResourceDir);
        List <string> pathList = new List <string>();

        if (!string.IsNullOrEmpty(rootPath))
        {
            Directory.CreateDirectory(rootPath);
        }

        PathUtility.GetAllDirInDir(rootPath, "Resources", pathList);

        return(pathList);
    }
Esempio n. 3
0
    public static void CreateConfig(List <string> pathList)
    {
        m_configFileCount = 0;
        string configFileDir = Application.dataPath + "/" + sPackConfigFileDir;

        if (!Directory.Exists(configFileDir))
        {
            Directory.CreateDirectory(configFileDir);
        }

        for (int i = 0; i < pathList.Count; i++)
        {
            string        onePath  = PathUtility.CombinePath(pathList[i], "Resources");
            DirectoryInfo info     = new DirectoryInfo(onePath);
            int           count    = 1;
            string        finalStr = "id\tFilePath\r\n";
            //扫描所有文件
            var allFiles = info.GetFiles("*.*", SearchOption.AllDirectories);
            foreach (var fi in allFiles)
            {
                if (Path.GetExtension(fi.Name.ToLower()) == ".meta")
                {
                    continue;
                }

                string ResourcePath = fi.FullName.Substring(fi.FullName.IndexOf("ArtRes"));
                string temp         = ResConfigFile.ContentHelpWrite(count++, ResourcePath);
                finalStr += temp;
            }


            string configFileName = info.Parent.Name + m_configFileCount.ToString() + ".bytes";
            ResConfigFile.GenFile(configFileDir + "/" + configFileName, finalStr);
            m_configFileList.Add(configFileName);
            m_configFileCount++;
        }

        GenSceneConfig();

        AssetDatabase.Refresh();
    }
Esempio n. 4
0
    private static void CalcNeedPackageFileCount()
    {
        for (int i = 0; i < m_configFileList.Count; i++)
        {
            string strPath = m_configFileList[i];
            string fileDir = PathUtility.CombinePath("Assets", sPackConfigFileDir);
            fileDir = PathUtility.CombinePath(fileDir, strPath);
            TextAsset textAsset = AssetDatabase.LoadMainAssetAtPath(fileDir) as TextAsset;
            if (textAsset == null)
            {
                UnityEngine.Debug.Log(string.Format("not find {0}", strPath));
                return;
            }

            //string AssetType = Path.GetFileNameWithoutExtension (strPath);
            fileDir = PathUtility.CombinePath(sPackConfigFileDir, strPath);
            string       FileFullName = PathUtility.CombinePath(Application.dataPath, fileDir);
            StreamReader sr           = new StreamReader(FileFullName);
            string       totalStr     = sr.ReadToEnd();
            if (string.IsNullOrEmpty(totalStr))
            {
                return;
            }

            TabFile tf = new TabFile(FileFullName, totalStr);

            if (m_configTabFileList.ContainsKey(strPath))
            {
                UnityEngine.Debug.Log("Find Same Config File " + strPath);
                continue;
            }
            m_configTabFileList.Add(strPath, tf);

            m_totalFileCount += tf.GetCount();
        }
    }