public InfoMessageType type; //インスペクターに表示する際の情報の種類 /// <summary> /// コンストラクタ /// </summary> /// <param name="showMessage">インスペクターに表示する文字列</param> /// <param name="infoMessageType">インスペクターに表示する際の情報の種類</param> /// <param name="order">表示する順番</param> public InfoBoxAttribute(string showMessage, InfoMessageType infoMessageType = InfoMessageType.None, int order = 0) { // コンストラクタで渡ってきた引数をメンバ変数に格納する message = showMessage; type = infoMessageType; this.order = order; }
/// <summary> /// Initializes a new instance of the <see cref="ValidateInputAttribute"/> class. /// </summary> /// <param name="memberName">Name of callback function to validate input. The function must have at least one parameter of the same type as the property.</param> /// <param name="defaultMessage">Default message for invalid values.</param> /// <param name="messageType">Type of the message.</param> public ValidateInputAttribute(string memberName, string defaultMessage = null, InfoMessageType messageType = InfoMessageType.Error) { this.MemberName = memberName; this.DefaultMessage = defaultMessage; this.MessageType = messageType; this.IncludeChildren = true; }
private void DrawTheIcon(Rect rect, bool serialized, InfoMessageType messageType) { if (messageType == InfoMessageType.Error) { GUI.DrawTexture(rect.AlignCenterXY(22), EditorIcons.ConsoleErroricon, ScaleMode.ScaleToFit); } else if (messageType == InfoMessageType.Warning) { GUI.DrawTexture(rect.AlignCenterXY(20), EditorIcons.ConsoleWarnicon, ScaleMode.ScaleToFit); } else if (messageType == InfoMessageType.Info) { GUI.DrawTexture(rect.AlignCenterXY(20), EditorIcons.ConsoleInfoIcon, ScaleMode.ScaleToFit); } else if (serialized) { GUI.DrawTexture(rect.AlignCenterXY(EditorIcons.TestPassed.width), EditorIcons.TestPassed, ScaleMode.ScaleToFit); } else { GUI.color = EditorGUIUtility.isProSkin ? new Color(1, 1, 1, 0.2f) : new Color(0.15f, 0.15f, 0.15f, 0.2f); EditorIcons.X.Draw(rect.Padding(2)); GUI.color = Color.white; } }
/// <summary> /// Displays a message box with hideable details. /// </summary> /// <param name="message">The message for the message box.</param> /// <param name="details">The hideable details of the message box.</param> /// <param name="infoMessageType">Type of the message box.</param> /// <param name="visibleIf">Optional name of a member to hide or show the message box.</param> public DetailedInfoBoxAttribute(string message, string details, InfoMessageType infoMessageType = InfoMessageType.Info, string visibleIf = null) { this.Message = message; this.Details = details; this.InfoMessageType = infoMessageType; this.VisibleIf = visibleIf; }
public ValidateInputAttribute(string memberName, string message, InfoMessageType messageType, bool rejectedInvalidInput) { this.MemberName = memberName; this.DefaultMessage = message; this.MessageType = messageType; this.IncludeChildren = true; }
/// <summary> /// メッセージの種類を取得する /// </summary> /// <param name="type">インスペクターに表示する際の種類</param> /// <returns>HelpBoxで使用するenumの形式に変換して返す</returns> public MessageType GetMessageType(InfoMessageType type) { // HelpBoxで使用するenumの形式に変換する switch (type) { case InfoMessageType.None: { return(MessageType.None); } case InfoMessageType.Info: { return(MessageType.Info); } case InfoMessageType.Warning: { return(MessageType.Warning); } case InfoMessageType.Error: { return(MessageType.Error); } } return(0); }
/// <summary>Displays an info box above the property.</summary> /// <param name="message">The message for the message box. Supports referencing a member string field, property or method by using $.</param> /// <param name="infoMessageType">The type of the message box.</param> /// <param name="visibleIfMemberName">Name of member bool to show or hide the message box.</param> public InfoBoxAttribute( string message, InfoMessageType infoMessageType = InfoMessageType.Info, string visibleIfMemberName = null) { this.Message = message; this.InfoMessageType = infoMessageType; this.VisibleIf = visibleIfMemberName; }
public TextInformationMessage(InfoMessageType type, short id, string[] args = null) : base(Id) { Type = type; TextId = id; if (args == null) { Args = new string[0]; } else { Args = args; } }
protected void AddInfoMessage(string key, string title, string message, InfoMessageType type) { if (infoMessage == null) { infoMessage = new Dictionary <string, InfoMessage>(); } infoMessage.Add(key, new InfoMessage() { title = title, message = message, show = new AnimBool(false, Repaint), type = type }); }
public static ValidationResultType ToValidationResultType(this InfoMessageType messageType) { if (messageType == InfoMessageType.Error) { return(ValidationResultType.Error); } else if (messageType == InfoMessageType.Warning) { return(ValidationResultType.Warning); } else { return(ValidationResultType.Valid); } }
public static void SetMessage(this Controller instance, InfoMessageType infoMessageType, string value) { string infoMessage = string.Empty; switch (infoMessageType) { case InfoMessageType.Success: infoMessage = "Info.success"; break; case InfoMessageType.Danger: infoMessage = "Info.danger"; break; case InfoMessageType.Warning: infoMessage = "Info.warning"; break; case InfoMessageType.Info: infoMessage = "Info.info"; break; } instance.TempData[infoMessage] = value; }
/// <summary> /// Adds an info box to the inspector, if the property is missing. /// </summary> /// <param name="messageType">The type of info box to draw.</param> public RequiredAttribute(InfoMessageType messageType) { this.MessageType = messageType; }
/// <summary> /// Adds an error box to the inspector, if the property is missing. /// </summary> /// <param name="errorMessage">The message to display in the error box.</param> public RequiredAttribute(string errorMessage) { this.ErrorMessage = errorMessage; this.MessageType = InfoMessageType.Error; }
/// <summary> /// Adds an info box to the inspector, if the property is missing. /// </summary> /// <param name="errorMessage">The message to display in the error box.</param> /// <param name="messageType">The type of info box to draw.</param> public RequiredAttribute(string errorMessage, InfoMessageType messageType) { this.ErrorMessage = errorMessage; this.MessageType = messageType; }
/// <summary> /// Adds an error box to the inspector, if the property is missing. /// </summary> public RequiredAttribute() { this.MessageType = InfoMessageType.Error; }
private MemberSerializationInfo(MemberInfo member, string[] notes, SerializationFlags flags, SerializationBackendFlags serializationBackend) { Assert.IsNotNull(member); Assert.IsFalse(flags == 0); this.MemberInfo = member; this.Notes = notes; this.Info = flags; this.Backend = serializationBackend; this.OdinMessageType = InfoMessageType.None; this.UnityMessageType = InfoMessageType.None; // Should the member be serialized, but isn't? if (flags.HasNone(SerializationFlags.SerializedByUnity | SerializationFlags.SerializedByOdin | SerializationFlags.NonSerializedAttribute) && flags.HasAny(SerializationFlags.Public | SerializationFlags.SerializeFieldAttribute) && (flags.HasAll(SerializationFlags.Field) || flags.HasAll(SerializationFlags.AutoProperty))) { if (serializationBackend.HasNone(SerializationBackendFlags.Odin)) { this.OdinMessageType = InfoMessageType.Info; } if (flags.HasNone(SerializationFlags.Property) && UnitySerializationUtility.GuessIfUnityWillSerialize(member.GetReturnType()) == false) { this.UnityMessageType = InfoMessageType.Info; } } // Is the member serialized by both Odin and Unity? if (this.Info.HasAny(SerializationFlags.SerializedByOdin) && this.Info.HasAny(SerializationFlags.SerializedByUnity)) { this.OdinMessageType = InfoMessageType.Warning; this.UnityMessageType = InfoMessageType.Warning; } // Does the member have both SerializeField and NonSerialized attributes? if (this.Info.HasAll(SerializationFlags.SerializeFieldAttribute | SerializationFlags.NonSerializedAttribute)) { this.UnityMessageType = InfoMessageType.Warning; } // Does the member have both SerializeField and OdinSerialize attributes? if (this.Info.HasAll(SerializationFlags.SerializeFieldAttribute | SerializationFlags.OdinSerializeAttribute)) { if (this.Info.HasAll(SerializationFlags.SerializedByOdin)) { this.OdinMessageType = InfoMessageType.Warning; } if (this.Info.HasAll(SerializationFlags.SerializedByUnity)) { this.UnityMessageType = InfoMessageType.Warning; } } if (serializationBackend.HasAll(SerializationBackendFlags.UnityAndOdin) && this.Info.HasAll(SerializationFlags.SerializedByOdin | SerializationFlags.TypeSupportedByUnity) && this.Info.HasNone(SerializationFlags.SerializedByUnity)) { this.OdinMessageType = InfoMessageType.Warning; } // Does the member have a OdinSerialize attribute, but no Odin backend is available? if (!serializationBackend.HasAll(SerializationBackendFlags.Odin) && flags.HasAny(SerializationFlags.OdinSerializeAttribute)) { this.OdinMessageType = InfoMessageType.Error; } // Does the member have OdinSerialize attribute, but is not serialized by Odin? if (this.Info.HasAny(SerializationFlags.OdinSerializeAttribute) && !this.Info.HasAny(SerializationFlags.SerializedByOdin)) { this.OdinMessageType = InfoMessageType.Error; } // Is the member marked for serialzation but not serialized? if (this.Info.HasAny(SerializationFlags.SerializeFieldAttribute | SerializationFlags.OdinSerializeAttribute) && !this.Info.HasAny(SerializationFlags.SerializedByUnity | SerializationFlags.SerializedByOdin | SerializationFlags.NonSerializedAttribute)) { if (serializationBackend.HasAll(SerializationBackendFlags.Odin)) { this.OdinMessageType = InfoMessageType.Error; } if (!this.Info.HasAny(SerializationFlags.Property) && UnitySerializationUtility.GuessIfUnityWillSerialize(member.GetReturnType())) { this.UnityMessageType = InfoMessageType.Error; } } // Is the member public, not marked with NonSerialized, but not serialized? if (this.Info.HasAll(SerializationFlags.Public | SerializationFlags.Field) && !this.Info.HasAny(SerializationFlags.NonSerializedAttribute) && !this.Info.HasAny(SerializationFlags.SerializedByUnity | SerializationFlags.SerializedByOdin)) { if (serializationBackend.HasAll(SerializationBackendFlags.Odin)) { this.OdinMessageType = InfoMessageType.Error; } if (!this.Info.HasAny(SerializationFlags.Property) && UnitySerializationUtility.GuessIfUnityWillSerialize(member.GetReturnType())) { this.UnityMessageType = InfoMessageType.Error; } } }
/// <summary>Adds the property to the specified foldout group.</summary> /// <param name="name">Name of the foldout group.</param> /// <param name="foldEverything">Toggle to put all properties to the specified group</param> public InfoBoxAttribute(string description, InfoMessageType messageType) { this.messageType = messageType; this.description = description; }
protected InfoMessageBase(InfoMessageType type) { Type = type; }