Compare commits
3 Commits
2025.825.0
...
5399943118
| Author | SHA1 | Date | |
|---|---|---|---|
| 5399943118 | |||
| d07f82f6f4 | |||
| 5b186bb740 |
@@ -198,6 +198,7 @@ namespace osu.Game.Configuration
|
||||
|
||||
SetDefault(OsuSetting.MenuBackgroundSource, BackgroundSource.Skin);
|
||||
SetDefault(OsuSetting.SeasonalBackgroundMode, SeasonalBackgroundMode.Never);
|
||||
SetDefault(OsuSetting.UseSeasonalBackgroundsV2, true);
|
||||
|
||||
SetDefault(OsuSetting.DiscordRichPresence, DiscordRichPresenceMode.Full);
|
||||
|
||||
@@ -442,6 +443,7 @@ namespace osu.Game.Configuration
|
||||
MenuBackgroundSource,
|
||||
GameplayDisableWinKey,
|
||||
SeasonalBackgroundMode,
|
||||
UseSeasonalBackgroundsV2, // TODO: add migrations
|
||||
BackgroundCategory,
|
||||
EditorWaveformOpacity,
|
||||
EditorShowHitMarkers,
|
||||
|
||||
@@ -33,19 +33,19 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; }
|
||||
|
||||
private Bindable<SeasonalBackgroundMode> backgroundMode;
|
||||
private Bindable<bool> useSeasonalBackgrounds;
|
||||
private Bindable<string> selectedCategory;
|
||||
private Bindable<APISeasonalBackgrounds> currentBackgrounds;
|
||||
|
||||
private int currentBackgroundIndex;
|
||||
|
||||
private bool shouldShowCustomBackgrounds => backgroundMode.Value != SeasonalBackgroundMode.Never;
|
||||
private bool shouldShowCustomBackgrounds => useSeasonalBackgrounds.Value;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config, SessionStatics sessionStatics)
|
||||
{
|
||||
backgroundMode = config.GetBindable<SeasonalBackgroundMode>(OsuSetting.SeasonalBackgroundMode);
|
||||
backgroundMode.BindValueChanged(_ => BackgroundChanged?.Invoke());
|
||||
useSeasonalBackgrounds = config.GetBindable<bool>(OsuSetting.UseSeasonalBackgroundsV2);
|
||||
useSeasonalBackgrounds.BindValueChanged(_ => BackgroundChanged?.Invoke());
|
||||
|
||||
selectedCategory = config.GetBindable<string>(OsuSetting.BackgroundCategory);
|
||||
selectedCategory.BindValueChanged(_ => fetchBackgroundsForSelectedCategory());
|
||||
@@ -53,7 +53,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
currentBackgrounds = sessionStatics.GetBindable<APISeasonalBackgrounds>(Static.SeasonalBackgrounds);
|
||||
|
||||
if (shouldShowCustomBackgrounds)
|
||||
fetchCategories();
|
||||
fetchCategories(true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -64,7 +64,7 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
fetchCategories();
|
||||
}
|
||||
|
||||
private void fetchCategories()
|
||||
private void fetchCategories(bool ignoreSuccess = false)
|
||||
{
|
||||
if (!shouldShowCustomBackgrounds) return;
|
||||
|
||||
@@ -74,20 +74,27 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
{
|
||||
var serverCategories = response.Categories ?? Enumerable.Empty<string>();
|
||||
|
||||
AvailableCategories.Value = new[] { "Default" }.Concat(serverCategories)
|
||||
.Distinct(StringComparer.OrdinalIgnoreCase).ToList();
|
||||
AvailableCategories.Value = serverCategories.Distinct(StringComparer.OrdinalIgnoreCase).ToList();
|
||||
|
||||
if (!AvailableCategories.Value.Any()) {
|
||||
selectedCategory.Value = "";
|
||||
return; // we don't have any categories!!!
|
||||
}
|
||||
|
||||
if (!AvailableCategories.Value.Contains(selectedCategory.Value))
|
||||
selectedCategory.Value = "Default";
|
||||
else
|
||||
fetchBackgroundsForSelectedCategory();
|
||||
selectedCategory.Value = AvailableCategories.Value.Contains("Default")
|
||||
? "Default"
|
||||
: AvailableCategories.Value.ElementAt(0);
|
||||
|
||||
OnCategoriesRefreshed?.Invoke();
|
||||
fetchBackgroundsForSelectedCategory();
|
||||
|
||||
if (!ignoreSuccess)
|
||||
OnCategoriesRefreshed?.Invoke();
|
||||
};
|
||||
|
||||
request.Failure += exception =>
|
||||
{
|
||||
AvailableCategories.Value = new[] { "Íå óäàëîñü çàãðóçèòü..." };
|
||||
AvailableCategories.Value = Array.Empty<string>();
|
||||
OnLoadFailure?.Invoke(exception);
|
||||
};
|
||||
|
||||
@@ -98,13 +105,6 @@ namespace osu.Game.Graphics.Backgrounds
|
||||
{
|
||||
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;
|
||||
var request = new GetSeasonalBackgroundsRequest(categoryToFetch);
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace osu.Game
|
||||
private readonly ScreenshotManager screenshotManager = new ScreenshotManager();
|
||||
|
||||
[Cached]
|
||||
private readonly SeasonalBackgroundLoader backgroundLoader;
|
||||
private SeasonalBackgroundLoader seasonalBackgroundLoader;
|
||||
|
||||
protected SentryLogger SentryLogger;
|
||||
|
||||
@@ -253,10 +253,6 @@ namespace osu.Game
|
||||
|
||||
public OsuGame(string[] args = null)
|
||||
{
|
||||
backgroundLoader = new SeasonalBackgroundLoader();
|
||||
backgroundLoader.OnLoadFailure += handleBackgroundLoadFailure;
|
||||
backgroundLoader.OnCategoriesRefreshed += handleCategoriesRefreshed;
|
||||
|
||||
this.args = args;
|
||||
|
||||
Logger.NewEntry += forwardGeneralLogToNotifications;
|
||||
@@ -271,6 +267,8 @@ namespace osu.Game
|
||||
tabletLogNotifyOnError = true;
|
||||
}, true);
|
||||
});
|
||||
|
||||
initializeSeasonalBackgrounds();
|
||||
}
|
||||
|
||||
#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]
|
||||
private void load()
|
||||
@@ -1252,7 +1238,7 @@ namespace osu.Game
|
||||
|
||||
loadComponentSingleFile(screenshotManager, Add);
|
||||
|
||||
loadComponentSingleFile(backgroundLoader, Add);
|
||||
loadComponentSingleFile(seasonalBackgroundLoader, Add);
|
||||
|
||||
// dependency on notification overlay, dependent by settings overlay
|
||||
loadComponentSingleFile(CreateUpdateManager(), Add, true);
|
||||
@@ -1355,18 +1341,6 @@ namespace osu.Game
|
||||
handleStartupImport();
|
||||
}
|
||||
|
||||
private void handleBackgroundLoadFailure(Exception exception)
|
||||
{
|
||||
Schedule(() =>
|
||||
{
|
||||
Notifications?.Post(new SimpleErrorNotification
|
||||
{
|
||||
Text = ButtonSystemStrings.SeasonalBackgroundsFail,
|
||||
Icon = FontAwesome.Solid.ExclamationTriangle,
|
||||
Transient = true
|
||||
});
|
||||
});
|
||||
}
|
||||
private void handleBackButton()
|
||||
{
|
||||
// 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;
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -37,13 +37,11 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
|
||||
var backgroundModeBindable = config.GetBindable<SeasonalBackgroundMode>(OsuSetting.SeasonalBackgroundMode);
|
||||
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
|
||||
{
|
||||
LabelText = UserInterfaceStrings.UseSeasonalBackgrounds,
|
||||
Current = enabledProxyBindable
|
||||
Current = config.GetBindable<bool>(OsuSetting.UseSeasonalBackgroundsV2),
|
||||
ClassicDefault = true
|
||||
};
|
||||
|
||||
var categoryDropdown = new SettingsDropdown<string>
|
||||
|
||||
@@ -196,7 +196,7 @@ namespace osu.Game.Screens.Menu
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Colour = ColourInfo.GradientVertical(
|
||||
Color4Extensions.FromHex(@"ff66ba"), // original osu! cookie pink
|
||||
Color4Extensions.Darken(Color4Extensions.FromHex(@"ff66ba"), 1.0f)
|
||||
Color4Extensions.Darken(Color4Extensions.FromHex(@"ff66ba"), 0.5f)
|
||||
),
|
||||
},
|
||||
triangles = new TrianglesV2
|
||||
@@ -208,7 +208,7 @@ namespace osu.Game.Screens.Menu
|
||||
SpawnRatio = 1.4f,
|
||||
Colour = ColourInfo.GradientVertical(
|
||||
Color4Extensions.FromHex(@"ff66ba"),
|
||||
Color4Extensions.Darken(Color4Extensions.FromHex(@"ff66ba"), 2.5f)
|
||||
Color4Extensions.Darken(Color4Extensions.FromHex(@"ff66ba"), 1.0f)
|
||||
),
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
@@ -264,15 +264,15 @@ namespace osu.Game.Screens.Menu
|
||||
if (triangles == null || colourBox == null)
|
||||
return; // we're still loading
|
||||
|
||||
colourBox.Colour = ColourInfo.GradientVertical(
|
||||
logoColour.Value,
|
||||
Color4Extensions.Darken(logoColour.Value, 0.5f)
|
||||
);
|
||||
|
||||
triangles.Colour = ColourInfo.GradientVertical(
|
||||
logoColour.Value,
|
||||
Color4Extensions.Darken(logoColour.Value, 1.0f)
|
||||
);
|
||||
|
||||
colourBox.Colour = ColourInfo.GradientVertical(
|
||||
logoColour.Value,
|
||||
Color4Extensions.Darken(logoColour.Value, 2.5f)
|
||||
);
|
||||
}
|
||||
|
||||
public Container LogoElements { get; private set; }
|
||||
@@ -313,6 +313,7 @@ namespace osu.Game.Screens.Menu
|
||||
ripple.Texture = textures.Get(@"Menu/logo");
|
||||
|
||||
logoColour = config.GetBindable<Colour4>(OsuSetting.MenuCookieColor);
|
||||
logoColour.BindValueChanged(_ => UpdateColour());
|
||||
}
|
||||
|
||||
private int lastBeatIndex;
|
||||
@@ -393,7 +394,6 @@ namespace osu.Game.Screens.Menu
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
UpdateColour();
|
||||
|
||||
const float scale_adjust_cutoff = 0.4f;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user