Пример #1
0
        private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours, UserInputManager input)
        {
            if (Footer != null)
            {
                Footer.AddButton(@"random", colours.Green, () => triggerRandom(input), Key.F2);
                Footer.AddButton(@"options", colours.Blue, BeatmapOptions.ToggleVisibility, Key.F3);

                BeatmapOptions.AddButton(@"Delete", @"Beatmap", FontAwesome.fa_trash, colours.Pink, promptDelete, Key.Number4, float.MaxValue);
            }

            if (database == null)
            {
                database = beatmaps;
            }

            if (osu != null)
            {
                ruleset.BindTo(osu.Ruleset);
            }

            database.BeatmapSetAdded   += onBeatmapSetAdded;
            database.BeatmapSetRemoved += onBeatmapSetRemoved;

            trackManager  = audio.Track;
            dialogOverlay = dialog;

            sampleChangeDifficulty = audio.Sample.Get(@"SongSelect/select-difficulty");
            sampleChangeBeatmap    = audio.Sample.Get(@"SongSelect/select-expand");

            initialAddSetsTask = new CancellationTokenSource();

            carousel.Beatmaps = database.GetAllWithChildren <BeatmapSetInfo>(b => !b.DeletePending);

            Beatmap.ValueChanged += beatmap_ValueChanged;
        }
Пример #2
0
        private void load(OsuGameBase game, BeatmapDatabase beatmaps, OsuColour colours, UserInputManager inputManager)
        {
            this.inputManager = inputManager;
            this.beatmaps     = beatmaps;
            trackManager      = game.Audio.Track;

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    CornerRadius     = 5,
                    Masking          = true,
                    EdgeEffect       = new EdgeEffectParameters
                    {
                        Type   = EdgeEffectType.Shadow,
                        Colour = Color4.Black.Opacity(40),
                        Radius = 5,
                    },
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = colours.Gray3,
                            RelativeSizeAxes = Axes.Both,
                        },
                        list = new PlaylistList
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = 95, Bottom = 10, Right = 10
                            },
                            OnSelect = itemSelected,
                        },
                        filter = new FilterControl
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            ExitRequested    = () => State = Visibility.Hidden,
                            FilterChanged    = search => list.Filter(search),
                            Padding          = new MarginPadding(10),
                        },
                    },
                },
            };

            list.BeatmapSets = BeatmapSets = beatmaps.GetAllWithChildren <BeatmapSetInfo>(b => !b.DeletePending).ToList();

            beatmapBacking.BindTo(game.Beatmap);

            filter.Search.OnCommit = (sender, newText) =>
            {
                var beatmap = list.FirstVisibleSet?.Beatmaps?.FirstOrDefault();
                if (beatmap != null)
                {
                    playSpecified(beatmap);
                }
            };
        }
Пример #3
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);
        }
Пример #4
0
        private void load(OsuGameBase game, BeatmapDatabase beatmaps, OsuColour colours)
        {
            this.beatmaps = beatmaps;
            trackManager  = game.Audio.Track;

            Children = new Drawable[]
            {
                new Container
                {
                    RelativeSizeAxes = Axes.Both,
                    CornerRadius     = 5,
                    Masking          = true,
                    EdgeEffect       = new EdgeEffect
                    {
                        Type   = EdgeEffectType.Shadow,
                        Colour = Color4.Black.Opacity(40),
                        Radius = 5,
                    },
                    Children = new Drawable[]
                    {
                        new Box
                        {
                            Colour           = colours.Gray3,
                            RelativeSizeAxes = Axes.Both,
                        },
                        list = new PlaylistList
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding {
                                Top = 95, Bottom = 10, Right = 10
                            },
                            OnSelect = itemSelected,
                        },
                        filter = new FilterControl
                        {
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            ExitRequested    = () => State = Visibility.Hidden,
                            FilterChanged    = search => list.Filter(search),
                            Padding          = new MarginPadding(10),
                        },
                    },
                },
            };

            list.BeatmapSets = BeatmapSets = beatmaps.GetAllWithChildren <BeatmapSetInfo>().ToList();

            beatmapBacking.BindTo(game.Beatmap);
        }
        public BeatmapCollectionView(DependencyContainer dependencies)
        {
            BeatmapDatabase = dependencies.Get <BeatmapDatabase>();

            var vbox          = new VBox();
            var beatmapsBySet = BeatmapDatabase.GetAllWithChildren <BeatmapInfo>(recursive: true)
                                .GroupBy(bm => bm.BeatmapSet, new BeatmapSetInfoComparer());

            foreach (var item in beatmapsBySet)
            {
                vbox.PackStart(new BeatmapSetView(item, dependencies));
            }

            Content = vbox;
        }
