Exemple #1
0
        private void load(OsuGameBase osuGame, BeatmapDatabase beatmaps, AudioManager audio, TextureStore textures)
        {
            this.beatmaps = beatmaps;
            trackManager  = osuGame.Audio.Track;
            config        = osuGame.Config;
            preferUnicode = osuGame.Config.GetBindable <bool>(OsuConfig.ShowUnicode);
            preferUnicode.ValueChanged += preferUnicode_changed;

            beatmapSource = osuGame.Beatmap ?? new Bindable <WorkingBeatmap>();
            playList      = beatmaps.GetAllWithChildren <BeatmapSetInfo>();

            backgroundSprite = new MusicControllerBackground();
            AddInternal(backgroundSprite);
        }
Exemple #2
0
        private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction)
        {
            //we might be off-screen when this update comes in.
            //rather than Scheduling, manually handle this to avoid possible memory contention.
            pendingBeatmapSwitch = () =>
            {
                Task.Run(() =>
                {
                    if (beatmap?.Beatmap == null)
                    {
                        title.Text  = @"Nothing to play";
                        artist.Text = @"Nothing to play";
                    }
                    else
                    {
                        BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
                        title.Text  = unicodeString(metadata.Title, metadata.TitleUnicode);
                        artist.Text = unicodeString(metadata.Artist, metadata.ArtistUnicode);
                    }
                });

                MusicControllerBackground newBackground;

                (newBackground = new MusicControllerBackground(beatmap)).LoadAsync(game, delegate
                {
                    dragContainer.Add(newBackground);

                    switch (direction)
                    {
                    case TransformDirection.Next:
                        newBackground.Position = new Vector2(400, 0);
                        newBackground.MoveToX(0, 500, EasingTypes.OutCubic);
                        backgroundSprite.MoveToX(-400, 500, EasingTypes.OutCubic);
                        break;

                    case TransformDirection.Prev:
                        newBackground.Position = new Vector2(-400, 0);
                        newBackground.MoveToX(0, 500, EasingTypes.OutCubic);
                        backgroundSprite.MoveToX(400, 500, EasingTypes.OutCubic);
                        break;
                    }

                    backgroundSprite.Expire();
                    backgroundSprite = newBackground;
                });
            };
        }
Exemple #3
0
        private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction)
        {
            Task.Run(() =>
            {
                if (beatmap.Beatmap == null)
                {
                    //todo: we may need to display some default text here (currently in the constructor).
                    return;
                }

                BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
                title.Text  = config.GetUnicodeString(metadata.Title, metadata.TitleUnicode);
                artist.Text = config.GetUnicodeString(metadata.Artist, metadata.ArtistUnicode);
            });

            MusicControllerBackground newBackground;

            (newBackground = new MusicControllerBackground(beatmap)).Preload(game, delegate
            {
                Add(newBackground);

                switch (direction)
                {
                case TransformDirection.Next:
                    newBackground.Position = new Vector2(400, 0);
                    newBackground.MoveToX(0, 500, EasingTypes.OutCubic);
                    backgroundSprite.MoveToX(-400, 500, EasingTypes.OutCubic);
                    break;

                case TransformDirection.Prev:
                    newBackground.Position = new Vector2(-400, 0);
                    newBackground.MoveToX(0, 500, EasingTypes.OutCubic);
                    backgroundSprite.MoveToX(400, 500, EasingTypes.OutCubic);
                    break;
                }

                backgroundSprite.Expire();
                backgroundSprite = newBackground;
            });
        }
