Ejemplo n.º 1
0
        private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
        {
            // prevent user from changing beatmap while the intro is still runnning.
            beatmap = base.Beatmap.BeginLease(false);

            menuVoice = config.GetBindable <bool>(OsuSetting.MenuVoice);
            seeya     = audio.Samples.Get(@"seeya");
        }
Ejemplo n.º 2
0
 private void addBeatmapSets(Framework.Game game, CancellationToken token)
 {
     foreach (var beatmapSet in database.Query <BeatmapSetInfo>().Where(b => !b.DeletePending))
     {
         if (token.IsCancellationRequested)
         {
             return;
         }
         addBeatmapSet(beatmapSet, game);
     }
 }
Ejemplo n.º 3
0
        private void addBeatmapSet(BeatmapSetInfo beatmapSet, Framework.Game game, bool select = false)
        {
            beatmapSet = database.GetWithChildren <BeatmapSetInfo>(beatmapSet.ID);
            beatmapSet.Beatmaps.ForEach(b =>
            {
                database.GetChildren(b);
                if (b.Metadata == null)
                {
                    b.Metadata = beatmapSet.Metadata;
                }
            });

            foreach (var b in beatmapSet.Beatmaps)
            {
                b.ComputeDifficulty(database);
            }
            beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.StarDifficulty).ToList();

            var beatmap = new WorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault(), beatmapSet, database);

            var group = new BeatmapGroup(beatmap)
            {
                SelectionChanged = selectionChanged,
                StartRequested   = b => footer.StartButton.TriggerClick()
            };

            //for the time being, let's completely load the difficulty panels in the background.
            //this likely won't scale so well, but allows us to completely async the loading flow.
            Task.WhenAll(group.BeatmapPanels.Select(panel => panel.Preload(game))).ContinueWith(task => Schedule(delegate
            {
                beatmapGroups.Add(group);

                carousel.AddGroup(group);

                if (Beatmap == null || select)
                {
                    carousel.SelectBeatmap(beatmapSet.Beatmaps.First());
                }
                else
                {
                    var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(Beatmap.BeatmapInfo));
                    if (panel != null)
                    {
                        carousel.SelectGroup(group, panel);
                    }
                }
            }));
        }
Ejemplo n.º 4
0
        private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
        {
            menuMusic = config.GetBindable <bool>(OsuSetting.MenuMusic);

            BeatmapSetInfo setInfo = null;

            if (!menuMusic.Value)
            {
                var sets = beatmaps.GetAllUsableBeatmapSets();
                if (sets.Count > 0)
                {
                    setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
                }
            }

            if (setInfo == null)
            {
                setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == menu_music_beatmap_hash);

                if (setInfo == null)
                {
                    // we need to import the default menu background beatmap
                    setInfo = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream(@"Tracks/triangles.osz"), "triangles.osz")).Result;

                    setInfo.Protected = true;
                    beatmaps.Update(setInfo);
                }
            }

            introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);

            track = introBeatmap.Track;
            track.Reset();

            if (config.Get <bool>(OsuSetting.MenuVoice) && !menuMusic.Value)
            {
                // triangles has welcome sound included in the track. only play this if the user doesn't want menu music.
                welcome = audio.Samples.Get(@"welcome");
            }
        }
Ejemplo n.º 5
0
        private void addBeatmapSet(BeatmapSetInfo beatmapSet, Framework.Game game, bool select = false)
        {
            beatmapSet = database.GetWithChildren <BeatmapSetInfo>(beatmapSet.ID);
            beatmapSet.Beatmaps.ForEach(b =>
            {
                database.GetChildren(b);
                if (b.Metadata == null)
                {
                    b.Metadata = beatmapSet.Metadata;
                }
            });

            var group = new BeatmapGroup(beatmapSet, database)
            {
                SelectionChanged = selectionChanged,
                StartRequested   = b => raiseSelect()
            };

            //for the time being, let's completely load the difficulty panels in the background.
            //this likely won't scale so well, but allows us to completely async the loading flow.
            Task.WhenAll(group.BeatmapPanels.Select(panel => panel.LoadAsync(game))).ContinueWith(task => Schedule(delegate
            {
                beatmapGroups.Add(group);

                group.State = BeatmapGroupState.Collapsed;
                carousel.AddGroup(group);

                filterChanged(false, false);

                if (Beatmap == null || select)
                {
                    carousel.SelectBeatmap(beatmapSet.Beatmaps.First());
                }
                else
                {
                    carousel.SelectBeatmap(Beatmap.BeatmapInfo);
                }
            }));
        }
