private void load(AudioManager audio) { Beatmap.Value = new WaveformTestBeatmap(audio); var playable = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset); var editorBeatmap = new EditorBeatmap(playable); Dependencies.Cache(editorBeatmap); Dependencies.CacheAs <IBeatSnapProvider>(editorBeatmap); AddRange(new Drawable[] { editorBeatmap, new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 5), Children = new Drawable[] { new StartStopButton(), new AudioVisualiser(), } }, TimelineArea = new TimelineArea { Child = CreateTestComponent(), Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, Size = new Vector2(0.8f, 100), } }); }
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.Filter.Sort = FilterControl.SortMode.Artist; }); AddButton(@"Sort by Title", delegate { songSelect.Filter.Sort = FilterControl.SortMode.Title; }); AddButton(@"Sort by Author", delegate { songSelect.Filter.Sort = FilterControl.SortMode.Author; }); AddButton(@"Sort by Difficulty", delegate { songSelect.Filter.Sort = FilterControl.SortMode.Difficulty; }); }
private void load(AudioManager audio) { Beatmap.Value = new WaveformTestBeatmap(audio); var playable = Beatmap.Value.GetPlayableBeatmap(Beatmap.Value.BeatmapInfo.Ruleset); EditorBeatmap = new EditorBeatmap(playable); Dependencies.Cache(EditorBeatmap); Dependencies.CacheAs <IBeatSnapProvider>(EditorBeatmap); Composer = playable.BeatmapInfo.Ruleset.CreateInstance().CreateHitObjectComposer().With(d => d.Alpha = 0); AddRange(new Drawable[] { EditorBeatmap, Composer, new FillFlowContainer { AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Spacing = new Vector2(0, 5), Children = new Drawable[] { new StartStopButton(), new AudioVisualiser(), } }, TimelineArea = new TimelineArea(CreateTestComponent()) { Anchor = Anchor.Centre, Origin = Anchor.Centre, } }); }
internal WindowsGameHost(string gameName, bool bindIPC = false) : base(gameName, bindIPC) { // OnActivate / OnDeactivate may not fire, so the initial activity state may be unknown here. // In order to be certain we have the correct activity state we are querying the Windows API here. timePeriod = new TimePeriod(1) { Active = true }; Window = new WindowsGameWindow(); Window.WindowStateChanged += (sender, e) => { if (Window.WindowState != OpenTK.WindowState.Minimized) { OnActivated(); } else { OnDeactivated(); } }; Dependencies.Cache(Storage = new WindowsStorage(gameName)); }
private void load(GameHost host) { Dependencies.Cache(rulesets = new RulesetStore(ContextFactory)); Dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, Audio, host, Beatmap.Default)); beatmapManager.Import(TestResources.GetTestBeatmapForImport()).Wait(); }
private void load() { TestSongSelect songSelect = null; var storage = new TestStorage(@"TestCasePlaySongSelect"); // this is by no means clean. should be replacing inside of OsuGameBase somehow. IDatabaseContextFactory factory = new SingletonContextFactory(new OsuDbContext()); Dependencies.Cache(rulesets = new RulesetStore(factory)); Dependencies.Cache(manager = new BeatmapManager(storage, factory, rulesets, null, null) { DefaultBeatmap = defaultBeatmap = Beatmap.Default }); void loadNewSongSelect(bool deleteMaps = false) => AddStep("reload song select", () => { if (deleteMaps) { manager.Delete(manager.GetAllUsableBeatmapSets()); Beatmap.SetDefault(); } if (songSelect != null) { Remove(songSelect); songSelect.Dispose(); } Add(songSelect = new TestSongSelect()); }); loadNewSongSelect(true); AddWaitStep(3); AddAssert("dummy selected", () => songSelect.CurrentBeatmap == defaultBeatmap); AddAssert("dummy shown on wedge", () => songSelect.CurrentBeatmapDetailsBeatmap == defaultBeatmap); AddStep("import test maps", () => { for (int i = 0; i < 100; i += 10) { manager.Import(createTestBeatmapSet(i)); } }); AddWaitStep(3); AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); loadNewSongSelect(); AddWaitStep(3); AddAssert("random map selected", () => songSelect.CurrentBeatmap != defaultBeatmap); 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; }); }
private void load(RulesetStore rulesets) { OsuConfigManager manager; Dependencies.Cache(manager = new OsuConfigManager(LocalStorage)); manager.GetBindable <double>(OsuSetting.DimLevel).Value = 1.0; }
private void load(FrameworkConfigManager config) { Resources = new ResourceStore <byte[]>(); Resources.AddStore(new NamespacedResourceStore <byte[]>(new DllResourceStore(@"osu.Framework.dll"), @"Resources")); Resources.AddStore(new DllResourceStore(MainResourceFile)); Textures = new TextureStore(new RawTextureLoaderStore(new NamespacedResourceStore <byte[]>(Resources, @"Textures"))); Textures.AddStore(new RawTextureLoaderStore(new OnlineStore())); Dependencies.Cache(Textures); Audio = Dependencies.Cache(new AudioManager( new NamespacedResourceStore <byte[]>(Resources, @"Tracks"), new NamespacedResourceStore <byte[]>(Resources, @"Samples")) { EventScheduler = Scheduler }); Host.RegisterThread(Audio.Thread); //attach our bindables to the audio subsystem. config.BindWith(FrameworkSetting.AudioDevice, Audio.AudioDevice); config.BindWith(FrameworkSetting.VolumeUniversal, Audio.Volume); config.BindWith(FrameworkSetting.VolumeEffect, Audio.VolumeSample); config.BindWith(FrameworkSetting.VolumeMusic, Audio.VolumeTrack); Shaders = new ShaderManager(new NamespacedResourceStore <byte[]>(Resources, @"Shaders")); Dependencies.Cache(Shaders); Fonts = new FontStore(new GlyphStore(Resources, @"Fonts/OpenSans")) { ScaleAdjust = 100 }; Dependencies.Cache(Fonts); }
private void load(GameHost host, AudioManager audio) { Dependencies.Cache(rulesets = new RulesetStore(ContextFactory)); Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, Beatmap.Default)); var beatmaps = new List <BeatmapInfo>(); for (int i = 0; i < 6; i++) { int beatmapId = 10 * 10 + i; int length = RNG.Next(30000, 200000); double bpm = RNG.NextSingle(80, 200); beatmaps.Add(new BeatmapInfo { Ruleset = new OsuRuleset().RulesetInfo, OnlineBeatmapID = beatmapId, Path = "normal.osu", Version = $"{beatmapId} (length {TimeSpan.FromMilliseconds(length):m\\:ss}, bpm {bpm:0.#})", Length = length, BPM = bpm, BaseDifficulty = new BeatmapDifficulty { OverallDifficulty = 3.5f, }, });
private void load(RulesetStore rulesets) { foreach (var r in rulesets.AvailableRulesets) { Player p = null; AddStep(r.Name, () => p = loadPlayerFor(r)); AddUntilStep("player loaded", () => { if (p?.IsLoaded == true) { p = null; return(true); } return(false); }); AddCheckSteps(); } OsuConfigManager manager; Dependencies.Cache(manager = new OsuConfigManager(LocalStorage)); manager.GetBindable <double>(OsuSetting.DimLevel).Value = 1.0; }
private void Init(IRootMain rootMain) { Dependencies.Cache(this); infoContainer = CreateChild <InfoContainer>("info", 0); { infoContainer.Anchor = AnchorType.BottomStretch; infoContainer.Pivot = PivotType.Top; infoContainer.RawWidth = 0f; infoContainer.Height = Mathf.Min(infoContainer.FullDetailHeight, rootMain.Resolution.y - InfoDetailedYDiff); infoContainer.Y = InfoBriefY; } versionContainer = CreateChild <VersionContainer>("version", 1); { versionContainer.Anchor = AnchorType.TopStretch; versionContainer.Pivot = PivotType.Top; versionContainer.RawWidth = 0; versionContainer.Y = 0f; versionContainer.Height = 160f; } infoDetailAni = new Anime(); infoDetailAni.AnimateFloat(y => infoContainer.Y = y) .AddTime(0f, () => infoContainer.Y) .AddTime(0.25f, infoContainer.Height) .Build(); infoBriefAni = new Anime(); infoBriefAni.AnimateFloat(y => infoContainer.Y = y) .AddTime(0f, () => infoContainer.Y) .AddTime(0.25f, InfoBriefY) .Build(); OnEnableInited(); }
private void load(GameHost host, AudioManager audio) { Dependencies.Cache(rulesets = new RulesetStore(ContextFactory)); Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, Beatmap.Default)); manager.Import(new TestBeatmap(new OsuRuleset().RulesetInfo).BeatmapInfo.BeatmapSet).Wait(); }
protected override void Dispose(bool isDisposing) { if (oldDb != null) { Dependencies.Cache(oldDb, true); } base.Dispose(isDisposing); }
public AppController(string[] args, GameHost host) { Host = Dependencies.Cache(host); DB = Dependencies.Cache(new DatabaseController(host, Dependencies)); Dependencies.Cache(this); Dependencies.Initialize(this); }
private void load(GameHost host, AudioManager audio) { Dependencies.Cache(rulesets = new RulesetStore(ContextFactory)); Dependencies.Cache(beatmaps = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, Beatmap.Default)); beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).Wait(); importedSet = beatmaps.GetAllUsableBeatmapSetsEnumerable(IncludedDetails.All).First(); }
private void load(GameHost host, AudioManager audio) { Dependencies.Cache(rulesets = new RealmRulesetStore(Realm)); Dependencies.Cache(beatmaps = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default)); Dependencies.Cache(Realm); beatmaps.Import(TestResources.GetQuickTestBeatmapForImport()).WaitSafely(); }
private void load() { Dependencies.Cache(BeatDivisor); Dependencies.CacheAs <IFrameBasedClock>(Clock); Dependencies.CacheAs <IAdjustableClock>(Clock); Beatmap.BindValueChanged(beatmapChanged, true); }
private void load(GameHost host, AudioManager audio) { Dependencies.Cache(rulesets = new RealmRulesetStore(Realm)); Dependencies.Cache(manager = new BeatmapManager(LocalStorage, Realm, rulesets, null, audio, Resources, host, Beatmap.Default)); Dependencies.Cache(Realm); importedBeatmapSet = manager.Import(TestResources.CreateTestBeatmapSetInfo(8, rulesets.AvailableRulesets.ToArray())); }
private void Init(IGameSession gameSession) { Dependencies.Cache(this); gameSession.OnHardDispose += () => { UnbindInputter(); }; }
private void load(GameHost host, AudioManager audio) { Dependencies.Cache(rulesets = new RulesetStore(ContextFactory)); Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, Resources, host, Beatmap.Default)); var beatmapSet = TestResources.CreateTestBeatmapSetInfo(); manager.Import(beatmapSet).Wait(); }
private void load() { Add(dialogOverlay = new DialogOverlay { Depth = -1 }); Dependencies.Cache(dialogOverlay); }
private void load(RulesetConfigCache configCache) { // Cache ruleset config manager and session because karaoke input manager need it. var config = (KaraokeRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance()); var session = new KaraokeSessionStatics(config, null); Dependencies.Cache(config); Dependencies.Cache(session); }
private void load(GameHost host, AudioManager audio) { Dependencies.Cache(rulesets = new RulesetStore(ContextFactory)); Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, defaultBeatmap = Beatmap.Default)); Beatmap.SetDefault(); Dependencies.Cache(config = new OsuConfigManager(LocalStorage)); }
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); }
private void load() { base.Content.AddRange(new Drawable[] { Content, dialogOverlay = new DialogOverlay() }); Dependencies.Cache(dialogOverlay); }
private void load(GameHost host, AudioManager audio) { Dependencies.Cache(rulesets = new RulesetStore(ContextFactory)); Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, host, Beatmap.Default)); Dependencies.Cache(new OsuConfigManager(LocalStorage)); manager.Import(TestResources.GetQuickTestBeatmapForImport()).Wait(); Beatmap.SetDefault(); }
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); dependencies.Cache(rulesetStore = new RealmRulesetStore(Realm)); dependencies.Cache(beatmapManager = new BeatmapManager(LocalStorage, Realm, rulesetStore, null, dependencies.Get <AudioManager>(), Resources, dependencies.Get <GameHost>(), Beatmap.Default)); dependencies.Cache(scoreManager = new ScoreManager(dependencies.Get <RulesetStore>(), () => beatmapManager, LocalStorage, Realm, Scheduler)); Dependencies.Cache(Realm); return(dependencies); }
private void load(RulesetConfigCache configCache) { var config = (KaraokeRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance()); Dependencies.Cache(new KaraokeSessionStatics(config, null)); SetContents(() => new KaraokeInputManager(new KaraokeRuleset().RulesetInfo) { Child = new NotePlayfield(COLUMN_NUMBER) }); }
public HeadlessGameHost(string gameName = @"", bool bindIPC = false, bool realtime = true) : base(gameName, bindIPC) { if (!realtime) { customClock = new FramedClock(new FastClock(1000.0 / 30)); } UpdateThread.Scheduler.Update(); Dependencies.Cache(Storage = new DesktopStorage(string.Empty)); }
private void load(GameHost host, AudioManager audio) { Dependencies.Cache(rulesets = new RulesetStore(ContextFactory)); Dependencies.Cache(manager = new BeatmapManager(LocalStorage, ContextFactory, rulesets, null, audio, Resources, host, defaultBeatmap = Beatmap.Default)); Dependencies.Cache(music = new MusicController()); // required to get bindables attached Add(music); Dependencies.Cache(config = new OsuConfigManager(LocalStorage)); }