1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 16:42:57 +08:00

Update few links not working; Reasses sample playing; Slight renames

This commit is contained in:
HoutarouOreki 2018-07-23 23:15:14 +02:00
parent 7c6be4a075
commit 054f578bc8
9 changed files with 44 additions and 22 deletions

View File

@ -21,6 +21,7 @@ namespace osu.Game.Graphics.UserInterface
{ {
private readonly SpriteIcon icon; private readonly SpriteIcon icon;
private SampleChannel sampleHover; private SampleChannel sampleHover;
private SampleChannel sampleClick;
public Action Action; public Action Action;
@ -64,7 +65,10 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnClick(InputState state) protected override bool OnClick(InputState state)
{ {
if (isEnabled) if (isEnabled)
{
sampleClick?.Play();
Action?.Invoke(); Action?.Invoke();
}
return base.OnClick(state); return base.OnClick(state);
} }
@ -79,6 +83,7 @@ namespace osu.Game.Graphics.UserInterface
private void load(AudioManager audio) private void load(AudioManager audio)
{ {
sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); sampleHover = audio.Sample.Get(@"UI/generic-hover-soft");
sampleClick = audio.Sample.Get(@"UI/generic-select-soft");
} }
public string TooltipText { get; set; } public string TooltipText { get; set; }

View File

@ -80,9 +80,9 @@ namespace osu.Game.Overlays.Changelog
{ {
foreach (StreamBadge streamBadge in badgesContainer) foreach (StreamBadge streamBadge in badgesContainer)
{ {
if (streamBadge.ChangelogEntry.UpdateStream.Name == updateStream) if (streamBadge.LatestBuild.UpdateStream.Name == updateStream)
{ {
selectedStreamId = streamBadge.ChangelogEntry.UpdateStream.Id; selectedStreamId = streamBadge.LatestBuild.UpdateStream.Id;
streamBadge.Activate(); streamBadge.Activate();
} }
else else
@ -92,13 +92,13 @@ namespace osu.Game.Overlays.Changelog
private void onBadgeSelected(StreamBadge source, EventArgs args) private void onBadgeSelected(StreamBadge source, EventArgs args)
{ {
selectedStreamId = source.ChangelogEntry.UpdateStream.Id; selectedStreamId = source.LatestBuild.UpdateStream.Id;
OnSelected(source); OnSelected(source);
} }
protected virtual void OnSelected(StreamBadge source) protected virtual void OnSelected(StreamBadge source)
{ {
Selected?.Invoke(source.ChangelogEntry, EventArgs.Empty); Selected?.Invoke(source.LatestBuild, EventArgs.Empty);
} }
protected override bool OnHover(InputState state) protected override bool OnHover(InputState state)
@ -107,7 +107,7 @@ namespace osu.Game.Overlays.Changelog
{ {
if (selectedStreamId < 0) if (selectedStreamId < 0)
{ {
if (selectedStreamId != streamBadge.ChangelogEntry.UpdateStream.Id) if (selectedStreamId != streamBadge.LatestBuild.UpdateStream.Id)
streamBadge.Deactivate(); streamBadge.Deactivate();
else else
streamBadge.EnableDim(); streamBadge.EnableDim();
@ -124,7 +124,7 @@ namespace osu.Game.Overlays.Changelog
{ {
if (selectedStreamId < 0) if (selectedStreamId < 0)
streamBadge.Activate(); streamBadge.Activate();
else if (streamBadge.ChangelogEntry.UpdateStream.Id == selectedStreamId) else if (streamBadge.LatestBuild.UpdateStream.Id == selectedStreamId)
streamBadge.DisableDim(); streamBadge.DisableDim();
} }
base.OnHoverLost(state); base.OnHoverLost(state);

View File

@ -159,7 +159,6 @@ namespace osu.Game.Overlays.Changelog
Font = @"Exo2.0-Light", Font = @"Exo2.0-Light",
Colour = StreamColour.FromStreamName(build.UpdateStream.Name), Colour = StreamColour.FromStreamName(build.UpdateStream.Name),
Action = () => OnBuildSelected(build), Action = () => OnBuildSelected(build),
IsClickMuted = true,
}, },
} }
}, },

View File

@ -160,6 +160,7 @@ namespace osu.Game.Overlays.Changelog
}, },
}; };
listing.Activated += OnListingSelected; listing.Activated += OnListingSelected;
releaseStream.Activated += OnReleaseSelected;
} }
public void ShowBuild(string displayName, string displayVersion) public void ShowBuild(string displayName, string displayVersion)
@ -175,6 +176,8 @@ namespace osu.Game.Overlays.Changelog
{ {
releaseStream.Deactivate(); releaseStream.Deactivate();
listing.Activate(); listing.Activate();
titleStream.Text = "Listing";
titleStream.FlashColour(Color4.White, 500, Easing.OutQuad);
chevron.MoveToX(-20, 100).FadeOut(100); chevron.MoveToX(-20, 100).FadeOut(100);
} }
@ -183,6 +186,11 @@ namespace osu.Game.Overlays.Changelog
ListingSelected?.Invoke(); ListingSelected?.Invoke();
} }
protected virtual void OnReleaseSelected(object source, EventArgs e)
{
titleStream.FlashColour(Color4.White, 500, Easing.OutQuad);
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(TextureStore textures) private void load(TextureStore textures)
{ {

View File

@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Changelog.Header
public event ActivatedEventHandler Activated; public event ActivatedEventHandler Activated;
private SampleChannel sampleHover; private SampleChannel sampleHover;
protected SampleChannel SampleActivate; private SampleChannel sampleActivate;
public TextBadgePair(ColourInfo badgeColour, string displayText = "Listing", bool startCollapsed = true) public TextBadgePair(ColourInfo badgeColour, string displayText = "Listing", bool startCollapsed = true)
{ {
@ -86,7 +86,6 @@ namespace osu.Game.Overlays.Changelog.Header
IsActivated = true; IsActivated = true;
LineBadge.Uncollapse(); LineBadge.Uncollapse();
Text.Font = "Exo2.0-Bold"; Text.Font = "Exo2.0-Bold";
SampleActivate?.Play();
} }
public void SetTextColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None) public void SetTextColour(ColourInfo newColour, double duration = 0, Easing easing = Easing.None)
@ -125,6 +124,7 @@ namespace osu.Game.Overlays.Changelog.Header
protected override bool OnClick(InputState state) protected override bool OnClick(InputState state)
{ {
OnActivated(); OnActivated();
sampleActivate?.Play();
return base.OnClick(state); return base.OnClick(state);
} }
@ -137,7 +137,7 @@ namespace osu.Game.Overlays.Changelog.Header
private void load(AudioManager audio) private void load(AudioManager audio)
{ {
sampleHover = audio.Sample.Get(@"UI/generic-hover-soft"); sampleHover = audio.Sample.Get(@"UI/generic-hover-soft");
SampleActivate = audio.Sample.Get(@"UI/generic-select-soft"); sampleActivate = audio.Sample.Get(@"UI/generic-select-soft");
} }
} }
} }

