1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 16:12:57 +08:00

Revert "Allow OverlayView fetching with no API requests required"

This reverts commit 449b9a21ae.
This commit is contained in:
Salman Ahmed 2020-12-18 01:27:58 +03:00
parent 5d180753fa
commit 5e4f667cff

View File

@ -42,29 +42,25 @@ namespace osu.Game.Overlays
/// <summary> /// <summary>
/// Create the API request for fetching data. /// Create the API request for fetching data.
/// </summary> /// </summary>
protected virtual APIRequest<T> CreateRequest() => null; protected abstract APIRequest<T> CreateRequest();
/// <summary> /// <summary>
/// Fired when results arrive from the main API request. /// Fired when results arrive from the main API request.
/// </summary> /// </summary>
/// <param name="response"></param> /// <param name="response"></param>
protected virtual void OnSuccess(T response) protected abstract void OnSuccess(T response);
{
}
/// <summary> /// <summary>
/// Force a re-request for data from the API. /// Force a re-request for data from the API.
/// </summary> /// </summary>
protected virtual void PerformFetch() protected void PerformFetch()
{ {
request?.Cancel(); request?.Cancel();
request = CreateRequest();
if (request != null) request = CreateRequest();
{ request.Success += response => Schedule(() => OnSuccess(response));
request.Success += response => Schedule(() => OnSuccess(response));
API.Queue(request); API.Queue(request);
}
} }
private void onlineStateChanged(ValueChangedEvent<APIState> state) => Schedule(() => private void onlineStateChanged(ValueChangedEvent<APIState> state) => Schedule(() =>