Esempio n. 1
0
        private void OnColorChanged(AShape shape)
        {
            if (shape == null)
            {
                throw new ArgumentNullException(nameof(shape));
            }

            ShapeCollection shapeCollection = EnsureEntities(shape.Color);

            shapeCollection.Add(shape);
        }
Esempio n. 2
0
        private ShapeCollection EnsureCollection(Color color)
        {
            if (shapeCollections.TryGetValue(color, out var shapeCollection))
            {
                return(shapeCollection);
            }

            shapeCollection = new ShapeCollection(color, GraphicsDevice, game.GraphicsContext);
            shapeCollection.ColorChanged += OnColorChanged;
            shapeCollections[color]       = shapeCollection;
            rootEntity.AddChild(shapeCollection.Entity);

            return(shapeCollection);
        }
Esempio n. 3
0
 private void Delete(ShapeCollection shapeCollection)
 {
     rootEntity.RemoveChild(shapeCollection.Entity);
     shapeCollection.ColorChanged -= OnColorChanged;
     shapeCollections.Remove(shapeCollection.Color);
 }