Exemple #4
0
        private void load(OsuGameBase osuGame, OsuConfigManager config, BeatmapDatabase beatmaps, OsuColour colours)
        {
            game = osuGame;

            unicodeString = config.GetUnicodeString;

            Children = new Drawable[]
            {
                dragContainer = new Container
                {
                    Anchor       = Anchor.Centre,
                    Origin       = Anchor.Centre,
                    Masking      = true,
                    CornerRadius = 5,
                    EdgeEffect   = new EdgeEffect
                    {
                        Type   = EdgeEffectType.Shadow,
                        Colour = Color4.Black.Opacity(40),
                        Radius = 5,
                    },
                    RelativeSizeAxes = Axes.Both,
                    Children         = new Drawable[]
                    {
                        title = new OsuSpriteText
                        {
                            Origin   = Anchor.BottomCentre,
                            Anchor   = Anchor.TopCentre,
                            Position = new Vector2(0, 40),
                            TextSize = 25,
                            Colour   = Color4.White,
                            Text     = @"Nothing to play",
                            Font     = @"Exo2.0-MediumItalic"
                        },
                        artist = new OsuSpriteText
                        {
                            Origin   = Anchor.TopCentre,
                            Anchor   = Anchor.TopCentre,
                            Position = new Vector2(0, 45),
                            TextSize = 15,
                            Colour   = Color4.White,
                            Text     = @"Nothing to play",
                            Font     = @"Exo2.0-BoldItalic"
                        },
                        new ClickableContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Origin       = Anchor.Centre,
                            Anchor       = Anchor.BottomCentre,
                            Position     = new Vector2(0, -30),
                            Action       = () =>
                            {
                                if (current?.Track == null)
                                {
                                    return;
                                }
                                if (current.Track.IsRunning)
                                {
                                    current.Track.Stop();
                                }
                                else
                                {
                                    current.Track.Start();
                                }
                            },
                            Children = new Drawable[]
                            {
                                playButton = new TextAwesome
                                {
                                    TextSize = 30,
                                    Icon     = FontAwesome.fa_play_circle_o,
                                    Origin   = Anchor.Centre,
                                    Anchor   = Anchor.Centre
                                }
                            }
                        },
                        new ClickableContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Origin       = Anchor.Centre,
                            Anchor       = Anchor.BottomCentre,
                            Position     = new Vector2(-30, -30),
                            Action       = prev,
                            Children     = new Drawable[]
                            {
                                new TextAwesome
                                {
                                    TextSize = 15,
                                    Icon     = FontAwesome.fa_step_backward,
                                    Origin   = Anchor.Centre,
                                    Anchor   = Anchor.Centre
                                }
                            }
                        },
                        new ClickableContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Origin       = Anchor.Centre,
                            Anchor       = Anchor.BottomCentre,
                            Position     = new Vector2(30, -30),
                            Action       = next,
                            Children     = new Drawable[]
                            {
                                new TextAwesome
                                {
                                    TextSize = 15,
                                    Icon     = FontAwesome.fa_step_forward,
                                    Origin   = Anchor.Centre,
                                    Anchor   = Anchor.Centre
                                }
                            }
                        },
                        new ClickableContainer
                        {
                            AutoSizeAxes = Axes.Both,
                            Origin       = Anchor.Centre,
                            Anchor       = Anchor.BottomRight,
                            Position     = new Vector2(20, -30),
                            Children     = new Drawable[]
                            {
                                new TextAwesome
                                {
                                    TextSize = 15,
                                    Icon     = FontAwesome.fa_bars,
                                    Origin   = Anchor.Centre,
                                    Anchor   = Anchor.Centre
                                }
                            }
                        },
                        progress = new DragBar
                        {
                            Origin        = Anchor.BottomCentre,
                            Anchor        = Anchor.BottomCentre,
                            Height        = 10,
                            Colour        = colours.Yellow,
                            SeekRequested = seek
                        }
                    }
                }
            };

            this.beatmaps = beatmaps;
            trackManager  = osuGame.Audio.Track;
            preferUnicode = config.GetBindable <bool>(OsuConfig.ShowUnicode);
            preferUnicode.ValueChanged += preferUnicode_changed;

            beatmapSource = osuGame.Beatmap ?? new Bindable <WorkingBeatmap>();
            playList      = beatmaps.GetAllWithChildren <BeatmapSetInfo>();

            backgroundSprite = new MusicControllerBackground();
            dragContainer.Add(backgroundSprite);
        }
