/// <summary> /// 判断Resource下面某个资源存在与否 /// </summary> /// <param name="resourceKey">相对Resource的路径</param> /// <returns></returns> public bool CheckResourceExist(string resourceKey) { #if UNITY_EDITOR && !USE_PACK_RES string resourceFullPath = string.Format("{0}/Resources/{1}{2}", Application.dataPath, resourceKey, ".prefab"); return(FileUtil.IsFileExist(resourceFullPath)); #else if (_packConfig == null) { return(false); } return(_packConfig.GetPackInfoForResource(resourceKey) != null); #endif }
//构建Win64平台EXE 程序 public static void BuildWin64Exe() { GenerateLuaWrap(); AssetDatabase.Refresh(); #if USE_PACK_RES FullResBuilder.DeleteRedundantFiles(BuildTarget.StandaloneWindows); #endif string version = System.Text.Encoding.UTF8.GetString(FileUtil.ReadFile(Application.dataPath + "/Resources/Version.bytes")); if (string.IsNullOrEmpty(version)) { version = "000"; } // version = version.Replace("\n", "").Replace(" ", "").Replace("\t", "").Replace("\r", ""); string exeFolderName = string.Empty; // #if JW_DEBUG exeFolderName = "Debug_Arcade_" + version; #else exeFolderName = "Release_Arcade_" + version; #endif string outDir = Application.dataPath + "/../../Builds/BuildWin/" + exeFolderName; string outPath = outDir + "/ToyRealMachine.exe"; // PlayerSettings.companyName = "BCZX"; PlayerSettings.productName = "RealMachine"; PlayerSettings.defaultIsFullScreen = true; PlayerSettings.displayResolutionDialog = ResolutionDialogSetting.Disabled; PlayerSettings.resizableWindow = false; PlayerSettings.forceSingleInstance = true; PlayerSettings.allowFullscreenSwitch = false; PlayerSettings.applicationIdentifier = "com.bczx.arcade"; PlayerSettings.d3d11FullscreenMode = D3D11FullscreenMode.FullscreenWindow; PlayerSettings.visibleInBackground = false; PlayerSettings.defaultIsNativeResolution = true; PlayerSettings.runInBackground = false; PlayerSettings.SplashScreen.show = false; PlayerSettings.forceSingleInstance = true; string path = System.IO.Path.GetFullPath(outPath); #if JW_DEBUG BuildOptions option = BuildOptions.AllowDebugging | BuildOptions.Development; #else BuildOptions option = BuildOptions.None; #endif string error = BuildPipeline.BuildPlayer(EditorBuildSettings.scenes, path, BuildTarget.StandaloneWindows64, option); if (error != null) { Debug.Log("BuildWinExe Error:" + error.ToString()); #if !UNITY_EDITOR EditorApplication.Exit(2); #endif } // if (FileUtil.IsFileExist(outPath)) { Debug.Log("BuildWinExe Zip:"); //合并成Zip string outZipPath = Application.dataPath + "/../../Builds/BuildWin/" + exeFolderName + ".zip"; // ZipHelper.CreateZip(outZipPath, outDir); // FileUtil.CopyFile(Application.dataPath + "/Resources/Version.bytes", Application.dataPath + "/../../Builds/BuildWin/Version.bytes"); } #if !UNITY_EDITOR EditorApplication.Exit(0); #endif }
/// <summary> /// 文件是否存在于StreamingAssets目录下 /// </summary> /// <param name="fileName"></param> /// <returns></returns> public static bool IsFileExistInStreamingAssets(string fileName) { return(FileUtil.IsFileExist(FileUtil.CombinePath(Application.streamingAssetsPath, fileName))); }