Ejemplo n.º 6
0
        private void load(OsuConfigManager config, Framework.Game game, RealmAccess realm, IAPIProvider api)
        {
            // prevent user from changing beatmap while the intro is still running.
            beatmap = Beatmap.BeginLease(false);

            MenuVoice = config.GetBindable <bool>(OsuSetting.MenuVoice);
            MenuMusic = config.GetBindable <bool>(OsuSetting.MenuMusic);

            if (api.LocalUser.Value.IsSupporter)
            {
                AddInternal(skinnableSeeya = new SkinnableSound(new SampleInfo(SeeyaSampleName)));
            }
            else
            {
                seeya = audio.Samples.Get(SeeyaSampleName);
            }

            // if the user has requested not to play theme music, we should attempt to find a random beatmap from their collection.
            if (!MenuMusic.Value)
            {
                realm.Run(r =>
                {
                    var usableBeatmapSets = r.All <BeatmapSetInfo>().Where(s => !s.DeletePending && !s.Protected).AsRealmCollection();

                    int setCount = usableBeatmapSets.Count;

                    if (setCount > 0)
                    {
                        var found = usableBeatmapSets[RNG.Next(0, setCount - 1)].Beatmaps.FirstOrDefault();

                        if (found != null)
                        {
                            initialBeatmap = beatmaps.GetWorkingBeatmap(found);
                        }
                    }
                });
            }

            // we generally want a song to be playing on startup, so use the intro music even if a user has specified not to if no other track is available.
            if (initialBeatmap == null)
            {
                // Intro beatmaps are generally made using the osu! ruleset.
                // It might not be present in test projects for other rulesets.
                bool osuRulesetPresent = rulesets.GetRuleset(0) != null;

                if (!loadThemedIntro() && osuRulesetPresent)
                {
                    // if we detect that the theme track or beatmap is unavailable this is either first startup or things are in a bad state.
                    // this could happen if a user has nuked their files store. for now, reimport to repair this.
                    var import = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream($"Tracks/{BeatmapFile}"), BeatmapFile)).GetResultSafely();

                    import?.PerformWrite(b => b.Protected = true);

                    loadThemedIntro();
                }
            }

            bool loadThemedIntro()
            {
                var setInfo = beatmaps.QueryBeatmapSet(b => b.Protected && b.Hash == BeatmapHash);

                if (setInfo == null)
                {
                    return(false);
                }

                setInfo.PerformRead(s =>
                {
                    if (s.Beatmaps.Count == 0)
                    {
                        return;
                    }

                    initialBeatmap = beatmaps.GetWorkingBeatmap(s.Beatmaps.First());
                });

                return(UsingThemedIntro = initialBeatmap != null);
            }
        }
Ejemplo n.º 7
0
 private void load(Framework.Game game)
 {
     Host.MaximumDrawHz     = int.MaxValue;
     Host.MaximumUpdateHz   = int.MaxValue;
     Host.MaximumInactiveHz = int.MaxValue;
 }
Ejemplo n.º 8
0
 private void load(Framework.Game game)
 {
     this.game = game;
 }
