internal static bool IsValid(MemberInfo memberInfo) { switch (memberInfo.MemberType) { case MemberTypes.Field: return(true); case MemberTypes.Method: var methodInfo = ((MethodInfo)memberInfo); if (methodInfo.IsGenericMethod) { return(false); } if (methodInfo.ReturnType == typeof(void)) { return(false); } if (memberInfo.Name.StartsWith("set_")) { return(false); } if (memberInfo.Name.StartsWith("get_")) { if (methodInfo.GetParameters().Length == 0) { return(false); } } foreach (var parameterInfo in methodInfo.GetParameters()) { if (!ConstValueGUI.IsSupported(parameterInfo.ParameterType)) { return(false); } } return(true); case MemberTypes.Property: return(true); default: return(false); } }
public static void GetValueGUI(this GetValue value) { if (value.Lable != "") { GUILayout.Label(value.Lable); } EditorGUILayout.BeginHorizontal((GUIStyle)"box"); if (value.ValueType == GetValue.ValueTypes.Const) { value.ConstValue.OnGUI("Value"); if (GUILayout.Button("B", EditorStyles.miniButtonRight, GUILayout.Width(20))) { value.ValueType = GetValue.ValueTypes.Bind; BindWindow.Show(value.BindValue); } } if (value.ValueType == GetValue.ValueTypes.Bind) { value.BindValue.DescriptionGUI(); if (GUILayout.Button("B", EditorStyles.miniButtonRight, GUILayout.Width(20))) { BindWindow.Show(value.BindValue); } if (GUILayout.Button("X", EditorStyles.miniButtonRight, GUILayout.Width(20))) { if (ConstValueGUI.IsSupported(value.Type)) { value.ValueType = GetValue.ValueTypes.Const; } } } EditorGUILayout.EndHorizontal(); return; }
public static void AssinmentGUI(this Assinment bindUnit) { GUILayout.BeginHorizontal(); SetValueGUI(bindUnit.SetValue); if (bindUnit.SetValue.IsValid) { if (bindUnit.GetValue == null) { bindUnit.GetValue = new GetValue(bindUnit.SetValue.FinalType); } if (!ConstValueGUI.IsSupported(bindUnit.SetValue.FinalType)) { bindUnit.GetValue.ValueType = GetValue.ValueTypes.Bind; } bindUnit.GetValue.ChangeType(bindUnit.SetValue.FinalType); GUILayout.Label(EditorGUIUtility.IconContent("Profiler.LastFrame")); GetValueGUI(bindUnit.GetValue); } GUILayout.EndHorizontal(); }