Beispiel #1
0
        protected override void ShowMore()
        {
            base.ShowMore();

            request          = new GetUserBeatmapsRequest(User.Value.Id, type, VisiblePages++ *ItemsPerPage);
            request.Success += sets => Schedule(() =>
            {
                ShowMoreButton.FadeTo(sets.Count == ItemsPerPage ? 1 : 0);
                ShowMoreLoading.Hide();

                if (!sets.Any() && VisiblePages == 1)
                {
                    MissingText.Show();
                    return;
                }

                foreach (var s in sets)
                {
                    if (!s.OnlineBeatmapSetID.HasValue)
                    {
                        continue;
                    }

                    var panel = new DirectGridPanel(s.ToBeatmapSet(Rulesets));
                    ItemsContainer.Add(panel);
                }
            });

            Api.Queue(request);
        }
Beispiel #2
0
        protected override void ShowMore()
        {
            base.ShowMore();

            request          = new GetUserRecentActivitiesRequest(User.Value.Id, VisiblePages++ *ItemsPerPage);
            request.Success += activities => Schedule(() =>
            {
                ShowMoreButton.FadeTo(activities.Count == ItemsPerPage ? 1 : 0);
                ShowMoreLoading.Hide();

                if (!activities.Any() && VisiblePages == 1)
                {
                    MissingText.Show();
                    return;
                }

                MissingText.Hide();

                foreach (APIRecentActivity activity in activities)
                {
                    ItemsContainer.Add(new DrawableRecentActivity(activity));
                }
            });

            Api.Queue(request);
        }
        protected override void ShowMore()
        {
            base.ShowMore();

            var req = new GetUserMostPlayedBeatmapsRequest(User.Value.Id, VisiblePages++ *ItemsPerPage);

            req.Success += beatmaps =>
            {
                ShowMoreButton.FadeTo(beatmaps.Count == ItemsPerPage ? 1 : 0);
                ShowMoreLoading.Hide();

                if (!beatmaps.Any() && VisiblePages == 1)
                {
                    MissingText.Show();
                    return;
                }

                MissingText.Hide();

                foreach (var beatmap in beatmaps)
                {
                    ItemsContainer.Add(new DrawableMostPlayedRow(beatmap.GetBeatmapInfo(Rulesets), beatmap.PlayCount));
                }
            };

            Api.Queue(req);
        }
        protected override void ShowMore()
        {
            base.ShowMore();

            var req = new GetUserBeatmapsRequest(User.Value.Id, type, VisiblePages++ *ItemsPerPage);

            req.Success += sets =>
            {
                ShowMoreButton.FadeTo(sets.Count == ItemsPerPage ? 1 : 0);
                ShowMoreLoading.Hide();

                if (!sets.Any())
                {
                    MissingText.Show();
                    return;
                }

                foreach (var s in sets)
                {
                    if (!s.OnlineBeatmapSetID.HasValue)
                    {
                        continue;
                    }

                    var panel = new DirectGridPanel(s.ToBeatmapSet(Rulesets));
                    ItemsContainer.Add(panel);

                    panel.PreviewPlaying.ValueChanged += isPlaying =>
                    {
                        if (!isPlaying)
                        {
                            return;
                        }

                        if (currentlyPlaying != null && currentlyPlaying != panel)
                        {
                            currentlyPlaying.PreviewPlaying.Value = false;
                        }

                        currentlyPlaying = panel;
                    };
                }
            };

            Api.Queue(req);
        }
Beispiel #5
0
        protected override void ShowMore()
        {
            base.ShowMore();

            var req = new GetUserScoresRequest(User.Value.Id, type, VisiblePages++ *ItemsPerPage);

            req.Success += scores =>
            {
                foreach (var s in scores)
                {
                    s.ApplyRuleset(Rulesets.GetRuleset(s.OnlineRulesetID));
                }

                ShowMoreButton.FadeTo(scores.Count == ItemsPerPage ? 1 : 0);
                ShowMoreLoading.Hide();

                if (!scores.Any() && VisiblePages == 1)
                {
                    MissingText.Show();
                    return;
                }

                MissingText.Hide();

                foreach (APIScore score in scores)
                {
                    DrawableProfileScore drawableScore;

                    switch (type)
                    {
                    default:
                        drawableScore = new DrawablePerformanceScore(score, includeWeight ? Math.Pow(0.95, ItemsContainer.Count) : (double?)null);
                        break;

                    case ScoreType.Recent:
                        drawableScore = new DrawableTotalScore(score);
                        break;
                    }

                    ItemsContainer.Add(drawableScore);
                }
            };

            Api.Queue(req);
        }
Beispiel #6
0
        protected override void ShowMore()
        {
            base.ShowMore();

            request          = new GetUserScoresRequest(User.Value.Id, type, VisiblePages++ *ItemsPerPage);
            request.Success += scores => Schedule(() =>
            {
                foreach (var s in scores)
                {
                    s.Ruleset = Rulesets.GetRuleset(s.RulesetID);
                }

                if (!scores.Any() && VisiblePages == 1)
                {
                    ShowMoreButton.Hide();
                    ShowMoreLoading.Hide();
                    MissingText.Show();
                    return;
                }

                IEnumerable <DrawableProfileScore> drawableScores;

                switch (type)
                {
                default:
                    drawableScores = scores.Select(score => new DrawablePerformanceScore(score, includeWeight ? Math.Pow(0.95, ItemsContainer.Count) : (double?)null));
                    break;

                case ScoreType.Recent:
                    drawableScores = scores.Select(score => new DrawableTotalScore(score));
                    break;
                }

                LoadComponentsAsync(drawableScores, s =>
                {
                    MissingText.Hide();
                    ShowMoreButton.FadeTo(scores.Count == ItemsPerPage ? 1 : 0);
                    ShowMoreLoading.Hide();

                    ItemsContainer.AddRange(s);
                });
            });

            Api.Queue(request);
        }
        void ReleaseDesignerOutlets()
        {
            if (_textLabel != null)
            {
                _textLabel.Dispose();
                _textLabel = null;
            }

            if (Label != null)
            {
                Label.Dispose();
                Label = null;
            }

            if (ShowMoreButton != null)
            {
                ShowMoreButton.Dispose();
                ShowMoreButton = null;
            }
        }
Beispiel #8
0
        public void SetTexts(string mainText, string moreText, string showMoreText, UIImage showMoreImage)
        {
            var text = mainText;

            if (moreText.Length > 0)
            {
                text += "\n\n" + moreText;
            }
            TextLabel.Text = text;

            var attributed = new NSMutableAttributedString(showMoreText + " ");
            var attachment = new NSTextAttachment {
                Image = showMoreImage
            };

            attributed.Append(NSAttributedString.FromAttachment(attachment));

            PerformWithoutAnimation(() =>
            {
                ShowMoreButton.SetAttributedTitle(attributed, UIControlState.Normal);
                ShowMoreButton.LayoutIfNeeded();
            });
        }
        public TestSceneShowMoreButton()
        {
            ShowMoreButton button = null;

            int fireCount = 0;

            Add(button = new ShowMoreButton
            {
                Anchor = Anchor.Centre,
                Origin = Anchor.Centre,
                Action = () =>
                {
                    fireCount++;
                    // ReSharper disable once AccessToModifiedClosure
                    // ReSharper disable once PossibleNullReferenceException
                    Scheduler.AddDelayed(() => button.IsLoading = false, 2000);
                }
            });

            AddStep("click button", () => button.Click());

            AddAssert("action fired once", () => fireCount == 1);
            AddAssert("is in loading state", () => button.IsLoading);

            AddStep("click button", () => button.Click());

            AddAssert("action not fired", () => fireCount == 1);
            AddAssert("is in loading state", () => button.IsLoading);

            AddUntilStep("wait for loaded", () => !button.IsLoading);

            AddStep("click button", () => button.Click());

            AddAssert("action fired twice", () => fireCount == 2);
            AddAssert("is in loading state", () => button.IsLoading);
        }
Beispiel #10
0
        void ReleaseDesignerOutlets()
        {
            if (AILogo != null)
            {
                AILogo.Dispose();
                AILogo = null;
            }

            if (BackButton != null)
            {
                BackButton.Dispose();
                BackButton = null;
            }

            if (BottomLeft_Button != null)
            {
                BottomLeft_Button.Dispose();
                BottomLeft_Button = null;
            }

            if (BottomRight_Button != null)
            {
                BottomRight_Button.Dispose();
                BottomRight_Button = null;
            }

            if (CenteringLabel != null)
            {
                CenteringLabel.Dispose();
                CenteringLabel = null;
            }

            if (HighLowLabel != null)
            {
                HighLowLabel.Dispose();
                HighLowLabel = null;
            }

            if (ImportanceLevelLabel != null)
            {
                ImportanceLevelLabel.Dispose();
                ImportanceLevelLabel = null;
            }

            if (ImportanceTextBox != null)
            {
                ImportanceTextBox.Dispose();
                ImportanceTextBox = null;
            }

            if (InfoButton != null)
            {
                InfoButton.Dispose();
                InfoButton = null;
            }

            if (OneToFiveLabel2 != null)
            {
                OneToFiveLabel2.Dispose();
                OneToFiveLabel2 = null;
            }

            if (PCTitle != null)
            {
                PCTitle.Dispose();
                PCTitle = null;
            }

            if (PlayCharLabel != null)
            {
                PlayCharLabel.Dispose();
                PlayCharLabel = null;
            }

            if (PlayErrorLabel != null)
            {
                PlayErrorLabel.Dispose();
                PlayErrorLabel = null;
            }

            if (PlayPrefLabel != null)
            {
                PlayPrefLabel.Dispose();
                PlayPrefLabel = null;
            }

            if (ProgressBar != null)
            {
                ProgressBar.Dispose();
                ProgressBar = null;
            }

            if (Putter_Fitter != null)
            {
                Putter_Fitter.Dispose();
                Putter_Fitter = null;
            }

            if (PutterSpecsLabel != null)
            {
                PutterSpecsLabel.Dispose();
                PutterSpecsLabel = null;
            }

            if (ResultsTitleLabel != null)
            {
                ResultsTitleLabel.Dispose();
                ResultsTitleLabel = null;
            }

            if (ResultsView != null)
            {
                ResultsView.Dispose();
                ResultsView = null;
            }

            if (ShowMoreButton != null)
            {
                ShowMoreButton.Dispose();
                ShowMoreButton = null;
            }

            if (ShowMoreLabel != null)
            {
                ShowMoreLabel.Dispose();
                ShowMoreLabel = null;
            }

            if (ShowMyDetailsButton != null)
            {
                ShowMyDetailsButton.Dispose();
                ShowMyDetailsButton = null;
            }

            if (StartOverButton != null)
            {
                StartOverButton.Dispose();
                StartOverButton = null;
            }

            if (TitleLabel != null)
            {
                TitleLabel.Dispose();
                TitleLabel = null;
            }

            if (TopLeft_Button != null)
            {
                TopLeft_Button.Dispose();
                TopLeft_Button = null;
            }

            if (TopRight_Button != null)
            {
                TopRight_Button.Dispose();
                TopRight_Button = null;
            }
        }