private void updateSearch() { queryChangedDebounce?.Cancel(); if (!IsLoaded) { return; } Users = null; clearPanels(); loading.Hide(); getUsersRequest?.Cancel(); if (api?.IsLoggedIn != true) { return; } switch (Header.Tabs.Current.Value) { case SocialTab.Friends: var friendRequest = new GetFriendsRequest(); // TODO filter arguments? friendRequest.Success += updateUsers; api.Queue(getUsersRequest = friendRequest); break; default: var userRequest = new GetUsersRequest(); // TODO filter arguments! userRequest.Success += response => updateUsers(response.Select(r => r.User)); api.Queue(getUsersRequest = userRequest); break; } loading.Show(); }
public virtual void APIStateChanged(IAPIProvider api, APIState state) { switch (state) { case APIState.Offline: PopContentOut(Content); placeholder.ScaleTo(0.8f).Then().ScaleTo(1, 3 * transform_duration, Easing.OutQuint); placeholder.FadeInFromZero(2 * transform_duration, Easing.OutQuint); LoadingAnimation.Hide(); break; case APIState.Online: PopContentIn(Content); placeholder.FadeOut(transform_duration / 2, Easing.OutQuint); LoadingAnimation.Hide(); break; case APIState.Failing: case APIState.Connecting: PopContentOut(Content); LoadingAnimation.Show(); placeholder.FadeOut(transform_duration / 2, Easing.OutQuint); break; } }
private void showMore() { var req = new GetUserScoresRequest(user.Id, type, visiblePages++ *5); showMoreLoading.Show(); showMoreButton.Hide(); req.Success += scores => { foreach (var s in scores) { s.ApplyRuleset(rulesets.GetRuleset(s.OnlineRulesetID)); } showMoreButton.FadeTo(scores.Count == 5 ? 1 : 0); showMoreLoading.Hide(); if (scores.Any()) { missing.Hide(); foreach (OnlineScore score in scores) { scoreContainer.Add(new DrawableScore(score, includeWeigth ? Math.Pow(0.95, scoreContainer.Count) : -1) { RelativeSizeAxes = Axes.X, Height = 60, }); } } }; Schedule(() => { api.Queue(req); }); }
private void updateScores() { if (!IsLoaded) { return; } Scores = null; getScoresRequest?.Cancel(); if (api == null || Beatmap == null) { return; } loading.Show(); getScoresRequest = new GetScoresRequest(Beatmap); getScoresRequest.Success += r => { Scores = r.Scores; loading.Hide(); }; api.Queue(getScoresRequest); }
private void fetchInitialMessages(Channel channel) { var req = new GetMessagesRequest(channel); req.Success += messages => { channel.AddNewMessages(messages.ToArray()); if (channel == currentChannel) { loading.Hide(); } }; api.Queue(req); }
private void showMore() { var req = new GetUserScoresRequest(user.Value.Id, type, visiblePages++ *5); showMoreLoading.Show(); showMoreButton.Hide(); req.Success += scores => { foreach (var s in scores) { s.ApplyRuleset(rulesets.GetRuleset(s.OnlineRulesetID)); } showMoreButton.FadeTo(scores.Count == 5 ? 1 : 0); showMoreLoading.Hide(); if (!scores.Any()) { return; } missing.Hide(); foreach (OnlineScore score in scores) { DrawableScore drawableScore; switch (type) { default: drawableScore = new DrawablePerformanceScore(score, includeWeight ? Math.Pow(0.95, scoreContainer.Count) : (double?)null); break; case ScoreType.Recent: drawableScore = new DrawableTotalScore(score); break; } drawableScore.RelativeSizeAxes = Axes.X; drawableScore.Height = 60; scoreContainer.Add(drawableScore); } }; api.Queue(req); }
private void reloadUsers(APIAccess api) { Users = null; // no this is not the correct data source, but it's something. var request = new GetUsersRequest(); request.Success += res => { Users = res.Select(e => e.User); loading.Hide(); }; api.Queue(request); loading.Show(); }
private void updateScores() { getScoresRequest?.Cancel(); getScoresRequest = null; Scores = null; if (Scope == LeaderboardScope.Local) { // TODO: get local scores from wherever here. PlaceholderState = PlaceholderState.NoScores; return; } if (Beatmap?.OnlineBeatmapID == null) { PlaceholderState = PlaceholderState.Unavailable; return; } if (api?.IsLoggedIn != true) { PlaceholderState = PlaceholderState.NotLoggedIn; return; } PlaceholderState = PlaceholderState.Retrieving; loading.Show(); if (Scope != LeaderboardScope.Global && !api.LocalUser.Value.IsSupporter) { loading.Hide(); PlaceholderState = PlaceholderState.NotSupporter; return; } getScoresRequest = new GetScoresRequest(Beatmap, osuGame?.Ruleset.Value ?? Beatmap.Ruleset, Scope); getScoresRequest.Success += r => { Scores = r.Scores; PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores; }; getScoresRequest.Failure += onUpdateFailed; api.Queue(getScoresRequest); }
private void fetchInitialMessages(Channel channel) { var req = new GetMessagesRequest(new List <Channel> { channel }, null); req.Success += delegate(List <Message> messages) { loading.Hide(); channel.AddNewMessages(messages.ToArray()); Debug.Write("success!"); }; req.Failure += delegate { Debug.Write("failure!"); }; api.Queue(req); }
private void load(OverlayColourProvider colourProvider) { coverGradient.Colour = ColourInfo.GradientVertical(colourProvider.Background6.Opacity(0.3f), colourProvider.Background6.Opacity(0.8f)); onlineStatusPill.BackgroundColour = colourProvider.Background6; State.BindValueChanged(_ => updateDownloadButtons()); BeatmapSet.BindValueChanged(setInfo => { Picker.BeatmapSet = RulesetSelector.BeatmapSet = author.BeatmapSet = beatmapAvailability.BeatmapSet = Details.BeatmapSet = setInfo.NewValue; cover.BeatmapSet = setInfo.NewValue; if (setInfo.NewValue == null) { onlineStatusPill.FadeTo(0.5f, 500, Easing.OutQuint); fadeContent.Hide(); loading.Show(); downloadButtonsContainer.FadeOut(transition_duration); favouriteButton.FadeOut(transition_duration); } else { fadeContent.FadeIn(500, Easing.OutQuint); loading.Hide(); title.Text = setInfo.NewValue.Metadata.Title ?? string.Empty; artist.Text = setInfo.NewValue.Metadata.Artist ?? string.Empty; onlineStatusPill.FadeIn(500, Easing.OutQuint); onlineStatusPill.Status = setInfo.NewValue.OnlineInfo.Status; downloadButtonsContainer.FadeIn(transition_duration); favouriteButton.FadeIn(transition_duration); updateDownloadButtons(); } }, true); }
private void load(OsuColour colours) { tabsBg.Colour = colours.Gray3; State.BindValueChanged(_ => updateDownloadButtons()); BeatmapSet.BindValueChanged(setInfo => { Picker.BeatmapSet = RulesetSelector.BeatmapSet = author.BeatmapSet = beatmapAvailability.BeatmapSet = Details.BeatmapSet = setInfo.NewValue; cover.BeatmapSet = setInfo.NewValue; if (setInfo.NewValue == null) { onlineStatusPill.FadeTo(0.5f, 500, Easing.OutQuint); fadeContent.Hide(); loading.Show(); downloadButtonsContainer.FadeOut(transition_duration); favouriteButton.FadeOut(transition_duration); } else { fadeContent.FadeIn(500, Easing.OutQuint); loading.Hide(); title.Text = setInfo.NewValue.Metadata.Title ?? string.Empty; artist.Text = setInfo.NewValue.Metadata.Artist ?? string.Empty; onlineStatusPill.FadeIn(500, Easing.OutQuint); onlineStatusPill.Status = setInfo.NewValue.OnlineInfo.Status; downloadButtonsContainer.FadeIn(transition_duration); favouriteButton.FadeIn(transition_duration); updateDownloadButtons(); } }, true); }