Ejemplo n.º 9
0
        private void load(AudioManager audio, OsuConfigManager config, BeatmapDatabase beatmaps, Framework.Game game)
        {
            menuVoice = config.GetBindable <bool>(OsuSetting.MenuVoice);
            menuMusic = config.GetBindable <bool>(OsuSetting.MenuMusic);

            BeatmapSetInfo setInfo = null;

            if (!menuMusic)
            {
                var query = beatmaps.Query <BeatmapSetInfo>().Where(b => !b.DeletePending);
                int count = query.Count();
                if (count > 0)
                {
                    setInfo = query.ElementAt(RNG.Next(0, count - 1));
                }
            }

            if (setInfo == null)
            {
                var query = beatmaps.Query <BeatmapSetInfo>().Where(b => b.Hash == MENU_MUSIC_BEATMAP_HASH);

                setInfo = query.FirstOrDefault();

                if (setInfo == null)
                {
                    // we need to import the default menu background beatmap
                    beatmaps.Import(new OszArchiveReader(game.Resources.GetStream(@"Tracks/circles.osz")));

                    setInfo = query.First();

                    setInfo.DeletePending = true;
                    beatmaps.Update(setInfo, false);
                }
            }

            beatmaps.GetChildren(setInfo);
            Beatmap.Value = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);

            track = Beatmap.Value.Track;

            welcome = audio.Sample.Get(@"welcome");
            seeya   = audio.Sample.Get(@"seeya");
        }
Ejemplo n.º 10
0
        private void load(OsuConfigManager config, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game)
        {
            // prevent user from changing beatmap while the intro is still runnning.
            beatmap = Beatmap.BeginLease(false);

            MenuVoice = config.GetBindable <bool>(OsuSetting.MenuVoice);
            MenuMusic = config.GetBindable <bool>(OsuSetting.MenuMusic);
            seeya     = audio.Samples.Get(SeeyaSampleName);

            BeatmapSetInfo setInfo = null;

            // if the user has requested not to play theme music, we should attempt to find a random beatmap from their collection.
            if (!MenuMusic.Value)
            {
                var sets = beatmaps.GetAllUsableBeatmapSets(IncludedDetails.Minimal);

                if (sets.Count > 0)
                {
                    setInfo        = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
                    initialBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
                }
            }

            // we generally want a song to be playing on startup, so use the intro music even if a user has specified not to if no other track is available.
            if (setInfo == null)
            {
                if (!loadThemedIntro())
                {
                    // if we detect that the theme track or beatmap is unavailable this is either first startup or things are in a bad state.
                    // this could happen if a user has nuked their files store. for now, reimport to repair this.
                    var import = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream($"Tracks/{BeatmapFile}"), BeatmapFile)).Result;
                    import.Protected = true;
                    beatmaps.Update(import);

                    loadThemedIntro();
                }
            }

            bool loadThemedIntro()
            {
                setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == BeatmapHash);

                if (setInfo != null)
                {
                    initialBeatmap   = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
                    UsingThemedIntro = !(Track is TrackVirtual);
                }

                return(UsingThemedIntro);
            }
        }
Ejemplo n.º 11
0
        private async Task load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap)
        {
            this.beatmap.BindTo(beatmap);

            menuVoice = config.GetBindable <bool>(OsuSetting.MenuVoice);
            menuMusic = config.GetBindable <bool>(OsuSetting.MenuMusic);

            BeatmapSetInfo setInfo = null;

            if (!menuMusic)
            {
                var sets = beatmaps.GetAllUsableBeatmapSets();
                if (sets.Count > 0)
                {
                    setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
                }
            }

            if (setInfo == null)
            {
                setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == menu_music_beatmap_hash);

                if (setInfo == null)
                {
                    // we need to import the default menu background beatmap
                    setInfo = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream(@"Tracks/circles.osz"), "circles.osz"));

                    setInfo.Protected = true;
                    beatmaps.Update(setInfo);
                }
            }

            introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
            track        = introBeatmap.Track;

            welcome = await audio.Sample.GetAsync(@"welcome");

            seeya = await audio.Sample.GetAsync(@"seeya");
        }
