mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 02:42:54 +08:00
Unify build div's dimming mechanics with osu-web
This commit is contained in:
parent
709872d688
commit
c9f3e72b7a
@ -72,8 +72,10 @@ namespace osu.Game.Overlays.Changelog
|
||||
{
|
||||
if (SelectedRelease != null)
|
||||
{
|
||||
if (SelectedRelease.UpdateStream.Id != streamBadge.ChangelogEntry.Id)
|
||||
if (SelectedRelease.UpdateStream.Id != streamBadge.ChangelogEntry.UpdateStream.Id)
|
||||
streamBadge.Deactivate();
|
||||
else
|
||||
streamBadge.EnableDim();
|
||||
}
|
||||
else
|
||||
streamBadge.Deactivate();
|
||||
@ -83,9 +85,13 @@ namespace osu.Game.Overlays.Changelog
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
if (SelectedRelease == null)
|
||||
foreach (StreamBadge streamBadge in BadgesContainer.Children)
|
||||
foreach (StreamBadge streamBadge in BadgesContainer.Children)
|
||||
{
|
||||
if (SelectedRelease == null)
|
||||
streamBadge.Activate(true);
|
||||
else if (streamBadge.ChangelogEntry.UpdateStream.Id == SelectedRelease.UpdateStream.Id)
|
||||
streamBadge.DisableDim();
|
||||
}
|
||||
base.OnHoverLost(state);
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ namespace osu.Game.Overlays.Changelog
|
||||
private readonly Header.LineBadge lineBadge;
|
||||
private SampleChannel sampleHover;
|
||||
public readonly APIChangelog ChangelogEntry;
|
||||
private readonly FillFlowContainer<SpriteText> Text;
|
||||
|
||||
public StreamBadge(APIChangelog changelogEntry)
|
||||
{
|
||||
@ -38,7 +39,7 @@ namespace osu.Game.Overlays.Changelog
|
||||
isActivated = true;
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer<SpriteText>
|
||||
Text = new FillFlowContainer<SpriteText>
|
||||
{
|
||||
AutoSizeAxes = Axes.X,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
@ -86,6 +87,7 @@ namespace osu.Game.Overlays.Changelog
|
||||
{
|
||||
isActivated = true;
|
||||
this.FadeIn(transition_duration);
|
||||
Text.FadeIn(transition_duration);
|
||||
lineBadge.IsCollapsed = false;
|
||||
if (!withoutHeaderUpdate)
|
||||
OnActivation?.Invoke();
|
||||
@ -94,6 +96,7 @@ namespace osu.Game.Overlays.Changelog
|
||||
public void Deactivate()
|
||||
{
|
||||
isActivated = false;
|
||||
DisableDim();
|
||||
if (!IsHovered)
|
||||
{
|
||||
this.FadeTo(0.5f, transition_duration);
|
||||
@ -109,7 +112,8 @@ namespace osu.Game.Overlays.Changelog
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
if (!isActivated) sampleHover?.Play();
|
||||
sampleHover?.Play();
|
||||
DisableDim();
|
||||
this.FadeIn(transition_duration);
|
||||
lineBadge.IsCollapsed = false;
|
||||
return base.OnHover(state);
|
||||
@ -122,9 +126,15 @@ namespace osu.Game.Overlays.Changelog
|
||||
this.FadeTo(0.5f, transition_duration);
|
||||
lineBadge.IsCollapsed = true;
|
||||
}
|
||||
else
|
||||
EnableDim();
|
||||
base.OnHoverLost(state);
|
||||
}
|
||||
|
||||
public void EnableDim() => Text.FadeTo(0.5f, transition_duration);
|
||||
|
||||
public void DisableDim() => Text.FadeIn(transition_duration);
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user