protected static void AddFrameworksToProject(string[] frameworks, string buildPath, PBXProject project, string target) { #if UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 string frameworksDir = Path.Combine(Directory.GetCurrentDirectory(), "Assets/" + fabricPluginsPath); string pluginFrameworksDir = "Frameworks/" + fabricPluginsPath + "/"; foreach (string framework in frameworks) { string pluginFrameworkDir = pluginFrameworksDir + framework; if (!Directory.Exists(Path.Combine(buildPath, pluginFrameworkDir))) { Utils.Log("Adding {0} to Xcode project", framework); AddFrameworkToProject(project, target, Path.Combine(frameworksDir, framework), buildPath, pluginFrameworkDir); } } #else foreach (string framework in FabricManager.Frameworks) { string srcPath = Path.Combine(FabricManager.SDKPath, framework); //Framework所在原路径(绝对路径) string dstPath = Path.Combine(BuildTools.GetXcodeFrameworkFullPath(buildPath), framework); //复制Framework的目标路径(绝对路径) BuildTools.CopyAndReplaceDirectory(srcPath, dstPath); string fullPath = Path.Combine(BuildTools.FrameworkXcodeRoot, framework); //添加到Xcode工程的文件路径(相对路径) project.AddFileToBuild(target, project.AddFile(fullPath, fullPath, PBXSourceTree.Source)); } #endif }
// /// <summary> /// 如果非realBuild,僅返回最終路徑 /// DoBuildAssetBundle和__DoBuildScriptableObject有两个开关,决定是否真的Build /// realBuildOrJustPath由外部传入,一般用于进行md5比较后,传入来的,【不收集Build缓存】 TODO:其实可以收集的。。 /// IsJustCollect用于全局的否决真Build,【收集Build缓存】 /// </summary> /// <param name="path"></param> /// <param name="asset"></param> /// <param name="realBuildOrJustPath"></param> /// <returns></returns> public static CDepCollectInfo DoBuildAssetBundle(string path, UnityEngine.Object asset, bool realBuildOrJustPath = true) { path = Path.ChangeExtension(path, AppEngine.GetConfig(KEngineDefaultConfigs.AssetBundleExt)); //asset.name = fullAssetPath; var hasBuilded = false; if (!BuildRecord.ContainsKey(path)) { if (realBuildOrJustPath) { AddCache(path); } if (IsJustCollect) { AddCache(path); } if (!IsJustCollect && realBuildOrJustPath) { //BuildedCache[fullAssetPath] = true; BuildTools.BuildAssetBundle(asset, path); hasBuilded = true; } } return(new CDepCollectInfo { Path = path, Asset = asset, HasBuild = hasBuilded, }); }
public void ExportCurrentUI() { //if (changeLayer) //{ // 去掉一些残留的Clone //var allTrans = GameObject.FindObjectsOfType<Transform>(); //for (var i = allTrans.Length - 1; i >= 0 ; i--) //{ // var child = allTrans[i]; // if (child != null && child.gameObject.name.EndsWith("Window(Clone)")) // { // GameObject.DestroyImmediate(child.gameObject); // } //} EditorApplication.SaveScene(); // 强制保存一下,保证一些Prefab更新 //} foreach (var windowAsset in GameObject.FindObjectsOfType <KUIWindowAsset>()) { var uiName = windowAsset.name; var tempPanelObject = CreateTempPrefab(windowAsset.gameObject); if (ExportCurrentUIEvent != null) { ExportCurrentUIEvent(this, UIScenePath, uiName, tempPanelObject); } else { BuildTools.BuildAssetBundle(tempPanelObject, GetBuildRelPath(uiName)); } DestroyTempPrefab(tempPanelObject); } }
public void GetToolsDirectory_40_ReturnsDirectory() { DirectoryInfo dir = BuildTools.GetBuildToolsDirectory(new Version("4.0")); Assert.That(dir.Name, Is.EqualTo("v4.0.30319")); Assert.That(File.Exists(QQnPath.Combine(dir.FullName, "msbuild.exe")), "MSBuild exists"); }
public void DrawAssetBundleUI() { GUILayout.BeginHorizontal("HelpBox"); EditorGUILayout.LabelField("== Assetbundle相关 =="); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("打包Assetbundle(增量)", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { BuildTools.BuildAllAssetBundles(); } if (GUILayout.Button("重新打包Assetbundle(先删除再重打)", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { BuildTools.ReBuildAllAssetBundles(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("为Prefab设置Assetbundle name(BoundleResources)", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { BuildTools.MakeAssetBundleNames(); } if (GUILayout.Button("清理冗余资源", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { BuildTools.CleanAssetBundlesRedundancies(); } GUILayout.EndHorizontal(); }
public void CheckFullSolutionVersion() { DirectoryInfo di = new DirectoryInfo(Environment.CurrentDirectory); while (di.Parent.FullName != di.Root.FullName) { bool breakOut = false; foreach (FileInfo f in di.GetFiles("TurtleBuild.sln", SearchOption.TopDirectoryOnly)) { Version slnVersion; Version vsVersion; Version minVsVersion; Assert.That(BuildTools.TryGetSolutionAndVisualStudioVersion(f.FullName, out slnVersion, out vsVersion, out minVsVersion)); Assert.That(slnVersion, Is.EqualTo(new Version(12, 0))); Assert.That(minVsVersion, Is.GreaterThanOrEqualTo(new Version(10, 0))); Assert.That(minVsVersion, Is.LessThan(new Version(11, 0))); Assert.That(vsVersion, Is.GreaterThanOrEqualTo(new Version(10, 0))); breakOut = true; break; } if (breakOut) { break; } di = di.Parent; } }
void OnGUI() { Profiler.BeginSample("BuildWindow.OnGUI"); // We keep levelinfos in a member variable. This forces a reference to the LevelInfos. Otherwise they will be nuked by OpenScene() if (m_LevelInfos == null) { m_LevelInfos = BuildTools.LoadLevelInfos(); } m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos); GUILayout.Label("Project", EditorStyles.boldLabel); GUILayout.TextArea(Application.dataPath.BeforeLast("Assets")); DrawLevelSelect(); GUILayout.Space(10.0f); DrawBuildTools(); GUILayout.Space(10.0f); DrawQuickStart(); GUILayout.EndScrollView(); Profiler.EndSample(); }
private static void AddKakaoFrameworks(string buildPath) { foreach (var framework in _SystemFrameworks) { KGIosSupport.AddFramework(framework); } string frameworkFullPath = BuildTools.GetXcodeFrameworkFullPath(buildPath); foreach (var folderPath in _FolderPaths) { string folderFullPath = Path.Combine(_FrameworkRoot, folderPath); if (Directory.Exists(folderFullPath)) { foreach (var fileFullPath in Directory.GetDirectories(folderFullPath)) { string fileName = Path.GetFileName(fileFullPath); if (fileName.EndsWith(".framework") || fileName.EndsWith(".bundle")) { string dstFullPath = Path.Combine(frameworkFullPath, fileName); FolderUtil.CopyAndReplace(fileFullPath, dstFullPath); string xcodePath = Path.Combine(BuildTools.FrameworkXcodeRoot, fileName); //添加到Xcode工程的文件路径(相对路径) KGIosSupport.AddFileToBuild(xcodePath, xcodePath); } } } } }
public static CDepCollectInfo __DoBuildScriptableObject(string fullAssetPath, ScriptableObject so, bool realBuildOrJustPath = true) { var hasBuilded = false; fullAssetPath = Path.ChangeExtension(fullAssetPath, AppEngine.GetConfig(KEngineDefaultConfigs.AssetBundleExt)); if (so == null) { Log.Error("Error Null ScriptableObject: {0}", fullAssetPath); } else { //so.name = fullAssetPath; if (!BuildRecord.ContainsKey(fullAssetPath)) { AddCache(fullAssetPath); if (!IsJustCollect && realBuildOrJustPath) { BuildTools.BuildScriptableObject(so, fullAssetPath); hasBuilded = true; } } } return(new CDepCollectInfo { Path = fullAssetPath, Asset = so, HasBuild = hasBuilded, }); }
static void ShowBuildTool() { //创建窗口 Rect rc = new Rect(0, 0, 500, 500); BuildTools window = (BuildTools)GetWindow(typeof(BuildTools), true, "Build Tool 5.x"); window.Show(); }
void DeleteProject() { BuildTools.DeleteProject(project); InitProjects(); add = false; project = null; selected = projects.Count - 1; }
public void TestVsWhereNotExist() { Actions.GetEnvironmentVariable["ProgramFiles(x86)"] = @"C:\Program Files (x86)"; Actions.FileExists[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"] = false; var candidates = BuildTools.GetCandidateVcVarsFiles(Actions).ToArray(); Assert.Equal(4, candidates.Length); }
public static void BuildAll() { ProjectConfig.IsEditor = true; ProjectConfig.DoInit(""); BuildTools.BuildAssetBundles(); BuildTools.PackData(); BuildTools.BuildPlayer(); Debug.Log("Done!"); }
public static LevelInfo GetLevelInfoFor(string scenePath) { foreach (var levelInfo in BuildTools.LoadLevelInfos()) { if (AssetDatabase.GetAssetPath(levelInfo.main_scene) == scenePath) { return(levelInfo); } } return(null); }
private void InitProjects() { projects = BuildTools.LoadProjectList(); if (projects == null) { return; } projects.Sort(delegate(ProjectBuildData x, ProjectBuildData y) { return(string.Compare(x.Name, y.Name)); }); }
void OnClick_OpenBuildFolder() { var lastBuildFile = BuildTools.GetLastBuildFile(); if (lastBuildFile != null) { EditorHelpers.OpenDirectoryWithExplorer(lastBuildFile.Directory.FullName); } else { EditorUtility.DisplayDialog("No Build Found", "No existing windows build artifact was found.", "Ok"); } }
public void TestVcVarsAllBatFiles() { Actions.GetEnvironmentVariable["ProgramFiles(x86)"] = @"C:\Program Files (x86)"; Actions.FileExists[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"] = false; Actions.FileExists[@"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"] = true; Actions.FileExists[@"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"] = false; Actions.FileExists[@"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"] = true; Actions.FileExists[@"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"] = false; var vcvarsfiles = BuildTools.VcVarsAllBatFiles(Actions).ToArray(); Assert.Equal(2, vcvarsfiles.Length); }
public async Task RunAsync(CancellationToken token) { await BuildTools.BuildSolution(Context, token); await TestTools.UnitTest(Context, token); var assemblyFile = Path.Combine(Context.ContentDirectory, "Jenkins.Net", "bin", "Release", "net45", "Jenkins.Net.dll"); var assemblyVersion = AssemblyTools.GetVersion(assemblyFile); var projectPackageVersion = $"{Context.BuildNumber}.{assemblyVersion}"; await CreateNugetPackage(token); await CreateProjectPackage(projectPackageVersion, token); }
public override void OnClick(InputState input) { //Attempt to remove wall at clicked position Ray?mouseRay = input.GetMouseRay(); if (mouseRay != null) { AbstractWorldObject selectedObject = VoxelRaycastUtility.GetNearestIntersectingWorldObject((Ray)mouseRay); if (selectedObject != null && selectedObject is Wall) { BuildTools.RemoveWall(selectedObject as Wall); } } }
private static void AddCapabilities(string buildPath) { string fullPath = Path.Combine(BuildTools.GetXcodeEntitlementsRoot(buildPath), _EntitlementsFileName); if (File.Exists(fullPath)) { File.Delete(fullPath); } //Create XmlDocument xmlDoc = new XmlDocument(); XmlDeclaration declaration = xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", "yes"); xmlDoc.AppendChild(declaration); XmlDocumentType docType = xmlDoc.CreateDocumentType("plist", @"-//Apple//DTD PLIST 1.0//EN", @"http://www.apple.com/DTDs/PropertyList-1.0.dtd", null); xmlDoc.AppendChild(docType); XmlElement plist = xmlDoc.CreateElement("plist"); plist.SetAttribute("version", "1.0"); xmlDoc.AppendChild(plist); XmlElement dict = xmlDoc.CreateElement("dict"); { //Set KeyChainShare XmlElement key = xmlDoc.CreateElement("key"); key.InnerText = "keychain-access-groups"; dict.AppendChild(key); XmlElement array = xmlDoc.CreateElement("array"); //App itself XmlElement group_1 = xmlDoc.CreateElement("string"); group_1.InnerText = _KeyChainSharePrefix + PlayerSettings.applicationIdentifier; array.AppendChild(group_1); //Kakao XmlElement group_2 = xmlDoc.CreateElement("string"); group_2.InnerText = _KeyChainSharePrefix + "KakaoGameAccessGroup"; array.AppendChild(group_2); dict.AppendChild(array); } plist.AppendChild(dict); xmlDoc.Save(fullPath); KGIosSupport.AddBuildProperty("CODE_SIGN_ENTITLEMENTS", fullPath); }
public void TestVsWhereSucceeded() { Actions.GetEnvironmentVariable["ProgramFiles(x86)"] = @"C:\Program Files (x86)"; Actions.FileExists[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"] = true; Actions.RunProcess[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -prerelease -legacy -property installationPath"] = 0; Actions.RunProcessOut[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -prerelease -legacy -property installationPath"] = "C:\\VS1\nC:\\VS2"; Actions.RunProcessOut[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -prerelease -legacy -property installationVersion"] = "10.0\n11.0"; Actions.RunProcess[@"C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe -prerelease -legacy -property installationVersion"] = 0; var candidates = BuildTools.GetCandidateVcVarsFiles(Actions).ToArray(); Assert.Equal("C:\\VS1\\VC\\vcvarsall.bat", candidates[0].Path); Assert.Equal(10, candidates[0].ToolsVersion); Assert.Equal("C:\\VS2\\VC\\vcvarsall.bat", candidates[1].Path); Assert.Equal(11, candidates[1].ToolsVersion); }
// Token: 0x06000028 RID: 40 RVA: 0x000039FC File Offset: 0x00001BFC public static bool BuildPlayer() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); string targetPlayerOutputPath = BuildTools.GetTargetPlayerOutputPath(EditorUserBuildSettings.activeBuildTarget); string directoryName = Path.GetDirectoryName(targetPlayerOutputPath); bool flag = !Directory.Exists(directoryName); if (flag) { Directory.CreateDirectory(directoryName); } BuildOptions buildOptions = BuildOptions.ShowBuiltPlayer; bool development = EditorUserBuildSettings.development; if (development) { buildOptions |= BuildOptions.Development; } bool connectProfiler = EditorUserBuildSettings.connectProfiler; if (connectProfiler) { buildOptions |= BuildOptions.ConnectWithProfiler; } bool allowDebugging = EditorUserBuildSettings.allowDebugging; if (allowDebugging) { buildOptions |= BuildOptions.AllowDebugging; } BuildReport buildReport = BuildPipeline.BuildPlayer(EditorBuildSettingsScene.GetActiveSceneList(EditorBuildSettings.scenes), targetPlayerOutputPath, EditorUserBuildSettings.activeBuildTarget, buildOptions); bool flag2 = buildReport.summary.totalErrors > 0; if (flag2) { Debug.LogError("Error MSG : " + buildReport.summary.ToString()); } stopwatch.Stop(); Debug.LogWarningFormat("BuildPlayer {0}, Cost Time:{1}", new object[] { EditorUserBuildSettings.activeBuildTarget, stopwatch.Elapsed.ToString() }); return(true); }
public void DrawAssetBundleUI() { GUILayout.BeginHorizontal("HelpBox"); EditorGUILayout.LabelField("== Assetbundle相关 =="); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("打包AB", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { BuildTools.BuildAllAssetBundles(); } if (GUILayout.Button("删除全部AB并重新打包", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { BuildTools.ReBuildAllAssetBundles(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("设置AB Name", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { BuildTools.MakeAssetBundleNames(); } if (GUILayout.Button("清空全部AB Name", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { BuildTools.ClearAssetBundleNames(); } if (GUILayout.Button("打开AB目录", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(20))) { var path = AppConfig.ProductRelPath + "/Bundles/" + KResourceModule.GetBuildPlatformName(); OpenFolder(path, true); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("清理冗余资源", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { BuildTools.CleanAssetBundlesRedundancies(); } GUILayout.EndHorizontal(); }
public void CheckSolutionVersions() { DirectoryInfo di = new DirectoryInfo(Environment.CurrentDirectory); while (di.Parent.FullName != di.Root.FullName) { bool breakOut = false; foreach (FileInfo f in di.GetFiles("*.sln", SearchOption.TopDirectoryOnly)) { Version v = BuildTools.GetSolutionVersion(f.FullName); Assert.That(v, Is.Not.Null); Version expectedVersion; if (f.Name.Contains("2005")) { expectedVersion = new Version(9, 0); } else if (f.Name.Contains("2008")) { expectedVersion = new Version(10, 0); } else { // VS 2012 / Portable format expectedVersion = new Version(12, 0); } Assert.That(v, Is.EqualTo(expectedVersion)); breakOut = true; } if (breakOut) { break; } di = di.Parent; } }
public static void FixMaterials() { Undo.RegisterSceneUndo("rtools"); RenderSettings.fog = true; RenderSettings.fogDensity = 0.0002f; RenderSettings.skybox = bs.resEditor.skyboxes[Random.Range(0, bs.resEditor.skyboxes.Length)]; foreach (Renderer r in FindObjectsOfType(typeof(Renderer))) { if (r.sharedMaterial != null && r.name.StartsWith("DrawCall")) { foreach (string b in res.levelMaterialsTxt) { var isLevel = b == r.sharedMaterial.name; r.gameObject.layer = isLevel ? Layer.level : Layer.cull; if (isLevel) { break; } } } } BuildTools.FixMaterials(); }
public override void OnClick(InputState input) { //Attempt to add block at clicked position Ray?mouseRay = input.GetMouseRay(); if (mouseRay != null) { AbstractWorldObject selectedObject = VoxelRaycastUtility.GetNearestIntersectingWorldObject((Ray)mouseRay); if (selectedObject != null) { //Need a way to determine what type of block to create based on BlockType bool blockAdded = BuildTools.AddBlock((Ray)mouseRay, selectedObject as AbstractBlock); if (blockAdded) { RemoveQuantity(1); } } } //If successful, decrement _quantity and _numUses }
void SaveProject() { if (BuildTools.SaveProject(add, project)) { InitProjects(); if (add) { add = false; for (int i = 0; i < projects.Count; i++) { if (string.Compare(projects[i].Name, project.Name) == 0) { selected = i; break; } } } } else { EditorUtility.DisplayDialog("error", "failed", "ok"); } }
void DrawBuildTools() { var action = BuildAction.None; if (GUILayout.Button("Update Registry")) { Debug.Log("Updating registries..."); BundledResourceBuilder.UpdateRegistries(false); Debug.Log("Updating registries done"); } GUILayout.Label("Bundles (" + PrettyPrintTimeStamp(TimeLastBuildBundles()) + ")", EditorStyles.boldLabel); var buildBundledLevels = false; var buildBundledAssets = false; var forceBuildBundles = false; List <LevelInfo> buildOnlyLevels = null; s_SingleLevelBuilding = EditorGUILayout.Toggle("Single level building", s_SingleLevelBuilding); if (s_SingleLevelBuilding) { GUILayout.BeginVertical(); foreach (var l in m_LevelInfos) { if (GUILayout.Button("Build only: " + l.name + " [force]")) { buildBundledLevels = true; forceBuildBundles = true; buildOnlyLevels = new List <LevelInfo>(); buildOnlyLevels.Add(l); break; } } GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal(); if (GUILayout.Button("Levels [force]")) { buildBundledLevels = true; forceBuildBundles = true; } if (GUILayout.Button("Assets [force]")) { buildBundledAssets = true; forceBuildBundles = true; } if (GUILayout.Button("All [force]")) { buildBundledLevels = true; buildBundledAssets = true; forceBuildBundles = true; } GUILayout.EndHorizontal(); var buildTarget = EditorUserBuildSettings.activeBuildTarget; // BuildTarget.StandaloneWindows64 if (buildBundledLevels || buildBundledAssets) { BuildTools.BuildBundles(GetBundlePath(buildTarget), buildTarget, buildBundledAssets, buildBundledLevels, forceBuildBundles, buildOnlyLevels); if (buildTarget == BuildTarget.PS4) { // Copy the asset bundles into the PS4 game folder too var bundlePathSrc = GetBundlePath(buildTarget) + "/" + SimpleBundleManager.assetBundleFolder; var bundlePathDst = GetBuildPath(buildTarget) + "/" + GetBuildExeName(buildTarget) + "/Media/StreamingAssets/" + SimpleBundleManager.assetBundleFolder; BuildTools.CopyDirectory(bundlePathSrc, bundlePathDst); } GUIUtility.ExitGUI(); } GUILayout.Space(10.0f); GUILayout.Label("Game (" + PrettyPrintTimeStamp(TimeLastBuildGame()) + ")", EditorStyles.boldLabel); GUILayout.Space(1.0f); GUILayout.Label("Building for: " + buildTarget.ToString() + " use normal build window to change.", GUILayout.ExpandWidth(false)); GUILayout.BeginHorizontal(); m_BuildDevelopment = EditorGUILayout.Toggle("Development build", m_BuildDevelopment); GUI.enabled = m_BuildDevelopment; m_ConnectProfiler = EditorGUILayout.Toggle("Connect profiler", m_ConnectProfiler); GUI.enabled = true; GUILayout.EndHorizontal(); m_IL2CPP = EditorGUILayout.Toggle("IL2CPP", m_IL2CPP); m_AllowDebugging = EditorGUILayout.Toggle("Allow debugging", m_AllowDebugging); var m_RunArguments = EditorPrefTextField("Arguments", "RunArguments"); GUILayout.BeginHorizontal(); var buildGame = false; var buildOnlyScripts = false; if (GUILayout.Button("Build game")) { buildGame = true; } if (GUILayout.Button("Build ONLY scripts")) { buildOnlyScripts = true; } if (buildGame || buildOnlyScripts) { StopAll(); var buildOptions = m_AllowDebugging ? BuildOptions.AllowDebugging : BuildOptions.None; if (buildOnlyScripts) { buildOptions |= BuildOptions.BuildScriptsOnly; } if (m_BuildDevelopment) { buildOptions |= BuildOptions.Development; if (m_ConnectProfiler) { buildOptions |= BuildOptions.ConnectWithProfiler; } } BuildTools.BuildGame(GetBuildPath(buildTarget), GetBuildExeName(buildTarget), buildTarget, buildOptions, "AutoBuild", m_IL2CPP); if (action == BuildAction.BuildAndRun) { RunBuild(""); } GUIUtility.ExitGUI(); // prevent warnings from gui about unmatched layouts } if (GUILayout.Button("Run")) { RunBuild(m_RunArguments); GUIUtility.ExitGUI(); // prevent warnings from gui about unmatched layouts } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); var path = Application.dataPath.BeforeLast("Assets") + GetBuildPath(buildTarget); var windowsPath = path.Replace("/", "\\"); if (GUILayout.Button("Open build folder")) { if (Directory.Exists(windowsPath)) { var p = new System.Diagnostics.Process(); p.StartInfo = new System.Diagnostics.ProcessStartInfo("explorer.exe", windowsPath); p.Start(); } else { EditorUtility.DisplayDialog("Folder missing", string.Format("Folder {0} doesn't exist yet", windowsPath), "Ok"); } } GUILayout.EndHorizontal(); }
private void PopulateRootDirChildren() { string build = Path.Combine(RootDirectory, BuildToolsPath); if (Directory.Exists(build)) { BuildToolsDirectory = build; foreach(string directory in Directory.GetDirectories(build)) { DirectoryInfo dir = new DirectoryInfo(directory); if (Regex.IsMatch(dir.Name, @"\d+\.\d+\.\d+")) { BuildToolsList.Add(new BuildTools(dir)); } } DexDumpExecLocation = BuildToolsList.Max().DexDumpExecLocation; } BuildToolsList.Sort(); SelectedBuildTools = BuildToolsList[BuildToolsList.Count - 1]; string platform = Path.Combine(RootDirectory, PlatformToolsPath); if (Directory.Exists(platform)) { PlatformToolsDirectory = platform; } platform = Path.Combine(RootDirectory, PlatformsPath); if (Directory.Exists(platform)) { PlatformsDirectory = platform; } if (NUtilityGlobalContext.OSType == (int)(NUtilityGlobalContext.OS.Windows)) { AdbExecLocation = Path.Combine(PlatformToolsDirectory, "adb.exe"); } else { AdbExecLocation = Path.Combine(PlatformToolsDirectory, "adb"); } }
// 包含json!,不包含圖集 static CDepCollectInfo GetBuildSpineData(SkeletonDataAsset data) { string path = AssetDatabase.GetAssetPath(data); // DataAsset bool needBuildDataAsset = BuildTools.CheckNeedBuild(path); if (needBuildDataAsset) { BuildTools.MarkBuildVersion(path); } // Spine的JSON string textAssetPath = AssetDatabase.GetAssetPath(data.skeletonJSON); bool needBuildJsonTextAsset = BuildTools.CheckNeedBuild(textAssetPath); if (needBuildJsonTextAsset) { BuildTools.MarkBuildVersion(textAssetPath); } //string originPath = path; //string tmpPath = "Assets/~TempSkeletonDataAsset.asset"; //bool copyResult = AssetDatabase.CopyAsset(path, tmpPath); //Log.Assert(copyResult); //SkeletonDataAsset copyData = AssetDatabase.LoadAssetAtPath(tmpPath, typeof(SkeletonDataAsset)) as SkeletonDataAsset; if (data.spriteCollection == null || data.skeletonJSON == null) { Log.Error("Err Spine Data: {0}, Lack of SpriteCollection or Json", data.name); //return ""; } string spriteColPath = BuildSpriteCollection(data.spriteCollection); string spriteColAssetPath = AssetDatabase.GetAssetPath(data.spriteCollection.gameObject); bool needBuildSpriteCol = BuildTools.CheckNeedBuild(spriteColAssetPath); if (needBuildSpriteCol) { BuildTools.MarkBuildVersion(spriteColAssetPath); } SkeletonDataAsset copyData = GameObject.Instantiate(data) as SkeletonDataAsset; copyData.spriteCollection = null; // 挖空图集, 保留Json! // SpineData包括了这个SkeletonData! var skeletonDataBuildResult = __DoBuildScriptableObject(DepBuildToFolder + "/SkeletonData_" + data.name, copyData, needBuildDataAsset || needBuildJsonTextAsset); // json文件直接放在SkeletonDataAsset打包! 分离图集 CSpineData spineData = ScriptableObject.CreateInstance <CSpineData>(); spineData.SpriteCollectionPath = spriteColPath; spineData.DataAssetPath = skeletonDataBuildResult.Path; // 保留json文件,不挖空 copyData.skeletonJSON path = __GetPrefabBuildPath(path); // DataAsset或圖集或Json任一重打包了,都要重新打包CSpineData(記錄圖集保存地方和Jsondataasset保存地方) var spineDataBuildResult = __DoBuildScriptableObject(DepBuildToFolder + "/SpineData_" + path, spineData, needBuildDataAsset || needBuildSpriteCol || needBuildJsonTextAsset); spineDataBuildResult.Child = skeletonDataBuildResult; GameObject.DestroyImmediate(copyData); return(spineDataBuildResult); }
// Prefab build, 单次build缓存 public static string BuildSpriteCollection(tk2dSpriteCollectionData data) { if (data == null) { Log.Error("[BuildSpriteColleccion]Null SpriteCol Data!!!"); return(""); } GameObject spriteColPrefab = PrefabUtility.FindPrefabRoot(data.gameObject) as GameObject; Log.Assert(spriteColPrefab); string path = AssetDatabase.GetAssetPath(spriteColPrefab); // prefab只用来获取路径,不打包不挖空 if (string.IsNullOrEmpty(path)) { Log.Info("Null Sprite Collection {0}", path); return(""); // !!! SpriteCollection可能动态生成的,不打包它 } bool needBuild = BuildTools.CheckNeedBuild(path); if (needBuild) { BuildTools.MarkBuildVersion(path); } path = __GetPrefabBuildPath(path); GameObject copySpriteColObj = GameObject.Instantiate(spriteColPrefab) as GameObject; tk2dSpriteCollectionData spriteColData = copySpriteColObj.GetComponent <tk2dSpriteCollectionData>(); foreach (Material mat in spriteColData.materials) // many materials { string matPath = BuildDepMaterial(mat, GameDef.PictureScale); if (!string.IsNullOrEmpty(matPath)) // 材质可能动态创建的,无需打包 //CResourceDependencies.Create(spriteColData, CResourceDependencyType.SPRITE_COLLECTION, matPath); { KAssetDep.Create <CTk2dSpriteCollectionDep>(spriteColData, matPath); } } spriteColData.materials = new Material[0]; // 挖空spriteCollections spriteColData.textures = new Texture[0]; foreach (var def in spriteColData.spriteDefinitions) { def.material = null; // 进行缩放! //if (def.positions != null) //{ // // position! size! // for (var ip = 0; ip < def.positions.Length; ip++) // { // def.positions[ip] = def.positions[ip] / GameDef.PictureScale; // } // for (var ip = 0; ip < def.untrimmedBoundsData.Length; ip++) // { // def.untrimmedBoundsData[ip] = def.untrimmedBoundsData[ip] / GameDef.PictureScale; // } // for (var ip = 0; ip < def.boundsData.Length; ip++) // { // def.boundsData[ip] = def.boundsData[ip] / GameDef.PictureScale; // } //} } var result = DoBuildAssetBundle(DepBuildToFolder + "/Col_" + path, copySpriteColObj, needBuild); // Build主对象, 被挖空Material了的 GameObject.DestroyImmediate(copySpriteColObj); return(result.Path); }