Ejemplo n.º 12
0
        private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, Framework.Game game,
                          OsuGame osu, OsuColour colours)
        {
            if (Footer != null)
            {
                Footer.AddButton(@"random", colours.Green, SelectRandom, 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 (osu != null)
            {
                playMode.BindTo(osu.PlayMode);
            }
            playMode.ValueChanged += playMode_ValueChanged;

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

            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();

            Task.Factory.StartNew(() => addBeatmapSets(game, initialAddSetsTask.Token), initialAddSetsTask.Token);
        }
Ejemplo n.º 13
0
        private void load(OsuConfigManager config, SkinManager skinManager, BeatmapManager beatmaps, Framework.Game game)
        {
            // prevent user from changing beatmap while the intro is still runnning.
            beatmap = Beatmap.BeginLease(false);

            MenuVoice = config.GetBindable <bool>(OsuSetting.MenuVoice);
            MenuMusic = config.GetBindable <bool>(OsuSetting.MenuMusic);

            seeya = audio.Samples.Get(@"seeya");

            BeatmapSetInfo setInfo = null;

            if (!MenuMusic.Value)
            {
                var sets = beatmaps.GetAllUsableBeatmapSets();
                if (sets.Count > 0)
                {
                    setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
                }
            }

            if (setInfo == null)
            {
                setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == BeatmapHash);

                if (setInfo == null)
                {
                    // we need to import the default menu background beatmap
                    setInfo = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream($"Tracks/{BeatmapFile}"), BeatmapFile)).Result;

                    setInfo.Protected = true;
                    beatmaps.Update(setInfo);
                }
            }

            introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
            Track        = introBeatmap.Track;
        }
Ejemplo n.º 14
0
        private void load(BeatmapDatabase beatmaps, AudioManager audio, DialogOverlay dialog, Framework.Game game,
                          OsuGame osu, OsuColour colours)
        {
            const float carousel_width = 640;
            const float filter_height  = 100;

            beatmapGroups = new List <BeatmapGroup>();
            Children      = new Drawable[]
            {
                new ParallaxContainer
                {
                    Padding = new MarginPadding {
                        Top = filter_height
                    },
                    ParallaxAmount   = 0.005f,
                    RelativeSizeAxes = Axes.Both,
                    Children         = new[]
                    {
                        new WedgeBackground
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding
                            {
                                Right = carousel_width * 0.76f
                            },
                        },
                    }
                },
                carousel = new CarouselContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    Size             = new Vector2(carousel_width, 1),
                    Anchor           = Anchor.CentreRight,
                    Origin           = Anchor.CentreRight,
                },
                filter = new FilterControl
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = filter_height,
                    FilterChanged    = () => filterChanged(),
                    Exit             = Exit,
                },
                beatmapInfoWedge = new BeatmapInfoWedge
                {
                    Alpha            = 0,
                    Size             = wedged_container_size,
                    RelativeSizeAxes = Axes.X,
                    Margin           = new MarginPadding
                    {
                        Top   = 20,
                        Right = 20,
                    },
                },
                beatmapOptions = new BeatmapOptionsOverlay
                {
                    OnRemoveFromUnplayed = null,
                    OnClearLocalScores   = null,
                    OnEdit   = null,
                    OnDelete = promptDelete,
                    Margin   = new MarginPadding
                    {
                        Bottom = 50,
                    },
                },
                modSelect = new ModSelectOverlay
                {
                    RelativeSizeAxes = Axes.X,
                    Origin           = Anchor.BottomCentre,
                    Anchor           = Anchor.BottomCentre,
                    Margin           = new MarginPadding
                    {
                        Bottom = 50,
                    },
                },
                footer = new Footer
                {
                    OnBack  = Exit,
                    OnStart = () =>
                    {
                        if (player != null || Beatmap == null)
                        {
                            return;
                        }

                        Beatmap.PreferredPlayMode = playMode.Value;

                        (player = new PlayerLoader(new Player
                        {
                            Beatmap = Beatmap, //eagerly set this so it's present before push.
                        })).LoadAsync(Game, l => Push(player));
                    }
                },
            };

            footer.AddButton(@"mods", colours.Yellow, modSelect.ToggleVisibility);
            footer.AddButton(@"random", colours.Green, carousel.SelectRandom);
            footer.AddButton(@"options", colours.Blue, beatmapOptions.ToggleVisibility);

            if (osu != null)
            {
                playMode.BindTo(osu.PlayMode);
            }
            playMode.ValueChanged += playMode_ValueChanged;

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

            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();

            Task.Factory.StartNew(() => addBeatmapSets(game, initialAddSetsTask.Token), initialAddSetsTask.Token);
        }
