コード例 #1
0
ファイル: StartApp.cs プロジェクト: Tend-R/LIangRepository
        /// <summary>
        /// 读取json配置 存储到系统常量类
        /// </summary>
        private void InitReadJson()
        {
            SystemDefine.jsonDic = new Dictionary <string, string>();
            IConfigManger jsonConfig = new JsonConfigManger(SystemDefine.jsonName);

            if (jsonConfig != null)
            {
                SystemDefine.jsonDic = jsonConfig.AppJsonSetting;
            }
        }
コード例 #2
0
        public static void SetABLabels()
        {
            keyValueList = new KeyValueInfo();
            keyValueList.KeyValueList = new List <KeyValueNode>();
            keyValueList.KeyValueList.Clear();
            //需要给AB做标记的根目录
            string strNeedSetABLableRootDIR = "";

            //目录信息
            DirectoryInfo[] dirScenesDIRArray = null;

            //清空无用AB标记
            AssetDatabase.RemoveUnusedAssetBundleNames();
            //定位需要打包资源的文件夹根目录。
            strNeedSetABLableRootDIR = PathManger.GetABResoursesPath();
            DirectoryInfo dirTempInfo = new DirectoryInfo(strNeedSetABLableRootDIR);

            dirScenesDIRArray = dirTempInfo.GetDirectories();
            //遍历每个“场景”文件夹(目录)
            foreach (DirectoryInfo currentDIR in dirScenesDIRArray)
            {
                //遍历本场景目录下的所有的目录或者文件,
                //如果是目录,则继续递归访问里面的文件,直到定位到文件。
                string        tmpScenesDIR     = strNeedSetABLableRootDIR + "/" + currentDIR.Name; //res/**
                DirectoryInfo tmpScenesDIRInfo = new DirectoryInfo(tmpScenesDIR);                  //场景目录信息res/**/**
                int           tmpIndex         = tmpScenesDIR.LastIndexOf("/");
                string        tmpScenesName    = tmpScenesDIR.Substring(tmpIndex + 1);             //场景名称
                //递归调用与处理目录或文件系统,如果找到文件,修改AssetBundle 的标签(label)
                JudgeDIROrFileByRecursive(currentDIR, tmpScenesName);
            }//foreach_end
            //将生成的bundle名与资源名添加到json文件
            JsonConfigManger.DataToJson(PathManger.jsonInfoPath, keyValueList);
            Debug.Log("Json数据配置完成!");
            //刷新
            AssetDatabase.Refresh();
            //提示
            Debug.Log("AssetBundles 标签设置完成!");
        }