protected override void DrawProperty(MightySerializedField mightyMember, SerializedProperty property, T attribute) { if (property.propertyType != SerializedPropertyType.String) { MightyGUIUtilities.DrawPropertyField(property); MightyGUIUtilities.DrawHelpBox($"{attribute.GetType()} can be used only on string fields"); return; } if (!m_pathCache.Contains(mightyMember)) { EnableDrawer(mightyMember, attribute); } var defaultPath = m_pathCache[mightyMember].Value; EditorGUILayout.BeginHorizontal(); EditorGUILayout.PropertyField(property); if (MightyGUIUtilities.DrawButton("...", GUILayout.Width(35))) { var value = property.stringValue; value = DisplayPanel(property.displayName, !string.IsNullOrWhiteSpace(value) ? FileUtilities.GetDirectoryPath(value) ?? value : defaultPath, mightyMember, attribute); if (!string.IsNullOrWhiteSpace(value)) { property.stringValue = value; } } EditorGUILayout.EndHorizontal(); }
private static bool Button(string label) { var previousColor = GUI.backgroundColor; GUI.backgroundColor = Color.white; var pressed = MightyGUIUtilities.DrawButton(label, 25); GUI.backgroundColor = previousColor; return(pressed); }
protected override bool DrawButton(ConfirmButtonAttribute attribute, string label, string methodName) { if (!MightyGUIUtilities.DrawButton(label, attribute.Height)) { return(false); } if (MightyGUIUtilities.ConfirmDialog(attribute.DialogTitle ?? label, attribute.ConfirmMessage ?? $"Do you want to run {methodName}?")) { return(true); } throw MightyExceptionUtilities.AbortAfterConfirmDialog; }
protected override bool DrawButton(IconButtonAttribute attribute, string label, string methodName) => MightyGUIUtilities.DrawButton(attribute.IconName, label, attribute.Height);