mirror of https://github.com/ppy/osu
Handle around an APIChangelog instead of just Name and Version:
Makes showing up the header immediately possible
This commit is contained in:
parent
6cd6ca432c
commit
7c6be4a075
|
@ -18,7 +18,7 @@ public class ChangelogBadges : Container
|
|||
private const float padding_y = 20;
|
||||
private const float padding_x = 85;
|
||||
|
||||
public delegate void SelectionHandler(string updateStream, string version, EventArgs args);
|
||||
public delegate void SelectionHandler(APIChangelog releaseStream, EventArgs args);
|
||||
|
||||
public event SelectionHandler Selected;
|
||||
|
||||
|
@ -49,17 +49,6 @@ public ChangelogBadges()
|
|||
},
|
||||
},
|
||||
};
|
||||
//foreach (StreamBadge streamBadge in BadgesContainer.Children)
|
||||
//{
|
||||
// streamBadge.OnActivation = () =>
|
||||
// {
|
||||
// SelectedRelease = streamBadge.ChangelogEntry;
|
||||
// foreach (StreamBadge item in BadgesContainer.Children)
|
||||
// if (item.ChangelogEntry.Id != streamBadge.ChangelogEntry.Id)
|
||||
// item.Deactivate();
|
||||
// OnSelection?.Invoke();
|
||||
// };
|
||||
//}
|
||||
}
|
||||
|
||||
public void Populate(List<APIChangelog> latestBuilds)
|
||||
|
@ -109,7 +98,7 @@ private void onBadgeSelected(StreamBadge source, EventArgs args)
|
|||
|
||||
protected virtual void OnSelected(StreamBadge source)
|
||||
{
|
||||
Selected?.Invoke(source.ChangelogEntry.UpdateStream.Name, source.ChangelogEntry.Version, EventArgs.Empty);
|
||||
Selected?.Invoke(source.ChangelogEntry, EventArgs.Empty);
|
||||
}
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
|
|
|
@ -16,7 +16,7 @@ public class ChangelogContent : FillFlowContainer
|
|||
private APIAccess api;
|
||||
private ChangelogContentGroup changelogContentGroup;
|
||||
|
||||
public delegate void BuildSelectedEventHandler(string updateStream, string version, EventArgs args);
|
||||
public delegate void BuildSelectedEventHandler(APIChangelog build, EventArgs args);
|
||||
|
||||
public event BuildSelectedEventHandler BuildSelected;
|
||||
|
||||
|
@ -80,9 +80,9 @@ public void ShowBuild(APIChangelog changelogBuild)
|
|||
changelogContentGroup.BuildSelected += OnBuildSelected;
|
||||
}
|
||||
|
||||
protected virtual void OnBuildSelected(string updateStream, string version, EventArgs args)
|
||||
protected virtual void OnBuildSelected(APIChangelog build, EventArgs args)
|
||||
{
|
||||
BuildSelected?.Invoke(updateStream, version, EventArgs.Empty);
|
||||
BuildSelected?.Invoke(build, EventArgs.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class ChangelogContentGroup : FillFlowContainer
|
|||
private readonly SortedDictionary<string, List<ChangelogEntry>> categories =
|
||||
new SortedDictionary<string, List<ChangelogEntry>>();
|
||||
|
||||
public delegate void BuildSelectedEventHandler(string updateStream, string version, EventArgs args);
|
||||
public delegate void BuildSelectedEventHandler(APIChangelog build, EventArgs args);
|
||||
|
||||
public event BuildSelectedEventHandler BuildSelected;
|
||||
|
||||
|
@ -53,8 +53,7 @@ public ChangelogContentGroup(APIChangelog build)
|
|||
IsEnabled = false,
|
||||
Icon = FontAwesome.fa_chevron_left,
|
||||
Size = new Vector2(24),
|
||||
Action = () => OnBuildSelected(build.Versions.Previous.UpdateStream.Name,
|
||||
build.Versions.Previous.Version),
|
||||
Action = () => OnBuildSelected(build.Versions.Previous),
|
||||
},
|
||||
new FillFlowContainer<SpriteText>
|
||||
{
|
||||
|
@ -91,8 +90,7 @@ public ChangelogContentGroup(APIChangelog build)
|
|||
IsEnabled = false,
|
||||
Icon = FontAwesome.fa_chevron_right,
|
||||
Size = new Vector2(24),
|
||||
Action = () => OnBuildSelected(build.Versions.Next.UpdateStream.Name,
|
||||
build.Versions.Next.Version),
|
||||
Action = () => OnBuildSelected(build.Versions.Next),
|
||||
},
|
||||
}
|
||||
},
|
||||
|
@ -160,7 +158,7 @@ public ChangelogContentGroup(APIChangelog build, bool newDate = false)
|
|||
TextSize = 20, // web: 18,
|
||||
Font = @"Exo2.0-Light",
|
||||
Colour = StreamColour.FromStreamName(build.UpdateStream.Name),
|
||||
Action = () => OnBuildSelected(build.UpdateStream.Name, build.Version),
|
||||
Action = () => OnBuildSelected(build),
|
||||
IsClickMuted = true,
|
||||
},
|
||||
}
|
||||
|
@ -188,9 +186,9 @@ public void UpdateChevronTooltips(string previousVersion, string nextVersion)
|
|||
}
|
||||
}
|
||||
|
||||
protected virtual void OnBuildSelected(string updateStream, string version)
|
||||
protected virtual void OnBuildSelected(APIChangelog build)
|
||||
{
|
||||
BuildSelected?.Invoke(updateStream, version, EventArgs.Empty);
|
||||
BuildSelected?.Invoke(build, EventArgs.Empty);
|
||||
}
|
||||
|
||||
public void GenerateText(List<ChangelogEntry> changelogEntries)
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays.Changelog;
|
||||
using System;
|
||||
|
||||
|
@ -114,9 +115,9 @@ protected override void PopOut()
|
|||
FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out);
|
||||
}
|
||||
|
||||
private void onBuildSelected(string updateStream, string version, EventArgs e)
|
||||
private void onBuildSelected(APIChangelog build, EventArgs e)
|
||||
{
|
||||
FetchAndShowBuild(updateStream, version);
|
||||
FetchAndShowBuild(build);
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
|
@ -151,18 +152,21 @@ public void FetchAndShowListing()
|
|||
/// <summary>
|
||||
/// Fetches and shows a specific build from a specific update stream.
|
||||
/// </summary>
|
||||
public void FetchAndShowBuild(string updateStream, string version, bool sentByBadges = false)
|
||||
public void FetchAndShowBuild(APIChangelog build, 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);
|
||||
var req = new GetChangelogBuildRequest(build.UpdateStream.Name, build.Version);
|
||||
|
||||
if (build.UpdateStream.DisplayName != null && build.DisplayVersion != null)
|
||||
header.ShowBuild(build.UpdateStream.DisplayName, build.DisplayVersion);
|
||||
else
|
||||
req.Success += res => header.ShowBuild(res.UpdateStream.DisplayName, res.DisplayVersion);
|
||||
|
||||
if (!sentByBadges)
|
||||
badges.SelectUpdateStream(updateStream);
|
||||
chart.ShowUpdateStream(updateStream);
|
||||
badges.SelectUpdateStream(build.UpdateStream.Name);
|
||||
|
||||
chart.ShowUpdateStream(build.UpdateStream.Name);
|
||||
req.Success += content.ShowBuild;
|
||||
req.Success += res => header.ShowBuild(res.UpdateStream.DisplayName, res.DisplayVersion);
|
||||
api.Queue(req);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue