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

View File

@ -80,9 +80,9 @@ namespace osu.Game.Overlays.Changelog
{
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();
}
else
@ -92,13 +92,13 @@ namespace osu.Game.Overlays.Changelog
private void onBadgeSelected(StreamBadge source, EventArgs args)
{
selectedStreamId = source.ChangelogEntry.UpdateStream.Id;
selectedStreamId = source.LatestBuild.UpdateStream.Id;
OnSelected(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)
@ -107,7 +107,7 @@ namespace osu.Game.Overlays.Changelog
{
if (selectedStreamId < 0)
{
if (selectedStreamId != streamBadge.ChangelogEntry.UpdateStream.Id)
if (selectedStreamId != streamBadge.LatestBuild.UpdateStream.Id)
streamBadge.Deactivate();
else
streamBadge.EnableDim();
@ -124,7 +124,7 @@ namespace osu.Game.Overlays.Changelog
{
if (selectedStreamId < 0)
streamBadge.Activate();
else if (streamBadge.ChangelogEntry.UpdateStream.Id == selectedStreamId)
else if (streamBadge.LatestBuild.UpdateStream.Id == selectedStreamId)
streamBadge.DisableDim();
}
base.OnHoverLost(state);

View File

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

View File

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

View File

@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Changelog.Header
public event ActivatedEventHandler Activated;
private SampleChannel sampleHover;
protected SampleChannel SampleActivate;
private SampleChannel sampleActivate;
public TextBadgePair(ColourInfo badgeColour, string displayText = "Listing", bool startCollapsed = true)
{
@ -86,7 +86,6 @@ namespace osu.Game.Overlays.Changelog.Header
IsActivated = true;
LineBadge.Uncollapse();
Text.Font = "Exo2.0-Bold";
SampleActivate?.Play();
}
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)
{
OnActivated();
sampleActivate?.Play();
return base.OnClick(state);
}
@ -137,7 +137,7 @@ namespace osu.Game.Overlays.Changelog.Header
private void load(AudioManager audio)
{
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();
Text.Font = "Exo2.0-Bold";
SetTextColour(Color4.White, 100);
SampleActivate?.Play();
}
public override void Deactivate()

View File

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

View File

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

View File

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