-
Notifications
You must be signed in to change notification settings - Fork 10
/
Container.cs
30 lines (23 loc) · 1.01 KB
/
Container.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using UnityEngine;
namespace UniMob.UI.Widgets
{
public sealed class Container : SingleChildLayoutWidget
{
public Sprite BackgroundImage { get; set; } = null;
public Color BackgroundColor { get; set; } = Color.clear;
public Alignment Alignment { get; set; } = Alignment.Center;
public WidgetSize? Size { get; set; }
public override State CreateState() => new ContainerState();
}
internal sealed class ContainerState : SingleChildLayoutState<Container>, IContainerState
{
public override WidgetViewReference View { get; }
= WidgetViewReference.Resource("$$_Container");
public Sprite BackgroundImage => Widget.BackgroundImage != null
? Widget.BackgroundImage
: UniMobViewContext.DefaultWhiteImage;
public Color BackgroundColor => Widget.BackgroundColor;
public Alignment Alignment => Widget.Alignment;
public override WidgetSize CalculateSize() => Widget.Size ?? base.CalculateSize();
}
}