Skip to content

Commit e831c46

Browse files
LiquidPLpeppy
andauthored
Replace new combo button icons with ruleset-specifc ones (ppy#37848)
- Depends on ppy/osu-resources#425. - Closes ppy#37874 This makes the new combo button use the new icons added in ppy#37804. Instead of having four separate icons per ruleset, the "sparkle" texture is overlaid on top of the appropriate icon. I'm not sure if I've overdone it with how every ruleset copypastes the same code for the icon (in `<ruleset>BlueprintContainer`), so that can be scaled down if necessary. | osu | taiko | catch | mania | |--------|--------|--------|--------| | <img width="200" height="67" alt="image" src="https://github.com/user-attachments/assets/88a31611-f200-4da8-8490-39e6803a452c" /> | <img width="194" height="69" alt="image" src="https://github.com/user-attachments/assets/fbe5c7c0-2a53-4f3f-9c80-67c8769dfb52" /> | <img width="194" height="69" alt="image" src="https://github.com/user-attachments/assets/dbfbd183-0469-4b57-9059-40351604aa64" /> | <img width="190" height="68" alt="image" src="https://github.com/user-attachments/assets/708fc2e0-34fb-4983-b696-8c23431f8af4" /> | Co-authored-by: Dean Herbert <pe@ppy.sh>
1 parent 18d4348 commit e831c46

6 files changed

Lines changed: 128 additions & 5 deletions

File tree

osu.Game.Rulesets.Catch/Edit/CatchBlueprintContainer.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33

44
using System.Collections.Generic;
55
using System.Linq;
6+
using osu.Framework.Graphics;
7+
using osu.Framework.Graphics.Containers;
8+
using osu.Framework.Graphics.Sprites;
69
using osu.Framework.Input.Events;
10+
using osu.Game.Graphics;
711
using osu.Game.Rulesets.Catch.Edit.Blueprints;
812
using osu.Game.Rulesets.Catch.Objects;
913
using osu.Game.Rulesets.Edit;
1014
using osu.Game.Rulesets.Objects;
15+
using osu.Game.Screens.Edit.Components.TernaryButtons;
1116
using osu.Game.Screens.Edit.Compose.Components;
1217
using osuTK;
1318

@@ -22,6 +27,29 @@ public CatchBlueprintContainer(CatchHitObjectComposer composer)
2227
{
2328
}
2429

30+
protected override Drawable CreateNewComboButton() => new NewComboTernaryButton
31+
{
32+
Current = NewCombo,
33+
CreateIcon = () => new Container
34+
{
35+
Children = new Drawable[]
36+
{
37+
new SpriteIcon
38+
{
39+
Anchor = Anchor.BottomLeft,
40+
Origin = Anchor.BottomLeft,
41+
Icon = OsuIcon.EditorFruit,
42+
Size = new Vector2(15),
43+
},
44+
new SpriteIcon
45+
{
46+
Icon = OsuIcon.EditorNewComboSparkles,
47+
Size = new Vector2(20),
48+
}
49+
},
50+
},
51+
};
52+
2553
protected override SelectionHandler<HitObject> CreateSelectionHandler() => new CatchSelectionHandler();
2654

2755
public override HitObjectSelectionBlueprint? CreateHitObjectBlueprintFor(HitObject hitObject)

osu.Game.Rulesets.Mania/Edit/ManiaBlueprintContainer.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,16 @@
33

44
using System.Collections.Generic;
55
using System.Linq;
6+
using osu.Framework.Graphics;
7+
using osu.Framework.Graphics.Containers;
8+
using osu.Framework.Graphics.Sprites;
69
using osu.Framework.Input.Events;
10+
using osu.Game.Graphics;
711
using osu.Game.Rulesets.Edit;
812
using osu.Game.Rulesets.Mania.Edit.Blueprints;
913
using osu.Game.Rulesets.Mania.Objects;
1014
using osu.Game.Rulesets.Objects;
15+
using osu.Game.Screens.Edit.Components.TernaryButtons;
1116
using osu.Game.Screens.Edit.Compose.Components;
1217
using osuTK;
1318

@@ -22,6 +27,29 @@ public ManiaBlueprintContainer(ManiaHitObjectComposer composer)
2227
{
2328
}
2429

30+
protected override Drawable CreateNewComboButton() => new NewComboTernaryButton
31+
{
32+
Current = NewCombo,
33+
CreateIcon = () => new Container
34+
{
35+
Children = new Drawable[]
36+
{
37+
new SpriteIcon
38+
{
39+
Anchor = Anchor.BottomLeft,
40+
Origin = Anchor.BottomLeft,
41+
Icon = OsuIcon.EditorNote,
42+
Size = new Vector2(15),
43+
},
44+
new SpriteIcon
45+
{
46+
Icon = OsuIcon.EditorNewComboSparkles,
47+
Size = new Vector2(20),
48+
}
49+
},
50+
},
51+
};
52+
2553
public override HitObjectSelectionBlueprint? CreateHitObjectBlueprintFor(HitObject hitObject)
2654
{
2755
switch (hitObject)

osu.Game.Rulesets.Taiko/Edit/TaikoBlueprintContainer.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@
33

44
using System.Collections.Generic;
55
using System.Linq;
6+
using osu.Framework.Graphics;
7+
using osu.Framework.Graphics.Containers;
8+
using osu.Framework.Graphics.Sprites;
69
using osu.Framework.Input.Events;
10+
using osu.Game.Graphics;
711
using osu.Game.Rulesets.Edit;
812
using osu.Game.Rulesets.Objects;
913
using osu.Game.Rulesets.Taiko.Edit.Blueprints;
14+
using osu.Game.Screens.Edit.Components.TernaryButtons;
1015
using osu.Game.Screens.Edit.Compose.Components;
1116
using osuTK;
1217

@@ -21,6 +26,29 @@ public TaikoBlueprintContainer(TaikoHitObjectComposer composer)
2126
{
2227
}
2328

29+
protected override Drawable CreateNewComboButton() => new NewComboTernaryButton
30+
{
31+
Current = NewCombo,
32+
CreateIcon = () => new Container
33+
{
34+
Children = new Drawable[]
35+
{
36+
new SpriteIcon
37+
{
38+
Anchor = Anchor.BottomLeft,
39+
Origin = Anchor.BottomLeft,
40+
Icon = OsuIcon.EditorHit,
41+
Size = new Vector2(15),
42+
},
43+
new SpriteIcon
44+
{
45+
Icon = OsuIcon.EditorNewComboSparkles,
46+
Size = new Vector2(20),
47+
}
48+
},
49+
},
50+
};
51+
2452
protected override SelectionHandler<HitObject> CreateSelectionHandler() => new TaikoSelectionHandler();
2553

2654
public override HitObjectSelectionBlueprint CreateHitObjectBlueprintFor(HitObject hitObject) =>

osu.Game/Graphics/OsuIcon.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static class OsuIcon
107107
public static IconUsage EditorDistanceSnap => get(OsuIconMapping.EditorDistanceSnap);
108108
public static IconUsage EditorFinish => get(OsuIconMapping.EditorFinish);
109109
public static IconUsage EditorGridSnap => get(OsuIconMapping.EditorGridSnap);
110-
public static IconUsage EditorNewCombo => get(OsuIconMapping.EditorNewCombo);
110+
public static IconUsage EditorNewComboSparkles => get(OsuIconMapping.EditorNewComboSparkles);
111111
public static IconUsage EditorSelect => get(OsuIconMapping.EditorSelect);
112112
public static IconUsage EditorSound => get(OsuIconMapping.EditorSound);
113113
public static IconUsage EditorWhistle => get(OsuIconMapping.EditorWhistle);
@@ -459,8 +459,8 @@ private enum OsuIconMapping
459459
[Description(@"Editor/grid-snap")]
460460
EditorGridSnap,
461461

462-
[Description(@"Editor/new-combo")]
463-
EditorNewCombo,
462+
[Description(@"Editor/new-combo-sparkles")]
463+
EditorNewComboSparkles,
464464

465465
[Description(@"Editor/select")]
466466
EditorSelect,

osu.Game/Screens/Edit/Components/TernaryButtons/NewComboTernaryButton.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ namespace osu.Game.Screens.Edit.Components.TernaryButtons
2929
{
3030
public partial class NewComboTernaryButton : CompositeDrawable, IHasCurrentValue<TernaryState>
3131
{
32+
public Func<Drawable>? CreateIcon { get; init; }
33+
3234
public Bindable<TernaryState> Current
3335
{
3436
get => current.Current;
@@ -61,7 +63,7 @@ private void load(EditorBeatmap editorBeatmap, IExpandingContainer? expandablePa
6163
{
6264
Current = Current,
6365
Description = "New combo",
64-
CreateIcon = () => new SpriteIcon { Icon = OsuIcon.EditorNewCombo },
66+
CreateIcon = CreateIcon,
6567
},
6668
},
6769
pickerButton = new ColourPickerButton

osu.Game/Screens/Edit/Compose/Components/ComposeBlueprintContainer.cs

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,13 +181,50 @@ private void additionBankChanged(string bankName, TernaryState state)
181181

182182
public SampleBankTernaryButton[] SampleBankTernaryStates { get; private set; }
183183

184+
/// <summary>
185+
/// Create the new combo ternary button. Mainly used to customize the displayed icon
186+
/// depending on the ruleset. Can be overriden to return null if a ruleset does not
187+
/// provide combo-supporting HitObjects.
188+
/// </summary>
189+
/// <returns></returns>
190+
[CanBeNull]
191+
protected virtual Drawable CreateNewComboButton() => new NewComboTernaryButton
192+
{
193+
Current = NewCombo,
194+
CreateIcon = () => new Container
195+
{
196+
Children = new Drawable[]
197+
{
198+
new SpriteIcon
199+
{
200+
Anchor = Anchor.BottomLeft,
201+
Origin = Anchor.BottomLeft,
202+
// This is currently using the osu! hitcircle icon as a default in order
203+
// not to break any custom rulesets that depend on there being a defined
204+
// new combo button.
205+
// Could consider removing it and let rulesets specify their own buttons/icons.
206+
Icon = OsuIcon.EditorHitCircle,
207+
Size = new Vector2(15),
208+
},
209+
new SpriteIcon
210+
{
211+
Icon = OsuIcon.EditorNewComboSparkles,
212+
Size = new Vector2(20),
213+
}
214+
},
215+
},
216+
};
217+
184218
/// <summary>
185219
/// Create all ternary states required to be displayed to the user.
186220
/// </summary>
187221
protected virtual IEnumerable<Drawable> CreateTernaryButtons()
188222
{
189223
//TODO: this should only be enabled (visible?) for rulesets that provide combo-supporting HitObjects.
190-
yield return new NewComboTernaryButton { Current = NewCombo };
224+
var newComboButton = CreateNewComboButton();
225+
226+
if (newComboButton != null)
227+
yield return newComboButton;
191228

192229
foreach (var kvp in SelectionHandler.SelectionSampleStates)
193230
{

0 commit comments

Comments
 (0)