Esempio n. 1
0
        public override CategoryBase FindOrCreateCategory(string categoryName, Type selectedType)
        {
            CategoryLocalizationHelper.CategoryName canonicalCategoryName = CategoryLocalizationHelper.GetCanonicalCategoryName(categoryName);
            if (canonicalCategoryName != CategoryLocalizationHelper.CategoryName.Unknown)
            {
                categoryName = CategoryLocalizationHelper.GetLocalizedCategoryName(canonicalCategoryName);
            }
            int index = OrderedListExtensions.GenericBinarySearch <CategoryBase, CategoryLocalizationHelper.CategoryName>(this.Categories, canonicalCategoryName, (Func <CategoryLocalizationHelper.CategoryName, CategoryBase, int>)((canonicalName, category) =>
            {
                SceneNodeCategory sceneNodeCategory = (SceneNodeCategory)category;
                return(canonicalName.CompareTo((object)sceneNodeCategory.CanonicalName));
            }));

            if (index >= 0)
            {
                return(this.Categories[index]);
            }
            CategoryBase category1 = this.CreateCategory(categoryName, selectedType);

            this.Categories.Insert(~index, category1);
            return(category1);
        }
Esempio n. 2
0
 public override void OnSelectionChanged(SceneNode[] selectedObjects)
 {
     base.OnSelectionChanged(selectedObjects);
     if (this.objectSet != null)
     {
         this.objectSet.Dispose();
         this.objectSet = (TriggerObjectSet)null;
     }
     this.selectedObjects = selectedObjects;
     if (selectedObjects.Length > 0)
     {
         SceneNode sceneNode = selectedObjects[0];
         if (sceneNode != null && ProjectNeutralTypes.BehaviorTriggerAction.IsAssignableFrom((ITypeId)sceneNode.Type))
         {
             BehaviorTriggerBaseNode behaviorTriggerBaseNode = sceneNode.Parent as BehaviorTriggerBaseNode;
             if (behaviorTriggerBaseNode != null)
             {
                 this.objectSet   = new TriggerObjectSet((BehaviorTriggerActionNode)sceneNode);
                 this.TriggerType = behaviorTriggerBaseNode.Type;
                 List <TargetedReferenceStep> list = new List <TargetedReferenceStep>();
                 foreach (IProperty property in ITypeExtensions.GetProperties(behaviorTriggerBaseNode.Type, MemberAccessTypes.Public, true))
                 {
                     ReferenceStep referenceStep = property as ReferenceStep;
                     if (referenceStep != null)
                     {
                         list.Add(new TargetedReferenceStep(referenceStep, behaviorTriggerBaseNode.Type));
                     }
                 }
                 foreach (TargetedReferenceStep targetedReferenceStep in list)
                 {
                     if (PropertyInspectorModel.IsPropertyBrowsable(this.selectedObjects, targetedReferenceStep))
                     {
                         AttributeCollection attributes     = targetedReferenceStep.Attributes;
                         Attribute[]         attributeArray = new Attribute[attributes.Count + 1];
                         int index;
                         for (index = 0; index < attributes.Count; ++index)
                         {
                             attributeArray[index] = attributes[index];
                         }
                         attributeArray[index] = (Attribute) new CategoryAttribute(CategoryLocalizationHelper.GetLocalizedCategoryName(CategoryLocalizationHelper.CategoryName.Triggers));
                         SceneNodeProperty property = (SceneNodeProperty)this.objectSet.CreateProperty(new PropertyReference(targetedReferenceStep.ReferenceStep), new AttributeCollection(attributeArray));
                         if (!PlatformTypes.IList.IsAssignableFrom((ITypeId)property.PropertyTypeId))
                         {
                             this.AddProperty(property);
                         }
                     }
                 }
             }
         }
     }
     this.OnPropertyChanged("IsEmpty");
 }