View File

@ -38,7 +38,6 @@ namespace osu.Game.Overlays.Changelog.Header
LineBadge.Uncollapse(); LineBadge.Uncollapse();
Text.Font = "Exo2.0-Bold"; Text.Font = "Exo2.0-Bold";
SetTextColour(Color4.White, 100); SetTextColour(Color4.White, 100);
SampleActivate?.Play();
} }
public override void Deactivate() public override void Deactivate()

View File

@ -29,7 +29,6 @@ namespace osu.Game.Overlays.Changelog.Header
else else
ShowText(transition_duration, displayText); ShowText(transition_duration, displayText);
IsActivated = true; IsActivated = true;
SampleActivate?.Play();
} }
public override void Deactivate() public override void Deactivate()

View File

@ -29,15 +29,17 @@ namespace osu.Game.Overlays.Changelog
private bool isActivated; private bool isActivated;
private readonly LineBadge lineBadge; private readonly LineBadge lineBadge;
private SampleChannel sampleClick;
private SampleChannel sampleHover; private SampleChannel sampleHover;
public readonly APIChangelog ChangelogEntry;
public readonly APIChangelog LatestBuild;
private readonly FillFlowContainer<SpriteText> text; private readonly FillFlowContainer<SpriteText> text;
public StreamBadge(APIChangelog changelogEntry) public StreamBadge(APIChangelog latestBuild)
{ {
ChangelogEntry = changelogEntry; this.LatestBuild = latestBuild;
Height = badge_height; Height = badge_height;
Width = ChangelogEntry.IsFeatured ? badge_width * 2 : badge_width; base.Width = this.LatestBuild.IsFeatured ? badge_width * 2 : badge_width;
Margin = new MarginPadding(5); Margin = new MarginPadding(5);
isActivated = true; isActivated = true;
Children = new Drawable[] Children = new Drawable[]
@ -51,7 +53,7 @@ namespace osu.Game.Overlays.Changelog
{ {
new SpriteText new SpriteText
{ {
Text = ChangelogEntry.UpdateStream.DisplayName, Text = this.LatestBuild.UpdateStream.DisplayName,
Font = @"Exo2.0-Bold", Font = @"Exo2.0-Bold",
TextSize = 16, TextSize = 16,
Margin = new MarginPadding Margin = new MarginPadding
@ -61,14 +63,14 @@ namespace osu.Game.Overlays.Changelog
}, },
new SpriteText new SpriteText
{ {
Text = ChangelogEntry.DisplayVersion, Text = this.LatestBuild.DisplayVersion,
Font = @"Exo2.0-Light", Font = @"Exo2.0-Light",
TextSize = 21, TextSize = 21,
}, },
new SpriteText new SpriteText
{ {
Text = ChangelogEntry.Users > 0 ? Text = this.LatestBuild.Users > 0 ?
$"{ChangelogEntry.Users:N0} users online" : $"{this.LatestBuild.Users:N0} users online" :
null, null,
TextSize = 12, TextSize = 12,
Font = @"Exo2.0-Regular", Font = @"Exo2.0-Regular",
@ -79,7 +81,7 @@ namespace osu.Game.Overlays.Changelog
lineBadge = new LineBadge(false) lineBadge = new LineBadge(false)
{ {
Anchor = Anchor.TopCentre, Anchor = Anchor.TopCentre,
Colour = StreamColour.FromStreamName(ChangelogEntry.UpdateStream.Name), Colour = StreamColour.FromStreamName(this.LatestBuild.UpdateStream.Name),
UncollapsedSize = 4, UncollapsedSize = 4,
CollapsedSize = 2, CollapsedSize = 2,
}, },
@ -111,6 +113,7 @@ namespace osu.Game.Overlays.Changelog
protected override bool OnClick(InputState state) protected override bool OnClick(InputState state)
{ {
Activate(false); Activate(false);
sampleClick?.Play();
return base.OnClick(state); return base.OnClick(state);
} }
@ -142,6 +145,7 @@ namespace osu.Game.Overlays.Changelog
[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

@ -4,6 +4,8 @@
using OpenTK; using OpenTK;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
@ -26,6 +28,8 @@ namespace osu.Game.Overlays
private readonly ChangelogChart chart; private readonly ChangelogChart chart;
private readonly ChangelogContent content; private readonly ChangelogContent content;
private SampleChannel sampleBack;
private readonly Color4 purple = new Color4(191, 4, 255, 255); private readonly Color4 purple = new Color4(191, 4, 255, 255);
private APIAccess api; private APIAccess api;
@ -96,7 +100,10 @@ namespace osu.Game.Overlays
if (isAtListing) if (isAtListing)
State = Visibility.Hidden; State = Visibility.Hidden;
else else
{
FetchAndShowListing(); FetchAndShowListing();
sampleBack?.Play();
}
return true; return true;
} }
@ -121,9 +128,10 @@ namespace osu.Game.Overlays
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(APIAccess api) private void load(APIAccess api, AudioManager audio)
{ {
this.api = api; this.api = api;
sampleBack = audio.Sample.Get(@"UI/generic-select-soft"); // @"UI/screen-back" feels non-fitting here
} }
protected override void LoadComplete() protected override void LoadComplete()