public static void pkgResources()
        {
            ResExportSys.m_instance.m_targetPlatform = BuildTarget.StandaloneWindows;

            ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath = ExportUtil.getStreamingDataPath("");
            ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath = ExportUtil.normalPath(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath);
            ExportUtil.DeleteDirectory(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath);
            ExportUtil.CreateDirectory(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath);

            ResExportSys.m_instance.parseResourceXml();
            ResExportSys.m_instance.packResourceList();
        }
Exemple #2
0
        static public void RecurCreateDirectory(string pathAndName)
        {
            string normPath = ExportUtil.normalPath(pathAndName);

            string[] pathArr = normPath.Split(new [] { '/' });

            string curCreatePath = "";
            int    idx           = 0;

            for (; idx < pathArr.Length; ++idx)
            {
                if (curCreatePath.Length == 0)
                {
                    curCreatePath = pathArr[idx];
                }
                else
                {
                    curCreatePath = string.Format("{0}/{1}", curCreatePath, pathArr[idx]);
                }

                CreateDirectory(curCreatePath);
            }
        }
Exemple #3
0
        public void parseXml(XmlElement elem)
        {
            m_srcRoot  = ExportUtil.getXmlAttrStr(elem.Attributes["srcroot"]);
            m_destRoot = ExportUtil.getXmlAttrStr(elem.Attributes["destroot"]);
            char[] splitChar = new char[1] {
                ','
            };
            m_unity3dExtNameList = ExportUtil.getXmlAttrStr(elem.Attributes["unity3dextname"]).Split(splitChar).ToList <string>();
            m_ignoreExtList      = ExportUtil.getXmlAttrStr(elem.Attributes["ignoreext"]).Split(splitChar).ToList <string>();

            int idx = 0;

            if (m_unity3dExtNameList.IndexOf("null") != -1)         // 如果扩展名字有 null ,就说明包括没有扩展名字
            {
                for (idx = 0; idx < m_unity3dExtNameList.Count; ++idx)
                {
                    if (m_unity3dExtNameList[idx] == "null")
                    {
                        m_unity3dExtNameList[idx] = "";
                    }
                }
            }

            if (m_ignoreExtList.IndexOf("null") != -1)         // 如果扩展名字有 null ,就说明包括没有扩展名字
            {
                for (idx = 0; idx < m_ignoreExtList.Count; ++idx)
                {
                    if (m_ignoreExtList[idx] == "null")
                    {
                        m_ignoreExtList[idx] = "";
                    }
                }
            }

            m_srcFullPath = Path.Combine(System.Environment.CurrentDirectory, m_srcRoot);
            m_srcFullPath = ExportUtil.normalPath(m_srcFullPath);
        }
Exemple #4
0
        // 遍历一个文件的时候处理
        public void handleFile(string fullFileName)
        {
            fullFileName = ExportUtil.normalPath(fullFileName);
            if (m_ignoreExtList.IndexOf(ExportUtil.getFileExt(fullFileName)) == -1)
            {
                string fineNameNoExt = ExportUtil.getFileNameNoExt(fullFileName);
                string assetPath     = fullFileName.Substring(fullFileName.IndexOf(ExportUtil.ASSETS));
                string destPath      = "";

                if (m_unity3dExtNameList.IndexOf(ExportUtil.getFileExt(fullFileName)) != -1)
                {
                    if (fullFileName.LastIndexOf('/') != m_srcFullPath.Length)
                    {
                        destPath = fullFileName.Substring(m_srcFullPath.Length + 1, fullFileName.LastIndexOf('/') - (m_srcFullPath.Length + 1));
                    }
                    if (!string.IsNullOrEmpty(m_destRoot))
                    {
                        destPath = Path.Combine(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath, m_destRoot);
                        destPath = Path.Combine(destPath, destPath);
                    }
                    else
                    {
                        destPath = Path.Combine(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath, destPath);
                    }

                    AssetBundleParam bundleParam = new AssetBundleParam();
#if UNITY_5
                    bundleParam.m_buildList = new AssetBundleBuild[1];
                    bundleParam.m_buildList[0].assetBundleName    = fineNameNoExt;
                    bundleParam.m_buildList[0].assetBundleVariant = ExportUtil.UNITY3D;
                    bundleParam.m_buildList[0].assetNames         = new string[1];
                    bundleParam.m_buildList[0].assetNames[0]      = assetPath;
                    bundleParam.m_targetPlatform = ResExportSys.m_instance.m_targetPlatform;
                    bundleParam.m_pathName       = destPath;
#elif UNITY_4_6 || UNITY_4_5
                    bundleParam.m_assets = objList.ToArray();
                    pathList.Clear();
                    pathList.Add(m_skelMeshParam.m_outPath);
                    pathList.Add(skelNoExt + ".unity3d");
                    bundleParam.m_pathName = ExportUtil.getStreamingDataPath(ExportUtil.combine(pathList.ToArray()));
#endif
                    ExportUtil.BuildAssetBundle(bundleParam);
                    // 打包成 unity3d 后文件名字会变成小写,这里修改一下
                    ExportUtil.modifyFileName(destPath, fineNameNoExt);
                }
                else        // 直接拷贝过去
                {
                    if (fullFileName.LastIndexOf('/') != m_srcFullPath.Length)
                    {
                        destPath = fullFileName.Substring(m_srcFullPath.Length + 1, fullFileName.Length - (m_srcFullPath.Length + 1));
                    }
                    if (!string.IsNullOrEmpty(m_destRoot))
                    {
                        destPath = Path.Combine(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath, m_destRoot);
                        destPath = Path.Combine(destPath, destPath);
                    }
                    else
                    {
                        destPath = Path.Combine(ResExportSys.m_instance.m_pResourcesCfgPackData.m_destFullPath, destPath);
                        File.Copy(fullFileName, destPath);
                    }
                }

                addResListItem(fullFileName, destPath);
            }
        }