mirror of
https://github.com/ppy/osu.git
synced 2025-03-06 00:02:55 +08:00
Initialise colours section with default combo colours if none present
Closes https://github.com/ppy/osu/issues/30100.
This commit is contained in:
parent
114e53f8b2
commit
6e5a38c6c8
@ -6,6 +6,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Screens.Edit.Setup
|
||||
{
|
||||
@ -25,9 +26,50 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
Caption = EditorSetupStrings.HitCircleSliderCombos,
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private bool syncingColours = false;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
if (Beatmap.BeatmapSkin != null)
|
||||
comboColours.Colours.BindTo(Beatmap.BeatmapSkin.ComboColours);
|
||||
comboColours.Colours.AddRange(Beatmap.BeatmapSkin.ComboColours);
|
||||
|
||||
if (comboColours.Colours.Count == 0)
|
||||
{
|
||||
// compare ctor of `EditorBeatmapSkin`
|
||||
for (int i = 0; i < SkinConfiguration.DefaultComboColours.Count; ++i)
|
||||
comboColours.Colours.Add(SkinConfiguration.DefaultComboColours[(i + 1) % SkinConfiguration.DefaultComboColours.Count]);
|
||||
}
|
||||
|
||||
comboColours.Colours.BindCollectionChanged((_, _) =>
|
||||
{
|
||||
if (Beatmap.BeatmapSkin != null)
|
||||
{
|
||||
if (syncingColours)
|
||||
return;
|
||||
|
||||
syncingColours = true;
|
||||
|
||||
Beatmap.BeatmapSkin.ComboColours.Clear();
|
||||
Beatmap.BeatmapSkin.ComboColours.AddRange(comboColours.Colours);
|
||||
|
||||
syncingColours = false;
|
||||
}
|
||||
});
|
||||
|
||||
Beatmap.BeatmapSkin?.ComboColours.BindCollectionChanged((_, _) =>
|
||||
{
|
||||
if (syncingColours)
|
||||
return;
|
||||
|
||||
syncingColours = true;
|
||||
|
||||
comboColours.Colours.Clear();
|
||||
comboColours.Colours.AddRange(Beatmap.BeatmapSkin?.ComboColours);
|
||||
|
||||
syncingColours = false;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user