private void WriteBundlesDatabase() { Console.WriteLine("Writing asset bundles database..."); _bundlesDatabaseBuilder.BuildAssetBundle(Path.Combine(_bundlesPath, "index"), _params.Target); string infoPath = Path.Combine(_params.BundlesLocation, _bundlesDatabaseBuilder.Database.Id + ".txt"); using (StreamWriter writer = File.CreateText(infoPath)) { writer.WriteLine("[" + PlayerSettings.companyName + " - " + PlayerSettings.productName + "]"); writer.WriteLine("Id: " + _bundlesDatabaseBuilder.Database.Id); writer.WriteLine("Version: " + CachingUtils.GetVersionFromId(_bundlesDatabaseBuilder.Database.Id)); writer.WriteLine("Hash: " + BuildUtils.ToHexString(_bundlesDatabaseBuilder.Database.Hash)); writer.WriteLine("Size: " + _bundlesDatabaseBuilder.Database.Size); writer.WriteLine("Created: " + DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss (K)")); writer.WriteLine("App Version: " + PlayerSettings.bundleVersion); writer.WriteLine("Platform: " + _params.Target.ToString()); writer.WriteLine("Subtarget: " + (_params.Target == BuildTarget.Android ? _params.AndroidSubtarget.ToString() : "Generic")); writer.WriteLine(); foreach (var bundleInfo in _bundles) { writer.WriteLine("[" + bundleInfo.Name + "]"); writer.WriteLine("Filename: " + bundleInfo.Data.Filename); writer.WriteLine("Size: " + bundleInfo.Data.Size); writer.WriteLine("Hash: " + BuildUtils.ToHexString(bundleInfo.Data.Hash)); writer.WriteLine("Cache Name: " + bundleInfo.Data.CacheName); writer.WriteLine("Version: " + CachingUtils.GetVersionFromHash(bundleInfo.Data.Hash)); if (bundleInfo.IsScene) { writer.WriteLine("Scenes:"); foreach (var scene in bundleInfo.AssetsPaths) { writer.WriteLine("\t" + scene + "\t(" + BuildUtils.ToHexString(GetHashForBuildAsset(scene)) + ")"); } } writer.WriteLine("Bundle Assets:"); foreach (var assetPath in bundleInfo.AssetsPaths) { writer.WriteLine("\t" + assetPath + "\t" + GetAssetId(assetPath) + "\t(" + BuildUtils.ToHexString(GetHashForBuildAsset(assetPath)) + ")"); } writer.WriteLine("Dependencies Assets:"); var assetPaths = BuildUtils.GetAssetPathsForObjects(bundleInfo.Dependencies); foreach (var assetPath in assetPaths) { writer.WriteLine("\t" + assetPath + "\t(" + BuildUtils.ToHexString(GetHashForBuildAsset(assetPath)) + ")"); } writer.WriteLine(); } } }
private static void BuildFace(CubeFace face, Cube cube, BlockDirection direction, Vector3 position, MeshData mesh) { List <int> indices = mesh.GetIndices(cube.GetAtlasID()); Rect texCoord = cube.GetFace(face, direction); int iFace = (int)face; BuildUtils.AddFaceIndices(mesh.vertices.Count, indices); BuildUtils.AddVertices(mesh.vertices, vertices[iFace], position); mesh.normals.AddRange(normals[iFace]); BuildUtils.AddFaceUV(texCoord, mesh.uv); }
static void BuildMenu() { BuildUtils build_utils = ScriptableObject.CreateInstance <BuildUtils>(); build_utils.titleContent = new GUIContent("GPR Build Utils"); build_utils.position = new Rect(Screen.width / 2, Screen.height / 2, 600, 100); build_utils.minSize = new Vector2(600, 100); build_utils.maxSize = new Vector2(600, 100); build_utils.name_ = UnityEngine.SceneManagement.SceneManager.GetActiveScene().name; build_utils.scene_ = UnityEngine.SceneManagement.SceneManager.GetActiveScene().path; build_utils.version_ = System.DateTime.Now.ToString("yyyyMMdd"); build_utils.ShowUtility(); }
public override bool Execute() { Dictionary <string, string> symbols; if (BuildUtils.ParseSymbolFile(VersionInfo, Log, out symbols)) { Major = symbols["FWMAJOR"]; Minor = symbols["FWMINOR"]; Revision = symbols["FWREVISION"]; Descriptor = symbols["FWBETAVERSION"]; return(true); } return(false); }
private void AddBundlesToStreamingAssets() { FileUtil.DeleteFileOrDirectory(StreamingBundlesDirectory); FileUtil.DeleteFileOrDirectory(StreamingBundlesCacheDirectory); if ((_params.ExtraOptions & Params.ExtraBuildOptions.IncludeBundles) != 0) { BuildUtils.CreateSymlink(_bundlesPath, StreamingBundlesDirectory); } if ((_params.ExtraOptions & Params.ExtraBuildOptions.IncludeBundlesCache) != 0) { BuildUtils.CreateSymlink(_bundlesCachePath, StreamingBundlesCacheDirectory); } }
private void CreateLateResources(IList <UnityEngine.Object> objects) { const string lateResourcesDirectory = "Assets/Resources/Late"; BuildUtils.PrepareCleanDirectory(lateResourcesDirectory); foreach (var obj in ScanningUtils.ItemsProcessor(objects, "Creating late resources", p => AssetDatabase.GetAssetPath(p))) { var lateResource = ScriptableObject.CreateInstance <LateResource>(); lateResource.Target = obj; AssetDatabase.CreateAsset(lateResource, lateResourcesDirectory + "/" + AssetId.FromObject(obj) + ".asset"); } }
void StartEntry(Entry entry) { int standaloneCount = entry.count; if (!Application.isPlaying && entry.runInEditor) { //EditorLevelManager.StartGameInEditor(args); standaloneCount--; } for (var i = 0; i < standaloneCount; i++) { BuildUtils.RunBuild(entry.name); } }
private static void BuildCross(Vector3 localPos, Vector3i worldPos, MeshData mesh) { Cross cross = (Cross)Map.Instance.GetBlock(worldPos).block; int atlas = cross.GetAtlasID(); BuildUtils.AddIndices(mesh.GetIndices(atlas), indices, mesh.vertices.Count); BuildUtils.AddVertices(mesh.vertices, vertices, localPos); mesh.normals.AddRange(normals); Rect uvRect = cross.GetFace(); List <Vector2> texCoords = mesh.uv; BuildUtils.AddFaceUV(uvRect, texCoords); BuildUtils.AddFaceUV(uvRect, texCoords); }
/// <summary> Drawing the 'SceneReference' property </summary> public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { using (PropertyScope(position, label, property, out label)) { var lineRect = position; lineRect.height = lineHeight; // Draw the main Object field var sceneAssetProperty = GetSceneAssetProperty(property); EditorGUI.BeginChangeCheck(); sceneAssetProperty.objectReferenceValue = EditorGUI.ObjectField(lineRect, label, sceneAssetProperty.objectReferenceValue, typeof(SceneAsset), false); var buildScene = BuildUtils.GetBuildScene(sceneAssetProperty.objectReferenceValue); if (EditorGUI.EndChangeCheck()) { if (buildScene.scene == null) { GetScenePathProperty(property).stringValue = string.Empty; } } if (property.isExpanded = EditorGUI.Foldout(lineRect, property.isExpanded, GUIContent.none, true)) { // Draw the Box Background var footerRect = position; footerRect.yMin += lineHeight + spacing; footerRect.height = FOOTER_HEIGHT; GUI.Box(EditorGUI.IndentedRect(footerRect), GUIContent.none, EditorStyles.helpBox); var itemsRect = EditorStyles.helpBox.padding.Remove(footerRect); var sceneControlID = GUIUtility.GetControlID(FocusType.Passive); if (!buildScene.assetGUID.Empty()) { // Draw the Build Settings Info of the selected Scene DrawSceneInfoGUI(itemsRect, buildScene, sceneControlID + 1); } } else { GetBuildGuiContent(buildScene, out var icon, out var buildLabel); var iconRect = lineRect; iconRect.xMax = lineRect.xMin + labelWidth; iconRect.xMin = iconRect.xMax - icon.image.width - spacing; icon.tooltip = $"{buildLabel.text}\n{buildLabel.tooltip}"; EditorGUI.LabelField(iconRect, icon); } } }
void UpdateIngameText() { // frame rate calculation m_SmoothDeltaTime = BuildUtils.SmoothDamp(m_SmoothDeltaTime, Time.unscaledDeltaTime, ref m_DeltaVelocity, 0.7f, Mathf.Infinity, Time.unscaledDeltaTime); FPS = m_SmoothDeltaTime > 0.0f ? (1.0f / m_SmoothDeltaTime) : 0.0f; if (TextFPS != null && theTextBuilder != null) { theTextBuilder.Remove(0, theTextBuilder.Length); theTextBuilder.Append(Mathf.RoundToInt(FPS)); TextFPS.text = theTextBuilder.ToString(); } if (TextTimeTotal != null && theTextBuilder != null && theTimelineController != null) { TimeSpan time = TimeSpan.FromSeconds(theTimelineController.TimerTotal); theTextBuilder.Remove(0, theTextBuilder.Length); //theTextBuilder.Append(string.Format("{0:hh\\:mm\\:ss\\:f}", time)); // this works well only for time-spans under 24 hours :) int hours = (int)time.TotalHours; int minutes = time.Minutes; int seconds = time.Seconds; theTextBuilder.Append(hours.ToString("D2") + ":" + minutes.ToString("D2") + ":" + seconds.ToString("D2")); TextTimeTotal.text = theTextBuilder.ToString(); } if (TextTimePlay != null && theTextBuilder != null && theTimelineController != null) { theTextBuilder.Remove(0, theTextBuilder.Length); theTextBuilder.Append(theTimelineController.TimerPlaystatePlay.ToString("F2")); TextTimePlay.text = theTextBuilder.ToString(); } if (TextTimePause != null && theTextBuilder != null && theTimelineController != null) { theTextBuilder.Remove(0, theTextBuilder.Length); theTextBuilder.Append(theTimelineController.TimerPlaystatePause.ToString("F2")); TextTimePause.text = theTextBuilder.ToString(); } if (TextTimelineCurrent != null && theTextBuilder != null && theTimelineController != null) { theTextBuilder.Remove(0, theTextBuilder.Length); theTextBuilder.Append(theTimelineController.GetCurrentTimelineName()); TextTimelineCurrent.text = theTextBuilder.ToString(); } }
void OnGUI() { GUILayout.Label("Build settings are taken from the standard Build Settings window"); GUILayout.Space(15); _buildNumber = EditorGUILayout.TextField("Build Number", _buildNumber); _makeBundleBasedPlayer = GUILayout.Toggle(_makeBundleBasedPlayer, "Make bundle-based player"); GUI.enabled = _makeBundleBasedPlayer; _includeBundles = GUILayout.Toggle(_includeBundles, "Include bundles"); _includeBundlesCache = GUILayout.Toggle(_includeBundlesCache, "Include bundles cache"); _quickPlayer = GUILayout.Toggle(_quickPlayer, "Quick test player (won't generate bundles)"); GUI.enabled = true; GUILayout.Space(15); GUILayout.BeginHorizontal(); if (GUILayout.Button("Player Settings")) { EditorApplication.ExecuteMenuItem("Edit/Project Settings/Player"); } if (GUILayout.Button("Build Settings")) { BuildUtils.OpenBuildPlayerWindow(); } GUILayout.Space(60); if (GUILayout.Button("Build")) { _makePending = true; _autoRun = false; } if (GUILayout.Button("Build And Run")) { _makePending = true; _autoRun = true; } GUILayout.EndHorizontal(); }
private static BuildPlayerOptions GetBuildPlayerOptions() { BuildLogger.LogSeparator("Generating Build Options"); var projectConfig = BuildConfig.ReadProjectConfig(); var scenePaths = BuildUtils.GetScenePaths(); BuildLogger.Log($"BuildArtifactPath: {projectConfig.WebGlBuildName}"); BuildLogger.LogArray("Scenes:", scenePaths); return(new BuildPlayerOptions() { scenes = scenePaths, locationPathName = projectConfig.WebGlBuildName, target = BuildTarget.WebGL, options = BuildOptions.None }); }
public static void CopyDirectoryRecursiveIgnoreMeta(string source, string target) { BuildUtils.PrepareCleanDirectory(target); // HACK: Another unity non public useful method... var editorAssembly = Assembly.LoadFrom(UnityEditorInternal.InternalEditorUtility.GetEditorAssemblyPath()); var editorType = editorAssembly.GetType("UnityEditor.FileUtil"); var method = editorType.GetMethod("CopyDirectoryRecursiveIgnoreMeta", BindingFlags.Static | BindingFlags.NonPublic); object[] options = { source, target }; method.Invoke(null, options); }
/// <inheritdoc /> /// <summary> Drawing the 'SceneReference' property </summary> public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { SerializedProperty sceneAssetProperty = GetSceneAssetProperty(property); // Draw the Box Background position.height -= FOOTER_HEIGHT; GUI.Box(EditorGUI.IndentedRect(position), GUIContent.none, EditorStyles.helpBox); position = boxPadding.Remove(position); position.height = LineHeight; // Draw the main Object field label.tooltip = "The actual Scene Asset reference.\nOn serialize this is also stored as the asset's path."; EditorGUI.BeginProperty(position, GUIContent.none, property); EditorGUI.BeginChangeCheck(); int sceneControlId = GUIUtility.GetControlID(FocusType.Passive); Object selectedObject = EditorGUI.ObjectField(position, label, sceneAssetProperty.objectReferenceValue, typeof(SceneAsset), false); BuildUtils.BuildScene buildScene = BuildUtils.GetBuildScene(selectedObject); if (EditorGUI.EndChangeCheck()) { sceneAssetProperty.objectReferenceValue = selectedObject; // If no valid scene asset was selected, reset the stored path accordingly if (buildScene.scene == null) { GetScenePathProperty(property).stringValue = string.Empty; } } position.y += PaddedLine; if (buildScene.assetGUID.Empty() == false) { // Draw the Build Settings Info of the selected Scene DrawSceneInfoGUI(position, buildScene, sceneControlId + 1); } EditorGUI.EndProperty(); }
public SpatialGDKTests(ReadOnlyTargetRules Target) : base(Target) { bLegacyPublicIncludePaths = false; PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; bUseUnity = BuildUtils.GetUnityModeSetting(); PrivateDependencyModuleNames.AddRange( new string[] { "SpatialGDK", "SpatialGDKEditor", "SpatialGDKServices", "Core", "CoreUObject", "Engine", "EngineSettings", "UnrealEd", "Json", "JsonUtilities" }); }
public CollectTargets(TaskLoggingHelper log, string timeoutValuesFilePath, string nUnitConsolePath) { Log = log; // Get the parent directory of the running program. We assume that // this is the root of the FieldWorks repository tree. var fwrt = BuildUtils.GetAssemblyFolder(); while (!Directory.Exists(Path.Combine(fwrt, "Build")) || !Directory.Exists(Path.Combine(fwrt, "Src"))) { fwrt = Path.GetDirectoryName(fwrt); if (fwrt == null) { Log.LogError("Error pulling the working folder from the running assembly."); break; } } m_fwroot = fwrt; m_TimeoutValuesFilePath = timeoutValuesFilePath; m_NUnitConsolePath = nUnitConsolePath; }
IEnumerator InitLocalVersion() { clientAppVersion = ChannelManager.instance.appVersion; var resVersionRequest = AssetBundleManager.Instance.RequestAssetFileAsync(BuildUtils.ResVersionFileName); yield return(resVersionRequest); var streamingResVersion = resVersionRequest.text; resVersionRequest.Dispose(); var persistentResVersion = GameUtility.SafeReadAllText(resVersionPath); if (string.IsNullOrEmpty(persistentResVersion)) { clientResVersion = streamingResVersion; } else { clientResVersion = BuildUtils.CheckIsNewVersion(streamingResVersion, persistentResVersion) ? persistentResVersion : streamingResVersion; } GameUtility.SafeWriteAllText(resVersionPath, clientResVersion); var persistentNoticeVersion = GameUtility.SafeReadAllText(noticeVersionPath); if (!string.IsNullOrEmpty(persistentNoticeVersion)) { ChannelManager.instance.noticeVersion = persistentNoticeVersion; } else { ChannelManager.instance.noticeVersion = "1.0.0"; } Logger.Log(string.Format("streamingResVersion = {0}, persistentResVersion = {1}, persistentNoticeVersion = {2}", streamingResVersion, persistentResVersion, persistentNoticeVersion)); yield break; }
IEnumerator InitAppVersion() { var appVersionRequest = AssetBundleManager.Instance.RequestAssetFileAsync(BuildUtils.AppVersionFileName); yield return appVersionRequest; var streamingAppVersion = appVersionRequest.text; appVersionRequest.Dispose(); var appVersionPath = AssetBundleUtility.GetPersistentDataPath(BuildUtils.AppVersionFileName); var persistentAppVersion = GameUtility.SafeReadAllText(appVersionPath); Logger.Log(string.Format("streamingAppVersion = {0}, persistentAppVersion = {1}", streamingAppVersion, persistentAppVersion)); // 如果persistent目录版本比streamingAssets目录app版本低,说明是大版本覆盖安装,清理过时的缓存 if (!string.IsNullOrEmpty(persistentAppVersion) && BuildUtils.CheckIsNewVersion(persistentAppVersion, streamingAppVersion)) { var path = AssetBundleUtility.GetPersistentDataPath(); GameUtility.SafeDeleteDir(path); } GameUtility.SafeWriteAllText(appVersionPath, streamingAppVersion); ChannelManager.instance.appVersion = streamingAppVersion; yield break; }
private void AddToDatabase(AssetBundlesDatabase.BundleData bundle, byte[] hash, string bundlePath) { bundle.Filename = Path.GetFileName(bundlePath); using (FileStream stream = File.OpenRead(bundlePath)) { bundle.Size = (int)stream.Length; bundle.Hash = hash; var str = bundle.Filename + "@" + CachingUtils.GetVersionFromHash(bundle.Hash); bundle.CacheName = BuildUtils.ToHexString(BuildUtils.GetASCIIStringHash(str)); } _database.Bundles.Add(bundle); // Update hash, id and size _database.Hash = BuildUtils.Sha1.ComputeHash(_database.Hash.Concat(bundle.Hash).ToArray()); _database.Id = BuildUtils.ToHexString(_database.Hash.Take(4)); _database.Size += bundle.Size; //EditorUtility.SetDirty(_database); }
/// <summary> /// 给Ios提供编译的方法 /// </summary> static void BuildForIos() { //不管什么平台先拷贝JPush FileUtility.CopyDirectory(Application.dataPath + "/AIOS_Platform/JPush", Application.dataPath + "/Plugins/iOS"); //是Release模式还是Debug模式 string buildMode = BuildUtils.buildMode; if (buildMode.ToLower() == "debug") { MacroSymbol_IOS_Spade += ";DEBUG"; MacroSymbol_IOS_Normal += ";DEBUG"; } string projectName = BuildUtils.projectName; if (projectName.StartsWith("Spade")) { PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iPhone, MacroSymbol_IOS_Spade); } else if (projectName.StartsWith("Oringinal")) { PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.iPhone, MacroSymbol_IOS_Normal); } PlayerSettings.aotOptions = "nimt-trampolines=1024"; string path = DeviceInfo.PersisitFullPath(BuildUtils.projectName); //删除之前的工程目录 if (Directory.Exists(path)) { FileUtility.deleteSubFolder(path); } BuildPipeline.BuildPlayer(BuildUtils.GetBuildScenes(), path, BuildTarget.iPhone, BuildOptions.Development); }
void OnGUI() { m_ScrollPos = GUILayout.BeginScrollView(m_ScrollPos); GUILayout.Label("Project", EditorStyles.boldLabel); GUILayout.TextArea(Application.dataPath.BeforeLast("Assets")); GUILayout.Space(5.0f); if (GUILayout.Button("Open Main Folder")) { BuildUtils.OpenProjectFolder(2); GUIUtility.ExitGUI(); } if (GUILayout.Button("Open Project Folder")) { BuildUtils.OpenProjectFolder(1); GUIUtility.ExitGUI(); } DrawBuild(); GUILayout.Space(10.0f); DrawQuickSelect(); GUILayout.Space(10.0f); DrawQuickStart(); GUILayout.Space(10.0f); GUILayout.EndScrollView(); }
/// <summary> /// Drawing the 'SceneReference' property /// </summary> public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) { if (property.serializedObject.isEditingMultipleObjects) { GUI.Label(position, "Scene multiediting not supported"); return; } var sceneAssetProperty = GetSceneAssetProperty(property); // label.tooltip = "The actual Scene Asset reference.\nOn serialize this is also stored as the asset's path."; var sceneControlID = GUIUtility.GetControlID(FocusType.Passive); EditorGUI.BeginChangeCheck(); { sceneAssetProperty.objectReferenceValue = EditorGUI.ObjectField(position, label, sceneAssetProperty.objectReferenceValue, typeof(SceneAsset), false); } if (EditorGUI.EndChangeCheck()) { var buildScene = BuildUtils.GetBuildScene(sceneAssetProperty.objectReferenceValue); if (buildScene.scene == null) { GetScenePathProperty(property).stringValue = string.Empty; } } }
public SpatialGDKFunctionalTests(ReadOnlyTargetRules Target) : base(Target) { bLegacyPublicIncludePaths = false; PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; bUseUnity = BuildUtils.GetUnityModeSetting(); PrivateIncludePaths.Add(ModuleDirectory); PrivateDependencyModuleNames.AddRange( new string[] { "SpatialGDK", "SpatialGDKEditor", "SpatialGDKServices", "Core", "CoreUObject", "Engine", "FunctionalTesting", "HTTP", "UnrealEd", "EngineSettings", "InputCore", "Slate" }); }
void DrawBuild() { // Title GUILayout.Label("Build", EditorStyles.boldLabel); // Build Times GUILayout.Label("Build times:"); string serverStr = PrettyPrintTimeStamp(TimeLastBuildGame(GameLoopMode.Server)); string clientStr = PrettyPrintTimeStamp(TimeLastBuildGame(GameLoopMode.Client)); string aiStr = PrettyPrintTimeStamp(TimeLastBuildGame(GameLoopMode.AI)); GUILayout.BeginHorizontal(); { GUILayout.Space(20); GUILayout.Label("- Build Time Server", GUILayout.Width(130)); EditorGUILayout.SelectableLabel(serverStr, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { GUILayout.Space(20); GUILayout.Label("- Build Time Client", GUILayout.Width(130)); EditorGUILayout.SelectableLabel(clientStr, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { GUILayout.Space(20); GUILayout.Label("- Build Time AI Client", GUILayout.Width(130)); EditorGUILayout.SelectableLabel(aiStr, EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); } GUILayout.EndHorizontal(); if (GUILayout.Button("Open Builds Folder")) { BuildUtils.RunBuild(BuildUtils.GameLoopMode.Undefined); GUIUtility.ExitGUI(); } // Build All GUILayout.Label("Rebuild S.Alone", EditorStyles.boldLabel); GUILayout.BeginVertical(EditorStyles.textArea); GUILayout.BeginHorizontal(); GUILayout.Label("Build All", GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.Width(100)); if (GUILayout.Button("Build")) { BuildServer(); BuildClient(); BuildAI(); GUIUtility.ExitGUI(); } GUILayout.EndHorizontal(); GUILayout.EndHorizontal(); // Build AI Server GUILayout.BeginHorizontal(); GUILayout.Label("Build Server", GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.Width(100)); if (GUILayout.Button("Build")) { BuildServer(); GUIUtility.ExitGUI(); } GUILayout.EndHorizontal(); GUILayout.EndHorizontal(); // Build Client GUILayout.BeginHorizontal(); GUILayout.Label("Build Client", GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.Width(100)); if (GUILayout.Button("Build")) { BuildClient(); GUIUtility.ExitGUI(); } GUILayout.EndHorizontal(); GUILayout.EndHorizontal(); // Build AI Client GUILayout.BeginHorizontal(); GUILayout.Label("Build AI Client", GUILayout.ExpandWidth(true)); GUILayout.BeginHorizontal(GUILayout.Width(100)); if (GUILayout.Button("Build")) { BuildAI(); GUIUtility.ExitGUI(); } GUILayout.EndHorizontal(); GUILayout.EndHorizontal(); GUILayout.EndVertical(); }
/// <summary> /// Draws info box of the provided scene /// </summary> private void DrawSceneInfoGUI(Rect position, BuildUtils.BuildScene buildScene, int sceneControlID) { bool readOnly = BuildUtils.IsReadOnly(); string readOnlyWarning = readOnly ? "\n\nWARNING: Build Settings is not checked out and so cannot be modified." : ""; // Label Prefix GUIContent iconContent = new GUIContent(); GUIContent labelContent = new GUIContent(); // Missing from build scenes if (buildScene.buildIndex == -1) { iconContent = EditorGUIUtility.IconContent("d_winbtn_mac_close"); labelContent.text = "NOT In Build"; labelContent.tooltip = "This scene is NOT in build settings.\nIt will be NOT included in builds."; } // In build scenes and enabled else if (buildScene.scene.enabled) { iconContent = EditorGUIUtility.IconContent("d_winbtn_mac_max"); labelContent.text = "BuildIndex: " + buildScene.buildIndex; labelContent.tooltip = "This scene is in build settings and ENABLED.\nIt will be included in builds." + readOnlyWarning; } // In build scenes and disabled else { iconContent = EditorGUIUtility.IconContent("d_winbtn_mac_min"); labelContent.text = "BuildIndex: " + buildScene.buildIndex; labelContent.tooltip = "This scene is in build settings and DISABLED.\nIt will be NOT included in builds."; } // Left status label using (new EditorGUI.DisabledScope(readOnly)) { Rect labelRect = DrawUtils.GetLabelRect(position); Rect iconRect = labelRect; iconRect.width = iconContent.image.width + padSize; labelRect.width -= iconRect.width; labelRect.x += iconRect.width; EditorGUI.PrefixLabel(iconRect, sceneControlID, iconContent); EditorGUI.PrefixLabel(labelRect, sceneControlID, labelContent); } // Right context buttons Rect buttonRect = DrawUtils.GetFieldRect(position); buttonRect.width = (buttonRect.width) / 3; string tooltipMsg = ""; using (new EditorGUI.DisabledScope(readOnly)) { // NOT in build settings if (buildScene.buildIndex == -1) { buttonRect.width *= 2; int addIndex = EditorBuildSettings.scenes.Length; tooltipMsg = "Add this scene to build settings. It will be appended to the end of the build scenes as buildIndex: " + addIndex + "." + readOnlyWarning; if (DrawUtils.ButtonHelper(buttonRect, "Add...", "Add (buildIndex " + addIndex + ")", EditorStyles.miniButtonLeft, tooltipMsg)) { BuildUtils.AddBuildScene(buildScene); } buttonRect.width /= 2; buttonRect.x += buttonRect.width; } // In build settings else { bool isEnabled = buildScene.scene.enabled; string stateString = isEnabled ? "Disable" : "Enable"; tooltipMsg = stateString + " this scene in build settings.\n" + (isEnabled ? "It will no longer be included in builds" : "It will be included in builds") + "." + readOnlyWarning; if (DrawUtils.ButtonHelper(buttonRect, stateString, stateString + " In Build", EditorStyles.miniButtonLeft, tooltipMsg)) { BuildUtils.SetBuildSceneState(buildScene, !isEnabled); } buttonRect.x += buttonRect.width; tooltipMsg = "Completely remove this scene from build settings.\nYou will need to add it again for it to be included in builds!" + readOnlyWarning; if (DrawUtils.ButtonHelper(buttonRect, "Remove...", "Remove from Build", EditorStyles.miniButtonMid, tooltipMsg)) { BuildUtils.RemoveBuildScene(buildScene); } } } buttonRect.x += buttonRect.width; tooltipMsg = "Open the 'Build Settings' Window for managing scenes." + readOnlyWarning; if (DrawUtils.ButtonHelper(buttonRect, "Settings", "Build Settings", EditorStyles.miniButtonRight, tooltipMsg)) { BuildUtils.OpenBuildSettings(); } }
private static void BuildCrossLight(Map map, Vector3i pos, MeshBuilder mesh) { Color color = BuildUtils.GetBlockLight(map, pos); mesh.AddColors(color, vertices.Length); }
// [MenuItem("Build Target/PreBuidTarget")] // static void PerformCopyToBuidTarget() // { // PreBuildTarget("OPPO", "Android"); // } // // [MenuItem("Build Target/ClearBuidTarget")] // static void ClearBuidTarget() // { // CleanAndroidBuildTarget(); // } static void BuildTarget(string name, string target) { string app_name = "JiangHu" + DateTime.Now.ToString("yyyyMMdd_") + name; string target_dir = string.Empty; // Application.dataPath + "/TargetAndroid"; string target_name = string.Empty; // app_name + ".apk"; BuildTargetGroup targetGroup = BuildTargetGroup.Android; BuildTarget buildTarget = UnityEditor.BuildTarget.Android; string applicationPath = Application.dataPath.Replace("/Assets", ""); if (target == "Android") { target_dir = applicationPath + "/TargetAndroid"; target_name = app_name + ".apk"; targetGroup = BuildTargetGroup.Android; } else if (target == "IOS") { target_dir = applicationPath + "/TargetIOS"; target_name = app_name; targetGroup = BuildTargetGroup.iPhone; buildTarget = UnityEditor.BuildTarget.iPhone; } //FileInfo buildFile = new FileInfo(target_dir); //if (buildFile.Exists) // buildFile.Delete(); if (File.Exists(target_name)) { File.Delete(target_name); } if (!Directory.Exists(target_dir)) { Directory.CreateDirectory(target_dir); } string sourcePath = ""; switch (name) { case "UC": PlayerSettings.bundleIdentifier = "com.fanhou.jianghu.uc"; PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "ANDROID_UC"); sourcePath = UI_PATH_NAME; break; case "JIUYAO": PlayerSettings.bundleIdentifier = "com.fanhou.jianghu.jiuyao"; PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "ANDROID_JIUYAO"); break; case "XIAOMI": PlayerSettings.bundleIdentifier = "Pushcraft.mi"; PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "ANDROID_XIAOMI"); sourcePath = MI_PATH_NAME; break; // case "OPPO": // PlayerSettings.bundleIdentifier = "com.fanhou.jianghu.nearme"; // PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "ANDROID_OPPO"); // sourcePath=OPPO_PATH_NAME; // break; case "OPPO_0917": PlayerSettings.bundleIdentifier = "com.fanhou.jianghu.nearme.gamecenter"; PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "ANDROID_OPPO"); sourcePath = OPPONEW_PATH_NAME; break; case "TencentTest": PlayerSettings.bundleIdentifier = "com.tencent.tmgp.yjws"; PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "ANDROID_TENCENT; TENCENT_TEST"); PlayerSettings.keyaliasPass = "******"; PlayerSettings.keystorePass = "******"; sourcePath = TENCENT_TEST_PATH; break; case "TencentRelease": PlayerSettings.bundleIdentifier = "com.tencent.tmgp.yjws"; PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "ANDROID_TENCENT; TENCENT_RELEASE"); PlayerSettings.keyaliasPass = "******"; PlayerSettings.keystorePass = "******"; sourcePath = TENCENT_RELEASE_PATH; break; default: break; } //string target_folder = EditorUtility.SaveFolderPanel("111", "", "2222"); string target_fileName = EditorUtility.SaveFilePanel("BuildTarget", target_dir, target_name, ""); if (string.IsNullOrEmpty(target_fileName)) { return; } //拷贝相应平台的Plugins/Android到Plugins/Android BuildUtils.CopyDirectoryRecursiveIgnoreMeta(Path.Combine(PLATFORM_ANDROID_PATH, sourcePath), PLATFORM_PLUGINS_TARGET); AssetDatabase.Refresh(); //开始Build场景 GenericBuild(Scenes, target_fileName, buildTarget, BuildOptions.None); PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, ""); BuildUtils.PrepareCleanDirectory(PLATFORM_PLUGINS_TARGET); }
public static void CleanAndroidBuildTarget() { PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Android, ""); BuildUtils.PrepareCleanDirectory(PLATFORM_PLUGINS_TARGET); AssetDatabase.Refresh(); }
public static void CopyToBuildTarget(string name, string target) { BuildTargetGroup targetGroup = BuildTargetGroup.Android; BuildTarget buildTarget = UnityEditor.BuildTarget.Android; string applicationPath = Application.dataPath.Replace("/Assets", ""); if (target == "IOS") { targetGroup = BuildTargetGroup.iPhone; buildTarget = UnityEditor.BuildTarget.iPhone; } string sourcePath = ""; switch (name) { case "UC": PlayerSettings.bundleIdentifier = "com.fanhou.jianghu.uc"; PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "ANDROID_UC"); sourcePath = UI_PATH_NAME; break; case "JIUYAO": PlayerSettings.bundleIdentifier = "com.fanhou.jianghu.jiuyao"; PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "ANDROID_JIUYAO"); break; case "XIAOMI": PlayerSettings.bundleIdentifier = "Pushcraft.mi"; PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "ANDROID_XIAOMI"); sourcePath = MI_PATH_NAME; break; // case "OPPO": // PlayerSettings.bundleIdentifier = "com.fanhou.jianghu.nearme"; // PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "ANDROID_OPPO"); // sourcePath=OPPO_PATH_NAME; // break; case "OPPO_0917": PlayerSettings.bundleIdentifier = "com.fanhou.jianghu.nearme.gamecenter"; PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "ANDROID_OPPO"); sourcePath = OPPONEW_PATH_NAME; break; case "TencentTest": PlayerSettings.bundleIdentifier = "com.tencent.tmgp.yjws"; PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "ANDROID_TENCENT; TENCENT_TEST"); PlayerSettings.keyaliasPass = "******"; PlayerSettings.keystorePass = "******"; sourcePath = TENCENT_TEST_PATH; break; case "TencentRelease": PlayerSettings.bundleIdentifier = "com.tencent.tmgp.yjws"; PlayerSettings.SetScriptingDefineSymbolsForGroup(targetGroup, "ANDROID_TENCENT; TENCENT_RELEASE"); PlayerSettings.keyaliasPass = "******"; PlayerSettings.keystorePass = "******"; sourcePath = TENCENT_RELEASE_PATH; break; default: break; } BuildUtils.CopyDirectoryRecursiveIgnoreMeta(Path.Combine(PLATFORM_ANDROID_PATH, sourcePath), PLATFORM_PLUGINS_TARGET); AssetDatabase.Refresh(); }
private void OnGUI() { //Unable to use a named GUIStyle without a current skin. //Most likely you need to move your GUIStyle initialization code to OnGUI //GUI风格元素需要在OnGUI方法里初始化,否则会报以上错误,界面也会发生显示错误 if (checkStyle == null) { checkStyle = new CheckStyle(); } GUILayout.BeginHorizontal(checkStyle.ToolBar, new GUILayoutOption[] { GUILayout.Width(this.position.width) }); { EditorGUI.BeginChangeCheck(); checkTypeMix = (CheckEnumType)EditorGUILayout.EnumMaskPopup(new GUIContent(titleStr), checkTypeMix, checkStyle.TE_ToolBarBtn, new GUILayoutOption[] { GUILayout.Width(600) }); if (EditorGUI.EndChangeCheck()) { //检查类型分类 OnCheckTypeSelect(checkTypeMix); } EditorGUI.BeginChangeCheck(); if (GUILayout.Button(string.Format("当前目录{0}", filePath), checkStyle.TE_ToolBarBtn)) { filePath = EditorUtility.OpenFolderPanel("选择筛选目录{0}", Application.dataPath, string.Empty); var currentDir = BuildUtils.GetUnityPath(Path.GetFullPath(Directory.GetCurrentDirectory())); filePath = filePath.Replace(string.Format("{0}/", currentDir), ""); } if (EditorGUI.EndChangeCheck()) { checkManager.SetFilePath(filePath); Debug.Log(string.Format("当前选择目录:{0}", filePath)); } } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); { if (GUILayout.Button("Check")) { //检查 if (checkManager.GetPathListByFilePath()) { checkManager.OnCheck(); } } if (GUILayout.Button("Format")) { //处理 checkManager.OnFormat(); } } GUILayout.EndHorizontal(); #region 表格GUI绘制 //表格 GUI 绘制 Rect viewRect = new Rect(border * 2 + this.position.width * percet, offset * 2, this.position.width * (1 - percet) - border * 3, this.position.height - offset * 2 - border); if (table != null) { table.Draw(viewRect); } #endregion #region 检查项GUI绘制 //检查项 itemlist 绘制 Rect itemViewRect = new Rect(border, offset * 2, this.position.width * percet, this.position.height - offset * 2 - border); GUILayout.BeginArea(itemViewRect, checkStyle.WindowBackground); scrollview = GUILayout.BeginScrollView(scrollview, GUIStyle.none, GUI.skin.verticalScrollbar); DrawItemWind(itemViewRect); GUILayout.EndScrollView(); GUILayout.EndArea(); #endregion }