///////////////////////////////////////// internal static void DrawToolPanel(SceneView sceneView) { if (!E.i.tools) { return; } var cont = EditorHelper.TempContent(EditorIcon.viewtoolorbit); //var size = EditorStyles.miniButton.CalcSize( cont, GUILayout.Width(32) ); var x = (Screen.width * 0.5f) - (128 * 0.5f); var y = Screen.height - (24 * 2) - (8 * 2); Rect r = new Rect(x, y, 128 + 4, 20); ScopeArea.Begin(r); ScopeHorizontal.Begin(); GUILayout.FlexibleSpace(); SelectionHierarchy.current?.ComponetToolGUI(); GUILayout.FlexibleSpace(); ScopeHorizontal.End(); ScopeArea.End(); ScopeArea.Begin(new Rect(Screen.width - 200, 120, 200, Screen.height - 100)); { #if ENABLE_TILEMAP if (s_tileOn) { ShowWindowButton(UnityTypes.UnityEditor_Tilemaps_GridPaintPaletteWindow, "Tile Pallete", EditorIcon.icons_processed_unityengine_tilemaps_tilemap_icon_asset); } #endif SelectionHierarchy.current?.SideButtonGUI(); } ScopeArea.End(); }
///////////////////////////////////////// void DrawLeftPane() { ScopeHorizontal.Begin(EditorStyles.toolbar); EditorGUILayout.LabelField("manifest.json"); GUILayout.FlexibleSpace(); if (HGUIToolbar.Button(EditorHelper.TempContent(SS._Apply))) { Utils.ApplyModifyList(); ManifestJsonUtils.Save(); } ScopeHorizontal.End(); m_treeViewL.DrawLayoutGUI(); }
public static void DrawGUI() { var method1 = AssemblieUtils.GetAllMethodsWithAttribute <Hananoki_OnOpenAsset>().ToArray(); Helper.New(ref E.i.m_enableOnOpen); foreach (var p in method1) { var cus = p.GetCustomAttributes(typeof(Hananoki_OnOpenAsset), false).OfType <Hananoki_OnOpenAsset>().ToList(); //cus.Find(x=>) ScopeHorizontal.Begin(EditorStyles.helpBox); ScopeVertical.Begin(GUILayout.Height(40), GUILayout.Width(20)); GUILayout.FlexibleSpace(); var hash = p.GetHash_OnOpenAsset(); int idx = E.i.m_enableOnOpen.IndexOf(hash); ScopeChange.Begin(); var _enable = EditorGUILayout.Toggle(0 <= idx, GUILayout.Width(20)); if (ScopeChange.End()) { if (_enable) { E.i.m_enableOnOpen.Add(hash); } else { E.i.m_enableOnOpen.Remove(hash); } E.Save(); Association.MakeMethods(true); } GUILayout.FlexibleSpace(); ScopeVertical.End(); ScopeVertical.Begin(); EditorGUILayout.LabelField(EditorHelper.TempContent($"{p.Name} : { cus[ 0 ].GetName()}", EditorIcon.assetIcon_CsScript)); EditorGUI.indentLevel++; EditorGUILayout.LabelField(EditorHelper.TempContent($"{p.Module.Name}", EditorIcon.icons_processed_assembly_icon_asset)); EditorGUI.indentLevel--; ScopeVertical.End(); ScopeHorizontal.End(); } }
//void OnDisable() { // var tilemap = self.GetComponent<Tilemap>(); // if( tilemap ) { // tilemap.color = ColorUtils.Alpha( tilemap.color, 1.0f ); // } //} public override void OnInspectorGUI() { base.OnInspectorGUI(); var tilemap = self.GetComponent <Tilemap>(); if (tilemap) { EditorGUILayout.LabelField("Tilemap", EditorStyles.boldLabel); EditorGUI.BeginChangeCheck(); var a = EditorGUILayout.Slider("Alpha", tilemap.color.a, 0.00f, 1.00f); if (EditorGUI.EndChangeCheck()) { tilemap.color = ColorUtils.RGBA(tilemap.color, a); } } #if ENABLE_TILEMAP var window = EditorWindowUtils.Find(UnityTypes.UnityEditor_Tilemaps_GridPaintPaletteWindow); if (window == null) { return; } var clipboardView = window.GetProperty <object>("clipboardView"); var _tileBase = clipboardView.GetProperty <TileBase>("activeTile"); if (_tileBase != m_tileBase) { m_tileBase = _tileBase; m_tileBaseEditor = Editor.CreateEditor(m_tileBase); } if (m_tileBaseEditor != null) { ScopeVertical.Begin(EditorStyles.helpBox); ScopeHorizontal.Begin(); EditorGUILayout.LabelField("Active Tile", EditorStyles.boldLabel); GUILayout.FlexibleSpace(); if (GUILayout.Button("Delete")) { UnityObject.DestroyImmediate(_tileBase, true); } ScopeHorizontal.End(); m_tileBaseEditor.OnInspectorGUI(); ScopeVertical.End(); } #endif }
///////////////////////////////////////// internal static bool ShowSideButton(string text, Texture2D image) { bool result = false; ScopeHorizontal.Begin(); GUILayout.FlexibleSpace(); var contt = EditorHelper.TempContent(text, image); var rr = GUILayoutUtility.GetRect(contt, Styles.rightButton, GUILayout.Width(text.CalcSizeFromLabel().x + 16 + 4)); EditorGUI.DrawRect(rr, E.i.uiBkColor); if (GUI.Button(rr, contt, Styles.rightButton)) { result = true; } ScopeHorizontal.End(); return(result); }
///////////////////////////////////////// public override void OnDefaultGUI() { ScopeIsCompile.Begin(); DrawToolBar(); var ww = (position.width - 40) * 0.5f; ScopeHorizontal.Begin(); ///////////////////////////////////////// ScopeVertical.Begin(GUILayout.Width(ww)); DrawLeftPane(); ScopeVertical.End(); ///////////////////////////////////////// ScopeVertical.Begin(HEditorStyles.dopesheetBackground, GUILayout.Width(40)); GUILayout.FlexibleSpace(); ScopeDisable.Begin(!m_treeViewL.HasSelection()); if (GUILayout.Button(">>")) { m_treeViewL.選択パッケージをアンインストール指定する(); } ScopeDisable.End(); GUILayout.Space(16); ScopeDisable.Begin(!m_treeViewR.HasSelection()); if (GUILayout.Button("<<")) { m_treeViewR.選択パッケージをインストール指定する(); } ScopeDisable.End(); GUILayout.FlexibleSpace(); ScopeVertical.End(); ///////////////////////////////////////// ScopeVertical.Begin(HEditorStyles.dopesheetBackground, GUILayout.Width(ww)); DrawRightPane(); ScopeVertical.End(); ScopeHorizontal.End(); ScopeIsCompile.End(); }
public override void OnDefaultGUI() { ////////////////////// EditorGUILayout.LabelField("Assembly Definition References", EditorStyles.boldLabel); ScopeVertical.Begin(EditorStyles.helpBox); foreach (var e in m_reference) { e.toggle = HEditorGUILayout.ToggleLeft(e.asmname, e.toggle); } ScopeVertical.End(); ////////////////////// GUILayout.FlexibleSpace(); ScopeHorizontal.Begin(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Apply")) { Apply(); } GUILayout.Space(8); ScopeHorizontal.End(); GUILayout.Space(8); }
static void DrawContentConfig() { ScopeChange.Begin(); //PB.i.enableAssetBundleBuild = HEditorGUILayout.ToggleLeft( S._EnableAssetBundleBuild, PB.i.enableAssetBundleBuild ); //HEditorGUI.DrawDebugRectAtLastRect(); 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 => x.GUID.ToAssetPath()).OrderBy(value => value).Select(x => new GUIContent(x, AssetDatabase.GetCachedIcon(x))).ToArray(); } int removeIndex = -1; ScopeVertical.Begin(EditorStyles.helpBox); for (int i = 0; i < s_exclusionContents.Length; i++) { var s = s_exclusionContents[i]; ScopeHorizontal.Begin(); GUILayout.Label(EditorHelper.TempContent(""), GUILayout.ExpandWidth(true), GUILayout.Height(18)); ScopeHorizontal.End(); 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, EditorIcon.minus)) { removeIndex = i; } } GUILayout.FlexibleSpace(); if (0 <= removeIndex) { var findGUID = s_exclusionContents[removeIndex].text.ToGUID(); var rIndex = PB.i.exclusionAssets.FindIndex(x => x.GUID == findGUID); PB.i.exclusionAssets.RemoveAt(rIndex); s_exclusionContents = null; s_changed = true; } ScopeVertical.End(); 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(x.ToGUID(), x)).ToArray()); PB.i.exclusionAssets = PB.i.exclusionAssets.Distinct(x => x.GUID).ToList(); PB.Save(); } string[] DirFiles(string path) { return(DirectoryUtils.GetFiles(path, "*", 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((string)context); }, DragAndDrop.paths[0]); m.AddItem(S._Registeringfilescontainedinafolder, false, (context) => { AddFiles(DirFiles((string)context)); ; }, DragAndDrop.paths[0]); m.DropDownAtMousePosition(); } 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((string[])context); }, DragAndDrop.paths); m.AddItem(S._Registeringfilescontainedinafolder, false, (context) => { foreach (var s in ((string[])context)) { if (Directory.Exists(s)) { AddFiles(DirFiles(s)); } else { AddFiles(s); } } }, DragAndDrop.paths); m.DropDownAtMousePosition(); } else { AddFiles(DragAndDrop.paths); } } DragAndDrop.activeControlID = 0; s_exclusionContents = null; } s_changed = true; Event.current.Use(); break; } if (ScopeChange.End()) { s_changed = true; } }
static void LabelBox(string text) { ScopeHorizontal.Begin(EditorStyles.helpBox); GUILayout.Label(text); ScopeHorizontal.End(); }
public static void DrawGUI() { E.Load(); HEditorGUILayout.HeaderTitle(SS._General); if (m_localeNames == null) { m_localeNames = new List <EditorLocalize.LCIDString>(); // EditorLocalize.s_lcidTable.OrderBy( x => x.NAME ).ToList(); var files = "95cedfc7731853946b0b3650f175d73a".GetFilesFromAssetGUID().Select(x => x.FileNameWithoutExtension()).ToList(); foreach (var rp in files) { var p = EditorLocalize.s_lcidTable.Find(x => x.LCID == rp); if (p == null) { continue; } m_localeNames.Add(p); } m_localeNames = m_localeNames.OrderBy(x => x.NAME).ToList(); } ScopeChange.Begin(); var idx = m_localeNames.FindIndex(x => x.LCID == E.i.LCID); if (idx < 0) { idx = m_localeNames.FindIndex(x => x.LCID == "en-US"); } idx = EditorGUILayout.Popup(S._Language, idx, m_localeNames.Select(x => x.NAME).ToArray()); if (ScopeChange.End()) { E.i.LCID = m_localeNames[idx].LCID; E.LoadLocalize(); E.Save(); } ////////////////////////////////// ScopeChange.Begin(); GUILayout.Space(4); var _versionTextColor = EditorGUILayout.ColorField(S._VersionTextColor, E.i.versionTextColor.value); var _versionBackColor = EditorGUILayout.ColorField(S._VersionBackColor, E.i.versionBackColor.value); var _windowShade = HEditorGUILayout.ToggleLeft(S._WindowShade, E.i.m_windowShade); var _uielementsFontFix = HEditorGUILayout.ToggleLeft("UIElements Font Fix", E.i.m_uielementsFontFix); if (ScopeChange.End()) { E.i.versionTextColor.value = _versionTextColor; E.i.versionBackColor.value = _versionBackColor; E.i.m_windowShade = _windowShade; E.i.m_uielementsFontFix = _uielementsFontFix; E.Save(); EditorWindowUtils.RepaintProjectWindow(); } ////////////////////////////////// ScopeChange.Begin(); GUILayout.Space(8); HEditorGUILayout.HeaderTitle("AssetPostprocessor"); E.i.m_asmdefNameSync = HEditorGUILayout.ToggleLeft(S._MaketheNamefieldthesameasthefilenamewhenimportingasmdef, E.i.m_asmdefNameSync); ScopeDisable.Begin(true); E.i.m_asmdefAutoReferenceOFF = HEditorGUILayout.ToggleLeft(S._TurnoffAutoReferencedwhenimportingasmdef, E.i.m_asmdefAutoReferenceOFF); if (E.i.m_asmdefAutoReferenceOFF) { E.i.m_asmdefAutoReferenceOFF = false; E.Save(); } ScopeDisable.End(); //E.i.m_disableSyncVS = HEditorGUILayout.ToggleLeft( "Kill SyncVS", E.i.m_disableSyncVS ); //E.i.utilityWindow = EditorGUILayout.ToggleLeft( SS._UtilityWindowMode, E.i.utilityWindow ); if (ScopeChange.End()) { E.Save(); } ////////////////////////////////// GUILayout.Space(8); HEditorGUILayout.HeaderTitle(S._WheretosaveProjectsettings); HEditorGUILayout.PreviewFolder(E.i.GetProjectSettingsPath(), OnProjectFolderPreset); GUILayout.Space(8f); ScopeHorizontal.Begin(); GUILayout.FlexibleSpace(); if (GUILayout.Button(SS._ReturnToDefault)) { E.i.versionTextColor = new EditorColor(ColorUtils.RGB(72), ColorUtils.RGB(173)); E.i.versionBackColor = new EditorColor(ColorUtils.RGB(242), ColorUtils.RGB(41)); //E.i.utilityWindow = false; E.Save(); } ScopeHorizontal.End(); //HGUILayout.LinkLabel( "hoge" ); //#if ENABLE_HANANOKI_SETTINGS && LOCAL_TEST // using( new GUILayout.HorizontalScope() ) { // GUILayout.FlexibleSpace(); // if( GUILayout.Button( "Open Settings" ) ) { // SettingsWindow.Open(); // } // } //#endif }