private void load() { Add(new FillFlowContainer { AutoSizeAxes = Axes.X, Direction = FillDirection.Horizontal, Height = ARGUMENT_HEIGHT, Spacing = new Vector2(4), Children = new Drawable[] { new Container { Size = new Vector2(ARGUMENT_HEIGHT), Child = image = new Sprite { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, }, }, new SpriteText { Text = value.Name.Value, Font = FontUsage.Default.With(size: ARGUMENT_HEIGHT), }, }, }); image.Texture = value.GetImageWithFallback().Texture; }
private void load() { SelectionContainer.Add(new FillFlowContainer { AutoSizeAxes = Axes.X, Direction = FillDirection.Horizontal, Height = 25, Spacing = new Vector2(4), Children = new Drawable[] { new Container { Size = new Vector2(25), Child = image = new Sprite { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fit, }, }, text = new SpriteText { Font = FontUsage.Default.With(size: 25), }, }, }); Current.BindValueChanged(v => { ProjectElement element = project.ProjectElements.FirstOrDefault(e => e.ID == v.NewValue); if (!(element is T)) { if (v.NewValue != null) { throw new ArgumentException( $"An argument looking for an element had it's result set to a non existent element or an argument type different to {typeof(T)}", nameof(v.NewValue)); } return; } text.Text = element.Name?.Value ?? string.Empty; image.Texture = element.GetImageWithFallback().Texture; }, true); }