public void OnGUILayout() { if (IsShowScroll) { scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.ExpandHeight(false)); } EditorGUILayout.BeginVertical(); { foreach (var typeDrawProperty in typeDrawerProperties) { EGUILayout.DrawHorizontalSpace(10); EGUILayout.DrawBoxHeader(typeDrawProperty.type.Name, GUILayout.ExpandWidth(true)); EGUILayout.DrawHorizontalLine(); foreach (var property in typeDrawProperty.drawerProperties) { property.OnGUILayout(); } } } EditorGUILayout.EndVertical(); if (IsShowScroll) { EditorGUILayout.EndScrollView(); } if (drawerObject != null && typeof(UnityEngine.Object).IsAssignableFrom(drawerObject.GetType())) { if (GUI.changed) { EditorUtility.SetDirty((UnityEngine.Object)drawerObject); } } }
public override void OnInspectorGUI() { EGUILayout.DrawScript(target); EditorGUILayout.Space(); EGUI.BeginGUIColor(Color.grey); { EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EGUILayout.DrawBoxHeader("Native Drawer Setting", GUILayout.ExpandWidth(true)); EGUI.BeginIndent(); { NativeDrawerSetting.IsShowHelp = EditorGUILayout.Toggle("Is Show Help", NativeDrawerSetting.IsShowHelp); } EGUI.EndIndent(); } EditorGUILayout.EndVertical(); } EGUI.EndGUIColor(); EditorGUILayout.Space(); EGUI.BeginLabelWidth(GetLabelWidth()); { drawerObject.OnGUILayout(); } EGUI.EndLableWidth(); }
private void DrawParts(Rect rect) { GUILayout.BeginArea(rect); { EditorGUILayout.BeginVertical(); { EGUILayout.DrawBoxHeader("Part Data", EGUIStyles.BoxedHeaderCenterStyle, GUILayout.ExpandWidth(true)); if (currentCreatorData != null && partOutputDataDrawer != null) { partOutputDataDrawer.OnGUILayout(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Create Parts")) { AvatarSkeletonPartCreatorData partOutputData = currentCreatorData.skeletonPartData; foreach (var data in partOutputData.partDatas) { if (!CreatePart(data)) { break; } } } } } EditorGUILayout.EndVertical(); } GUILayout.EndArea(); }
public void OnGUILayout() { string label = string.IsNullOrEmpty(Header) ? "" : Header; GUILayoutOption expandWidthOption = GUILayout.ExpandWidth(IsExpandWidth); GUIStyle style = IsLayoutCenter ? EGUIStyles.BoxedHeaderCenterStyle : EGUIStyles.BoxedHeaderStyle; EGUILayout.DrawBoxHeader(label, style, expandWidthOption); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); serializedObject.Update(); { EditorGUILayout.BeginVertical(EditorStyles.helpBox); { registParamsRLProperty.OnGUILayout(); } EditorGUILayout.EndVertical(); if (deleteIndex >= 0) { registParamGroupsProperty.RemoveElementAt(deleteIndex); RefreshRegistParamGroups(); deleteIndex = -1; } EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EGUILayout.DrawBoxHeader("Regist Param", GUILayout.ExpandWidth(true)); Rect lastRect = GUILayoutUtility.GetLastRect(); Rect addBtnRect = new Rect(lastRect.x + lastRect.width - 60, lastRect.y, 60, lastRect.height); if (GUI.Button(addBtnRect, "Add")) { registParamGroupsProperty.InsertArrayElementAtIndex(registParamGroupsProperty.arraySize); RefreshRegistParamGroups(); } for (int i = 0; i < registParamGroupsProperty.arraySize; ++i) { SerializedProperty lopaProperty = registParamGroupsProperty.GetArrayElementAtIndex(i); EditorGUILayout.BeginHorizontal(); { EditorGUILayout.BeginVertical(); { SerializedProperty nameProperty = lopaProperty.FindPropertyRelative("name"); EditorGUILayout.PropertyField(nameProperty); registParamGroupsRLProperties[i].OnGUILayout(); } EditorGUILayout.EndVertical(); if (GUILayout.Button("Delete", GUILayout.Width(60))) { deleteIndex = i; } } EditorGUILayout.EndHorizontal(); EGUILayout.DrawHorizontalLine(); } } EditorGUILayout.EndVertical(); } serializedObject.ApplyModifiedProperties(); }
public override void OnGUILayout() { BeginGroupAttribute attr = GetAttr <BeginGroupAttribute>(); EditorGUILayout.BeginVertical(EditorStyles.helpBox, GUILayout.ExpandWidth(true)); if (!string.IsNullOrEmpty(attr.Label)) { EGUILayout.DrawBoxHeader(attr.Label, GUILayout.ExpandWidth(true)); } }
public void OnGUILayout() { if (!string.IsNullOrEmpty(HeaderContent)) { EGUILayout.DrawBoxHeader(HeaderContent, EGUIStyles.BoxedHeaderCenterStyle, GUILayout.ExpandWidth(true)); } Rect rect = GUILayoutUtility.GetRect(GUIContent.none, GUIStyle.none, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); treeView?.OnGUI(rect); }
private void DrawSkeleton(Rect rect) { GUILayout.BeginArea(rect); { EditorGUILayout.BeginVertical(); { EGUILayout.DrawBoxHeader("Skeleton Data", EGUIStyles.BoxedHeaderCenterStyle, GUILayout.ExpandWidth(true)); if (currentCreatorData != null && skeletonCreatorDataDrawer != null) { skeletonCreatorDataDrawer.OnGUILayout(); AvatarSkeletonCreatorData skeletonCreatorData = currentCreatorData.skeletonData; string targetPrefabPath = skeletonCreatorData.GetSkeletonPrefabPath(); GameObject targetPrefab = null; if (!string.IsNullOrEmpty(targetPrefabPath)) { targetPrefab = AssetDatabase.LoadAssetAtPath <GameObject>(targetPrefabPath); } EditorGUILayout.Space(); EditorGUILayout.Space(); EditorGUILayout.ObjectField("Output", targetPrefab, typeof(GameObject), false); EditorGUILayout.Space(); GUILayout.FlexibleSpace(); if (GUILayout.Button("Create Skeleton")) { GameObject skeletonPrefab = AvatarCreatorUtil.CreateSkeleton(skeletonCreatorData); if (skeletonPrefab == null) { EditorUtility.DisplayDialog("Error", "Create Failed.\n Please view the details from the console!!!", "OK"); } else { SelectionUtility.PingObject(skeletonPrefab); } } if (GUILayout.Button("Preview Skeleton")) { PreviewSkeleton(); } } } EditorGUILayout.EndVertical(); } GUILayout.EndArea(); }
public override void OnGUI(Rect rect) { GUILayout.BeginArea(rect); { EGUILayout.DrawBoxHeader("Setting", EGUIStyles.BoxedHeaderCenterStyle, GUILayout.ExpandWidth(true)); EditorGUILayout.Space(); scrollPos = EditorGUILayout.BeginScrollView(scrollPos); { if (m_Setting != null) { EditorGUI.BeginChangeCheck(); { m_Setting.GlobalSetting.GlobalLogLevel = (LogLevel)EditorGUILayout.EnumPopup("Global Log Level:", m_Setting.GlobalSetting.GlobalLogLevel); } if (EditorGUI.EndChangeCheck()) { LogViewer.Viewer.ChangeGlobalLogLevel(m_Setting.GlobalSetting.GlobalLogLevel); } if (m_Setting.LoggerSettings.Count > 0) { EditorGUILayout.LabelField("Logger Log Level:"); EGUI.BeginIndent(); { foreach (var loggerSetting in m_Setting.LoggerSettings) { EditorGUI.BeginChangeCheck(); { EditorGUILayout.LabelField(loggerSetting.Name); EGUI.BeginIndent(); { loggerSetting.MinLogLevel = (LogLevel)EditorGUILayout.EnumPopup("Min Log Level:", loggerSetting.MinLogLevel); loggerSetting.StackTraceLogLevel = (LogLevel)EditorGUILayout.EnumPopup("StackTrace Log Level:", loggerSetting.StackTraceLogLevel); } EGUI.EndIndent(); } if (EditorGUI.EndChangeCheck()) { LogViewer.Viewer.ChangeLoggerLogLevel(loggerSetting.Name, loggerSetting.MinLogLevel, loggerSetting.StackTraceLogLevel); } } } EGUI.EndIndent(); } } } EditorGUILayout.EndScrollView(); } GUILayout.EndArea(); }
protected internal override void OnGUI(Rect rect) { GUILayout.BeginArea(rect); { scrollPos = EditorGUILayout.BeginScrollView(scrollPos, EditorStyles.helpBox); { EGUILayout.DrawBoxHeader("Assembly Type List", GUILayout.ExpandWidth(true)); foreach (var typeData in assemblyTypes) { if (!typeData.IsStruct() && !typeData.IsEnum()) { continue; } string fullName = typeData.Type.FullName; if (!string.IsNullOrEmpty(searchText) && fullName.ToLower().IndexOf(searchText.ToLower()) < 0) { continue; } if (genConfig.callCSharpTypeNames.IndexOf(fullName) < 0 && genConfig.callLuaTypeNames.IndexOf(fullName) < 0) { continue; } bool isSelected = genConfig.optimizeTypeNames.IndexOf(fullName) >= 0; bool tempIsSelected = EditorGUILayout.ToggleLeft(typeData.Type.FullName, isSelected); if (tempIsSelected != isSelected) { if (tempIsSelected) { genConfig.optimizeTypeNames.Add(fullName); } else { genConfig.optimizeTypeNames.Remove(fullName); } } } } EditorGUILayout.EndScrollView(); } GUILayout.EndArea(); }
internal static void OnDrawSetting() { EGUILayout.DrawHorizontalSpace(8); EGUI.BeginGUIColor(Color.grey); { EditorGUILayout.BeginVertical(EditorStyles.helpBox); { EGUILayout.DrawBoxHeader("Native Drawer Setting", GUILayout.ExpandWidth(true)); EGUI.BeginIndent(); { IsShowHelp = EditorGUILayout.Toggle("Is Show Help", IsShowHelp); } EGUI.EndIndent(); } EditorGUILayout.EndVertical(); } EGUI.EndGUIColor(); EGUILayout.DrawHorizontalSpace(8); }
public override void OnGUILayout() { EGUILayout.DrawBoxHeader(Label, GUILayout.ExpandWidth(true)); if (operater == null) { operater = ItemDrawer.Value as Operater; listDrawer = new ArrayDrawer(operater.rules); listDrawer.Header = "Operation Rules"; listDrawer.IsShowBox = true; listDrawer.IsShowInherit = false; listDrawer.CreateNewItem = () => { ShowMenuToCreateOperationRule((rule) => { operater.rules.Add(rule); listDrawer.Refresh(); }); }; listDrawer.ClearAllItem = () => { operater.rules.Clear(); listDrawer.Refresh(); }; listDrawer.DeleteItemAt = (index) => { operater.rules.RemoveAt(index); listDrawer.Refresh(); }; } EGUI.BeginIndent(); { operater.enable = EditorGUILayout.Toggle("enable", operater.enable); listDrawer.OnGUILayout(); } EGUI.EndIndent(); }
private void OnGUI() { DrawToolbar(); if (dragLineDrawer == null) { dragLineDrawer = new DragLineDrawer(this, DragLineDirection.Vertical); } Rect cRect = EditorGUILayout.GetControlRect(GUILayout.ExpandHeight(true), GUILayout.ExpandWidth(true)); if (cRect != contentRect && cRect.width > 10 && cRect.height > 10) { contentRect = cRect; dragLineDrawer.Position = new Rect(contentRect.x + 300, contentRect.y, 6, contentRect.height); } dragLineDrawer.LowLimitXY = 200; dragLineDrawer.UpperLimitXY = contentRect.width * 0.8f; dragLineDrawer.OnGUILayout(); Rect listViewRect = new Rect(contentRect.x, contentRect.y, dragLineDrawer.MinX - contentRect.x, contentRect.height); // EGUI.DrawAreaLine(listViewRect, Color.blue); GUILayout.BeginArea(listViewRect); { configListView.OnGUILayout(); } GUILayout.EndArea(); Rect objectRect = new Rect(dragLineDrawer.MaxX, contentRect.y, contentRect.width - dragLineDrawer.MaxX, contentRect.height); // EGUI.DrawAreaLine(objectRect, Color.yellow); GUILayout.BeginArea(objectRect); { EGUILayout.DrawBoxHeader("Checker", EGUIStyles.BoxedHeaderCenterStyle, GUILayout.ExpandWidth(true)); checkerDrawer?.OnGUILayout(); } GUILayout.EndArea(); }
public override void OnGUILayout() { EGUILayout.DrawBoxHeader(Label, GUILayout.ExpandWidth(true)); if (matcher == null) { matcher = ItemDrawer.Value as Matcher; listDrawer = new ArrayDrawer(matcher.filters); listDrawer.Header = "Filters"; listDrawer.IsShowBox = true; listDrawer.IsShowInherit = false; listDrawer.CreateNewItem = () => { ShowMenuToCreateMatchFilter((filter) => { matcher.filters.Add(filter); listDrawer.Refresh(); }); }; listDrawer.ClearAllItem = () => { matcher.filters.Clear(); listDrawer.Refresh(); }; listDrawer.DeleteItemAt = (index) => { matcher.filters.RemoveAt(index); listDrawer.Refresh(); }; } EGUI.BeginIndent(); { matcher.enable = EditorGUILayout.Toggle("enable", matcher.enable); listDrawer.OnGUILayout(); } EGUI.EndIndent(); }
public override void OnGUI(Rect rect) { GUILayout.BeginArea(rect); { EditorGUILayout.BeginVertical(); { EGUILayout.DrawBoxHeader("Setting", EGUIStyles.BoxedHeaderCenterStyle, GUILayout.ExpandWidth(true)); EditorGUILayout.Space(); CheckerSetting setting = CheckerUtility.ReadSetting(); setting.isFolderAsAsset = EditorGUILayout.Toggle("Is Asset For Folder", setting.isFolderAsAsset); GUILayout.FlexibleSpace(); if (GUILayout.Button("Close")) { Window.CloseWindow(); } } EditorGUILayout.EndVertical(); } GUILayout.EndArea(); }
public override void OnGUILayout() { BoxedHeaderAttribute attr = GetAttr <BoxedHeaderAttribute>(); EGUILayout.DrawBoxHeader(attr.Header, GUILayout.ExpandWidth(true)); }
protected internal override void OnGUI(Rect rect) { GUILayout.BeginArea(rect); { scrollPos = EditorGUILayout.BeginScrollView(scrollPos, EditorStyles.helpBox); { EGUILayout.DrawBoxHeader("Assembly Type List", GUILayout.ExpandWidth(true)); foreach (var typeData in assemblyTypes) { string fullName = typeData.Type.FullName; if (typeData.IsEnum()) { continue; } if (!string.IsNullOrEmpty(searchText) && fullName.ToLower().IndexOf(searchText.ToLower()) < 0) { continue; } if (genConfig.callCSharpTypeNames.IndexOf(fullName) < 0 && genConfig.callLuaTypeNames.IndexOf(fullName) < 0) { continue; } EGUI.BeginIndent(); { typeData.IsFoldout = EditorGUILayout.Foldout(typeData.IsFoldout, fullName, true); if (typeData.IsFoldout) { EGUI.BeginIndent(); { Rect fieldRect = GUILayoutUtility.GetRect(new GUIContent("Fields"), EGUIStyles.BoxedHeaderStyle, GUILayout.ExpandWidth(true)); EditorGUI.LabelField(fieldRect, GUIContent.none, EGUIStyles.BoxedHeaderStyle); typeData.IsFieldFoldout = EditorGUI.Foldout(fieldRect, typeData.IsFieldFoldout, "Fields"); if (typeData.IsFieldFoldout) { EGUI.BeginIndent(); { foreach (var field in typeData.Fields) { string fieldName = $"{typeData.Type.FullName}${field.Name}"; bool isSelected = genConfig.blackDatas.IndexOf(fieldName) >= 0; bool tempIsSelected = EditorGUILayout.ToggleLeft(fieldName, isSelected); if (isSelected != tempIsSelected) { if (tempIsSelected) { genConfig.blackDatas.Add(fieldName); } else { genConfig.blackDatas.Remove(fieldName); } } } } EGUI.EndIndent(); } Rect propertyRect = GUILayoutUtility.GetRect(new GUIContent("Properties"), EGUIStyles.BoxedHeaderStyle, GUILayout.ExpandWidth(true)); EditorGUI.LabelField(propertyRect, GUIContent.none, EGUIStyles.BoxedHeaderStyle); typeData.IsPropertyFoldout = EditorGUI.Foldout(propertyRect, typeData.IsPropertyFoldout, "Properties"); if (typeData.IsPropertyFoldout) { EGUI.BeginIndent(); { foreach (var property in typeData.Properties) { string propertyName = $"{typeData.Type.FullName}${property.Name}"; bool isSelected = genConfig.blackDatas.IndexOf(propertyName) >= 0; bool tempIsSelected = EditorGUILayout.ToggleLeft(propertyName, isSelected); if (isSelected != tempIsSelected) { if (tempIsSelected) { genConfig.blackDatas.Add(propertyName); } else { genConfig.blackDatas.Remove(propertyName); } } } } EGUI.EndIndent(); } Rect methodRect = GUILayoutUtility.GetRect(new GUIContent("Methods"), EGUIStyles.BoxedHeaderStyle, GUILayout.ExpandWidth(true)); EditorGUI.LabelField(methodRect, GUIContent.none, EGUIStyles.BoxedHeaderStyle); typeData.IsMethodFoldout = EditorGUI.Foldout(methodRect, typeData.IsMethodFoldout, "Methods"); if (typeData.IsMethodFoldout) { EGUI.BeginIndent(); { foreach (var method in typeData.Methods) { if (method.Name.StartsWith("set_") || method.Name.StartsWith("get_") || method.Name.StartsWith("op_")) { continue; } ParameterInfo[] paramInfos = method.GetParameters(); string paramStr = ""; foreach (var pi in paramInfos) { paramStr += $"@{pi.ParameterType.FullName}"; } string methodName = $"{typeData.Type.FullName}${method.Name}{paramStr}"; bool isSelected = genConfig.blackDatas.IndexOf(methodName) >= 0; bool tempIsSelected = EditorGUILayout.ToggleLeft(methodName, isSelected); if (isSelected != tempIsSelected) { if (tempIsSelected) { genConfig.blackDatas.Add(methodName); } else { genConfig.blackDatas.Remove(methodName); } } } } EGUI.EndIndent(); } } EGUI.EndIndent(); } } EGUI.EndIndent(); } } EditorGUILayout.EndScrollView(); } GUILayout.EndArea(); }
protected override void DrawInstance() { EditorGUILayout.BeginVertical(EGUIStyles.BoxStyle); { EGUILayout.DrawBoxHeader(Header, GUILayout.ExpandWidth(true)); Rect lastRect = GUILayoutUtility.GetLastRect(); Rect clearBtnRect = new Rect(lastRect.x + lastRect.width - 40, lastRect.y, 40, lastRect.height); if (GUI.Button(clearBtnRect, "C", EditorStyles.toolbarButton)) { if (ClearAllItem != null) { ClearAllItem.Invoke(); } else { Clear(); } } IList list = Target as IList; for (int i = 0; i < list.Count; ++i) { EditorGUILayout.BeginHorizontal(); { EditorGUILayout.BeginVertical(); { itemDrawers[i].OnGUILayout(); } EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(GUILayout.Width(20)); { if (GUILayout.Button("-")) { if (DeleteItemAt != null) { DeleteItemAt(i); } else { RemoveItemAtIndex(i); } } } EditorGUILayout.EndVertical(); } EditorGUILayout.EndHorizontal(); EGUILayout.DrawHorizontalLine(); } Rect addBtnRect = GUILayoutUtility.GetRect(lastRect.width, 20); addBtnRect.x += addBtnRect.width - 40; addBtnRect.width = 40; if (GUI.Button(addBtnRect, "+")) { if (CreateNewItem != null) { CreateNewItem.Invoke(); } else { AddNewItemAtLast(); } } } EditorGUILayout.EndVertical(); }
protected internal override void OnGUI(Rect rect) { if (genericTypeRL == null) { genericTypeRL = new ReorderableList(genConfig.callLuaGenericTypeNames, typeof(string), true, true, true, true); genericTypeRL.elementHeight = EditorGUIUtility.singleLineHeight; genericTypeRL.drawHeaderCallback = (r) => { EditorGUI.LabelField(r, "Generic Type Names"); }; genericTypeRL.drawElementCallback = (r, index, isActive, isFocuse) => { Rect typeNameRect = new Rect(r.x, r.y, r.width - 60, r.height); genConfig.callLuaGenericTypeNames[index] = EditorGUI.TextField(typeNameRect, genConfig.callLuaGenericTypeNames[index]); Rect btnRect = new Rect(r.x + r.width - 60, r.y, 60, r.height); if (GUI.Button(btnRect, "Check")) { string typeName = genConfig.callLuaGenericTypeNames[index]; bool isValid = true; string errorMsg = string.Empty; if (string.IsNullOrEmpty(typeName)) { isValid = false; errorMsg = "Name is empty"; } else { string[] splitStr = typeName.Split(new char[] { '@' }, StringSplitOptions.RemoveEmptyEntries); if (splitStr == null || splitStr.Length == 0) { isValid = false; errorMsg = "The format of Name is Error"; } else if (splitStr.Length <= 1) { isValid = false; errorMsg = "The lenght of name is less than 2"; } else { string gName = splitStr[0]; string[] pNames = new string[splitStr.Length - 1]; Array.Copy(splitStr, 1, pNames, 0, pNames.Length); Type t = AssemblyUtility.GetGenericType(gName, pNames); if (t == null) { isValid = false; errorMsg = "Convert Failed"; } } } if (!isValid) { EditorUtility.DisplayDialog("Failed", errorMsg, "OK"); } else { EditorUtility.DisplayDialog("Success", "Success", "OK"); } } }; genericTypeRL.onAddCallback = (list) => { list.list.Add(string.Empty); }; } GUILayout.BeginArea(rect); { scrollPos = EditorGUILayout.BeginScrollView(scrollPos, EditorStyles.helpBox); { EGUILayout.DrawBoxHeader("Generic Type List", GUILayout.ExpandWidth(true)); EditorGUILayout.LabelField("Example:List<int> == System.Collections.Generic.List`[email protected]"); genericTypeRL.DoLayoutList(); EditorGUILayout.Space(); EGUILayout.DrawBoxHeader("Assembly Type List", GUILayout.ExpandWidth(true)); foreach (var typeData in assemblyTypes) { string fullName = typeData.Type.FullName; if (!string.IsNullOrEmpty(searchText) && fullName.ToLower().IndexOf(searchText.ToLower()) < 0) { continue; } bool isSelected = genConfig.callLuaTypeNames.IndexOf(fullName) >= 0; bool tempIsSelected = EditorGUILayout.ToggleLeft(typeData.Type.FullName, isSelected); if (tempIsSelected != isSelected) { if (tempIsSelected) { genConfig.callLuaTypeNames.Add(fullName); } else { genConfig.callLuaTypeNames.Remove(fullName); } } } } EditorGUILayout.EndScrollView(); } GUILayout.EndArea(); }