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