protected override void Load(BaseGame game) { base.Load(game); OszArchiveReader.Register(); Beatmaps = new BeatmapDatabase(Host.Storage, Host); //this completely overrides the framework default. will need to change once we make a proper FontStore. Fonts = new TextureStore() { ScaleAdjust = 0.01f }; Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/osuFont")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-RegularItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBold")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBoldItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Bold")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BoldItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Light")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-LightItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Medium")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-MediumItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Black")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic")); API = new APIAccess() { Username = Config.Get <string>(OsuConfig.Username), Password = Config.Get <string>(OsuConfig.Password), Token = Config.Get <string>(OsuConfig.Token) }; }
public BeatmapImporter(GameHost host, BeatmapDatabase beatmaps = null) { this.beatmaps = beatmaps; channel = new IpcChannel <BeatmapImportMessage>(host); channel.MessageReceived += messageReceived; }
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; }
protected void LoadScore(Score s) { scoreLoad?.Cancel(); var menu = intro.ChildScreen; if (menu == null) { scoreLoad = Schedule(() => LoadScore(s)); return; } if (!menu.IsCurrentScreen) { menu.MakeCurrent(); Delay(500); scoreLoad = Schedule(() => LoadScore(s)); return; } if (s.Beatmap == null) { notificationManager.Post(new SimpleNotification { Text = @"Tried to load a score for a beatmap we don't have!", Icon = FontAwesome.fa_life_saver, }); return; } Beatmap.Value = BeatmapDatabase.GetWorkingBeatmap(s.Beatmap); menu.Push(new PlayerLoader(new ReplayPlayer(s.Replay))); }
protected override void Load(BaseGame game) { base.Load(game); OsuGame osuGame = game as OsuGame; if (osuGame != null) { playMode = osuGame.PlayMode; playMode.ValueChanged += playMode_ValueChanged; // Temporary: scrollContainer.Padding = new MarginPadding { Top = ToolbarPadding }; } if (database == null) { database = (game as OsuGameBase).Beatmaps; } database.BeatmapSetAdded += s => Schedule(() => addBeatmapSet(s)); trackManager = game.Audio.Track; Task.Factory.StartNew(addBeatmapSets); }
public BeatmapImporter(BasicGameHost host, BeatmapDatabase beatmaps = null) { this.beatmaps = beatmaps; channel = new IpcChannel<BeatmapImportMessage>(host); channel.MessageReceived += messageReceived; }
public BeatmapGroup(BeatmapSetInfo beatmapSet, BeatmapDatabase database) { BeatmapSet = beatmapSet; WorkingBeatmap beatmap = database.GetWorkingBeatmap(BeatmapSet.Beatmaps.FirstOrDefault()); foreach (var b in BeatmapSet.Beatmaps) { b.StarDifficulty = (float)(database.GetWorkingBeatmap(b).Beatmap?.CalculateStarDifficulty() ?? -1f); } Header = new BeatmapSetHeader(beatmap) { GainedSelection = headerGainedSelection, RelativeSizeAxes = Axes.X, }; BeatmapSet.Beatmaps = BeatmapSet.Beatmaps.OrderBy(b => b.StarDifficulty).ToList(); BeatmapPanels = BeatmapSet.Beatmaps.Select(b => new BeatmapPanel(b) { Alpha = 0, GainedSelection = panelGainedSelection, StartRequested = p => { StartRequested?.Invoke(p.Beatmap); }, RelativeSizeAxes = Axes.X, }).ToList(); Header.AddDifficultyIcons(BeatmapPanels); }
public void TestLargeDatabase() { Stopwatch timer = new Stopwatch(); using (BeatmapDatabase database = new BeatmapDatabase("large_database")) { string testPath = Environment.CurrentDirectory; // Note: replace this with your own large KShoot folder for this test to be useful timer.Start(); database.AddSearchPath(testPath); database.StartSearching(); while (database.IsSearchRunning) { Thread.Sleep(10); database.Update(); } // Make sure all tasks completed Thread.Sleep(10); database.Update(); timer.Stop(); Debug.WriteLine($"Finished scanning in {timer.Elapsed}, found {database.Sets.Count} maps and {database.Difficulties.Count} difficulties"); } }
public override void Reset() { base.Reset(); oldDb = Dependencies.Get <BeatmapDatabase>(); if (db == null) { storage = new TestStorage(@"TestCasePlaySongSelect"); db = new BeatmapDatabase(storage); Dependencies.Cache(db, true); var sets = new List <BeatmapSetInfo>(); for (int i = 0; i < 100; i += 10) { sets.Add(createTestBeatmapSet(i)); } db.Import(sets); } Add(songSelect = new PlaySongSelect()); AddButton(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; }); AddButton(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; }); AddButton(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; }); AddButton(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; }); }
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); }
public override void Reset() { base.Reset(); if (db == null) { storage = new TestStorage(@"TestCasePlaySongSelect"); var backingDatabase = storage.GetDatabase(@"client"); rulesets = new RulesetDatabase(storage, backingDatabase); db = new BeatmapDatabase(storage, backingDatabase, rulesets); var sets = new List <BeatmapSetInfo>(); for (int i = 0; i < 100; i += 10) { sets.Add(createTestBeatmapSet(i)); } db.Import(sets); } Add(songSelect = new PlaySongSelect()); AddStep(@"Sort by Artist", delegate { songSelect.FilterControl.Sort = SortMode.Artist; }); AddStep(@"Sort by Title", delegate { songSelect.FilterControl.Sort = SortMode.Title; }); AddStep(@"Sort by Author", delegate { songSelect.FilterControl.Sort = SortMode.Author; }); AddStep(@"Sort by Difficulty", delegate { songSelect.FilterControl.Sort = SortMode.Difficulty; }); }
public WorkingBeatmap(BeatmapInfo beatmapInfo, BeatmapSetInfo beatmapSetInfo, BeatmapDatabase database, bool withStoryboard = false) { BeatmapInfo = beatmapInfo; BeatmapSetInfo = beatmapSetInfo; this.database = database; this.WithStoryboard = withStoryboard; }
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); } }; }
private void load(BeatmapDatabase db) { var beatmapInfo = db.Query <BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault(); if (beatmapInfo != null) { beatmap = db.GetWorkingBeatmap(beatmapInfo); } }
protected override void Dispose(bool isDisposing) { if (oldDb != null) { db = null; } base.Dispose(isDisposing); }
private void load() { Dependencies.Cache(this); Dependencies.Cache(LocalConfig); SQLiteConnection connection = Host.Storage.GetDatabase(@"client"); Dependencies.Cache(RulesetDatabase = new RulesetDatabase(Host.Storage, connection)); Dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, connection, RulesetDatabase, Host)); Dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, connection, Host, BeatmapDatabase)); Dependencies.Cache(new OsuColour()); //this completely overrides the framework default. will need to change once we make a proper FontStore. Dependencies.Cache(Fonts = new FontStore { ScaleAdjust = 100 }, true); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/osuFont")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Medium")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-MediumItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-Basic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-Hangul")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-CJK-Basic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto-CJK-Compatibility")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-RegularItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBold")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBoldItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Bold")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BoldItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Light")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-LightItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Black")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera-Light")); var defaultBeatmap = new DummyWorkingBeatmap(this); Beatmap = new NonNullableBindable <WorkingBeatmap>(defaultBeatmap); BeatmapDatabase.DefaultBeatmap = defaultBeatmap; OszArchiveReader.Register(); Dependencies.Cache(API = new APIAccess { Username = LocalConfig.Get <string>(OsuSetting.Username), Token = LocalConfig.Get <string>(OsuSetting.Token) }); API.Register(this); }
protected override void Dispose(bool isDisposing) { if (oldDb != null) { Dependencies.Cache(oldDb, true); db = null; } base.Dispose(isDisposing); }
public BeatmapIPCChannel(IIpcHost host, BeatmapDatabase beatmaps = null) : base(host) { this.beatmaps = beatmaps; MessageReceived += (msg) => { Debug.Assert(beatmaps != null); ImportAsync(msg.Path); }; }
public DatabaseController(GameHost host, DependencyContainer dependencies) { Dependencies = dependencies; Connection = host.Storage.GetDatabase(@"client"); Dependencies.Cache(debugConfig = new FrameworkDebugConfigManager()); Dependencies.Cache(config = new FrameworkConfigManager(host.Storage)); Dependencies.Cache(Localisation = new LocalisationEngine(config)); Dependencies.Cache(RulesetDatabase = new RulesetDatabase(host.Storage, Connection)); Dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(host.Storage, Connection, RulesetDatabase, host)); Dependencies.Cache(ScoreDatabase = new ScoreDatabase(host.Storage, Connection, host, BeatmapDatabase)); }
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); }
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; }
public void play(BeatmapInfo Beatmap, BeatmapDatabase Database) { using (var reader = Database.GetReader(Beatmap.BeatmapSet)) using (var file = reader.GetStream(Beatmap.Metadata?.AudioFile ?? Beatmap.BeatmapSet.Metadata.AudioFile)) { MemoryStream ms = new MemoryStream(); file.CopyTo(ms); System.Diagnostics.Debug.Print("Loaded file of size {0}", ms.Length); Track track = new TrackBass(ms); Audio.Track.SetExclusive(track); track.Start(); } }
public BeatmapIPCChannel(IIpcHost host, BeatmapDatabase beatmaps = null) : base(host) { this.beatmaps = beatmaps; MessageReceived += msg => { Debug.Assert(beatmaps != null); ImportAsync(msg.Path).ContinueWith(t => { if (t.Exception != null) { throw t.Exception; } }, TaskContinuationOptions.OnlyOnFaulted); }; }
private void load(AudioManager audio, OsuConfigManager config, BeatmapDatabase beatmaps, Framework.Game game) { menuVoice = config.GetBindable <bool>(OsuSetting.MenuVoice); menuMusic = config.GetBindable <bool>(OsuSetting.MenuMusic); var trackManager = audio.Track; 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 = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]); track = Beatmap.Track; trackManager.SetExclusive(track); welcome = audio.Sample.Get(@"welcome"); seeya = audio.Sample.Get(@"seeya"); }
private void load() { if (!Host.IsPrimaryInstance) { Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error); Environment.Exit(0); } if (args?.Length > 0) { var paths = args.Where(a => !a.StartsWith(@"-")); Task.Run(() => BeatmapDatabase.Import(paths)); } Dependencies.Cache(this); PlayMode = LocalConfig.GetBindable <PlayMode>(OsuConfig.PlayMode); }
public override void Reset() { base.Reset(); oldDb = Dependencies.Get<BeatmapDatabase>(); if (db == null) { storage = new TestStorage(@"TestCasePlaySongSelect"); db = new BeatmapDatabase(storage); Dependencies.Cache(db, true); var sets = new List<BeatmapSetInfo>(); for (int i = 0; i < 100; i += 10) sets.Add(createTestBeatmapSet(i)); db.Import(sets); } Add(new PlaySongSelect()); }
private void load() { Dependencies.Cache(this); Dependencies.Cache(LocalConfig); Dependencies.Cache(BeatmapDatabase = new BeatmapDatabase(Host.Storage, Host)); Dependencies.Cache(ScoreDatabase = new ScoreDatabase(Host.Storage, Host, BeatmapDatabase)); Dependencies.Cache(new OsuColour()); //this completely overrides the framework default. will need to change once we make a proper FontStore. Dependencies.Cache(Fonts = new FontStore { ScaleAdjust = 100 }, true); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/FontAwesome")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/osuFont")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Medium")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-MediumItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Noto")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-RegularItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBold")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-SemiBoldItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Bold")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BoldItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Light")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-LightItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Black")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-BlackItalic")); Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Venera")); OszArchiveReader.Register(); Dependencies.Cache(API = new APIAccess { Username = LocalConfig.Get <string>(OsuConfig.Username), Token = LocalConfig.Get <string>(OsuConfig.Token) }); API.Register(this); }
private void dragDrop(DragEventArgs e) { // this method will only be executed if e.Effect in dragEnter gets set to something other that None. var dropData = (object[])e.Data.GetData(DataFormats.FileDrop); var filePaths = dropData.Select(f => f.ToString()).ToArray(); if (filePaths.All(f => Path.GetExtension(f) == @".osz")) { Task.Run(() => BeatmapDatabase.Import(filePaths)); } else if (filePaths.All(f => Path.GetExtension(f) == @".osr")) { Task.Run(() => { var score = ScoreDatabase.ReadReplayFile(filePaths.First()); Schedule(() => LoadScore(score)); }); } }
private void recursiveBeatmaps(string subdir) { if (subdir.Contains("Abandoned")) { return; } foreach (string ss in Directory.GetDirectories(subdir)) { recursiveBeatmaps(ss); } foreach (string s in Directory.GetFiles(subdir, "*.osz2")) { Beatmap b = new Beatmap(s); BeatmapDatabase.PopulateBeatmap(b); maps.AddInPlace(b); } }
private void load(OsuGame game, OsuConfigManager config, BeatmapDatabase beatmaps) { menuMusic = config.GetBindable <bool>(OsuConfig.MenuMusic); LoadComponentAsync(background); if (!menuMusic) { trackManager = game.Audio.Track; int choosableBeatmapsetAmmount = beatmaps.Query <BeatmapSetInfo>().Count(); if (choosableBeatmapsetAmmount > 0) { song = beatmaps.GetWorkingBeatmap(beatmaps.GetWithChildren <BeatmapSetInfo>(RNG.Next(1, choosableBeatmapsetAmmount)).Beatmaps[0]); Beatmap = song; } } buttons.OnSettings = game.ToggleOptions; preloadSongSelect(); }
private void load() { if (!Host.IsPrimaryInstance) { Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error); Environment.Exit(0); } if (args?.Length > 0) { var paths = args.Where(a => !a.StartsWith(@"-")); Task.Run(() => BeatmapDatabase.Import(paths.ToArray())); } Dependencies.Cache(this); configRuleset = LocalConfig.GetBindable <int>(OsuSetting.Ruleset); Ruleset.Value = RulesetDatabase.GetRuleset(configRuleset.Value); Ruleset.ValueChanged += r => configRuleset.Value = r.ID ?? 0; }
private void load(BeatmapDatabase beatmaps, AudioManager audio, BaseGame game, OsuGame osuGame, OsuColour colours) { const float carouselWidth = 640; const float bottomToolHeight = 50; Children = new Drawable[] { new ParallaxContainer { ParallaxAmount = 0.005f, RelativeSizeAxes = Axes.Both, Children = new [] { new WedgeBackground { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Right = carouselWidth * 0.76f }, }, } }, carousel = new CarouselContainer { RelativeSizeAxes = Axes.Y, Size = new Vector2(carouselWidth, 1), Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, }, beatmapInfoWedge = new BeatmapInfoWedge { Alpha = 0, Position = wedged_container_start_position, Size = wedged_container_size, RelativeSizeAxes = Axes.X, Margin = new MarginPadding { Top = 20, Right = 20, }, }, new Container { RelativeSizeAxes = Axes.X, Height = bottomToolHeight, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Children = new Drawable[] { new Box { RelativeSizeAxes = Axes.Both, Size = Vector2.One, Colour = Color4.Black.Opacity(0.5f), }, new BackButton { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, //RelativeSizeAxes = Axes.Y, Action = () => Exit() }, new Button { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.Y, Width = 100, Text = "Play", Colour = colours.Pink, Action = start }, } } }; if (osuGame != null) { playMode = osuGame.PlayMode; playMode.ValueChanged += playMode_ValueChanged; } if (database == null) database = beatmaps; database.BeatmapSetAdded += onDatabaseOnBeatmapSetAdded; 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); }
private void load(AudioManager audio, BeatmapDatabase beatmaps, OsuGameBase game) { dimLevel = game.Config.GetBindable<int>(OsuConfig.DimLevel); try { if (Beatmap == null) Beatmap = beatmaps.GetWorkingBeatmap(BeatmapInfo); } catch { //couldn't load, hard abort! Exit(); return; } AudioTrack track = Beatmap.Track; if (track != null) { audio.Track.SetExclusive(track); sourceClock = track; } sourceClock = (IAdjustableClock)track ?? new StopwatchClock(); Schedule(() => { sourceClock.Reset(); }); var beatmap = Beatmap.Beatmap; if (beatmap.BeatmapInfo?.Mode > PlayMode.Osu) { //we only support osu! mode for now because the hitobject parsing is crappy and needs a refactor. Exit(); return; } PlayMode usablePlayMode = beatmap.BeatmapInfo?.Mode > PlayMode.Osu ? beatmap.BeatmapInfo.Mode : PreferredPlayMode; ruleset = Ruleset.GetRuleset(usablePlayMode); var scoreOverlay = ruleset.CreateScoreOverlay(); scoreOverlay.BindProcessor(scoreProcessor = ruleset.CreateScoreProcessor()); hitRenderer = ruleset.CreateHitRendererWith(beatmap.HitObjects); hitRenderer.OnJudgement += scoreProcessor.AddJudgement; hitRenderer.OnAllJudged += hitRenderer_OnAllJudged; if (Autoplay) hitRenderer.Schedule(() => hitRenderer.DrawableObjects.ForEach(h => h.State = ArmedState.Hit)); Children = new Drawable[] { new PlayerInputManager(game.Host) { Clock = new InterpolatingFramedClock(sourceClock), PassThrough = false, Children = new Drawable[] { hitRenderer, } }, scoreOverlay, }; }
public WorkingBeatmap(BeatmapInfo beatmapInfo, BeatmapSetInfo beatmapSetInfo, BeatmapDatabase database) { this.BeatmapInfo = beatmapInfo; this.BeatmapSetInfo = beatmapSetInfo; this.database = database; }
private void load(BeatmapDatabase db) { beatmap = db.GetWorkingBeatmap(db.Query<BeatmapInfo>().Where(b => b.Mode == PlayMode.Osu).FirstOrDefault()); }
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); }