修改水

This commit is contained in:
2026-01-01 22:00:33 +08:00
parent 040a222bd6
commit 9ceffccd39
1800 changed files with 103929 additions and 139495 deletions

View File

@@ -14,7 +14,6 @@ namespace Obi{
private MethodInfo eventMethodInfo = null;
private FieldInfo fieldInfo = null;
private PropertyInfo propertyInfo = null;
public VisibleIf(string methodName, bool negate = false)
{
@@ -40,19 +39,13 @@ namespace Obi{
// If we could not find a method with that name, look for a field:
if (eventMethodInfo == null && fieldInfo == null)
fieldInfo = eventOwnerType.GetField(eventName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
// or maybe a property
if (eventMethodInfo == null && fieldInfo == null && propertyInfo == null)
propertyInfo = eventOwnerType.GetProperty(eventName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
if (eventMethodInfo != null)
if (eventMethodInfo != null)
return (bool)eventMethodInfo.Invoke(property.serializedObject.targetObject, null);
else if (fieldInfo != null)
return (bool)fieldInfo.GetValue(property.serializedObject.targetObject);
else if (propertyInfo != null)
return (bool)propertyInfo.GetValue(property.serializedObject.targetObject);
else
Debug.LogWarning(string.Format("VisibleIf: Unable to find method, field or property {0} in {1}", eventName, eventOwnerType));
else
Debug.LogWarning(string.Format("VisibleIf: Unable to find method or field {0} in {1}", eventName, eventOwnerType));
return true;
}