mirror of
https://github.com/ppy/osu
synced 2024-12-29 02:12:43 +00:00
Rename lookup & field
This commit is contained in:
parent
82ef85569b
commit
20c27c6943
@ -14,7 +14,7 @@ namespace osu.Game.Configuration
|
|||||||
{
|
{
|
||||||
Set(Static.LoginOverlayDisplayed, false);
|
Set(Static.LoginOverlayDisplayed, false);
|
||||||
Set(Static.MutedAudioNotificationShownOnce, false);
|
Set(Static.MutedAudioNotificationShownOnce, false);
|
||||||
Set<APISeasonalBackgrounds>(Static.SeasonalBackgroundsResponse, null);
|
Set<APISeasonalBackgrounds>(Static.SeasonalBackgrounds, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -22,6 +22,6 @@ namespace osu.Game.Configuration
|
|||||||
{
|
{
|
||||||
LoginOverlayDisplayed,
|
LoginOverlayDisplayed,
|
||||||
MutedAudioNotificationShownOnce,
|
MutedAudioNotificationShownOnce,
|
||||||
SeasonalBackgroundsResponse,
|
SeasonalBackgrounds,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,20 +18,20 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
[LongRunningLoad]
|
[LongRunningLoad]
|
||||||
public class SeasonalBackgroundLoader : Component
|
public class SeasonalBackgroundLoader : Component
|
||||||
{
|
{
|
||||||
private Bindable<APISeasonalBackgrounds> cachedResponse;
|
private Bindable<APISeasonalBackgrounds> seasonalBackgrounds;
|
||||||
private int current;
|
private int current;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(SessionStatics sessionStatics, IAPIProvider api)
|
private void load(SessionStatics sessionStatics, IAPIProvider api)
|
||||||
{
|
{
|
||||||
cachedResponse = sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgroundsResponse);
|
seasonalBackgrounds = sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds);
|
||||||
|
|
||||||
if (cachedResponse.Value != null) return;
|
if (seasonalBackgrounds.Value != null) return;
|
||||||
|
|
||||||
var request = new GetSeasonalBackgroundsRequest();
|
var request = new GetSeasonalBackgroundsRequest();
|
||||||
request.Success += response =>
|
request.Success += response =>
|
||||||
{
|
{
|
||||||
cachedResponse.Value = response;
|
seasonalBackgrounds.Value = response;
|
||||||
current = RNG.Next(0, response.Backgrounds?.Count ?? 0);
|
current = RNG.Next(0, response.Backgrounds?.Count ?? 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
|
|
||||||
public SeasonalBackground LoadBackground()
|
public SeasonalBackground LoadBackground()
|
||||||
{
|
{
|
||||||
var backgrounds = cachedResponse.Value.Backgrounds;
|
var backgrounds = seasonalBackgrounds.Value.Backgrounds;
|
||||||
if (backgrounds == null || !backgrounds.Any()) return null;
|
if (backgrounds == null || !backgrounds.Any()) return null;
|
||||||
|
|
||||||
current = (current + 1) % backgrounds.Count;
|
current = (current + 1) % backgrounds.Count;
|
||||||
@ -49,7 +49,7 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
return new SeasonalBackground(url);
|
return new SeasonalBackground(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsInSeason => cachedResponse.Value != null && DateTimeOffset.Now < cachedResponse.Value.EndDate;
|
public bool IsInSeason => seasonalBackgrounds.Value != null && DateTimeOffset.Now < seasonalBackgrounds.Value.EndDate;
|
||||||
}
|
}
|
||||||
|
|
||||||
[LongRunningLoad]
|
[LongRunningLoad]
|
||||||
|
Loading…
Reference in New Issue
Block a user