3 Commits

Author SHA1 Message Date
5399943118 update logo colour only when changing setting value 2025-08-27 00:58:26 +03:00
d07f82f6f4 refactor custom seasonal background code
some of it may be trauma-inducing, but I don't know how to make it
better
2025-08-27 00:43:26 +03:00
5b186bb740 potentially make logo look less weird (untested)
uh, yeah, I accidentally flipped the colors around in the UpdateColour() method (which I should've probably make private or protected), and it's the reason why the logo overall looked dimmer than it should've

anyhow, this should *probably* look a bit better, don't have any means to test it yet though
2025-08-25 12:46:27 +02:00
5 changed files with 70 additions and 62 deletions

View File

@@ -198,6 +198,7 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.MenuBackgroundSource, BackgroundSource.Skin); SetDefault(OsuSetting.MenuBackgroundSource, BackgroundSource.Skin);
SetDefault(OsuSetting.SeasonalBackgroundMode, SeasonalBackgroundMode.Never); SetDefault(OsuSetting.SeasonalBackgroundMode, SeasonalBackgroundMode.Never);
SetDefault(OsuSetting.UseSeasonalBackgroundsV2, true);
SetDefault(OsuSetting.DiscordRichPresence, DiscordRichPresenceMode.Full); SetDefault(OsuSetting.DiscordRichPresence, DiscordRichPresenceMode.Full);
@@ -442,6 +443,7 @@ namespace osu.Game.Configuration
MenuBackgroundSource, MenuBackgroundSource,
GameplayDisableWinKey, GameplayDisableWinKey,
SeasonalBackgroundMode, SeasonalBackgroundMode,
UseSeasonalBackgroundsV2, // TODO: add migrations
BackgroundCategory, BackgroundCategory,
EditorWaveformOpacity, EditorWaveformOpacity,
EditorShowHitMarkers, EditorShowHitMarkers,

View File

