diff options
author | chai <chaifix@163.com> | 2020-10-15 19:05:22 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2020-10-15 19:05:22 +0800 |
commit | f049177e20a276049c61edbad631c1b2bbdd5706 (patch) | |
tree | 7d1a1cd9b690a5d9a8b9a65554a191d6ec769601 /Assets/Plugins/AdvancedInspector/Attributes/Title.cs | |
parent | 6990a0d1fbdcbbf404f40713363ac1a148c8840a (diff) |
-advanced inspector
+odin
Diffstat (limited to 'Assets/Plugins/AdvancedInspector/Attributes/Title.cs')
-rw-r--r-- | Assets/Plugins/AdvancedInspector/Attributes/Title.cs | 111 |
1 files changed, 0 insertions, 111 deletions
diff --git a/Assets/Plugins/AdvancedInspector/Attributes/Title.cs b/Assets/Plugins/AdvancedInspector/Attributes/Title.cs deleted file mode 100644 index 2330db37..00000000 --- a/Assets/Plugins/AdvancedInspector/Attributes/Title.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Reflection; -using System.Linq; -using System.Text; - -using UnityEngine; - -namespace AdvancedInspector -{ - /// <summary> - /// Similar to Unity "Header" attribute, but can be place on any members and be set at runtime. - /// </summary> - [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Method)] - public class TitleAttribute : Attribute, IRuntimeAttribute<TitleAttribute> - { - public delegate TitleAttribute TitleDelegate(); - public delegate TitleAttribute TitleStaticDelegate(TitleAttribute title, object instance, object value); - - private string message; - - /// <summary> - /// The title message - /// </summary> - public string Message - { - get { return message; } - set { message = value; } - } - - private FontStyle style = FontStyle.Bold; - - /// <summary> - /// The font style. - /// </summary> - public FontStyle Style - { - get { return style; } - set { style = value; } - } - - #region IRuntime Implementation - private string methodName = ""; - - public string MethodName - { - get { return methodName; } - } - - public Type Template - { - get { return typeof(TitleDelegate); } - } - - public Type TemplateStatic - { - get { return typeof(TitleStaticDelegate); } - } - - private List<Delegate> delegates = new List<Delegate>(); - - public List<Delegate> Delegates - { - get { return delegates; } - set { delegates = value; } - } - - public TitleAttribute Invoke(int index, object instance, object value) - { - if (delegates.Count == 0 || index >= delegates.Count) - return this; - - try - { - if (delegates[index].Target == null) - { - return delegates[0].DynamicInvoke(this, instance, value) as TitleAttribute; - } - else - { - return delegates[0].DynamicInvoke() as TitleAttribute; - } - } - catch (Exception e) - { - if (e is TargetInvocationException) - e = ((TargetInvocationException)e).InnerException; - - Debug.LogError(string.Format("Invoking a method failed while trying to retrieve a Title attribute. The exception was \"{0}\".", e.Message)); - return null; - } - } - #endregion - - public TitleAttribute(string methodName) - { - this.methodName = methodName; - } - - public TitleAttribute(FontStyle style, string message) - { - this.style = style; - this.message = message; - } - - public TitleAttribute(Delegate method) - { - this.delegates.Add(method); - } - } -} |