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