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); }
protected SongSelect() { const float carousel_width = 640; const float filter_height = 100; beatmapGroups = new List <BeatmapGroup>(); Add(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 }, } } }); Add(carousel = new CarouselContainer { RelativeSizeAxes = Axes.Y, Size = new Vector2(carousel_width, 1), Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, }); Add(filter = new FilterControl { RelativeSizeAxes = Axes.X, Height = filter_height, FilterChanged = () => filterChanged(), Exit = Exit, }); Add(beatmapInfoWedge = new BeatmapInfoWedge { Alpha = 0, Size = wedged_container_size, RelativeSizeAxes = Axes.X, Margin = new MarginPadding { Top = 20, Right = 20, }, X = -50, }); if (ShowFooter) { Add(BeatmapOptions = new BeatmapOptionsOverlay { Margin = new MarginPadding { Bottom = 50, }, }); Add(Footer = new Footer { OnBack = Exit, OnStart = raiseSelect, }); } }
public PlaySongSelect() { 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 = new Color4(0, 0, 0, 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 = new Color4(238, 51, 153, 255), Action = () => Push(new Player { BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap, PreferredPlayMode = playMode.Value }) }, } } }; }
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); }
/// <param name="database">Optionally provide a database to use instead of the OsuGame one.</param> public PlaySongSelect(BeatmapDatabase database = null) { this.database = database; 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, }, wedgedBeatmapInfoOverlay = new BeatmapInfoOverlay { Alpha = 0, Position = wedged_container_start_position, Size = wedged_container_size, RelativeSizeAxes = Axes.X, Shear = wedged_container_shear, Margin = new MarginPadding { Top = 20, Right = 20, }, Masking = true, BorderColour = new Color4(221, 255, 255, 255), BorderThickness = 2.5f, EdgeEffect = new EdgeEffect { Type = EdgeEffectType.Glow, Colour = new Color4(130, 204, 255, 150), Radius = 20, Roundness = 15, }, }, 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 = new Color4(0, 0, 0, 0.5f), }, new Button { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, RelativeSizeAxes = Axes.Y, Width = 100, Text = "Play", Colour = new Color4(238, 51, 153, 255), Action = () => Push(new Player { BeatmapInfo = carousel.SelectedGroup.SelectedPanel.Beatmap, PreferredPlayMode = playMode.Value }) }, } } }; }