3 Commits

5 changed files with 46 additions and 25 deletions

3
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,3 @@
{
"dotnet.defaultSolution": "osu.Desktop.slnf"
}

View File

@@ -59,9 +59,9 @@ namespace osu.Game.Graphics.Backgrounds
/// <summary>
/// Public method to trigger a refresh of categories from the UI.
/// </summary>
public void RefreshCategories()
public void RefreshCategories(bool ignoreSuccess = false)
{
fetchCategories();
fetchCategories(ignoreSuccess);
}
private void fetchCategories(bool ignoreSuccess = false)
@@ -76,7 +76,8 @@ namespace osu.Game.Graphics.Backgrounds
AvailableCategories.Value = serverCategories.Distinct(StringComparer.OrdinalIgnoreCase).ToList();
if (!AvailableCategories.Value.Any()) {
if (!AvailableCategories.Value.Any())
{
selectedCategory.Value = "";
return; // we don't have any categories!!!
}

View File

@@ -5,16 +5,13 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Localisation;
using osu.Game.Configuration;
using osu.Game.Graphics.Backgrounds;
using osu.Game.Localisation;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.Settings;
namespace osu.Game.Overlays.Settings.Sections.UserInterface
{
@@ -29,13 +26,13 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
private SettingsEnumDropdown<BackgroundSource> backgroundSourceDropdown;
private Bindable<bool> useSeasonalBackgrounds;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config, IAPIProvider api)
{
user = api.LocalUser.GetBoundCopy();
var backgroundModeBindable = config.GetBindable<SeasonalBackgroundMode>(OsuSetting.SeasonalBackgroundMode);
var enabledProxyBindable = new Bindable<bool>();
useSeasonalBackgrounds = config.GetBindable<bool>(OsuSetting.UseSeasonalBackgroundsV2);
var backgroundToggle = new SettingsCheckbox
{
@@ -56,28 +53,21 @@ namespace osu.Game.Overlays.Settings.Sections.UserInterface
Action = () => backgroundLoader.RefreshCategories()
};
backgroundLoader.AvailableCategories.BindValueChanged(categories => categoryDropdown.Items = categories.NewValue, true);
// TODO: the category dropdown disappear if no backgrounds (e.g. when first enabling the setting)
refreshButton.CanBeShown.BindTo(useSeasonalBackgrounds);
categoryDropdown.CanBeShown.BindTo(useSeasonalBackgrounds);
useSeasonalBackgrounds.BindValueChanged(
_ => backgroundLoader.RefreshCategories(true)
);
backgroundModeBindable.BindValueChanged(mode =>
{
if (mode.NewValue == SeasonalBackgroundMode.Always)
{
categoryDropdown.Show();
refreshButton.Show();
}
else
{
categoryDropdown.Hide();
refreshButton.Hide();
}
}, true);
backgroundLoader.AvailableCategories.BindValueChanged(categories => categoryDropdown.Items = categories.NewValue, true);
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = UserInterfaceStrings.ShowMenuTips,
Current = config.GetBindable<bool>(OsuSetting.MenuTips)
Current = config.GetBindable<bool>(OsuSetting.MenuTips),
},
new SettingsCheckbox
{

View File

@@ -40,6 +40,7 @@ using osu.Game.Localisation;
using osu.Game.Online.API;
using osu.Game.Online.Multiplayer;
using osu.Game.Overlays;
using osu.Game.Overlays.Dialog;
using osu.Game.Overlays.Notifications;
using osu.Game.Overlays.OSD;
using osu.Game.Rulesets;
@@ -1312,6 +1313,8 @@ namespace osu.Game.Screens.Edit
yield return upload;
}
yield return new EditorMenuItem("Remove all online IDs", MenuItemType.Destructive, anonymizeBeatmap);
if (editorBeatmap.BeatmapInfo.OnlineID > 0)
{
yield return new OsuMenuItemSpacer();
@@ -1396,6 +1399,29 @@ namespace osu.Game.Screens.Edit
void startSubmission() => this.Push(new BeatmapSubmissionScreen());
}
private void anonymizeBeatmap()
{
dialogOverlay.Push(new ConfirmDialog(
"Really remove online IDs?", () =>
{
var maps = editorBeatmap.BeatmapInfo.BeatmapSet.Beatmaps;
foreach (BeatmapInfo map in maps)
{
map.OnlineID = -1;
map.BeatmapSet.OnlineID = -1;
map.ResetOnlineInfo(true);
beatmapManager.Save(
map,
beatmapManager.GetWorkingBeatmap(map, true)!.Beatmap,
editorBeatmap.BeatmapSkin
); // as much as I don't want to mutate this much, there's no other choice
}
updateLastSavedHash();
onScreenDisplay?.Display(new BeatmapEditorToast("Online IDs removed", editorBeatmap.BeatmapInfo.GetDisplayTitle()));
}
));
}
private void exportBeatmap(bool legacy)
{
if (HasUnsavedChanges)

View File

@@ -260,7 +260,8 @@ namespace osu.Game.Screens.Menu
};
}
public void UpdateColour() {
public void UpdateColour()
{
if (triangles == null || colourBox == null)
return; // we're still loading