2021-04-19 02:16:17 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Localisation;
|
|
|
|
using osu.Game.Graphics.UserInterfaceV2;
|
2022-08-11 01:53:20 +08:00
|
|
|
using osu.Game.Localisation;
|
2024-10-04 16:01:11 +08:00
|
|
|
using osu.Game.Skinning;
|
2021-04-19 02:16:17 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Edit.Setup
|
|
|
|
{
|
2024-07-10 20:42:11 +08:00
|
|
|
public partial class ColoursSection : SetupSection
|
2021-04-19 02:16:17 +08:00
|
|
|
{
|
2022-08-15 23:14:16 +08:00
|
|
|
public override LocalisableString Title => EditorSetupStrings.ColoursHeader;
|
2021-04-19 02:16:17 +08:00
|
|
|
|
2024-08-28 18:17:39 +08:00
|
|
|
private FormColourPalette comboColours = null!;
|
2021-04-19 02:16:17 +08:00
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
2024-08-28 18:17:39 +08:00
|
|
|
comboColours = new FormColourPalette
|
2021-04-19 02:16:17 +08:00
|
|
|
{
|
2024-08-28 18:17:39 +08:00
|
|
|
Caption = EditorSetupStrings.HitCircleSliderCombos,
|
2022-08-16 13:51:54 +08:00
|
|
|
}
|
2021-04-19 02:16:17 +08:00
|
|
|
};
|
2024-10-04 16:01:11 +08:00
|
|
|
}
|
|
|
|
|
2024-10-04 17:18:09 +08:00
|
|
|
private bool syncingColours;
|
2021-04-19 02:16:17 +08:00
|
|
|
|
2024-10-04 16:01:11 +08:00
|
|
|
protected override void LoadComplete()
|
|
|
|
{
|
2021-08-15 22:32:26 +08:00
|
|
|
if (Beatmap.BeatmapSkin != null)
|
2024-10-04 16:01:11 +08:00
|
|
|
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;
|
|
|
|
});
|
2021-04-19 02:16:17 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|