コード例 #1
0
ファイル: AnimationComponent.cs プロジェクト: cg123/xenko
        void playingAnimations_CollectionChanged(object sender, TrackingCollectionChangedEventArgs e)
        {
            var item = (PlayingAnimation)e.Item;
            switch (e.Action)
            {
                case NotifyCollectionChangedAction.Add:
                {
                    item.attached = true;
                    break;
                }
                case NotifyCollectionChangedAction.Remove:
                {
                    var evaluator = item.Evaluator;
                    if (evaluator != null)
                    {
                        Blender.ReleaseEvaluator(evaluator);
                        item.Evaluator = null;
                    }

                    item.endedTCS?.TrySetResult(true);
                    item.endedTCS = null;
                    item.attached = false;
                    break;
                }
            }
        }
コード例 #2
0
 void playingAnimations_CollectionChanged(object sender, TrackingCollectionChangedEventArgs e)
 {
     if (e.Action == NotifyCollectionChangedAction.Remove)
     {
         var item = (PlayingAnimation)e.Item;
         var evaluator = item.Evaluator;
         if (evaluator != null)
         {
             Blender.ReleaseEvaluator(evaluator);
             item.Evaluator = null;
         }
     }
 }
コード例 #3
0
ファイル: Grid.cs プロジェクト: h78hy78yhoi8j/xenko
 private void DefinitionCollectionChanged(object sender, TrackingCollectionChangedEventArgs trackingCollectionChangedEventArgs)
 {
     var modifiedElement = (StripDefinition)trackingCollectionChangedEventArgs.Item;
     switch (trackingCollectionChangedEventArgs.Action)
     {
         case NotifyCollectionChangedAction.Add:
             modifiedElement.DefinitionChanged += OnStripDefinitionChanged;
             break;
         case NotifyCollectionChangedAction.Remove:
             modifiedElement.DefinitionChanged -= OnStripDefinitionChanged;
             break;
         default:
             throw new NotImplementedException();
     }
     InvalidateMeasure();
 }
コード例 #4
0
 private void ChildrenCollectionChanged(object sender, TrackingCollectionChangedEventArgs e)
 {
     switch (e.Action)
     {
         case NotifyCollectionChangedAction.Add:
             AddItem((TransformComponent)e.Item);
             break;
         case NotifyCollectionChangedAction.Remove:
             RemoveItem((TransformComponent)e.Item);
             break;
         default:
             throw new NotSupportedException();
     }
 }
コード例 #5
0
ファイル: MeshRenderFeature.cs プロジェクト: cg123/xenko
        private void RenderFeatures_CollectionChanged(object sender, TrackingCollectionChangedEventArgs e)
        {
            var renderFeature = (SubRenderFeature)e.Item;

            switch (e.Action)
            {
                case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
                    renderFeature.AttachRootRenderFeature(this);
                    renderFeature.Initialize(Context);
                    break;
                case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
                    renderFeature.Dispose();
                    break;
            }
        }
コード例 #6
0
ファイル: Model.cs プロジェクト: Powerino73/paradox
 private void children_CollectionChanged(object sender, TrackingCollectionChangedEventArgs e)
 {
     var child = (Model)e.Item;
     switch (e.Action)
     {
         case NotifyCollectionChangedAction.Add:
             if (child.parent != null)
                 throw new InvalidOperationException("Model already have a parent.");
             child.parent = this;
             break;
         case NotifyCollectionChangedAction.Remove:
             if (child.parent != this)
                 throw new InvalidOperationException("Model doesn't have expected parent.");
             child.parent = null;
             break;
     }
 }
コード例 #7
0
ファイル: ParticlePlugin.cs プロジェクト: cg123/xenko
 private void UpdatersOnCollectionChanged(object sender, TrackingCollectionChangedEventArgs trackingCollectionChangedEventArgs)
 {
     updatersCount = ParticleUtils.CalculateMaximumPowerOf2Count(Updaters.Sum(particleUpdater => particleUpdater.Count));
 }
コード例 #8
0
ファイル: SceneInstance.cs プロジェクト: cg123/xenko
        private void VisibilityGroups_CollectionChanged(object sender, TrackingCollectionChangedEventArgs e)
        {
            var visibilityGroup = (VisibilityGroup)e.Item;

            switch (e.Action)
            {
                case NotifyCollectionChangedAction.Add:
                    foreach (var registeredRenderProcessorType in registeredRenderProcessorTypes)
                    {
                        var processor = CreateRenderProcessor(registeredRenderProcessorType.Value, visibilityGroup);

                        // Assume we are in middle of a compositor draw so we need to run it manually once (Update/Draw already happened)
                        if (currentRenderContext != null)
                        {
                            processor.Update(currentRenderContext.Time);
                            processor.Draw(currentRenderContext);
                        }
                    }
                    break;
                case NotifyCollectionChangedAction.Remove:
                    foreach (var registeredRenderProcessorType in registeredRenderProcessorTypes)
                    {
                        // Remove matching entries
                        var instances = registeredRenderProcessorType.Value.Instances;
                        for (int i = 0; i < instances.Count; ++i)
                        {
                            var registeredProcessorInstance = instances[i];
                            if (registeredProcessorInstance.Key == visibilityGroup)
                            {
                                Processors.Remove(registeredProcessorInstance.Value);
                                instances.RemoveAt(i);
                                break;
                            }
                        }
                    }
                    visibilityGroup.Dispose();
                    break;
            }
        }
コード例 #9
0
 private void OnSoundsOnCollectionChanged(object sender, TrackingCollectionChangedEventArgs args)
 {
     switch (args.Action)
     {
         case NotifyCollectionChangedAction.Add:
             AttachSound((Sound)args.Item);
             break;
         case NotifyCollectionChangedAction.Remove:
             DetachSound((Sound)args.Item);
             break;
     }
 }