public bool SetProperty(string valueName, string valueStr) { DesignerPropertyEditor propertyEditor = getPropertyEditor(valueName); if (propertyEditor == null) { return(false); } VariableDef var = propertyEditor.GetVariable(); if (var.Value.ToString().ToLower() != valueStr.ToLower()) { Plugin.InvokeTypeParser(null, var.GetValueType(), valueStr, (object value) => var.Value = value, null); propertyEditor.ValueWasnotAssigned(); propertyEditor.SetVariable(var, null); propertyEditor.ValueWasAssigned(); return(true); } return(false); }
public bool SetProperty(BehaviorNode behavior, string valueName, string valueStr) { DesignerPropertyEditor propertyEditor = getPropertyEditor(valueName); if (propertyEditor == null && behavior != null) { Node root = behavior as Node; foreach (PropertyDef p in root.LocalVars) { if (!p.IsArrayElement && p.BasicName == valueName) { propertyEditor = addRowControl(p); break; } } } if (propertyEditor == null) { return(false); } VariableDef var = propertyEditor.GetVariable(); if (var.Value.ToString().ToLower() != valueStr.ToLower()) { Plugin.InvokeTypeParser(null, var.ValueType, valueStr, (object value) => var.Value = value, null); propertyEditor.ValueWasnotAssigned(); propertyEditor.SetVariable(var, null); propertyEditor.ValueWasAssigned(); return(true); } return(false); }