@@ -33,19 +33,19 @@ namespace osu.Game.Graphics.Backgrounds
[Resolved] [Resolved]
private IAPIProvider api { get; set; } private IAPIProvider api { get; set; }
private Bindable<SeasonalBackgroundMode> backgroundMode; private Bindable<bool> useSeasonalBackgrounds;
private Bindable<string> selectedCategory; private Bindable<string> selectedCategory;
private Bindable<APISeasonalBackgrounds> currentBackgrounds; private Bindable<APISeasonalBackgrounds> currentBackgrounds;
private int currentBackgroundIndex; private int currentBackgroundIndex;
private bool shouldShowCustomBackgrounds => backgroundMode.Value != SeasonalBackgroundMode.Never; private bool shouldShowCustomBackgrounds => useSeasonalBackgrounds.Value;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config, SessionStatics sessionStatics) private void load(OsuConfigManager config, SessionStatics sessionStatics)
{ {
backgroundMode = config.GetBindable<SeasonalBackgroundMode>(OsuSetting.SeasonalBackgroundMode); useSeasonalBackgrounds = config.GetBindable<bool>(OsuSetting.UseSeasonalBackgroundsV2);
backgroundMode.BindValueChanged(_ => BackgroundChanged?.Invoke()); useSeasonalBackgrounds.BindValueChanged(_ => BackgroundChanged?.Invoke());
selectedCategory = config.GetBindable<string>(OsuSetting.BackgroundCategory); selectedCategory = config.GetBindable<string>(OsuSetting.BackgroundCategory);
selectedCategory.BindValueChanged(_ => fetchBackgroundsForSelectedCategory()); selectedCategory.BindValueChanged(_ => fetchBackgroundsForSelectedCategory());
@@ -53,7 +53,7 @@ namespace osu.Game.Graphics.Backgrounds
currentBackgrounds = sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds); currentBackgrounds = sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds);
if (shouldShowCustomBackgrounds) if (shouldShowCustomBackgrounds)
fetchCategories(); fetchCategories(true);
} }
/// <summary> /// <summary>
@@ -64,7 +64,7 @@ namespace osu.Game.Graphics.Backgrounds
fetchCategories(); fetchCategories();
} }
private void fetchCategories() private void fetchCategories(bool ignoreSuccess = false)
{ {
if (!shouldShowCustomBackgrounds) return; if (!shouldShowCustomBackgrounds) return;
@@ -74,20 +74,27 @@ namespace osu.Game.Graphics.Backgrounds
{ {
var serverCategories = response.Categories ?? Enumerable.Empty<string>(); var serverCategories = response.Categories ?? Enumerable.Empty<string>();
AvailableCategories.Value = new[] { "Default" }.Concat(serverCategories) AvailableCategories.Value = serverCategories.Distinct(StringComparer.OrdinalIgnoreCase).ToList();
.Distinct(StringComparer.OrdinalIgnoreCase).ToList();
if (!AvailableCategories.Value.Any()) {
selectedCategory.Value = "";
return; // we don't have any categories!!!
}
if (!AvailableCategories.Value.Contains(selectedCategory.Value)) if (!AvailableCategories.Value.Contains(selectedCategory.Value))
selectedCategory.Value = "Default"; selectedCategory.Value = AvailableCategories.Value.Contains("Default")
else ? "Default"
: AvailableCategories.Value.ElementAt(0);
fetchBackgroundsForSelectedCategory(); fetchBackgroundsForSelectedCategory();
if (!ignoreSuccess)
OnCategoriesRefreshed?.Invoke(); OnCategoriesRefreshed?.Invoke();
}; };
request.Failure += exception => request.Failure += exception =>
{ {
AvailableCategories.Value = new[] { "Íå óäàëîñü çàãðóçèòü..." }; AvailableCategories.Value = Array.Empty<string>();
OnLoadFailure?.Invoke(exception); OnLoadFailure?.Invoke(exception);
}; };
@@ -98,13 +105,6 @@ namespace osu.Game.Graphics.Backgrounds
{ {
if (!shouldShowCustomBackgrounds) return; if (!shouldShowCustomBackgrounds) return;
if (AvailableCategories.Value.Count() == 1 && AvailableCategories.Value.First().Contains("Íå óäàëîñü"))
{
currentBackgrounds.Value = new APISeasonalBackgrounds { Backgrounds = new List<APISeasonalBackground>() };
BackgroundChanged?.Invoke();
return;
}
string categoryToFetch = selectedCategory.Value == "Default" ? null : selectedCategory.Value; string categoryToFetch = selectedCategory.Value == "Default" ? null : selectedCategory.Value;
var request = new GetSeasonalBackgroundsRequest(categoryToFetch); var request = new GetSeasonalBackgroundsRequest(categoryToFetch);

View File

@@ -171,7 +171,7 @@ namespace osu.Game
private readonly ScreenshotManager screenshotManager = new ScreenshotManager(); private readonly ScreenshotManager screenshotManager = new ScreenshotManager();
[Cached] [Cached]
private readonly SeasonalBackgroundLoader backgroundLoader; private SeasonalBackgroundLoader seasonalBackgroundLoader;
protected SentryLogger SentryLogger; protected SentryLogger SentryLogger;
@@ -253,10 +253,6 @@ namespace osu.Game
public OsuGame(string[] args = null) public OsuGame(string[] args = null)
{ {
backgroundLoader = new SeasonalBackgroundLoader();
backgroundLoader.OnLoadFailure += handleBackgroundLoadFailure;
backgroundLoader.OnCategoriesRefreshed += handleCategoriesRefreshed;
this.args = args; this.args = args;
Logger.NewEntry += forwardGeneralLogToNotifications; Logger.NewEntry += forwardGeneralLogToNotifications;
@@ -271,6 +267,8 @@ namespace osu.Game
tabletLogNotifyOnError = true; tabletLogNotifyOnError = true;
}, true); }, true);
}); });
initializeSeasonalBackgrounds();
} }
#region IOverlayManager #region IOverlayManager
@@ -409,18 +407,6 @@ namespace osu.Game
} }
} }
} }
private void handleCategoriesRefreshed()
{
Schedule(() =>
{
Notifications?.Post(new SimpleNotification
{
Text = ButtonSystemStrings.SeasonalBackgroundsRefreshed,
Icon = FontAwesome.Solid.CheckCircle,
Transient = true
});
});
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
@@ -1252,7 +1238,7 @@ namespace osu.Game
loadComponentSingleFile(screenshotManager, Add); loadComponentSingleFile(screenshotManager, Add);
loadComponentSingleFile(backgroundLoader, Add); loadComponentSingleFile(seasonalBackgroundLoader, Add);
// dependency on notification overlay, dependent by settings overlay // dependency on notification overlay, dependent by settings overlay
loadComponentSingleFile(CreateUpdateManager(), Add, true); loadComponentSingleFile(CreateUpdateManager(), Add, true);
@@ -1355,18 +1341,6 @@ namespace osu.Game
handleStartupImport(); handleStartupImport();
} }
private void handleBackgroundLoadFailure(Exception exception)
{
Schedule(() =>
{
Notifications?.Post(new SimpleErrorNotification
{
Text = ButtonSystemStrings.SeasonalBackgroundsFail,
Icon = FontAwesome.Solid.ExclamationTriangle,
Transient = true
});
});
}
private void handleBackButton() private void handleBackButton()
{ {
// TODO: this is SUPER SUPER bad. // TODO: this is SUPER SUPER bad.
@@ -1503,6 +1477,40 @@ namespace osu.Game
} }
} }
private void initializeSeasonalBackgrounds()
{
seasonalBackgroundLoader = new SeasonalBackgroundLoader();
seasonalBackgroundLoader.OnCategoriesRefreshed += handleCategoriesRefreshed;
seasonalBackgroundLoader.OnLoadFailure += handleBackgroundLoadFailure;
}
private void handleCategoriesRefreshed()
{
Schedule(() =>
{
Notifications?.Post(new SimpleNotification
{
Text = ButtonSystemStrings.SeasonalBackgroundsRefreshed,
Icon = FontAwesome.Solid.CheckCircle,
Transient = true
});
});
}
private void handleBackgroundLoadFailure(Exception exception)
{
Schedule(() =>
{
Notifications?.Post(new SimpleErrorNotification
{
Text = ButtonSystemStrings.SeasonalBackgroundsFail,
Icon = FontAwesome.Solid.ExclamationTriangle,
Transient = true
});
});
}
private Task asyncLoadStream; private Task asyncLoadStream;
/// <summary> /// <summary>

