public class LayersHandler
: Drawable
{ private Dictionary
<string, Layer
> layers
; private View view
; public LayersHandler
(View view
) { layers
= new Dictionary
<string, Layer
>(); this.view = view
; } public void AddLayers
(params string[] names
) { for (int i
= 0; i
< names
.Length; i
++) AddLayer
(names
[i
]); } public void RemoveLayers
(params string[] names
) { for (int i
= 0; i
< names
.Length; i
++) RemoveLayer
(names
[i
]); } public void AddLayer
(string name
) { layers
.Add(name,
new Layer
(name, view
)); } public void RemoveLayer
(string name
) { layers
.Remove(name
); } public void AddToLayer
(string name, Drawable drawable
) { layers
[name
].Add(drawable
); } public void RemoveFromLayer
(string name, Drawable drawable
) { layers
[name
].Remove(drawable
); } public void Draw
(RenderTarget target, RenderStates states
) { foreach (var el
in layers
) target
.Draw(el
.Value); } public Layer GetLayer
(string name
) { return layers
[name
]; } }