示例#1
0
        public static bool GetMightyMethod <T>(this BaseMightyMember mightyMember, object target, string memberName,
                                               CallbackSignature callbackSignature, out MightyMethod <T> method)
        {
            if (string.IsNullOrWhiteSpace(memberName))
            {
                method = null;
                return(false);
            }

            if (target is BaseWrapperAttribute wrapper && GetCallbackName(target, memberName, out var callbackName))
            {
                return(mightyMember.GetMightyMethod(mightyMember.GetWrapperTarget(wrapper), callbackName, callbackSignature, out method));
            }

            if (InternalGetMightyMethod(target, memberName, callbackSignature, out method))
            {
                return(true);
            }

            if (!(mightyMember is MightySerializedField serializedField))
            {
                return(false);
            }

            target = serializedField.Property.GetPropertyTargetReference();
            return(target.GetType().GetCustomAttributes(typeof(SerializableAttribute), true).Length > 0 &&
                   InternalGetMightyMethod(target, memberName, callbackSignature, out method));
        }
示例#2
0
 private void InitCallback(BaseMightyMember mightyMember, object target, string callbackName, CallbackSignature signature)
 {
     mightyMember.GetMightyMethod <object>(target, callbackName, signature, out var mightyMethod);
     if (mightyMethod != null)
     {
         m_customDrawerCache[mightyMember, signature] = mightyMethod;
     }
 }