public BehaviourRootGUI(BehaviourTreeDesignerWindow window) : base() { mWindow = window; mLockTex = DevilEditorUtility.GetTexture(Path.Combine(Installizer.InstallRoot, "DevilFramework/Editor/Icons/lock.png")); }
public BehaviourMeta(System.Type target) { //TargetType = target; Name = target.Name; DisplayName = Name; Namespace = target.Namespace; string iconPath = ""; if (target.IsSubclassOf(typeof(BTNodeBase))) { NodeType = EBTNodeType.controller; Category = "Composite"; iconPath = Installizer.InstallRoot + "/DevilFramework/Editor/Icons/composite.png"; } else if (target.IsSubclassOf(typeof(BTTaskBase))) { NodeType = EBTNodeType.task; Category = "Task"; iconPath = Installizer.InstallRoot + "/DevilFramework/Editor/Icons/task.png"; } else if (target.IsSubclassOf(typeof(BTConditionBase))) { NodeType = EBTNodeType.condition; Category = "Condition"; iconPath = Installizer.InstallRoot + "/DevilFramework/Editor/Icons/condition.png"; } else if (target.IsSubclassOf(typeof(BTServiceBase))) { NodeType = EBTNodeType.service; Category = "Service"; iconPath = Installizer.InstallRoot + "/DevilFramework/Editor/Icons/service.png"; } else { NodeType = EBTNodeType.invalid; Category = "Invalid"; } BTCompositeAttribute attr = Ref.GetCustomAttribute <BTCompositeAttribute>(target); if (attr != null) { if (!string.IsNullOrEmpty(attr.Title)) { DisplayName = attr.Title; } if (!string.IsNullOrEmpty(attr.Detail)) { SubTitle = attr.Detail; } if (!string.IsNullOrEmpty(attr.IconPath)) { iconPath = attr.IconPath; } if (!string.IsNullOrEmpty(attr.Category)) { Category = attr.Category; } HideProperty = attr.HideProperty; } FieldInfo[] fields = target.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); List <BTInputProperty> propperties = new List <BTInputProperty>(); for (int i = 0; i < fields.Length; i++) { BTVariableAttribute vatt = Ref.GetCustomAttribute <BTVariableAttribute>(fields[i]); if (vatt != null) { BTInputProperty pro = new BTInputProperty(fields[i], vatt); propperties.Add(pro); } } Icon = DevilEditorUtility.GetTexture(iconPath); Properties = propperties.ToArray(); NotDisplayName = string.Format("<b><color=yellow>NOT</color></b> {0}", DisplayName); SearchName = Name.ToLower() + " " + DisplayName.ToLower(); color = BehaviourModuleManager.GetOrNewInstance().GetCategoryColor(Category); }