mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:42:55 +08:00
Fix editor displaying combo colours in effectively incorrect order
Addresses https://github.com/ppy/osu/discussions/27316. Stable lies about the first combo colour being first; in the `.osu` file it is actually second. It does a thing in editor itself to correct for this. https://github.com/peppy/osu-stable-reference/blob/master/osu!/GameModes/Edit/Forms/SongSetup.cs#L233-L234
This commit is contained in:
parent
d544b4dbf1
commit
d1d32fc16c
@ -4,7 +4,7 @@
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
@ -38,8 +38,17 @@ namespace osu.Game.Screens.Edit
|
||||
Skin = skin;
|
||||
|
||||
ComboColours = new BindableList<Colour4>();
|
||||
if (Skin.Configuration.ComboColours != null)
|
||||
ComboColours.AddRange(Skin.Configuration.ComboColours.Select(c => (Colour4)c));
|
||||
|
||||
if (Skin.Configuration.ComboColours is IReadOnlyList<Color4> comboColours)
|
||||
{
|
||||
// due to the foibles of how `IHasComboInformation` / `ComboIndexWithOffsets` work,
|
||||
// the actual effective first combo colour that will be used on the beatmap is the one with index 1, not 0.
|
||||
// see also: `IHasComboInformation.UpdateComboInformation`,
|
||||
// https://github.com/peppy/osu-stable-reference/blob/46cd3a10af7cc6cc96f4eba92ef1812dc8c3a27e/osu!/GameModes/Edit/Forms/SongSetup.cs#L233-L234.
|
||||
for (int i = 0; i < comboColours.Count; ++i)
|
||||
ComboColours.Add(comboColours[(i + 1) % comboColours.Count]);
|
||||
}
|
||||
|
||||
ComboColours.BindCollectionChanged((_, _) => updateColours());
|
||||
}
|
||||
|
||||
@ -47,7 +56,10 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
private void updateColours()
|
||||
{
|
||||
Skin.Configuration.CustomComboColours = ComboColours.Select(c => (Color4)c).ToList();
|
||||
// performs the inverse of the index rotation operation described in the ctor.
|
||||
Skin.Configuration.CustomComboColours.Clear();
|
||||
for (int i = 0; i < ComboColours.Count; ++i)
|
||||
Skin.Configuration.CustomComboColours.Add(ComboColours[(ComboColours.Count + i - 1) % ComboColours.Count]);
|
||||
invokeSkinChanged();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user