Exemple #1
0
 protected DrawableOsuHitObject(OsuHitObject hitObject)
     : base(hitObject)
 {
     base.AddInternal(shakeContainer = new ShakeContainer {
         RelativeSizeAxes = Axes.Both
     });
     Alpha = 0;
 }
        private void load(OsuGame game, ScoreManager scores)
        {
            InternalChild = shakeContainer = new ShakeContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = button = new DownloadButton
                {
                    RelativeSizeAxes = Axes.Both,
                }
            };

            button.Action = () =>
            {
                switch (State.Value)
                {
                case DownloadState.LocallyAvailable:
                    game?.PresentScore(Model.Value);
                    break;

                case DownloadState.NotDownloaded:
                    scores.Download(Model.Value);
                    break;

                case DownloadState.Downloaded:
                case DownloadState.Downloading:
                    shakeContainer.Shake();
                    break;
                }
            };

            State.BindValueChanged(state =>
            {
                button.State.Value = state.NewValue;

                switch (replayAvailability)
                {
                case ReplayAvailability.Local:
                    button.TooltipText = @"Watch replay";
                    break;

                case ReplayAvailability.Online:
                    button.TooltipText = @"Download replay";
                    break;

                default:
                    button.TooltipText = @"Replay unavailable";
                    break;
                }
            }, true);

            if (replayAvailability == ReplayAvailability.NotAvailable)
            {
                button.Enabled.Value = false;
                button.Alpha         = 0.6f;
            }
        }
Exemple #3
0
        private void load()
        {
            Alpha = 0;

            base.AddInternal(shakeContainer = new ShakeContainer
            {
                ShakeDuration    = 30,
                RelativeSizeAxes = Axes.Both
            });
        }
 public BeatmapPanelDownloadButton(BeatmapSetInfo beatmapSet)
     : base(beatmapSet)
 {
     InternalChild = shakeContainer = new ShakeContainer
     {
         RelativeSizeAxes = Axes.Both,
         Child            = button = new DownloadButton
         {
             RelativeSizeAxes = Axes.Both,
         },
     };
 }
Exemple #5
0
        private void load(OsuGame game, ScoreManager scores)
        {
            InternalChild = shakeContainer = new ShakeContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = button = new DownloadButton
                {
                    RelativeSizeAxes = Axes.Both,
                }
            };

            button.Action = () =>
            {
                switch (State.Value)
                {
                case DownloadState.LocallyAvailable:
                    game?.PresentScore(Score.Value, ScorePresentType.Gameplay);
                    break;

                case DownloadState.NotDownloaded:
                    scores.Download(Score.Value, false);
                    break;

                case DownloadState.Importing:
                case DownloadState.Downloading:
                    shakeContainer.Shake();
                    break;
                }
            };

            Score.BindValueChanged(score =>
            {
                downloadTracker?.RemoveAndDisposeImmediately();

                if (score.NewValue != null)
                {
                    AddInternal(downloadTracker = new ScoreDownloadTracker(score.NewValue)
                    {
                        State = { BindTarget = State }
                    });
                }

                button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable;
                updateTooltip();
            }, true);

            State.BindValueChanged(state =>
            {
                button.State.Value = state.NewValue;
                updateTooltip();
            }, true);
        }
        public PanelDownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false)
            : base(beatmapSet)
        {
            this.noVideo = noVideo;

            InternalChild = shakeContainer = new ShakeContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = button = new DownloadButton
                {
                    RelativeSizeAxes = Axes.Both,
                },
            };
        }
Exemple #7
0
        private void load()
        {
            Alpha = 0;

            base.AddInternal(shakeContainer = new ShakeContainer
            {
                ShakeDuration    = 30,
                RelativeSizeAxes = Axes.Both
            });

            IndexInCurrentComboBindable.BindTo(HitObject.IndexInCurrentComboBindable);
            PositionBindable.BindTo(HitObject.PositionBindable);
            StackHeightBindable.BindTo(HitObject.StackHeightBindable);
            ScaleBindable.BindTo(HitObject.ScaleBindable);
        }
Exemple #8
0
        private void load(OsuGame game, ScoreManager scores)
        {
            InternalChild = shakeContainer = new ShakeContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = button = new DownloadButton
                {
                    RelativeSizeAxes = Axes.Both,
                }
            };

            button.Action = () =>
            {
                switch (State.Value)
                {
                case DownloadState.LocallyAvailable:
                    game?.PresentScore(Model.Value, ScorePresentType.Gameplay);
                    break;

                case DownloadState.NotDownloaded:
                    scores.Download(Model.Value);
                    break;

                case DownloadState.Importing:
                case DownloadState.Downloading:
                    shakeContainer.Shake();
                    break;
                }
            };

            State.BindValueChanged(state =>
            {
                button.State.Value = state.NewValue;

                updateTooltip();
            }, true);

            Model.BindValueChanged(_ =>
            {
                button.Enabled.Value = replayAvailability != ReplayAvailability.NotAvailable;

                updateTooltip();
            }, true);
        }
