private void load() { RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; Masking = true; CornerRadius = 6; NewsBackground bg; InternalChildren = new Drawable[] { background = new Box { RelativeSizeAxes = Axes.Both, Colour = colourProvider.Background4 }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, Height = 160, Masking = true, CornerRadius = 6, Children = new Drawable[] { new DelayedLoadWrapper(bg = new NewsBackground(post.FirstImage) { RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, Anchor = Anchor.Centre, Origin = Anchor.Centre, Alpha = 0 }) { RelativeSizeAxes = Axes.Both }, new DateContainer(post.PublishedAt) { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Margin = new MarginPadding { Top = 10, Right = 15 } } } }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Horizontal = 15, Vertical = 10 }, Child = main = new TextFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y } } } }, new HoverClickSounds() }; bg.OnLoadComplete += d => d.FadeIn(250, Easing.In); main.AddParagraph(post.Title, t => t.Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold)); main.AddParagraph(post.Preview, t => t.Font = OsuFont.GetFont(size: 12)); // Should use sans-serif font main.AddParagraph("by ", t => t.Font = OsuFont.GetFont(size: 12)); main.AddText(post.Author, t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold)); }
private void load(OverlayColourProvider colourProvider, GameHost host) { if (post.Slug != null) { TooltipText = "view in browser"; Action = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug); } NewsPostBackground bg; AddRange(new Drawable[] { background = new Box { RelativeSizeAxes = Axes.Both }, new FillFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Direction = FillDirection.Vertical, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.X, Height = 160, Masking = true, CornerRadius = 6, Children = new Drawable[] { new DelayedLoadWrapper(bg = new NewsPostBackground(post.FirstImage) { RelativeSizeAxes = Axes.Both, FillMode = FillMode.Fill, Anchor = Anchor.Centre, Origin = Anchor.Centre, Alpha = 0 }) { RelativeSizeAxes = Axes.Both }, new DateContainer(post.PublishedAt) { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Margin = new MarginPadding { Top = 10, Right = 15 } } } }, new Container { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, Padding = new MarginPadding { Horizontal = 15, Vertical = 10 }, Child = main = new TextFlowContainer { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y } } } } }); IdleColour = colourProvider.Background4; HoverColour = colourProvider.Background3; bg.OnLoadComplete += d => d.FadeIn(250, Easing.In); main.AddParagraph(post.Title, t => t.Font = OsuFont.GetFont(size: 20, weight: FontWeight.SemiBold)); main.AddParagraph(post.Preview, t => t.Font = OsuFont.GetFont(size: 12)); // Should use sans-serif font main.AddParagraph("by ", t => t.Font = OsuFont.GetFont(size: 12)); main.AddText(post.Author, t => t.Font = OsuFont.GetFont(size: 12, weight: FontWeight.SemiBold)); }
private void load(TextureStore textures) { RelativeSizeAxes = Axes.Both; Masking = true; BorderColour = Colour4.Black; BorderThickness = 3.5f; InternalChildren = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Colour = new Colour4(106, 100, 104, 255) }, new FillFlowContainer { RelativeSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Padding = new MarginPadding(40), Spacing = new Vector2(20), Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Width = .3f, Child = gameImage = new Sprite { RelativeSizeAxes = Axes.Both, Texture = textures.Get("Images/gtg") } }, new Container { RelativeSizeAxes = Axes.Both, Width = .5f, Children = new Drawable[] { new FillFlowContainer { RelativeSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new Drawable[] { new Container { RelativeSizeAxes = Axes.Both, Child = text = new TextFlowContainer { RelativeSizeAxes = Axes.Both } }, }, }, }, }, new Container { RelativeSizeAxes = Axes.Both, Width = .2f, Padding = new MarginPadding { Right = 80 }, Child = new FillFlowContainer { RelativeSizeAxes = Axes.Both, Direction = FillDirection.Horizontal, Spacing = new Vector2(30), Children = new Drawable[] { new SpriteIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Width = .5f, Icon = FontAwesome.Solid.Users, }, new SpriteText { Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = game.Minplayers + "-" + game.Maxplayers, Font = new FontUsage(size: GameNameSize), }, }, }, }, }, }, }; Schedule(async() => { gameImage.Texture = await textures.GetAsync(@$ "https://gamestogo.company/api/Games/DownloadFile/{game.Image}"); }); text.AddText(game.Name, f => f.Font = new FontUsage(size: GameNameSize)); text.AddParagraph(@$ "Hecho por: {game.Creator.Username}", t => t.Font = new FontUsage(size: MadeBySize)); }