public static GUIStyle CachedLabelTitleStyle() { return(EditorGUIStyleUtil.CachedStyle("EditorGUIStyleUtil::LabelTitle", GUI.skin.label, (style) => { style.fontSize = 14; style.fontStyle = FontStyle.Bold; })); }
public static GUIStyle CachedAlignedButtonStyle() { return(EditorGUIStyleUtil.CachedStyle("EditorGUIStyleUtil::AlignedButton", GUI.skin.button, (style) => { style.margin.top = 0; style.padding.top = 3; })); }
public static GUIStyle CachedColorlessFoldoutStyle() { return(EditorGUIStyleUtil.CachedStyle("EditorGUIStyleUtil::ColorlessFoldout", EditorStyles.foldout, (style) => { style.hover.textColor = style.normal.textColor; style.focused.textColor = style.normal.textColor; style.active.textColor = style.normal.textColor; style.onFocused.textColor = style.normal.textColor; style.onNormal.textColor = style.normal.textColor; style.onHover.textColor = style.normal.textColor; style.onActive.textColor = style.normal.textColor; style.hover.background = style.normal.background; style.focused.background = style.normal.background; style.active.background = style.normal.background; style.onHover.background = style.onNormal.background; style.onFocused.background = style.onNormal.background; style.onActive.background = style.onNormal.background; })); }
private void OnGUI() { EditorGUILayout.BeginVertical(GUILayout.Height(kTopBarSize)); EditorGUILayout.BeginHorizontal(); EditorGUILayout.LabelField("Validate:", GUILayout.Width(50.0f)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); ValidateScriptableObjects_ = GUILayout.Toggle(ValidateScriptableObjects_, "Scriptable Objects", GUILayout.ExpandWidth(false)); ValidatePrefabsInResources_ = GUILayout.Toggle(ValidatePrefabsInResources_, "Prefabs in Resources", GUILayout.ExpandWidth(false)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); ValidateSavedScenes_ = GUILayout.Toggle(ValidateSavedScenes_, "Saved Scenes", GUILayout.ExpandWidth(false)); ValidateBuildScenes_ = GUILayout.Toggle(ValidateBuildScenes_, "Build Scenes", GUILayout.ExpandWidth(false)); ValidateOpenScenes_ = GUILayout.Toggle(ValidateOpenScenes_, "Open Scenes", GUILayout.ExpandWidth(false)); EditorGUILayout.EndHorizontal(); EditorGUILayout.BeginHorizontal(); string buttonTitle = "Validate!"; if (validationTimeInMS_ != null) { buttonTitle += string.Format(" ({0:0.00}s)", validationTimeInMS_.Value / 1000.0f); } if (GUILayout.Button(buttonTitle)) { Validate(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); ScrollPosition_ = EditorGUILayout.BeginScrollView(ScrollPosition_); int index = 0; foreach (IValidationError error in validationErrors_.OrderBy(error => error.GetContextObjectName())) { Color color = index % 2 == 0 ? kErrorEvenColor.Value : kErrorOddColor.Value; EditorGUILayout.BeginVertical(EditorGUIStyleUtil.StyleWithBackgroundColor(color)); var horizontalStyle = EditorGUIStyleUtil.CachedStyle("DTValidatorWindow::HorizontalMarginStyle", GUIStyle.none, (style) => { style.padding.top = 5; style.padding.left = 5; style.padding.bottom = 2; style.margin.bottom = 3; }); EditorGUILayout.BeginHorizontal(horizontalStyle); var boxStyle = EditorGUIStyleUtil.StyleWithTexture(error.GetContextIcon(), (GUIStyle style) => { style.margin.top = 8; }); GUILayout.Box("", boxStyle, GUILayout.Height(15.0f), GUILayout.Width(15.0f)); EditorGUILayout.BeginVertical(); EditorGUILayout.LabelField(error.GetContextObjectName(), EditorGUIStyleUtil.CachedLabelTitleStyle(), EditorGUIStyleUtil.TitleHeight); var componentError = error as ComponentValidationError; if (componentError != null) { EditorGUILayout.LabelField(componentError.ComponentPath); } EditorGUILayout.BeginHorizontal(); var missingMonoScriptError = error as MissingMonoScriptValidationError; if (missingMonoScriptError != null && error.MemberInfo == null) { EditorGUILayout.LabelField(string.Format(" >Missing script on '{0}'!", missingMonoScriptError.GameObjectPath)); } else { EditorGUILayout.LabelField(string.Format(" >Missing '{1}' on script '{0}'", error.MemberInfo.DeclaringType.Name, error.MemberInfo.Name)); } if (GUILayout.Button("Select In Editor", EditorGUIStyleUtil.CachedAlignedButtonStyle(), GUILayout.ExpandWidth(false))) { error.SelectInEditor(); } EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); EditorGUILayout.EndHorizontal(); EditorGUILayout.EndVertical(); index++; } EditorGUILayout.EndScrollView(); }
private static GUIStyle CachedStyleWithWordWrap(string key, GUIStyle baseStyle) { return(EditorGUIStyleUtil.CachedStyle(key, baseStyle, (style) => style.wordWrap = true)); }