-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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]>
- Loading branch information
Showing
5 changed files
with
141 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Collections.Generic; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Containers; | ||
using osu.Game.Configuration; | ||
using osu.Game.Rulesets.Mods; | ||
using osu.Game.Skinning; | ||
|
||
namespace osu.Game.Screens.Play.HUD | ||
{ | ||
/// <summary> | ||
/// Displays a single-line horizontal auto-sized flow of mods. For cases where wrapping is required, use <see cref="ModFlowDisplay"/> instead. | ||
/// </summary> | ||
public partial class SkinnableModDisplay : CompositeDrawable, ISerialisableDrawable | ||
{ | ||
private ModDisplay modDisplay = null!; | ||
|
||
[Resolved] | ||
private Bindable<IReadOnlyList<Mod>> mods { get; set; } = null!; | ||
|
||
[SettingSource("Show extended info", "Whether to show extended information for each mod.")] | ||
public Bindable<bool> ShowExtendedInformation { get; } = new Bindable<bool>(true); | ||
|
||
[SettingSource("Expansion mode", "How the mod display expands when interacted with.")] | ||
public Bindable<ExpansionMode> ExpansionModeSetting { get; } = new Bindable<ExpansionMode>(ExpansionMode.ExpandOnHover); | ||
|
||
public SkinnableModDisplay() | ||
{ | ||
} | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
InternalChild = modDisplay = new ModDisplay(); | ||
modDisplay.Current = mods; | ||
AutoSizeAxes = Axes.Both; | ||
} | ||
|
||
protected override void LoadComplete() | ||
{ | ||
base.LoadComplete(); | ||
|
||
ShowExtendedInformation.BindValueChanged(_ => modDisplay.ShowExtendedInformation = ShowExtendedInformation.Value, true); | ||
ExpansionModeSetting.BindValueChanged(_ => modDisplay.ExpansionMode = ExpansionModeSetting.Value, true); | ||
|
||
FinishTransforms(true); | ||
} | ||
|
||
public bool UsesFixedAnchor { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters