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

Fix links not working due to rewrite regression

This commit is contained in:
HoutarouOreki 2018-07-23 20:36:24 +02:00
parent f526d66969
commit 6cd6ca432c
6 changed files with 34 additions and 10 deletions

View File

@ -77,6 +77,7 @@ namespace osu.Game.Overlays.Changelog
changelogContentGroup.GenerateText(changelogBuild.ChangelogEntries);
changelogContentGroup.UpdateChevronTooltips(changelogBuild.Versions.Previous?.DisplayVersion,
changelogBuild.Versions.Next?.DisplayVersion);
changelogContentGroup.BuildSelected += OnBuildSelected;
}
protected virtual void OnBuildSelected(string updateStream, string version, EventArgs args)

View File

@ -26,7 +26,9 @@ namespace osu.Game.Overlays.Changelog
private readonly SpriteIcon chevron;
private readonly TextBadgePairRelease releaseStream;
public Action ListingActivated;
public delegate void ListingSelectedEventHandler();
public event ListingSelectedEventHandler ListingSelected;
private const float cover_height = 280;
private const float title_height = 50;
@ -127,7 +129,7 @@ namespace osu.Game.Overlays.Changelog
Margin = new MarginPadding
{
Top = 10,
Left = 7,
Left = 15,
Right = 18,
Bottom = 15,
},
@ -157,6 +159,7 @@ namespace osu.Game.Overlays.Changelog
Origin = Anchor.CentreLeft,
},
};
listing.Activated += OnListingSelected;
}
public void ShowBuild(string displayName, string displayVersion)
@ -175,6 +178,11 @@ namespace osu.Game.Overlays.Changelog
chevron.MoveToX(-20, 100).FadeOut(100);
}
protected virtual void OnListingSelected(object source, EventArgs e)
{
ListingSelected?.Invoke();
}
[BackgroundDependencyLoader]
private void load(TextureStore textures)
{

View File

@ -20,8 +20,10 @@ namespace osu.Game.Overlays.Changelog.Header
protected LineBadge LineBadge;
public bool IsActivated { get; protected set; }
public Action OnActivation;
public Action OnDeactivation;
public delegate void ActivatedEventHandler(object source, EventArgs args);
public event ActivatedEventHandler Activated;
private SampleChannel sampleHover;
protected SampleChannel SampleActivate;
@ -120,6 +122,17 @@ namespace osu.Game.Overlays.Changelog.Header
return base.OnHover(state);
}
protected override bool OnClick(InputState state)
{
OnActivated();
return base.OnClick(state);
}
protected virtual void OnActivated()
{
Activated?.Invoke(this, EventArgs.Empty);
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{

View File

@ -32,21 +32,21 @@ namespace osu.Game.Overlays.Changelog.Header
public override void Activate()
{
if (IsActivated)
return;
IsActivated = true;
LineBadge.Uncollapse();
Text.Font = "Exo2.0-Bold";
SetTextColour(Color4.White, 100);
SampleActivate?.Play();
OnActivation?.Invoke();
}
public override void Deactivate()
{
IsActivated = false;
LineBadge.Collapse();
Text.Font = "Exo2.0-Regular"; // commented out since it makes bad resize-jumping
Text.Font = "Exo2.0-Regular";
SetTextColour(badgeColour, 100);
OnDeactivation?.Invoke();
}
protected override bool OnClick(InputState state)

View File

@ -30,14 +30,12 @@ namespace osu.Game.Overlays.Changelog.Header
ShowText(transition_duration, displayText);
IsActivated = true;
SampleActivate?.Play();
OnActivation?.Invoke();
}
public override void Deactivate()
{
IsActivated = false;
HideText(transition_duration);
OnDeactivation?.Invoke();
}
}
}

View File

@ -79,8 +79,9 @@ namespace osu.Game.Overlays
},
},
};
header.ListingSelected += FetchAndShowListing;
badges.Selected += onBuildSelected;
header.ListingActivated += FetchAndShowListing;
content.BuildSelected += onBuildSelected;
}
// receive input outside our bounds so we can trigger a close event on ourselves.
@ -152,6 +153,9 @@ namespace osu.Game.Overlays
/// </summary>
public void FetchAndShowBuild(string updateStream, string version, bool sentByBadges = false)
{
//// I should probably change this to take APIChangelog as an argument,
//// instantly update the header and badge, and if it doesn't contain the
//// needed info, just subscribe to when the info will be available
isAtListing = false;
var req = new GetChangelogBuildRequest(updateStream, version);
if (!sentByBadges)