Ejemplo n.º 1
0
        /// <summary>
        /// Renders the inspector title for our asset
        /// </summary>
        public static void DrawInspectorDescription(string rDescription, UnityEditor.MessageType rMessageType)
        {
            Color lGUIColor = GUI.color;

            GUI.color = EditorHelper.CreateColor(255f, 255f, 255f, 1f);
            UnityEditor.EditorGUILayout.HelpBox(rDescription, rMessageType);

            GUI.color = lGUIColor;
        }
        /// <summary>
        /// Draws the property.
        /// </summary>
        protected override void DrawPropertyLayout(GUIContent label)
        {
            if (this.errorMessage != null)
            {
                SirenixEditorGUI.ErrorMessageBox(this.errorMessage);
            }
            else
            {
                if (Event.current.type == EventType.Layout)
                {
                    try
                    {
                        var entry = this.Property.ValueEntry;
                        if (entry != null)
                        {
                            var parentValue = entry.Property.ParentValues[0];
                            this.drawMessageBox =
                                this.Attribute.VisibleIf == null ||
                                (this.staticValidationParameterMethodCaller != null && this.staticValidationParameterMethodCaller(entry.WeakSmartValue)) ||
                                (this.instanceValidationParameterMethodCaller != null && this.instanceValidationParameterMethodCaller(entry.Property.ParentValues[0], entry.WeakSmartValue)) ||
                                (this.instanceValidationMethodCaller != null && this.instanceValidationMethodCaller(entry.Property.ParentValues[0])) ||
                                (this.instanceValueGetter != null && (bool)this.instanceValueGetter(ref parentValue)) ||
                                (this.staticValidationCaller != null && this.staticValidationCaller());
                        }
                        else
                        {
                            this.drawMessageBox = true;
                        }
                    }
                    catch (System.Exception ex)
                    {
                        Debug.LogException(ex);
                    }
                }

                if (this.drawMessageBox)
                {
                    UnityEditor.MessageType type = UnityEditor.MessageType.None;

                    switch (this.Attribute.InfoMessageType)
                    {
                    case InfoMessageType.None:
                        type = UnityEditor.MessageType.None;
                        break;

                    case InfoMessageType.Info:
                        type = UnityEditor.MessageType.Info;
                        break;

                    case InfoMessageType.Warning:
                        type = UnityEditor.MessageType.Warning;
                        break;

                    case InfoMessageType.Error:
                        type = UnityEditor.MessageType.Error;
                        break;

                    default:
                        SirenixEditorGUI.ErrorMessageBox("Unknown InfoBoxType: " + this.Attribute.InfoMessageType.ToString());
                        break;
                    }

                    this.hideDetailedMessage = SirenixEditorGUI.DetailedMessageBox(this.messageHelper.GetString(this.Property), this.detailsHelper.GetString(this.Property), type, this.hideDetailedMessage);
                }
            }

            this.CallNextDrawer(label);
        }
Ejemplo n.º 3
0
 public static void HelpBox(System.String message, UnityEditor.MessageType type, bool wide)
 {
     UnityEditor.EditorGUILayout.HelpBox(TranslationUtility.get(message), type, wide);
 }
Ejemplo n.º 4
0
 public static void HelpBox(UnityEngine.Rect position, System.String message, UnityEditor.MessageType type)
 {
     UnityEditor.EditorGUI.HelpBox(position, TranslationUtility.get(message), type);
 }