-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement skinnable mod display #30993
Conversation
Also makes the mod display initialization sequence (start expanded, then unexpand) controlled by HUDOverlay rather than mod display itself. This enabled different treatment depending on whether the mod display is viewed in the skin editor or in the player. Co-authored-by: Bartłomiej Dach <[email protected]>
5da21d8
to
0a00f7a
Compare
It was mostly a demonstrative thing to use in the heat in the moment for the skinnable mod display and it breaks all other tests. So let's just not.
Hmm, something looks to have changed here behaviour wise. During local gameplay, the mods now stay visible through the whole play whereas they used to fade away after a second or two. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As commented.
This was very weird on master - `ModDisplay` applied a fade-in on the `iconsContainer` that lasted 1000ms, and `HUDOverlay` would stack another 200ms fade-in on top if a replay was loaded. Moving that first fadeout to a higher level broke fade-out because transforms got overwritten.
Should be fixed with 772ac2d. |
My remaining concerns are that there is now going to be a doubled-up mod display when in replay mode, and during the start of gameplay. I guess the fully "correct" way to implement this would be to migrate that element to the "break" or "intro" layer of the skinning system, which we don't have prepared just yet. @bdach I guess you're okay with this being the case for now? I'm pretty indifferent as by default a user is not inconvenienced by this. It's just an oddity if you have added this new element. A more important concern for me is that this looks weird in the skin editor when viewing with no mods: This would be an amicable fix for me: diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs
index 417ce355a5..e0b149191a 100644
--- a/osu.Game/Screens/Play/HUD/ModDisplay.cs
+++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs
@@ -22,6 +22,8 @@ namespace osu.Game.Screens.Play.HUD
/// </summary>
public partial class ModDisplay : CompositeDrawable, IHasCurrentValue<IReadOnlyList<Mod>>
{
+ public const float INITIAL_SCALE = 0.6f;
+
private ExpansionMode expansionMode = ExpansionMode.ExpandOnHover;
public ExpansionMode ExpansionMode
@@ -72,6 +74,7 @@ public ModDisplay(bool showExtendedInformation = true)
this.showExtendedInformation = showExtendedInformation;
AutoSizeAxes = Axes.Both;
+ Scale = new Vector2(INITIAL_SCALE);
InternalChild = iconsContainer = new ReverseChildIDFillFlowContainer<ModIcon>
{
@@ -93,7 +96,7 @@ private void updateDisplay(ValueChangedEvent<IReadOnlyList<Mod>> mods)
iconsContainer.Clear();
foreach (Mod mod in mods.NewValue.AsOrdered())
- iconsContainer.Add(new ModIcon(mod, showExtendedInformation: showExtendedInformation) { Scale = new Vector2(0.6f) });
+ iconsContainer.Add(new ModIcon(mod, showExtendedInformation: showExtendedInformation));
}
private void updateExpansionMode(double duration = 500)
diff --git a/osu.Game/Screens/Play/HUD/SkinnableModDisplay.cs b/osu.Game/Screens/Play/HUD/SkinnableModDisplay.cs
index 819484e8ba..cfcc5c8163 100644
--- a/osu.Game/Screens/Play/HUD/SkinnableModDisplay.cs
+++ b/osu.Game/Screens/Play/HUD/SkinnableModDisplay.cs
@@ -10,6 +10,8 @@
using osu.Game.Rulesets.Mods;
using osu.Game.Skinning;
using osu.Game.Localisation.SkinComponents;
+using osu.Game.Rulesets.UI;
+using osuTK;
namespace osu.Game.Screens.Play.HUD
{
@@ -32,7 +34,13 @@ public partial class SkinnableModDisplay : CompositeDrawable, ISerialisableDrawa
[BackgroundDependencyLoader]
private void load()
{
- InternalChild = modDisplay = new ModDisplay();
+ InternalChildren = new Drawable[]
+ {
+ // Provide a minimum autosize.
+ new Container { Size = ModIcon.MOD_ICON_SIZE * ModDisplay.INITIAL_SCALE },
+ modDisplay = new ModDisplay(),
+ };
+
modDisplay.Current = mods;
AutoSizeAxes = Axes.Both;
}
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As commented.
Co-authored-by: Dean Herbert <[email protected]>
As you said, I'm not sure how I would resolve this right now. There are no tools to do this, and I don't want to make any changes to skinning systems since I see that as "your turf" so to speak.
Applied, although I had to back out the part that pulled up the scale application to a higher level, since it broke the mod display on the footer which has scale applied to it directly: osu/osu.Game/Screens/Select/FooterButtonMods.cs Lines 47 to 54 in 767be9d
|
Addresses #30596
Also makes the mod display initialization sequence (start expanded, then unexpand) controlled by HUDOverlay rather than mod display itself. This enabled different treatment depending on whether the mod display is viewed in the skin editor or in the player.