public static FieldInfoWrapper GetFieldInfo(Component component, String valueName) { FieldInfoWrapper fieldInfo = null; CustomMaterialOnScreen customMaterialOnScreen = null; try { customMaterialOnScreen = component as CustomMaterialOnScreen; } catch (Exception) { } if (customMaterialOnScreen != null) { var materialProperty = customMaterialOnScreen.GetMaterialProperty(valueName); if (materialProperty != null) { fieldInfo = new CustomfieldInfo(materialProperty); } } else { FieldInfo fi = component.GetType().GetField(valueName); if (fi != null) { fieldInfo = new DefaultFieldInfo(fi); } PropertyInfo pi = component.GetType().GetProperty(valueName); if (pi != null) { fieldInfo = new CustomPropertyInfo(pi); } } return(fieldInfo); }
public virtual void UpdateFieldInfo(Component component) { try { bool updateFieldInfo = false; _component = component; if (_fieldInfo == null) { updateFieldInfo = true; } else if (_fieldInfo.GetName() != ValueName) { updateFieldInfo = true; } if (updateFieldInfo) { _fieldInfo = PostprocessData.GetFieldInfo(_component, ValueName); } } catch (Exception ex) { Debug.Log(":("); } }
public void AddInterpolatorFor(String valueName) { FieldInfoWrapper fieldInfo = GetFieldInfo(Postprocess, valueName); if (fieldInfo != null) { Values.Add( new InterpolatorDataWrapper( (InterpolatorData) TypeToInterpolatorMap[fieldInfo.GetFieldType()].GetConstructor(new Type[] { typeof(String) }) .Invoke(new object[] { valueName }))); } }