private List <PropertyDef> getProperties() { List <PropertyDef> properties = new List <PropertyDef>(); if (_agentType != null) { foreach (PropertyDef p in _agentType.GetProperties()) { if (Plugin.IsCompatibleType(FilterType, p.Type)) { bool isInt = Plugin.IsIntergerType(p.Type); bool isFloat = Plugin.IsFloatType(p.Type); if (this.ValueType == ValueTypes.All || isInt && ((this.ValueType & ValueTypes.Int) == ValueTypes.Int) || isFloat && ((this.ValueType & ValueTypes.Float) == ValueTypes.Float)) { properties.Add(p); } } } } return(properties); }
public void InspectObject(AgentType agentType, string agentFullname, Nodes.Node node) { _agentFullname = agentFullname; preLayout(); deleteAllRowControls(); if (agentType != null) { IList <PropertyDef> properties = agentType.GetProperties(); foreach (PropertyDef p in properties) { addRowControl(p, null); } } else if (node != null) { List <ParInfo> allPars = node.Pars; foreach (ParInfo par in allPars) { addRowControl(null, par); } } postLayout(); }
private string getValueType(MethodDef.Param param, string instanceName, string propertyName) { if (param.IsProperty) { if (instanceName == VariableDef.kSelf) { return(VariableDef.kSelf); } Nodes.Behavior behavior = GetBehavior(); AgentType agent = (behavior != null) ? behavior.AgentType : null; agent = Plugin.GetInstanceAgentType(instanceName, behavior, agent); if (agent != null) { IList <PropertyDef> properties = agent.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { return(instanceName); } } } } return(VariableDef.kConst); }
protected static VariableDef setProperty(List <Nodes.Node.ErrorCheck> result, DefaultObject node, AgentType agentType, string propertyName, string arrayIndexStr, string valueType) { if (agentType != null) { IList <PropertyDef> properties = agentType.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { PropertyDef prop = p.Clone(); prop.Owner = valueType; VariableDef v = new VariableDef(prop, valueType); if (v != null && !string.IsNullOrEmpty(arrayIndexStr)) { v.ArrayIndexElement = new MethodDef.Param("ArrayIndex", typeof(int), "int", "ArrayIndex", "ArrayIndex"); v.ArrayIndexElement.IsArrayIndex = true; DesignerMethodEnum.parseParam(result, node, null, v.ArrayIndexElement, arrayIndexStr); } return(v); } } } return(null); }
private string getValueType(MethodDef.Param param, string propertyName) { if (param.IsLocalVar) { Nodes.Behavior behavior = GetBehavior(); AgentType agent = (behavior != null) ? behavior.AgentType : null; // Try to find the Agent property with the name. if (agent != null) { IList <PropertyDef> properties = agent.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { return(VariableDef.kSelf); } } } // Try to find the global property with the name. string className = Plugin.GetClassName(propertyName); return(getValueType(param, className, propertyName)); } return(VariableDef.kConst); }
private string getValueType(string instanceName, string propertyName) { if (instanceName == VariableDef.kSelf) { return(VariableDef.kSelf); } AgentType agent = Plugin.GetInstanceAgentType(instanceName); if (agent != null) { IList <PropertyDef> properties = agent.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { return(instanceName); } } } return(VariableDef.kConst); }
public static List <ValueMark> GetValidValues(AgentType agentType, string agentFullname, int frame) { Debug.Check(!string.IsNullOrEmpty(agentFullname) && frame > -1); List <ValueMark> valueSet = new List <ValueMark>(); if (_agentDatabase.ContainsKey(agentFullname)) { AgentData agentData = _agentDatabase[agentFullname]; // Properties if (agentType != null) { foreach (PropertyDef p in agentType.GetProperties()) { ValueMark value = agentData.GetValidValue(p.BasicName, frame); if (value != null) { valueSet.Add(value); } } } } return(valueSet); }
private static VariableDef createVariable(List <Nodes.Node.ErrorCheck> result, DefaultObject node, AgentType agentType, string instacneName, string propertyName) { List <string> tokens = DesignerPropertyEnum.SplitTokens(propertyName); Debug.Check(tokens.Count > 0); string arrayIndexStr = null; if (tokens.Count > 1) { propertyName = tokens[0] + "[]"; arrayIndexStr = tokens[1]; } Nodes.Behavior behavior = node.Behavior as Nodes.Behavior; agentType = Plugin.GetInstanceAgentType(instacneName, behavior, agentType); if (agentType != null) { IList <PropertyDef> properties = agentType.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { VariableDef v = new VariableDef(p, instacneName); if (v != null && !string.IsNullOrEmpty(arrayIndexStr)) { v.ArrayIndexElement = new MethodDef.Param("ArrayIndex", typeof(int), "int", "ArrayIndex", "ArrayIndex"); v.ArrayIndexElement.IsArrayIndex = true; DesignerMethodEnum.parseParam(result, node, null, v.ArrayIndexElement, arrayIndexStr); } return(v); } } } return(null); }
static private VariableDef createVariable(AgentType agentType, string instacneName, string propertyName) { agentType = Plugin.GetInstanceAgentType(instacneName, agentType); if (agentType != null) { IList <PropertyDef> properties = agentType.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { return(new VariableDef(p, instacneName)); } } } return(null); }
protected VariableDef setProperty(AgentType agentType, string propertyName, string valueType) { if (agentType != null) { IList <PropertyDef> properties = agentType.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { VariableDef v = new VariableDef(p, valueType); return(v); } } } return(null); }
public void InspectObject(AgentType agentType, string agentFullname) { _agentFullname = agentFullname; preLayout(); deleteAllRowControls(); if (agentType != null) { IList <PropertyDef> properties = agentType.GetProperties(); foreach (PropertyDef p in properties) { if (!p.IsAddedAutomatically) { addRowControl(p); } } } postLayout(); }
protected VariableDef setProperty(AgentType agentType, string propertyName, string valueType) { if (agentType != null) { IList<PropertyDef> properties = agentType.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { VariableDef v = new VariableDef(p, valueType); return v; } } } return null; }
private string getValueType(string propertyName) { Behaviac.Design.Nodes.Node node = _object as Behaviac.Design.Nodes.Node; Behaviac.Design.Nodes.Behavior behavior = (node != null) ? node.Behavior as Behaviac.Design.Nodes.Behavior : null; if (behavior != null) { // Try to find the Par parameter with the name. List <ParInfo> allPars = new List <ParInfo>(); ((Nodes.Node)behavior).GetAllPars(ref allPars); if (allPars.Count > 0) { foreach (ParInfo p in allPars) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { return(VariableDef.kPar); } } } } // Try to find the Agent property with the name. if (behavior != null && behavior.AgentType != null) { IList <PropertyDef> properties = behavior.AgentType.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { return(VariableDef.kSelf); } } } // Try to find the World property with the name. string className = Plugin.GetClassName(propertyName); if (!string.IsNullOrEmpty(className)) { AgentType agent = Plugin.GetInstanceAgentType(className); if (agent != null) { IList <PropertyDef> properties = agent.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { return(className); } } } } return(VariableDef.kConst); }
private void setMembers() { _methods.Clear(); _properties.Clear(); this.memberListBox.Items.Clear(); if (this.instanceComboBox.SelectedIndex > -1 && this.memberTypeComboBox.SelectedIndex > -1) { AgentType agentType = null; // self if (this.instanceComboBox.SelectedIndex == 0) { BehaviorTreeView focusedView = (BehaviorTreeViewDock.LastFocused != null) ? BehaviorTreeViewDock.LastFocused.BehaviorTreeView : null; if (focusedView != null && focusedView.RootNode != null) { agentType = focusedView.RootNode.AgentType; } } // global else { agentType = Plugin.InstanceNames[this.instanceComboBox.SelectedIndex - 1].agentType_; } if (agentType != null) { string filter = !string.IsNullOrEmpty(memberFilterTextBox.Text) ? memberFilterTextBox.Text.ToLowerInvariant() : string.Empty; // method if (this.memberTypeComboBox.SelectedIndex == 0 || this.memberTypeComboBox.SelectedIndex == 2) { IList <MethodDef> methods = agentType.GetMethods(MethodType.Method); foreach (MethodDef m in methods) { string methodName = m.DisplayName.ToLowerInvariant(); if (memberFilterCheckBox.Checked && methodName.StartsWith(filter) || !memberFilterCheckBox.Checked && methodName.Contains(filter)) { _methods.Add(m); this.memberListBox.Items.Add(m.DisplayName + "()"); } } } // property if (this.memberTypeComboBox.SelectedIndex == 1 || this.memberTypeComboBox.SelectedIndex == 2) { IList <PropertyDef> properties = agentType.GetProperties(); foreach (PropertyDef p in properties) { string propName = p.DisplayName.ToLowerInvariant(); if (memberFilterCheckBox.Checked && propName.StartsWith(filter) || !memberFilterCheckBox.Checked && propName.Contains(filter)) { _properties.Add(p); this.memberListBox.Items.Add(p.DisplayName); } } } } } this.memberCountLabel.Text = this.memberListBox.Items.Count.ToString(); }
private static VariableDef createVariable(List<Nodes.Node.ErrorCheck> result, DefaultObject node, AgentType agentType, string instacneName, string propertyName) { List<string> tokens = DesignerPropertyEnum.SplitTokens(propertyName); Debug.Check(tokens.Count > 0); string arrayIndexStr = null; if (tokens.Count > 1) { propertyName = tokens[0] + "[]"; arrayIndexStr = tokens[1]; } Nodes.Behavior behavior = node.Behavior as Nodes.Behavior; agentType = Plugin.GetInstanceAgentType(instacneName, behavior, agentType); if (agentType != null) { IList<PropertyDef> properties = agentType.GetProperties(); foreach(PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { VariableDef v = new VariableDef(p, instacneName); if (v != null && !string.IsNullOrEmpty(arrayIndexStr)) { v.ArrayIndexElement = new MethodDef.Param("ArrayIndex", typeof(int), "int", "ArrayIndex", "ArrayIndex"); v.ArrayIndexElement.IsArrayIndex = true; DesignerMethodEnum.parseParam(result, node, null, v.ArrayIndexElement, arrayIndexStr); } return v; } } } return null; }
private static VariableDef createVariable(AgentType agentType, string instacneName, string propertyName) { agentType = Plugin.GetInstanceAgentType(instacneName, agentType); if (agentType != null) { IList<PropertyDef> properties = agentType.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) return new VariableDef(p, instacneName); } } return null; }
private string getValueType(MethodDef.Param param, string propertyName) { if (param.IsLocalVar) { Behaviac.Design.Nodes.Node node = _object as Behaviac.Design.Nodes.Node; if (node == null) { Attachments.Attachment attach = (_object as Attachments.Attachment); if (attach != null) { node = attach.Node; } } Behaviac.Design.Nodes.Behavior behavior = (node != null) ? node.Behavior as Behaviac.Design.Nodes.Behavior : null; // Try to find the Agent property with the name. if (behavior != null && behavior.AgentType != null) { IList <PropertyDef> properties = behavior.AgentType.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { return(VariableDef.kSelf); } } } // Try to find the global property with the name. string className = Plugin.GetClassName(propertyName); if (!string.IsNullOrEmpty(className)) { AgentType agent = Plugin.GetInstanceAgentType(className); if (agent != null) { IList <PropertyDef> properties = agent.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { return(className); } } } } } return(VariableDef.kConst); }
private List <PropertyDef> getProperties() { this.SetupCastSettings(this._object); List <PropertyDef> properties = new List <PropertyDef>(); if (_agentType != null) { bool bNoRealyOnly = false; if (this._property.Attribute != null) { bNoRealyOnly = this._property.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoReadonly); } bool bIsArrayIndex = false; if (this._param != null) { bNoRealyOnly = this._param.IsOut || this._param.IsRef; bIsArrayIndex = this._param.IsArrayIndex; } bool bArrayOnly = ((this.ValueType & ValueTypes.Array) == ValueTypes.Array); foreach (PropertyDef p in _agentType.GetProperties()) { if (bIsArrayIndex && p.IsArrayElement) { //array index can only be a const or another property continue; } if (bNoRealyOnly && p.IsReadonly) { continue; } if (_valueOwner != VariableDef.kSelf && p.IsPar) { continue; } Type listType = Plugin.GetType("XMLPluginBehaviac.IList"); bool isArrayType = Plugin.IsArrayType(this.FilterType) || this.FilterType == typeof(System.Collections.IList) || (listType != null && this.FilterType == listType); if (Plugin.IsCompatibleType(this.ValueType, this.FilterType, p.Type, bArrayOnly) || (bArrayOnly && isArrayType && Plugin.IsArrayType(p.Type))) { bool isInt = Plugin.IsIntergerType(p.Type); bool isFloat = Plugin.IsFloatType(p.Type); bool isBool = Plugin.IsBooleanType(p.Type); bool isString = Plugin.IsStringType(p.Type); bool isRefType = Plugin.IsRefType(p.Type); bool bOk = false; if (bArrayOnly) { //bool isArray = Plugin.IsArrayType(p.Type) && !Plugin.IsArrayType(this.FilterType); bool isArray = Plugin.IsArrayType(p.Type); bOk = isArray; } else { bOk = (this.ValueType == ValueTypes.All) || ((isBool && ((this.ValueType & ValueTypes.Bool) == ValueTypes.Bool))) || ((isInt && ((this.ValueType & ValueTypes.Int) == ValueTypes.Int))) || (isFloat && ((this.ValueType & ValueTypes.Float) == ValueTypes.Float)) || (isString && ((this.ValueType & ValueTypes.String) == ValueTypes.String)) || (isRefType && ((this.ValueType & ValueTypes.RefType) == ValueTypes.RefType)); } if (bOk) { properties.Add(p); } } } } return(properties); }
protected static VariableDef setProperty(List<Nodes.Node.ErrorCheck> result, DefaultObject node, AgentType agentType, string propertyName, string arrayIndexStr, string valueType) { if (agentType != null) { IList<PropertyDef> properties = agentType.GetProperties(); foreach (PropertyDef p in properties) { if (p.Name == propertyName #if BEHAVIAC_NAMESPACE_FIX || p.Name.EndsWith(propertyName) #endif ) { PropertyDef prop = p.Clone(); prop.Owner = valueType; VariableDef v = new VariableDef(prop, valueType); if (v != null && !string.IsNullOrEmpty(arrayIndexStr)) { v.ArrayIndexElement = new MethodDef.Param("ArrayIndex", typeof(int), "int", "ArrayIndex", "ArrayIndex"); v.ArrayIndexElement.IsArrayIndex = true; DesignerMethodEnum.parseParam(result, node, null, v.ArrayIndexElement, arrayIndexStr); } return v; } } } return null; }