Ejemplo n.º 15
0
 private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
 {
     menuVoice = config.GetBindable <bool>(OsuSetting.MenuVoice);
     seeya     = audio.Samples.Get(@"seeya");
 }
Ejemplo n.º 16
0
 private void load(Framework.Game game)
 {
     Add(new Background(@"Backgrounds/bg1"));
 }
Ejemplo n.º 17
0
        private void load(BeatmapDatabase beatmaps, AudioManager audio, Framework.Game game,
                          OsuGame osuGame, OsuColour colours)
        {
            const float carousel_width = 640;
            const float filter_height  = 100;

            beatmapGroups = new List <BeatmapGroup>();
            Children      = new Drawable[]
            {
                new ParallaxContainer
                {
                    Padding = new MarginPadding {
                        Top = filter_height
                    },
                    ParallaxAmount   = 0.005f,
                    RelativeSizeAxes = Axes.Both,
                    Children         = new[]
                    {
                        new WedgeBackground
                        {
                            RelativeSizeAxes = Axes.Both,
                            Padding          = new MarginPadding
                            {
                                Right = carousel_width * 0.76f
                            },
                        },
                    }
                },
                carousel = new CarouselContainer
                {
                    RelativeSizeAxes = Axes.Y,
                    Size             = new Vector2(carousel_width, 1),
                    Anchor           = Anchor.CentreRight,
                    Origin           = Anchor.CentreRight,
                },
                filter = new FilterControl
                {
                    RelativeSizeAxes = Axes.X,
                    Height           = filter_height,
                    FilterChanged    = filterChanged,
                    Exit             = Exit,
                },
                beatmapInfoWedge = new BeatmapInfoWedge
                {
                    Alpha            = 0,
                    Size             = wedged_container_size,
                    RelativeSizeAxes = Axes.X,
                    Margin           = new MarginPadding
                    {
                        Top   = 20,
                        Right = 20,
                    },
                },
                footer = new Footer
                {
                    OnBack  = Exit,
                    OnStart = () =>
                    {
                        if (player != null || Beatmap == null)
                        {
                            return;
                        }

                        (player = new PlayerLoader(new Player
                        {
                            BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap,
                            PreferredPlayMode = playMode.Value
                        })).LoadAsync(Game, l => Push(player));
                    }
                }
            };

            footer.AddButton(@"mods", colours.Yellow, null);
            footer.AddButton(@"random", colours.Green, carousel.SelectRandom);
            footer.AddButton(@"options", colours.Blue, null);

            if (osuGame != null)
            {
                playMode = osuGame.PlayMode;
                playMode.ValueChanged += playMode_ValueChanged;
            }

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

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

            trackManager = audio.Track;

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

            initialAddSetsTask = new CancellationTokenSource();

            Task.Factory.StartNew(() => addBeatmapSets(game, initialAddSetsTask.Token), initialAddSetsTask.Token);
        }
Ejemplo n.º 18
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);
        }
Ejemplo n.º 19
0
        private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
        {
            menuVoice = config.GetBindable <bool>(OsuSetting.MenuVoice);
            menuMusic = config.GetBindable <bool>(OsuSetting.MenuMusic);

            BeatmapSetInfo setInfo = null;

            if (!menuMusic)
            {
                var sets = beatmaps.GetAllUsableBeatmapSets();
                if (sets.Count > 0)
                {
                    setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
                }
            }

            if (setInfo == null)
            {
                setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == menu_music_beatmap_hash);

                if (setInfo == null)
                {
                    // we need to import the default menu background beatmap
                    setInfo           = beatmaps.Import(new OszArchiveReader(game.Resources.GetStream(@"Tracks/circles.osz")));
                    setInfo.Protected = true;
                }
            }

            Beatmap.Value = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);

            track = Beatmap.Value.Track;

            welcome = audio.Sample.Get(@"welcome");
            seeya   = audio.Sample.Get(@"seeya");

            if (setInfo.Protected)
            {
                beatmaps.Delete(setInfo);
            }
        }
Ejemplo n.º 20
0
 protected override void PerformLoad(Framework.Game game)
 {
     this.game = game;
     base.PerformLoad(game);
 }