mirror of
https://github.com/ppy/osu
synced 2024-12-15 03:16:17 +00:00
Fix news post images never unloading from memory after first display
This commit is contained in:
parent
f67e8ce523
commit
b37e9c0266
@ -119,22 +119,17 @@ namespace osu.Game.Overlays.Dashboard.Home.News
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host)
|
||||
{
|
||||
NewsPostBackground bg;
|
||||
|
||||
Child = new DelayedLoadWrapper(bg = new NewsPostBackground(post.FirstImage)
|
||||
Child = new DelayedLoadUnloadWrapper(() => new NewsPostBackground(post.FirstImage)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fill,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0
|
||||
})
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
};
|
||||
|
||||
bg.OnLoadComplete += d => d.FadeIn(250, Easing.In);
|
||||
|
||||
TooltipText = "view in browser";
|
||||
Action = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug);
|
||||
|
||||
|
@ -49,7 +49,6 @@ namespace osu.Game.Overlays.News
|
||||
Action = () => host.OpenUrlExternally("https://osu.ppy.sh/home/news/" + post.Slug);
|
||||
}
|
||||
|
||||
NewsPostBackground bg;
|
||||
AddRange(new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
@ -71,14 +70,14 @@ namespace osu.Game.Overlays.News
|
||||
CornerRadius = 6,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new DelayedLoadWrapper(bg = new NewsPostBackground(post.FirstImage)
|
||||
new DelayedLoadUnloadWrapper(() => new NewsPostBackground(post.FirstImage)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fill,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Alpha = 0
|
||||
})
|
||||
}, timeBeforeUnload: 5000)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both
|
||||
},
|
||||
@ -116,8 +115,6 @@ namespace osu.Game.Overlays.News
|
||||
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));
|
||||
|
@ -4,6 +4,7 @@
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
|
||||
@ -25,6 +26,12 @@ namespace osu.Game.Overlays.News
|
||||
Texture = store.Get(createUrl(sourceUrl));
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
this.FadeInFromZero(500, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private string createUrl(string source)
|
||||
{
|
||||
if (string.IsNullOrEmpty(source))
|
||||
|
Loading…
Reference in New Issue
Block a user