1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-13 08:32:57 +08:00

Make work again for simple case

This commit is contained in:
Dean Herbert 2024-03-23 23:07:31 +08:00
parent 4c82e44291
commit ec4a9a5fdd
No known key found for this signature in database
2 changed files with 17 additions and 20 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using Newtonsoft.Json;
namespace osu.Game.Online.API.Requests.Responses
@ -14,14 +15,12 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"images")]
public APIMenuImage[] Images { get; init; } = Array.Empty<APIMenuImage>();
public DateTimeOffset LastUpdated { get; init; }
public bool Equals(APIMenuContent? other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return LastUpdated.Equals(other.LastUpdated);
return Images.SequenceEqual(other.Images);
}
public override bool Equals(object? obj)
@ -36,7 +35,12 @@ namespace osu.Game.Online.API.Requests.Responses
public override int GetHashCode()
{
return LastUpdated.GetHashCode();
var hash = new HashCode();
foreach (var image in Images)
hash.Add(image.GetHashCode());
return hash.ToHashCode();
}
}
}

View File

@ -78,7 +78,7 @@ namespace osu.Game.Screens.Menu
{
base.LoadComplete();
Current.BindValueChanged(_ => loadNewImage(), true);
Current.BindValueChanged(_ => loadNewImages(), true);
checkForUpdates();
}
@ -102,7 +102,7 @@ namespace osu.Game.Screens.Menu
});
}
private void loadNewImage()
private void loadNewImages()
{
cancellationTokenSource?.Cancel();
cancellationTokenSource = null;
@ -131,19 +131,19 @@ namespace osu.Game.Screens.Menu
public MenuImage(APIMenuImage image)
{
AutoSizeAxes = Axes.Both;
Image = image;
}
[BackgroundDependencyLoader]
private void load(LargeTextureStore textureStore, OsuGame game)
private void load(LargeTextureStore textureStore, OsuGame? game)
{
Texture? texture = textureStore.Get(Image.Image);
if (texture != null && Image.Image.Contains(@"@2x"))
texture.ScaleAdjust *= 2;
AutoSizeAxes = Axes.Both;
InternalChildren = new Drawable[]
Children = new Drawable[]
{
new Sprite { Texture = texture },
flash = new Sprite
@ -155,7 +155,9 @@ namespace osu.Game.Screens.Menu
Action = () =>
{
Flash();
flash.FadeInFromZero(50)
.Then()
.FadeOut(500, Easing.OutQuint);
// Delay slightly to allow animation to play out.
openUrlAction?.Cancel();
@ -174,15 +176,6 @@ namespace osu.Game.Screens.Menu
this.FadeInFromZero(500, Easing.OutQuint);
flash.FadeOutFromOne(4000, Easing.OutQuint);
}
public Drawable Flash()
{
flash.FadeInFromZero(50)
.Then()
.FadeOut(500, Easing.OutQuint);
return this;
}
}
}
}