A game framework written with osu! in mind.
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
2// See the LICENCE file in the repository root for full licence text.
3
4using JetBrains.Annotations;
5using osu.Framework.Lists;
6
7namespace osu.Framework.Graphics.Containers
8{
9 /// <summary>
10 /// A wrapper for the content of a <see cref="GridContainer"/> that provides notifications when elements are changed.
11 /// </summary>
12 public class GridContainerContent : ObservableArray<ObservableArray<Drawable>>
13 {
14 private GridContainerContent([NotNull] Drawable[][] drawables)
15 : base(new ObservableArray<Drawable>[drawables.Length])
16 {
17 for (int i = 0; i < drawables.Length; i++)
18 {
19 if (drawables[i] != null)
20 {
21 var observableArray = new ObservableArray<Drawable>(drawables[i]);
22 this[i] = observableArray;
23 }
24 }
25 }
26
27 public static implicit operator GridContainerContent(Drawable[][] drawables)
28 {
29 if (drawables == null)
30 return null;
31
32 return new GridContainerContent(drawables);
33 }
34 }
35}