Exemple #9
0
        public BeatmapPanelDownloadButton(BeatmapSetInfo beatmapSet)
            : base(beatmapSet)
        {
            InternalChild = shakeContainer = new ShakeContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = button = new DownloadButton
                {
                    RelativeSizeAxes = Axes.Both,
                },
            };

            button.Add(new DownloadProgressBar(beatmapSet)
            {
                Anchor = Anchor.BottomLeft,
                Origin = Anchor.BottomLeft,
                Depth  = -1,
            });
        }
Exemple #10
0
        public DownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false)
            : base(beatmapSet)
        {
            this.noVideo = noVideo;

            InternalChild = shakeContainer = new ShakeContainer
            {
                RelativeSizeAxes = Axes.Both,
                Child            = button = new OsuAnimatedButton
                {
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        background = new Box
                        {
                            RelativeSizeAxes = Axes.Both,
                            Depth            = float.MaxValue
                        },
                        icon = new SpriteIcon
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            Size   = new Vector2(13),
                            Icon   = FontAwesome.Solid.Download,
                        },
                        checkmark = new SpriteIcon
                        {
                            Anchor = Anchor.Centre,
                            Origin = Anchor.Centre,
                            X      = 8,
                            Size   = Vector2.Zero,
                            Icon   = FontAwesome.Solid.Check,
                        }
                    }
                }
            };
        }
        private void load(IAPIProvider api, BeatmapManager beatmaps)
        {
            FillFlowContainer textSprites;

            AddInternal(shakeContainer = new ShakeContainer
            {
                RelativeSizeAxes = Axes.Both,
                Masking          = true,
                CornerRadius     = 5,
                Child            = button = new HeaderButton {
                    RelativeSizeAxes = Axes.Both
                },
            });

            button.AddRange(new Drawable[]
            {
                new Container
                {
                    Padding = new MarginPadding {
                        Horizontal = 10
                    },
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        textSprites = new FillFlowContainer
                        {
                            Anchor           = Anchor.CentreLeft,
                            Origin           = Anchor.CentreLeft,
                            AutoSizeAxes     = Axes.Both,
                            AutoSizeDuration = 500,
                            AutoSizeEasing   = Easing.OutQuint,
                            Direction        = FillDirection.Vertical,
                        },
                        new SpriteIcon
                        {
                            Anchor = Anchor.CentreRight,
                            Origin = Anchor.CentreRight,
                            Icon   = FontAwesome.Solid.Download,
                            Size   = new Vector2(18),
                        },
                    }
                },
                new DownloadProgressBar(BeatmapSet.Value)
                {
                    Anchor = Anchor.BottomLeft,
                    Origin = Anchor.BottomLeft,
                },
            });

            button.Action = () =>
            {
                if (State.Value != DownloadState.NotDownloaded)
                {
                    shakeContainer.Shake();
                    return;
                }

                beatmaps.Download(BeatmapSet.Value, noVideo);
            };

            localUser.BindTo(api.LocalUser);
            localUser.BindValueChanged(userChanged, true);
            button.Enabled.BindValueChanged(enabledChanged, true);

            State.BindValueChanged(state =>
            {
                switch (state.NewValue)
                {
                case DownloadState.Downloading:
                    textSprites.Children = new Drawable[]
                    {
                        new OsuSpriteText
                        {
                            Text = "Downloading...",
                            Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
                        },
                    };
                    break;

                case DownloadState.Importing:
                    textSprites.Children = new Drawable[]
                    {
                        new OsuSpriteText
                        {
                            Text = "Importing...",
                            Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
                        },
                    };
                    break;

                case DownloadState.LocallyAvailable:
                    this.FadeOut(200);
                    break;

                case DownloadState.NotDownloaded:
                    textSprites.Children = new Drawable[]
                    {
                        new OsuSpriteText
                        {
                            Text = "Download",
                            Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold)
                        },
                        new OsuSpriteText
                        {
                            Text = getVideoSuffixText(),
                            Font = OsuFont.GetFont(size: text_size - 2, weight: FontWeight.Bold)
                        },
                    };
                    this.FadeIn(200);
                    break;
                }
            }, true);
        }