Пример #6
0
        protected override void Load(BaseGame game)
        {
            base.Load(game);
            var osuGame = game as OsuGameBase;

            if (osuGame != null)
            {
                if (database == null)
                {
                    database = osuGame.Beatmaps;
                }
                trackManager = osuGame.Audio.Track;
            }

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

            backgroundSprite = getScaledSprite(fallbackTexture = game.Textures.Get(@"Backgrounds/bg4"));
            AddInternal(backgroundSprite);
        }
Пример #7
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);
        }
Пример #8
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);
        }
Пример #9
0
        private void load(OsuGameBase game, OsuConfigManager config, BeatmapDatabase beatmaps, OsuColour colours)
        {
            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 Container
                        {
                            Padding = new MarginPadding {
                                Bottom = progress_height
                            },
                            Height           = bottom_black_area_height,
                            RelativeSizeAxes = Axes.X,
                            Origin           = Anchor.BottomCentre,
                            Anchor           = Anchor.BottomCentre,
                            Children         = new Drawable[]
                            {
                                new FillFlowContainer <Button>
                                {
                                    AutoSizeAxes = Axes.Both,
                                    Direction    = FillDirection.Horizontal,
                                    Spacing      = new Vector2(5),
                                    Origin       = Anchor.Centre,
                                    Anchor       = Anchor.Centre,
                                    Children     = new[]
                                    {
                                        new Button
                                        {
                                            Action = prev,
                                            Icon   = FontAwesome.fa_step_backward,
                                        },
                                        playButton = new Button
                                        {
                                            Scale     = new Vector2(1.4f),
                                            IconScale = new Vector2(1.4f),
                                            Action    = () =>
                                            {
                                                if (current?.Track == null)
                                                {
                                                    return;
                                                }
                                                if (current.Track.IsRunning)
                                                {
                                                    current.Track.Stop();
                                                }
                                                else
                                                {
                                                    current.Track.Start();
                                                }
                                            },
                                            Icon = FontAwesome.fa_play_circle_o,
                                        },
                                        new Button
                                        {
                                            Action = next,
                                            Icon   = FontAwesome.fa_step_forward,
                                        },
                                    }
                                },
                                new Button
                                {
                                    Origin   = Anchor.Centre,
                                    Anchor   = Anchor.CentreRight,
                                    Position = new Vector2(-bottom_black_area_height / 2, 0),
                                    Icon     = FontAwesome.fa_bars,
                                },
                            }
                        },
                        progress = new DragBar
                        {
                            Origin        = Anchor.BottomCentre,
                            Anchor        = Anchor.BottomCentre,
                            Height        = progress_height,
                            Colour        = colours.Yellow,
                            SeekRequested = seek
                        }
                    }
                }
            };

            this.beatmaps = beatmaps;
            trackManager  = game.Audio.Track;
            preferUnicode = config.GetBindable <bool>(OsuConfig.ShowUnicode);
            preferUnicode.ValueChanged += unicode => updateDisplay(current, TransformDirection.None);

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

            currentBackground = new MusicControllerBackground();
            dragContainer.Add(currentBackground);
        }