/// <summary> /// /// </summary> static void DrawGUI() { P.Load(); PB.Load(); Styles.Init(); using (new PreferenceLayoutScope(ref m_scroll2)) { PB.i.selectTool = GUILayout.Toolbar(PB.i.selectTool, toolName); GUILayout.Space(8); if (PB.i.selectTool == 0) { DrawContentPlatfom(); } else { DrawContentConfig(); } } if (s_changed) { P.Save(); PB.Save(); BuildAssistWindow.Repaint(); } }
public void SceneSelectTabOnGUI() { PB.Load(); using (new VerticalScope(Styles.helpBox)) { using (new HorizontalScope()) { void editButton() { var lsss = PrefixLabel(GUILayoutUtility.GetLastRect(), EditorHelper.TempContent(S._BuildSceneSet)); lsss.x -= Styles.iconEdit.width; lsss.x -= 2; lsss.width = Styles.iconEdit.width; if (HEditorGUI.IconButton(lsss, Styles.iconEdit, 2)) { editMode = !editMode; PB.i.profileList = PB.i.profileList.Distinct(a => a.profileName).ToList(); Repaint(); } } if (PB.i.profileList.Count <= PB.i.selectIndex) { PB.i.selectIndex = PB.i.profileList.Count - 1; } var lst = PB.i.profileList.Select(x => x.profileName).ToArray(); BeginChangeCheck(); if (editMode) { PB.i.selectProfile.profileName = EditorGUILayout.TextField(S._BuildSceneSet, PB.i.selectProfile.profileName); editButton(); } else { PB.i.selectIndex = EditorGUILayout.Popup(S._BuildSceneSet, PB.i.selectIndex, lst); //var ls = GUILayoutUtility.GetLastRect(); editButton(); if (HEditorGUILayout.IconButton(Styles.iconPlus, 4)) { PB.i.profileList.Add(new PB.Profile($"BuildScene ({PB.i.profileList.Count})")); PB.i.selectIndex = PB.i.profileList.Count - 1; s_changed = true; } BeginDisabledGroup(PB.i.selectIndex == 0); if (HEditorGUILayout.IconButton(Styles.iconMinus, 4)) { PB.i.profileList.RemoveAt(PB.i.selectIndex); PB.i.selectIndex = PB.i.profileList.Count - 1; s_changed = true; } EndDisabledGroup(); } if (EndChangeCheck()) { PB.Save(); } } BeginHorizontal(); BeginChangeCheck(); PB.i.selectProfile.exclusionScene = EditorGUILayout.ToggleLeft(S._ExcludescenesfromthebuildthatarenotregisteredinBuildSettings, PB.i.selectProfile.exclusionScene); if (Button(S._Checktheorderofthebuild, ExpandWidth(false))) { var s = string.Join("\n", PB.GetBuildSceneName().Select((x, i) => $"{i}: {x}").ToArray()); EditorUtility.DisplayDialog(S._Checktheorderofthebuild, s, SS._OK); } if (EndChangeCheck()) { PB.Save(); } EndHorizontal(); } // Build SettingsにセットされているScene if (0 < m_scenePaths.Count) { Space(8); BeginHorizontal(); Label(S._BuildSettingsScenes, Styles.boldLabel); var r = EditorHelper.GetLayout(Styles.iconSettings, HEditorStyles.iconButton); if (HEditorGUI.IconButton(r, Styles.iconSettings, B.kBuildSettings, 1)) { UnityEditorMenu.File_Build_Settings(); } EndHorizontal(); foreach (var p in m_scenePaths) { BeginHorizontal(Styles.helpBox); BeginDisabledGroup(true); Toggle(p.enabled, ""); EndDisabledGroup(); Label(EditorHelper.TempContent(SceneName(p.path), EditorIcon.SceneAsset), Height(16)); if (EditorHelper.HasMouseClick(GUILayoutUtility.GetLastRect())) { EditorHelper.PingObject(p.path); Event.current.Use(); } FlexibleSpace(); foreach (var pp in PB.i.profileList) { BeginChangeCheck(); var toggle = Toggle(pp.Has(p.path), pp.profileName, "Button"); if (EndChangeCheck()) { pp.Toggle(toggle, p.path); PB.Save(); } } EndHorizontal(); } } // Build SettingsにセットされていないScene Space(8); Label(S._ScenesotherthanBuildSettings, Styles.boldLabel); foreach (var scenePath in m_leakedScenes) { BeginHorizontal(Styles.helpBox); Space(20); Label(EditorHelper.TempContent(scenePath, EditorIcon.SceneAsset), Height(16)); if (EditorHelper.HasMouseClick(GUILayoutUtility.GetLastRect())) { EditorHelper.PingObject(scenePath); Event.current.Use(); } FlexibleSpace(); foreach (var pp in PB.i.profileList) { BeginChangeCheck(); var toggle = Toggle(pp.Has(scenePath), pp.profileName, "Button"); if (EndChangeCheck()) { pp.Toggle(toggle, scenePath); PB.Save(); } } EndHorizontal(); } }
static void DrawContentConfig() { EditorGUI.BeginChangeCheck(); PB.i.enableAssetBundleBuild = HEditorGUILayout.ToggleLeft(S._EnableAssetBundleBuild, PB.i.enableAssetBundleBuild); PB.i.enableOldStyleProjectSettings = HEditorGUILayout.ToggleLeft(S._Usingtheold_styleProjectSettings, PB.i.enableOldStyleProjectSettings); GUILayout.Space(8); PB.i.enableExlusionAssets = HEditorGUILayout.ToggleLeft(S._Enablingassetexclusionatbuildtime, PB.i.enableExlusionAssets); GUILayout.Label(S._ExclusionAssetsList, EditorStyles.boldLabel); if (s_exclusionContents == null) { if (PB.i.exclusionAssets == null) { PB.i.exclusionAssets = new List <PB.ExclusionSets>(); } //foreach(var p in PB.i.exclusionAssets ) { // Debug.Log( GUIDUtils.GetAssetPath( p.GUID ) ); //} s_exclusionContents = PB.i.exclusionAssets.Select(x => GUIDUtils.GetAssetPath(x.GUID)).OrderBy(value => value).Select(x => new GUIContent(x, AssetDatabase.GetCachedIcon(x))).ToArray(); } int removeIndex = -1; using (new GUILayout.VerticalScope(Styles.helpBox)) { for (int i = 0; i < s_exclusionContents.Length; i++) { var s = s_exclusionContents[i]; using (new GUILayout.HorizontalScope()) { GUILayout.Label(EditorHelper.TempContent(""), GUILayout.ExpandWidth(true), GUILayout.Height(18)); } var rc = GUILayoutUtility.GetLastRect(); GUI.Box(rc, "", Styles.projectBrowserHeaderBgMiddle); GUI.Label(rc, s, Styles.labelAndIcon); rc.x = rc.xMax - 16; rc.width = 16; if (HEditorGUI.IconButton(rc, Styles.iconMinus)) { removeIndex = i; } } GUILayout.FlexibleSpace(); if (0 <= removeIndex) { var findGUID = GUIDUtils.ToGUID(s_exclusionContents[removeIndex].text); var rIndex = PB.i.exclusionAssets.FindIndex(x => x.GUID == findGUID); PB.i.exclusionAssets.RemoveAt(rIndex); s_exclusionContents = null; s_changed = true; s_window?.Repaint(); } } var dropRc = GUILayoutUtility.GetLastRect(); var evt = Event.current; switch (evt.type) { case EventType.DragUpdated: case EventType.DragPerform: if (!dropRc.Contains(evt.mousePosition)) { break; } DragAndDrop.visualMode = DragAndDropVisualMode.Copy; void AddFiles(params string[] paths) { PB.i.exclusionAssets.AddRange(paths.Select(x => new PB.ExclusionSets(GUIDUtils.ToGUID(x), x)).ToArray()); PB.i.exclusionAssets = PB.i.exclusionAssets.Distinct(x => x.GUID).ToList(); PB.Save(); } string[] DirFiles(string path) { return(DirectoryUtils.GetFiles(path.ToCast <string>(), "*", SearchOption.AllDirectories).Where(x => x.Extension() != ".meta").ToArray()); } if (evt.type == EventType.DragPerform) { DragAndDrop.AcceptDrag(); if (DragAndDrop.paths.Length == 1) { if (Directory.Exists(DragAndDrop.paths[0])) { var m = new GenericMenu(); m.AddItem(S._Registerasafolder, false, (context) => { AddFiles(context.ToCast <string>()); }, DragAndDrop.paths[0]); m.AddItem(S._Registeringfilescontainedinafolder, false, (context) => { AddFiles(DirFiles(context.ToCast <string>())); ; }, DragAndDrop.paths[0]); m.DropDown(); } else { AddFiles(DragAndDrop.paths); } } else { bool dirChekc = false; foreach (var s in DragAndDrop.paths) { if (Directory.Exists(s)) { dirChekc = true; break; } } if (dirChekc) { var m = new GenericMenu(); m.AddItem(S._Registerasafolder, false, (context) => { AddFiles(context.ToCast <string[]>()); }, DragAndDrop.paths); m.AddItem(S._Registeringfilescontainedinafolder, false, (context) => { foreach (var s in context.ToCast <string[]>()) { if (Directory.Exists(s)) { AddFiles(DirFiles(s)); } else { AddFiles(s); } } }, DragAndDrop.paths); m.DropDown(); } else { AddFiles(DragAndDrop.paths); } } DragAndDrop.activeControlID = 0; s_exclusionContents = null; } s_changed = true; Event.current.Use(); break; } if (EditorGUI.EndChangeCheck()) { s_changed = true; } }