1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 05:02:55 +08:00

Rewrite ChangelogHeader.cs

This commit is contained in:
HoutarouOreki 2018-07-22 18:44:45 +02:00
parent b3f789e19a
commit 797abd558f

View File

@ -26,9 +26,7 @@ namespace osu.Game.Overlays.Changelog
private readonly TextBadgePairListing listing; private readonly TextBadgePairListing listing;
private readonly TextBadgePairRelease releaseStream; private readonly TextBadgePairRelease releaseStream;
public Action OnListingActivated; public Action ListingActivated;
public APIChangelog ChangelogEntry;
private const float cover_height = 280; private const float cover_height = 280;
private const float title_height = 50; private const float title_height = 50;
@ -160,41 +158,21 @@ namespace osu.Game.Overlays.Changelog
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
}, },
}; };
// is this a bad way to do this?
OnLoadComplete = d =>
{
releaseStream.OnActivation = () =>
{
listing.Deactivate();
chevron.MoveToX(0, 100).FadeIn(100);
};
listing.OnActivation = () =>
{
releaseStream.Deactivate();
chevron.MoveToX(-20, 100).FadeOut(100);
changeHeaderText("Listing");
OnListingActivated?.Invoke();
};
};
} }
public void ShowReleaseStream() public void ShowBuild(string updateStream, string version)
{ {
releaseStream.Activate(String.Join(" ", listing.Deactivate();
ChangelogEntry.UpdateStream.DisplayName, ChangelogEntry.DisplayVersion)); releaseStream.Activate($"{updateStream} {version}");
changeHeaderText(ChangelogEntry.UpdateStream.DisplayName); titleStream.Text = updateStream;
}
private void changeHeaderText(string headerText)
{
titleStream.Text = headerText;
titleStream.FlashColour(Color4.White, 500, Easing.OutQuad); titleStream.FlashColour(Color4.White, 500, Easing.OutQuad);
} }
public void ActivateListing() => listing.Activate(); public void ShowListing()
{
public bool IsListingActivated() => listing.IsActivated; releaseStream.Deactivate();
listing.Activate();
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(TextureStore textures) private void load(TextureStore textures)