public override void OnInspectorGUI() { var data = target as BuildCollection; int selectedCount = 0; GUILayout.Label("With a Build Collection you can have multiple Build Processes in one list. " + "They can target different platforms and each have their own pre- and post-steps. ", EditorStyles.wordWrappedMiniLabel); GUILayout.Label("You can either run one Build Process manually or run a set of selected " + "Build Processes at once. ", EditorStyles.wordWrappedMiniLabel); if (data.mProcesses.Count == 0) { GUI.color = Color.yellow; GUILayout.Label("You should start by adding a Build Process. Hit \"Edit\" to do so. ", EditorStyles.wordWrappedLabel); GUI.color = Color.white; } GUILayout.Label("Build Processes", "BoldLabel"); GUILayout.BeginVertical("HelpBox", GUILayout.MinHeight(40)); { if (data.mProcesses.Count == 0) { GUILayout.Label("None", UBS.Styles.bigHint); } bool odd = false; foreach (var e in data.mProcesses) { if (e == null) { break; } GUILayout.BeginHorizontal(odd ? UBS.Styles.selectableListEntryOdd : UBS.Styles.selectableListEntry); { Texture2D platformIcon = GetPlatformIcon(e.mPlatform); GUILayout.Box(platformIcon, UBS.Styles.icon); GUILayout.Label(e.mName, odd ? UBS.Styles.selectableListEntryTextOdd : UBS.Styles.selectableListEntryText); GUILayout.FlexibleSpace(); var sel = GUILayout.Toggle(e.mSelected, ""); if (sel != e.mSelected) { e.mSelected = sel; EditorUtility.SetDirty(data); } selectedCount += e.mSelected ? 1 : 0; } GUILayout.EndHorizontal(); if (Event.current.type == EventType.MouseDown && Event.current.button == 1) { Rect r = GUILayoutUtility.GetLastRect(); if (r.Contains(Event.current.mousePosition)) { GenericMenu menu = new GenericMenu(); menu.AddItem(new GUIContent(e.mName), false, null); menu.AddSeparator(""); menu.AddItem(new GUIContent("Open target folder"), false, () => { DirectoryInfo di = new DirectoryInfo(UBS.Helpers.GetAbsolutePathRelativeToProject(e.mOutputPath)); string path; if ((di.Attributes & FileAttributes.Directory) != 0) { path = di.FullName; } else { path = di.Parent.FullName; } OpenInFileBrowser(path); }); menu.AddSeparator(""); menu.AddItem(new GUIContent("Build and run"), false, BuildAndRun, e); menu.AddItem(new GUIContent("Build"), false, Build, e); menu.ShowAsContext(); } } odd = !odd; } } GUILayout.EndVertical(); GUILayout.BeginHorizontal(); { if (GUILayout.Button("Edit")) { UBSEditorWindow.Init(data); } GUILayout.Space(5); GUI.enabled = selectedCount >= 1; if (GUILayout.Button("Run selected builds")) { UBSBuildWindow.Init(data); } GUILayout.Space(5); GUI.enabled = selectedCount == 1; if (GUILayout.Button("Build and run")) { UBSBuildWindow.Init(data, true); } GUI.enabled = true; if (GUILayout.Button("?", GUILayout.Width(32))) { EditorUtility.OpenWithDefaultApp("http://kwnetzwelt.net/unity-build-system"); } } GUILayout.EndHorizontal(); }
public override void OnInspectorGUI() { var data = target as BuildCollection; int selectedCount = 0; GUILayout.Label("With a Build Collection you can have multiple Build Processes in one list. " + "They can target different platforms and each have their own pre- and post-steps. ", EditorStyles.wordWrappedMiniLabel); GUILayout.Label("You can either run one Build Process manually or run a set of selected " + "Build Processes at once. ", EditorStyles.wordWrappedMiniLabel); GUILayout.Label("This asset can be accessed by hitting CTRL+SHIFT+C. ", EditorStyles.wordWrappedMiniLabel); if (data.mProcesses.Count == 0) { GUI.color = Color.yellow; GUILayout.Label("You should start by adding a Build Process. Hit \"Edit\" to do so. ", EditorStyles.wordWrappedLabel); GUI.color = Color.white; } GUILayout.Label("Build Processes", "BoldLabel"); GUILayout.BeginVertical("HelpBox", GUILayout.MinHeight(40)); { if (data.mProcesses.Count == 0) { GUILayout.Label("None", UBS.Styles.bigHint); } bool odd = false; foreach (var e in data.mProcesses) { if (e == null) { break; } selectedCount = UBSWindowBase.DrawBuildProcessEntry(data, e, odd, selectedCount, true); odd = !odd; } } GUILayout.EndVertical(); GUILayout.BeginHorizontal(); { if (GUILayout.Button("Edit")) { UBSEditorWindow.Init(data); } GUILayout.Space(5); GUI.enabled = selectedCount >= 1; if (GUILayout.Button("Run selected builds")) { UBSBuildWindow.Init(data); } GUILayout.Space(5); GUI.enabled = selectedCount == 1; if (GUILayout.Button("Build and run")) { UBSBuildWindow.Init(data, true); } GUI.enabled = true; if (GUILayout.Button("?", GUILayout.Width(32))) { EditorUtility.OpenWithDefaultApp("http://kwnetzwelt.net/unity-build-system"); } } GUILayout.EndHorizontal(); }