1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 18:32:56 +08:00

Improve showing up builds

This commit is contained in:
HoutarouOreki 2018-07-20 22:11:51 +02:00
parent 835a813715
commit 709872d688
3 changed files with 28 additions and 19 deletions

View File

@ -20,7 +20,6 @@ namespace osu.Game.Graphics.UserInterface
public class TooltipIconButton : ClickableContainer, IHasTooltip
{
private readonly SpriteIcon icon;
private SampleChannel sampleClick;
private SampleChannel sampleHover;
public Action Action;
@ -55,8 +54,8 @@ namespace osu.Game.Graphics.UserInterface
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
Size = new Vector2(18),
Alpha = 0.5f,
RelativeSizeAxes = Axes.Both,
Size = new Vector2(0.8f),
}
};
}
@ -64,10 +63,7 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnClick(InputState state)
{
if (isEnabled)
{
Action?.Invoke();
sampleClick?.Play();
}
return base.OnClick(state);
}
@ -81,7 +77,6 @@ namespace osu.Game.Graphics.UserInterface
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
sampleClick = audio.Sample.Get(@"UI/generic-select-soft");
sampleHover = audio.Sample.Get(@"UI/generic-hover-soft");
}

View File

@ -7,12 +7,14 @@ using osu.Framework.Graphics.Containers;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using System;
namespace osu.Game.Overlays.Changelog
{
public class ChangelogContent : FillFlowContainer<ChangelogContentGroup>
{
private APIChangelog currentBuild;
public APIChangelog CurrentBuild { get; private set; }
public Action OnBuildChanged;
private APIAccess api;
private ChangelogContentGroup changelogContentGroup;
@ -31,35 +33,42 @@ namespace osu.Game.Overlays.Changelog
private void add(APIChangelog changelogBuild)
{
Add(changelogContentGroup = new ChangelogContentGroup(changelogBuild)
{
PreviousRequested = showPrevious,
NextRequested = showNext,
});
{
PreviousRequested = showPrevious,
NextRequested = showNext,
});
}
public void ShowBuild(APIChangelog changelog)
{
Clear();
add(changelog);
CurrentBuild = changelog;
fetchChangelogBuild(changelog);
}
private void showBuild(APIChangelog changelog)
{
ShowBuild(changelog);
OnBuildChanged();
}
private void showNext()
{
if (currentBuild.Versions.Next != null)
ShowBuild(currentBuild.Versions.Next);
if (CurrentBuild.Versions.Next != null)
showBuild(CurrentBuild.Versions.Next);
}
private void showPrevious()
{
if (currentBuild.Versions.Previous != null)
ShowBuild(currentBuild.Versions.Previous);
if (CurrentBuild.Versions.Previous != null)
showBuild(CurrentBuild.Versions.Previous);
}
private void updateChevronTooltips()
{
changelogContentGroup.UpdateChevronTooltips(currentBuild.Versions.Previous?.DisplayVersion,
currentBuild.Versions.Next?.DisplayVersion);
changelogContentGroup.UpdateChevronTooltips(CurrentBuild.Versions.Previous?.DisplayVersion,
CurrentBuild.Versions.Next?.DisplayVersion);
}
[BackgroundDependencyLoader]
@ -73,7 +82,7 @@ namespace osu.Game.Overlays.Changelog
var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version);
req.Success += res =>
{
currentBuild = res;
CurrentBuild = res;
updateChevronTooltips();
};
api.Queue(req);

View File

@ -100,6 +100,11 @@ namespace osu.Game.Overlays
foreach (StreamBadge item in Streams.BadgesContainer.Children)
item.Deactivate();
};
content.OnBuildChanged = () =>
{
header.ChangelogEntry = content.CurrentBuild;
header.ShowReleaseStream();
};
}
public void ActivateListing() => header.ActivateListing();