Clean up events and states

This commit is contained in:
Dean Herbert
2019-05-15 18:08:19 +09:00
parent f49b0dc16d
commit 60d244d2d6
5 changed files with 27 additions and 54 deletions

View File

@ -23,9 +23,7 @@ namespace osu.Game.Overlays.Changelog
private readonly SortedDictionary<string, List<APIChangelogEntry>> categories =
new SortedDictionary<string, List<APIChangelogEntry>>();
public delegate void BuildSelectedEventHandler(APIChangelogBuild build, EventArgs args);
public event BuildSelectedEventHandler BuildSelected;
public event Action<APIChangelogBuild> BuildSelected;
public readonly FillFlowContainer ChangelogEntries;
@ -53,7 +51,7 @@ namespace osu.Game.Overlays.Changelog
Size = new Vector2(24),
Action = () =>
{
OnBuildSelected(build.Versions.Previous);
BuildSelected?.Invoke(build.Versions.Previous);
chevronPrevious.IsEnabled = false;
},
},
@ -88,7 +86,7 @@ namespace osu.Game.Overlays.Changelog
Size = new Vector2(24),
Action = () =>
{
OnBuildSelected(build.Versions.Next);
BuildSelected?.Invoke(build.Versions.Next);
chevronNext.IsEnabled = false;
},
},
@ -141,7 +139,7 @@ namespace osu.Game.Overlays.Changelog
Origin = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
Margin = new MarginPadding { Top = 20 },
Action = () => OnBuildSelected(build),
Action = () => BuildSelected?.Invoke(build),
Child = new FillFlowContainer
{
Direction = FillDirection.Horizontal,
@ -179,7 +177,7 @@ namespace osu.Game.Overlays.Changelog
clickableBuildText.FadeTo(0.5f, 500);
Scheduler.AddDelayed(() =>
{
clickableBuildText.Action = () => OnBuildSelected(build);
clickableBuildText.Action = () => BuildSelected?.Invoke(build);
clickableBuildText.FadeIn(500);
}, 2000);
};
@ -200,11 +198,6 @@ namespace osu.Game.Overlays.Changelog
}
}
protected virtual void OnBuildSelected(APIChangelogBuild build)
{
BuildSelected?.Invoke(build, EventArgs.Empty);
}
public void GenerateText(List<APIChangelogEntry> changelogEntries)
{
// sort entries by category