Exemple #5
0
        private void load(OsuGameBase osuGame, BeatmapDatabase beatmaps, AudioManager audio,
            TextureStore textures, OsuColour colours)
        {
            Children = new Drawable[]
            {
                title = new SpriteText
                {
                    Origin = Anchor.BottomCentre,
                    Anchor = Anchor.TopCentre,
                    Position = new Vector2(0, 40),
                    TextSize = 25,
                    Colour = Color4.White,
                    Text = @"Nothing to play",
                    Font = @"Exo2.0-MediumItalic"
                },
                artist = new SpriteText
                {
                    Origin = Anchor.TopCentre,
                    Anchor = Anchor.TopCentre,
                    Position = new Vector2(0, 45),
                    TextSize = 15,
                    Colour = Color4.White,
                    Text = @"Nothing to play",
                    Font = @"Exo2.0-BoldItalic"
                },
                new ClickableContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Origin = Anchor.Centre,
                    Anchor = Anchor.BottomCentre,
                    Position = new Vector2(0, -30),
                    Action = () =>
                    {
                        if (current?.Track == null) return;
                        if (current.Track.IsRunning)
                            current.Track.Stop();
                        else
                            current.Track.Start();
                    },
                    Children = new Drawable[]
                    {
                        playButton = new TextAwesome
                        {
                            TextSize = 30,
                            Icon = FontAwesome.fa_play_circle_o,
                            Origin = Anchor.Centre,
                            Anchor = Anchor.Centre
                        }
                    }
                },
                new ClickableContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Origin = Anchor.Centre,
                    Anchor = Anchor.BottomCentre,
                    Position = new Vector2(-30, -30),
                    Action = prev,
                    Children = new Drawable[]
                    {
                        new TextAwesome
                        {
                            TextSize = 15,
                            Icon = FontAwesome.fa_step_backward,
                            Origin = Anchor.Centre,
                            Anchor = Anchor.Centre
                        }
                    }
                },
                new ClickableContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Origin = Anchor.Centre,
                    Anchor = Anchor.BottomCentre,
                    Position = new Vector2(30, -30),
                    Action = next,
                    Children = new Drawable[]
                    {
                        new TextAwesome
                        {
                            TextSize = 15,
                            Icon = FontAwesome.fa_step_forward,
                            Origin = Anchor.Centre,
                            Anchor = Anchor.Centre
                        }
                    }
                },
                new ClickableContainer
                {
                    AutoSizeAxes = Axes.Both,
                    Origin = Anchor.Centre,
                    Anchor = Anchor.BottomRight,
                    Position = new Vector2(20, -30),
                    Children = new Drawable[]
                    {
                        listButton = new TextAwesome
                        {
                            TextSize = 15,
                            Icon = FontAwesome.fa_bars,
                            Origin = Anchor.Centre,
                            Anchor = Anchor.Centre
                        }
                    }
                },
                progress = new DragBar
                {
                    Origin = Anchor.BottomCentre,
                    Anchor = Anchor.BottomCentre,
                    Height = 10,
                    Colour = colours.Yellow,
                    SeekRequested = seek
                }
            };
        
            this.beatmaps = beatmaps;
            trackManager = osuGame.Audio.Track;
            config = osuGame.Config;
            preferUnicode = osuGame.Config.GetBindable<bool>(OsuConfig.ShowUnicode);
            preferUnicode.ValueChanged += preferUnicode_changed;

            beatmapSource = osuGame.Beatmap ?? new Bindable<WorkingBeatmap>();
            playList = beatmaps.GetAllWithChildren<BeatmapSetInfo>();

            backgroundSprite = new MusicControllerBackground();
            AddInternal(backgroundSprite);
        }
Exemple #6
0
        private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction)
        {
            Task.Run(() =>
            {
                if (beatmap?.Beatmap == null)
                    //todo: we may need to display some default text here (currently in the constructor).
                    return;

                BeatmapMetadata metadata = beatmap.Beatmap.BeatmapInfo.Metadata;
                title.Text = config.GetUnicodeString(metadata.Title, metadata.TitleUnicode);
                artist.Text = config.GetUnicodeString(metadata.Artist, metadata.ArtistUnicode);
            });

            MusicControllerBackground newBackground;

            (newBackground = new MusicControllerBackground(beatmap)).Preload(game, delegate
            {

                Add(newBackground);

                switch (direction)
                {
                    case TransformDirection.Next:
                        newBackground.Position = new Vector2(400, 0);
                        newBackground.MoveToX(0, 500, EasingTypes.OutCubic);
                        backgroundSprite.MoveToX(-400, 500, EasingTypes.OutCubic);
                        break;
                    case TransformDirection.Prev:
                        newBackground.Position = new Vector2(-400, 0);
                        newBackground.MoveToX(0, 500, EasingTypes.OutCubic);
                        backgroundSprite.MoveToX(400, 500, EasingTypes.OutCubic);
                        break;
                }

                backgroundSprite.Expire();
                backgroundSprite = newBackground;
            });
        }