private void CleanBehaviorTriggerReferences() { this.CleanConditionBehaviorReferences(); if (this.objectSet != null) { this.objectSet.Dispose(); this.objectSet = (TriggerObjectSet)null; } this.behaviorTriggerBaseNode = (BehaviorTriggerBaseNode)null; }
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"); }
public override void OnSelectionChanged(SceneNode[] selectedObjects) { this.CleanBehaviorTriggerReferences(); this.UnhookSelectionManagerEarlySceneUpdate(); BehaviorTriggerActionNode actionNode = Enumerable.FirstOrDefault <BehaviorTriggerActionNode>(Enumerable.OfType <BehaviorTriggerActionNode>((IEnumerable)selectedObjects)); if (actionNode == null || actionNode.Parent == null || !(actionNode.Parent is BehaviorTriggerBaseNode)) { return; } this.behaviorTriggerBaseNode = (BehaviorTriggerBaseNode)actionNode.Parent; this.objectSet = new TriggerObjectSet(actionNode); this.sceneViewModel = this.behaviorTriggerBaseNode.ViewModel; this.HookSelectionManagerEarlySceneUpdate(); this.Rebuild(); }