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 public class TooltipIconButton : ClickableContainer, IHasTooltip
{ {
private readonly SpriteIcon icon; private readonly SpriteIcon icon;
private SampleChannel sampleClick;
private SampleChannel sampleHover; private SampleChannel sampleHover;
public Action Action; public Action Action;
@ -55,8 +54,8 @@ namespace osu.Game.Graphics.UserInterface
{ {
Origin = Anchor.Centre, Origin = Anchor.Centre,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Size = new Vector2(18), RelativeSizeAxes = Axes.Both,
Alpha = 0.5f, Size = new Vector2(0.8f),
} }
}; };
} }
@ -64,10 +63,7 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnClick(InputState state) protected override bool OnClick(InputState state)
{ {
if (isEnabled) if (isEnabled)
{
Action?.Invoke(); Action?.Invoke();
sampleClick?.Play();
}
return base.OnClick(state); return base.OnClick(state);
} }
@ -81,7 +77,6 @@ namespace osu.Game.Graphics.UserInterface
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio)
{ {
sampleClick = audio.Sample.Get(@"UI/generic-select-soft");
sampleHover = audio.Sample.Get(@"UI/generic-hover-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;
using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses; using osu.Game.Online.API.Requests.Responses;
using System;
namespace osu.Game.Overlays.Changelog namespace osu.Game.Overlays.Changelog
{ {
public class ChangelogContent : FillFlowContainer<ChangelogContentGroup> public class ChangelogContent : FillFlowContainer<ChangelogContentGroup>
{ {
private APIChangelog currentBuild; public APIChangelog CurrentBuild { get; private set; }
public Action OnBuildChanged;
private APIAccess api; private APIAccess api;
private ChangelogContentGroup changelogContentGroup; private ChangelogContentGroup changelogContentGroup;
@ -31,35 +33,42 @@ namespace osu.Game.Overlays.Changelog
private void add(APIChangelog changelogBuild) private void add(APIChangelog changelogBuild)
{ {
Add(changelogContentGroup = new ChangelogContentGroup(changelogBuild) Add(changelogContentGroup = new ChangelogContentGroup(changelogBuild)
{ {
PreviousRequested = showPrevious, PreviousRequested = showPrevious,
NextRequested = showNext, NextRequested = showNext,
}); });
} }
public void ShowBuild(APIChangelog changelog) public void ShowBuild(APIChangelog changelog)
{ {
Clear(); Clear();
add(changelog); add(changelog);
CurrentBuild = changelog;
fetchChangelogBuild(changelog); fetchChangelogBuild(changelog);
} }
private void showBuild(APIChangelog changelog)
{
ShowBuild(changelog);
OnBuildChanged();
}
private void showNext() private void showNext()
{ {
if (currentBuild.Versions.Next != null) if (CurrentBuild.Versions.Next != null)
ShowBuild(currentBuild.Versions.Next); showBuild(CurrentBuild.Versions.Next);
} }
private void showPrevious() private void showPrevious()
{ {
if (currentBuild.Versions.Previous != null) if (CurrentBuild.Versions.Previous != null)
ShowBuild(currentBuild.Versions.Previous); showBuild(CurrentBuild.Versions.Previous);
} }
private void updateChevronTooltips() private void updateChevronTooltips()
{ {
changelogContentGroup.UpdateChevronTooltips(currentBuild.Versions.Previous?.DisplayVersion, changelogContentGroup.UpdateChevronTooltips(CurrentBuild.Versions.Previous?.DisplayVersion,
currentBuild.Versions.Next?.DisplayVersion); CurrentBuild.Versions.Next?.DisplayVersion);
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
@ -73,7 +82,7 @@ namespace osu.Game.Overlays.Changelog
var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version); var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version);
req.Success += res => req.Success += res =>
{ {
currentBuild = res; CurrentBuild = res;
updateChevronTooltips(); updateChevronTooltips();
}; };
api.Queue(req); api.Queue(req);

View File

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