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

Refactor the rewrite

This commit is contained in:
HoutarouOreki 2018-07-22 22:31:24 +02:00
parent 51eec0dca4
commit 391da47881
5 changed files with 12 additions and 16 deletions

View File

@ -109,8 +109,7 @@ namespace osu.Game.Overlays.Changelog
protected virtual void OnSelected(StreamBadge source)
{
if (Selected != null)
Selected(source.ChangelogEntry.UpdateStream.Name, source.ChangelogEntry.Version, EventArgs.Empty);
Selected?.Invoke(source.ChangelogEntry.UpdateStream.Name, source.ChangelogEntry.Version, EventArgs.Empty);
}
protected override bool OnHover(InputState state)
@ -135,7 +134,7 @@ namespace osu.Game.Overlays.Changelog
foreach (StreamBadge streamBadge in badgesContainer.Children)
{
if (selectedStreamId < 0)
streamBadge.Activate(true);
streamBadge.Activate();
else if (streamBadge.ChangelogEntry.UpdateStream.Id == selectedStreamId)
streamBadge.DisableDim();
}

View File

@ -2,12 +2,10 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Online.API.Requests.Responses;
using System;
@ -52,7 +50,7 @@ namespace osu.Game.Overlays.Changelog
}
// watch out for this?
Add(changelogContentGroup = new ChangelogContentGroup(build, true));
changelogContentGroup.BuildSelected += onBuildSelected;
changelogContentGroup.BuildSelected += OnBuildSelected;
changelogContentGroup.GenerateText(build.ChangelogEntries);
currentDate = build.CreatedAt.Date;
}
@ -66,7 +64,7 @@ namespace osu.Game.Overlays.Changelog
Margin = new MarginPadding { Top = 30, },
});
Add(changelogContentGroup = new ChangelogContentGroup(build, false));
changelogContentGroup.BuildSelected += onBuildSelected;
changelogContentGroup.BuildSelected += OnBuildSelected;
changelogContentGroup.GenerateText(build.ChangelogEntries);
}
}
@ -77,10 +75,9 @@ namespace osu.Game.Overlays.Changelog
Child = changelogContentGroup = new ChangelogContentGroup(changelogBuild);
}
protected virtual void onBuildSelected(string updateStream, string version, EventArgs args)
protected virtual void OnBuildSelected(string updateStream, string version, EventArgs args)
{
if (BuildSelected != null)
BuildSelected(updateStream, version, EventArgs.Empty);
BuildSelected?.Invoke(updateStream, version, EventArgs.Empty);
}
}
}

View File

@ -190,8 +190,7 @@ namespace osu.Game.Overlays.Changelog
protected virtual void OnBuildSelected(string updateStream, string version)
{
if (BuildSelected != null)
BuildSelected(updateStream, version, EventArgs.Empty);
BuildSelected?.Invoke(updateStream, version, EventArgs.Empty);
}
public void GenerateText(List<ChangelogEntry> changelogEntries)

View File

@ -11,7 +11,6 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Overlays.Changelog.Header;
using System;
@ -24,6 +23,7 @@ namespace osu.Game.Overlays.Changelog
private readonly Sprite headerBadge;
private readonly OsuSpriteText titleStream;
private readonly TextBadgePairListing listing;
private readonly SpriteIcon chevron;
private readonly TextBadgePairRelease releaseStream;
public Action ListingActivated;
@ -36,7 +36,6 @@ namespace osu.Game.Overlays.Changelog
public ChangelogHeader()
{
SpriteIcon chevron; // AppVeyor told me this should be a local variable..?
RelativeSizeAxes = Axes.X;
Height = cover_height;
Children = new Drawable[]
@ -166,12 +165,14 @@ namespace osu.Game.Overlays.Changelog
releaseStream.Activate($"{displayName} {displayVersion}");
titleStream.Text = displayName;
titleStream.FlashColour(Color4.White, 500, Easing.OutQuad);
chevron.MoveToX(0, 100).FadeIn(100);
}
public void ShowListing()
{
releaseStream.Deactivate();
listing.Activate();
chevron.MoveToX(-20, 100).FadeOut(100);
}
[BackgroundDependencyLoader]

View File

@ -90,8 +90,8 @@ namespace osu.Game.Overlays.Changelog
isActivated = true;
this.FadeIn(transition_duration);
lineBadge.IsCollapsed = false;
if (!withoutFiringUpdates && Selected != null)
Selected(this, EventArgs.Empty);
if (!withoutFiringUpdates)
Selected?.Invoke(this, EventArgs.Empty);
}
public void Deactivate()