mirror of
https://github.com/ppy/osu.git
synced 2025-03-28 02:27:19 +08:00
Reorganized elements for readability
This commit is contained in:
parent
88506a51dd
commit
2797507758
@ -132,39 +132,13 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class BeatmapInfoWedgeContainer : Container
|
|
||||||
{
|
|
||||||
private readonly WorkingBeatmap beatmap;
|
|
||||||
private readonly RulesetInfo ruleset;
|
|
||||||
|
|
||||||
internal WedgeInfoText Info;
|
|
||||||
|
|
||||||
public BeatmapInfoWedgeContainer(WorkingBeatmap beatmap, RulesetInfo ruleset)
|
|
||||||
{
|
|
||||||
this.beatmap = beatmap;
|
|
||||||
this.ruleset = ruleset;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
|
||||||
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new BeatmapInfoWedgeBackground(beatmap),
|
|
||||||
Info = new WedgeInfoText(beatmap, ruleset),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class WedgeInfoText : Container
|
public class WedgeInfoText : Container
|
||||||
{
|
{
|
||||||
public FillFlowContainer MapperContainer { get; private set; }
|
public OsuSpriteText VersionLabel { get; private set; }
|
||||||
public OsuSpriteText TitleLabel { get; private set; }
|
public OsuSpriteText TitleLabel { get; private set; }
|
||||||
public OsuSpriteText ArtistLabel { get; private set; }
|
public OsuSpriteText ArtistLabel { get; private set; }
|
||||||
public OsuSpriteText VersionLabel { get; private set; }
|
|
||||||
public BeatmapSetOnlineStatusPill StatusPill { get; private set; }
|
public BeatmapSetOnlineStatusPill StatusPill { get; private set; }
|
||||||
|
public FillFlowContainer MapperContainer { get; private set; }
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
|
private IBindable<IReadOnlyList<Mod>> mods { get; set; }
|
||||||
@ -172,16 +146,17 @@ namespace osu.Game.Screens.Select
|
|||||||
private ILocalisedBindableString titleBinding;
|
private ILocalisedBindableString titleBinding;
|
||||||
private ILocalisedBindableString artistBinding;
|
private ILocalisedBindableString artistBinding;
|
||||||
private FillFlowContainer infoLabelContainer;
|
private FillFlowContainer infoLabelContainer;
|
||||||
private Container topRightMetadataContainer;
|
private Container starRatingContainer;
|
||||||
private Container bpmLabelContainer;
|
private Container bpmLabelContainer;
|
||||||
private Container difficultyColourBarContainer;
|
private Container difficultyColourBarContainer;
|
||||||
private ModSettingChangeTracker settingChangeTracker;
|
|
||||||
private CancellationTokenSource cancellationTokenSource;
|
private CancellationTokenSource cancellationTokenSource;
|
||||||
private IBindable<StarDifficulty?> starDifficulty;
|
private IBindable<StarDifficulty?> starDifficulty;
|
||||||
|
|
||||||
private readonly WorkingBeatmap beatmap;
|
private readonly WorkingBeatmap beatmap;
|
||||||
private readonly RulesetInfo ruleset;
|
private readonly RulesetInfo ruleset;
|
||||||
|
|
||||||
|
private ModSettingChangeTracker settingChangeTracker;
|
||||||
|
|
||||||
public WedgeInfoText(WorkingBeatmap beatmap, RulesetInfo userRuleset)
|
public WedgeInfoText(WorkingBeatmap beatmap, RulesetInfo userRuleset)
|
||||||
{
|
{
|
||||||
this.beatmap = beatmap;
|
this.beatmap = beatmap;
|
||||||
@ -211,7 +186,6 @@ namespace osu.Game.Screens.Select
|
|||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Y,
|
RelativeSizeAxes = Axes.Y,
|
||||||
Width = 20,
|
Width = 20,
|
||||||
Child = createDifficultyColourBar(starDifficulty.Value ?? new StarDifficulty()),
|
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
@ -304,8 +278,6 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
addInfoLabels();
|
|
||||||
|
|
||||||
titleBinding.BindValueChanged(_ => setMetadata(metadata.Source));
|
titleBinding.BindValueChanged(_ => setMetadata(metadata.Source));
|
||||||
artistBinding.BindValueChanged(_ => setMetadata(metadata.Source), true);
|
artistBinding.BindValueChanged(_ => setMetadata(metadata.Source), true);
|
||||||
starDifficulty.BindValueChanged(updateDifficulty, true);
|
starDifficulty.BindValueChanged(updateDifficulty, true);
|
||||||
@ -313,38 +285,8 @@ namespace osu.Game.Screens.Select
|
|||||||
// no difficulty means it can't have a status to show
|
// no difficulty means it can't have a status to show
|
||||||
if (beatmapInfo.Version == null)
|
if (beatmapInfo.Version == null)
|
||||||
StatusPill.Hide();
|
StatusPill.Hide();
|
||||||
}
|
|
||||||
|
|
||||||
private void updateDifficulty(ValueChangedEvent<StarDifficulty?> valueChanged)
|
addInfoLabels();
|
||||||
{
|
|
||||||
var difficulty = valueChanged.NewValue ?? new StarDifficulty();
|
|
||||||
|
|
||||||
if (starRatingContainer.Children.Count > 0)
|
|
||||||
{
|
|
||||||
starRatingContainer.Child.FadeOut(250);
|
|
||||||
starRatingContainer.Child.Expire();
|
|
||||||
}
|
|
||||||
|
|
||||||
starRatingContainer.Child = difficulty.Stars > 0 ? new StarRatingDisplay(difficulty) : Empty();
|
|
||||||
|
|
||||||
if (difficultyColourBarContainer.Children.Count > 0)
|
|
||||||
{
|
|
||||||
difficultyColourBarContainer.Child.Expire();
|
|
||||||
}
|
|
||||||
|
|
||||||
difficultyColourBarContainer.Child = new DifficultyColourBar(difficulty)
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Width = 20,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void refreshModInformation(ValueChangedEvent<IReadOnlyList<Mod>> modsChangedEvent)
|
|
||||||
{
|
|
||||||
settingChangeTracker?.Dispose();
|
|
||||||
settingChangeTracker = new ModSettingChangeTracker(modsChangedEvent.NewValue);
|
|
||||||
settingChangeTracker.SettingChanged += _ => refreshBPMLabel(modsChangedEvent.NewValue);
|
|
||||||
refreshBPMLabel(modsChangedEvent.NewValue);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setMetadata(string source)
|
private void setMetadata(string source)
|
||||||
@ -455,6 +397,38 @@ namespace osu.Game.Screens.Select
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateDifficulty(ValueChangedEvent<StarDifficulty?> valueChanged)
|
||||||
|
{
|
||||||
|
var difficulty = valueChanged.NewValue ?? new StarDifficulty();
|
||||||
|
|
||||||
|
if (starRatingContainer.Children.Count > 0)
|
||||||
|
{
|
||||||
|
starRatingContainer.Child.FadeOut(250);
|
||||||
|
starRatingContainer.Child.Expire();
|
||||||
|
}
|
||||||
|
|
||||||
|
starRatingContainer.Child = difficulty.Stars > 0 ? new StarRatingDisplay(difficulty) : Empty();
|
||||||
|
|
||||||
|
if (difficultyColourBarContainer.Children.Count > 0)
|
||||||
|
{
|
||||||
|
difficultyColourBarContainer.Child.Expire();
|
||||||
|
}
|
||||||
|
|
||||||
|
difficultyColourBarContainer.Child = new DifficultyColourBar(difficulty)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = 20,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshModInformation(ValueChangedEvent<IReadOnlyList<Mod>> modsChangedEvent)
|
||||||
|
{
|
||||||
|
settingChangeTracker?.Dispose();
|
||||||
|
settingChangeTracker = new ModSettingChangeTracker(modsChangedEvent.NewValue);
|
||||||
|
settingChangeTracker.SettingChanged += _ => refreshBPMLabel(modsChangedEvent.NewValue);
|
||||||
|
refreshBPMLabel(modsChangedEvent.NewValue);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
@ -557,5 +531,31 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class BeatmapInfoWedgeContainer : Container
|
||||||
|
{
|
||||||
|
private readonly WorkingBeatmap beatmap;
|
||||||
|
private readonly RulesetInfo ruleset;
|
||||||
|
|
||||||
|
internal WedgeInfoText Info;
|
||||||
|
|
||||||
|
public BeatmapInfoWedgeContainer(WorkingBeatmap beatmap, RulesetInfo ruleset)
|
||||||
|
{
|
||||||
|
this.beatmap = beatmap;
|
||||||
|
this.ruleset = ruleset;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new BeatmapInfoWedgeBackground(beatmap),
|
||||||
|
Info = new WedgeInfoText(beatmap, ruleset),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user