mirror of
https://github.com/ppy/osu.git
synced 2026-05-19 19:40:46 +08:00
Do not allow adding more than 8 combo colours in editor
This commit is contained in:
@@ -31,9 +31,12 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
public LocalisableString Caption { get; init; }
|
||||
public LocalisableString HintText { get; init; }
|
||||
|
||||
public BindableBool CanAdd { get; } = new BindableBool(true);
|
||||
|
||||
private Box background = null!;
|
||||
private FormFieldCaption caption = null!;
|
||||
private FillFlowContainer flow = null!;
|
||||
private RoundedButton addButton = null!;
|
||||
|
||||
[Resolved]
|
||||
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||
@@ -47,8 +50,6 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
|
||||
RoundedButton button;
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
background = new Box
|
||||
@@ -76,7 +77,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Direction = FillDirection.Full,
|
||||
Spacing = new Vector2(5),
|
||||
Child = button = new RoundedButton
|
||||
Child = addButton = new RoundedButton
|
||||
{
|
||||
Action = addNewColour,
|
||||
Size = new Vector2(70),
|
||||
@@ -87,7 +88,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
},
|
||||
};
|
||||
|
||||
flow.SetLayoutPosition(button, float.MaxValue);
|
||||
flow.SetLayoutPosition(addButton, float.MaxValue);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
@@ -99,6 +100,7 @@ namespace osu.Game.Graphics.UserInterfaceV2
|
||||
if (args.Action != NotifyCollectionChangedAction.Replace)
|
||||
updateColours();
|
||||
}, true);
|
||||
CanAdd.BindValueChanged(_ => addButton.Alpha = CanAdd.Value ? 1 : 0, true);
|
||||
updateState();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Skinning;
|
||||
@@ -54,6 +55,8 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
Beatmap.BeatmapSkin.ComboColours.Clear();
|
||||
Beatmap.BeatmapSkin.ComboColours.AddRange(comboColours.Colours);
|
||||
|
||||
updateAddButtonVisibility();
|
||||
|
||||
syncingColours = false;
|
||||
}
|
||||
});
|
||||
@@ -68,8 +71,14 @@ namespace osu.Game.Screens.Edit.Setup
|
||||
comboColours.Colours.Clear();
|
||||
comboColours.Colours.AddRange(Beatmap.BeatmapSkin?.ComboColours);
|
||||
|
||||
updateAddButtonVisibility();
|
||||
|
||||
syncingColours = false;
|
||||
});
|
||||
|
||||
updateAddButtonVisibility();
|
||||
|
||||
void updateAddButtonVisibility() => comboColours.CanAdd.Value = comboColours.Colours.Count < LegacyBeatmapDecoder.MAX_COMBO_COLOUR_COUNT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user