View File

@@ -37,13 +37,11 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
var backgroundModeBindable = config.GetBindable<SeasonalBackgroundMode>(OsuSetting.SeasonalBackgroundMode); var backgroundModeBindable = config.GetBindable<SeasonalBackgroundMode>(OsuSetting.SeasonalBackgroundMode);
var enabledProxyBindable = new Bindable<bool>(); var enabledProxyBindable = new Bindable<bool>();
backgroundModeBindable.BindValueChanged(mode => enabledProxyBindable.Value = mode.NewValue == SeasonalBackgroundMode.Always, true);
enabledProxyBindable.BindValueChanged(enabled => backgroundModeBindable.Value = enabled.NewValue ? SeasonalBackgroundMode.Always : SeasonalBackgroundMode.Never);
var backgroundToggle = new SettingsCheckbox var backgroundToggle = new SettingsCheckbox
{ {
LabelText = UserInterfaceStrings.UseSeasonalBackgrounds, LabelText = UserInterfaceStrings.UseSeasonalBackgrounds,
Current = enabledProxyBindable Current = config.GetBindable<bool>(OsuSetting.UseSeasonalBackgroundsV2),
ClassicDefault = true
}; };
var categoryDropdown = new SettingsDropdown<string> var categoryDropdown = new SettingsDropdown<string>

View File

@@ -196,7 +196,7 @@ namespace osu.Game.Screens.Menu
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = ColourInfo.GradientVertical( Colour = ColourInfo.GradientVertical(
Color4Extensions.FromHex(@"ff66ba"), // original osu! cookie pink Color4Extensions.FromHex(@"ff66ba"), // original osu! cookie pink
Color4Extensions.Darken(Color4Extensions.FromHex(@"ff66ba"), 1.0f) Color4Extensions.Darken(Color4Extensions.FromHex(@"ff66ba"), 0.5f)
), ),
}, },
triangles = new TrianglesV2 triangles = new TrianglesV2
@@ -208,7 +208,7 @@ namespace osu.Game.Screens.Menu
SpawnRatio = 1.4f, SpawnRatio = 1.4f,
Colour = ColourInfo.GradientVertical( Colour = ColourInfo.GradientVertical(
Color4Extensions.FromHex(@"ff66ba"), Color4Extensions.FromHex(@"ff66ba"),
Color4Extensions.Darken(Color4Extensions.FromHex(@"ff66ba"), 2.5f) Color4Extensions.Darken(Color4Extensions.FromHex(@"ff66ba"), 1.0f)
), ),
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
@@ -264,15 +264,15 @@ namespace osu.Game.Screens.Menu
if (triangles == null || colourBox == null) if (triangles == null || colourBox == null)
return; // we're still loading return; // we're still loading
colourBox.Colour = ColourInfo.GradientVertical(
logoColour.Value,
Color4Extensions.Darken(logoColour.Value, 0.5f)
);
triangles.Colour = ColourInfo.GradientVertical( triangles.Colour = ColourInfo.GradientVertical(
logoColour.Value, logoColour.Value,
Color4Extensions.Darken(logoColour.Value, 1.0f) Color4Extensions.Darken(logoColour.Value, 1.0f)
); );
colourBox.Colour = ColourInfo.GradientVertical(
logoColour.Value,
Color4Extensions.Darken(logoColour.Value, 2.5f)
);
} }
public Container LogoElements { get; private set; } public Container LogoElements { get; private set; }
@@ -313,6 +313,7 @@ namespace osu.Game.Screens.Menu
ripple.Texture = textures.Get(@"Menu/logo"); ripple.Texture = textures.Get(@"Menu/logo");
logoColour = config.GetBindable<Colour4>(OsuSetting.MenuCookieColor); logoColour = config.GetBindable<Colour4>(OsuSetting.MenuCookieColor);
logoColour.BindValueChanged(_ => UpdateColour());
} }
private int lastBeatIndex; private int lastBeatIndex;
@@ -393,7 +394,6 @@ namespace osu.Game.Screens.Menu
protected override void Update() protected override void Update()
{ {
base.Update(); base.Update();
UpdateColour();
const float scale_adjust_cutoff = 0.4f; const float scale_adjust_cutoff = 0.4f;