public void UpdateBeatmap(WorkingBeatmap beatmap) { if (beatmap == null) { return; } var lastContainer = beatmapInfoContainer; float newDepth = lastContainer?.Depth + 1 ?? 0; BeatmapSetInfo beatmapSetInfo = beatmap.BeatmapSetInfo; BeatmapInfo beatmapInfo = beatmap.BeatmapInfo; (beatmapInfoContainer = new BufferedContainer { Depth = newDepth, PixelSnapping = true, CacheDrawnFrameBuffer = true, Shear = -Shear, RelativeSizeAxes = Axes.Both, Children = new Drawable[] { // We will create the white-to-black gradient by modulating transparency and having // a black backdrop. This results in an sRGB-space gradient and not linear space, // transitioning from white to black more perceptually uniformly. new Box { RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, // We use a container, such that we can set the colour gradient to go across the // vertices of the masked container instead of the vertices of the (larger) sprite. new Container { RelativeSizeAxes = Axes.Both, ColourInfo = ColourInfo.GradientVertical(Color4.White, new Color4(1f, 1f, 1f, 0.3f)), Children = new [] { // Zoomed-in and cropped beatmap background new BeatmapBackgroundSprite(beatmap) { Anchor = Anchor.Centre, Origin = Anchor.Centre, FillMode = FillMode.Fill, }, }, }, // Text for beatmap info new FlowContainer { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Direction = FlowDirection.VerticalOnly, Margin = new MarginPadding { Top = 10, Left = 25, Right = 10, Bottom = 40 }, AutoSizeAxes = Axes.Both, Children = new[] { new SpriteText { Font = @"Exo2.0-MediumItalic", Text = beatmapSetInfo.Metadata.Artist + " -- " + beatmapSetInfo.Metadata.Title, TextSize = 28, Shadow = true, }, new SpriteText { Font = @"Exo2.0-MediumItalic", Text = beatmapInfo.Version, TextSize = 17, Shadow = true, }, new FlowContainer { Margin = new MarginPadding { Top = 10 }, Direction = FlowDirection.HorizontalOnly, AutoSizeAxes = Axes.Both, Children = new [] { new SpriteText { Font = @"Exo2.0-Medium", Text = "mapped by ", TextSize = 15, Shadow = true, }, new SpriteText { Font = @"Exo2.0-Bold", Text = beatmapSetInfo.Metadata.Author, TextSize = 15, Shadow = true, }, } } } } } }).Preload(game, delegate(Drawable d) { FadeIn(250); lastContainer?.FadeOut(250); lastContainer?.Expire(); Add(d); }); }
private void onBeatmapSetRemoved(BeatmapSetInfo s) => Carousel.RemoveBeatmapSet(s);
private int getBeatmapIndex(BeatmapSetInfo set, BeatmapInfo info) => set.Beatmaps.FindIndex(b => b == info);
private void onBeatmapSetRemoved(BeatmapSetInfo s) => Schedule(() => removeBeatmapSet(s));
public void RemoveBeatmap(BeatmapSetInfo beatmapSet) { Schedule(() => removeGroup(groups.Find(b => b.BeatmapSet.ID == beatmapSet.ID))); }
public DirectGridPanel(BeatmapSetInfo beatmap) : base(beatmap) { Height = 140 + vertical_padding; //full height of all the elements plus vertical padding (autosize uses the image) }
public bool RemoveBeatmapSet(BeatmapSetInfo beatmapSet) => items.RemoveBeatmapSet(beatmapSet);
protected DirectPanel(BeatmapSetInfo setInfo) { SetInfo = setInfo; }
protected override string ComputeHash(BeatmapSetInfo item) => string.Empty;
public void AddBeatmapSet(BeatmapSetInfo beatmapSet) => items.AddBeatmapSet(beatmapSet);
/// <summary> /// Creates the <see cref="TrackManagerPreviewTrack"/>. /// </summary> protected virtual TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, ITrackStore trackStore) => new TrackManagerPreviewTrack(beatmapSetInfo, trackStore);
public TrackManagerPreviewTrack(BeatmapSetInfo beatmapSetInfo, ITrackStore trackManager) { this.beatmapSetInfo = beatmapSetInfo; this.trackManager = trackManager; }
/// <summary> /// Show an already fully-populated beatmap set. /// </summary> /// <param name="set">The set to show.</param> public void ShowBeatmapSet(BeatmapSetInfo set) { beatmapSet.Value = set; Show(); }
private void onDatabaseOnBeatmapSetAdded(BeatmapSetInfo s) { Schedule(() => addBeatmapSet(s, Game)); }
public DownloadButton(BeatmapSetInfo set, bool noVideo = false) { Width = 120; BeatmapSetDownloader downloader; Add(new Container { Depth = -1, RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Horizontal = 10 }, Children = new Drawable[] { downloader = new BeatmapSetDownloader(set, noVideo), new FillFlowContainer { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, AutoSizeAxes = Axes.Both, Direction = FillDirection.Vertical, Children = new[] { new OsuSpriteText { Text = "Download", TextSize = 13, Font = @"Exo2.0-Bold", }, new OsuSpriteText { Text = set.OnlineInfo.HasVideo && noVideo ? "without Video" : string.Empty, TextSize = 11, Font = @"Exo2.0-Bold", }, }, }, new SpriteIcon { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Icon = FontAwesome.fa_download, Size = new Vector2(16), Margin = new MarginPadding { Right = 5 }, }, }, }); Action = () => { if (!downloader.Download()) { Content.MoveToX(-5, 50, Easing.OutSine).Then() .MoveToX(5, 100, Easing.InOutSine).Then() .MoveToX(-5, 100, Easing.InOutSine).Then() .MoveToX(0, 50, Easing.InSine); } }; downloader.Downloaded.ValueChanged += d => { if (d) { this.FadeOut(200); } else { this.FadeIn(200); } }; }
private void handleBeatmapRemoved(BeatmapSetInfo obj) => beatmapSets.RemoveAll(s => s.ID == obj.ID);
protected override TrackManagerPreviewTrack CreatePreviewTrack(BeatmapSetInfo beatmapSetInfo, TrackManager trackManager) => new TestPreviewTrack(beatmapSetInfo, trackManager);
private void onBeatmapSetAdded(BeatmapSetInfo s) => carousel.AddBeatmap(s);
public TestPreviewTrack(BeatmapSetInfo beatmapSetInfo, TrackManager trackManager) : base(beatmapSetInfo, trackManager) { }
public DrawableCarouselBeatmapSet(CarouselBeatmapSet set) : base(set) { beatmapSet = set.BeatmapSet; }
/// <summary> /// Change the position of a <see cref="BeatmapSetInfo"/> in the current playlist. /// </summary> /// <param name="beatmapSetInfo">The beatmap to move.</param> /// <param name="index">The new position.</param> public void ChangeBeatmapSetPosition(BeatmapSetInfo beatmapSetInfo, int index) { beatmapSets.Remove(beatmapSetInfo); beatmapSets.Insert(index, beatmapSetInfo); }
public DirectListPanel(BeatmapSetInfo beatmap) : base(beatmap) { RelativeSizeAxes = Axes.X; Height = height; }
private void load() { importedSet = ImportBeatmapTest.LoadOszIntoOsu(game, virtualTrack: true).Result; importedBeatmap = importedSet.Beatmaps.First(b => b.RulesetID == 0); importedBeatmapId = importedBeatmap.OnlineBeatmapID ?? -1; }
private void onBeatmapSetAdded(BeatmapSetInfo s) => Schedule(() => addBeatmapSet(s));
public override WorkingBeatmap CopyExistingDifficulty(BeatmapSetInfo targetBeatmapSet, WorkingBeatmap referenceWorkingBeatmap) { // don't actually care about properly creating a difficulty for this context. return(TestBeatmap); }
private void addBeatmapSet(BeatmapSetInfo beatmapSet) { carousel.AddBeatmap(beatmapSet); }
public void ShowBeatmapSet(BeatmapSetInfo set) { beatmapSet.Value = set; Show(); scroll.ScrollTo(0); }
private void onBeatmapSetAdded(BeatmapSetInfo s) => Carousel.UpdateBeatmapSet(s);
private void selectBeatmap(BeatmapSetInfo beatmapSet = null) { carousel.SelectBeatmap(beatmapSet != null ? beatmapSet.Beatmaps.First() : Beatmap?.BeatmapInfo); }
public WorkingBeatmap(BeatmapInfo beatmapInfo, BeatmapSetInfo beatmapSetInfo, BeatmapDatabase database) { this.BeatmapInfo = beatmapInfo; this.BeatmapSetInfo = beatmapSetInfo; this.database = database; }
public void RemoveBeatmap(BeatmapSetInfo info) => removeGroup(groups.Find(b => b.BeatmapSet.ID == info.ID));
private void addBeatmapSet(BeatmapSetInfo beatmapSet, BaseGame game) { beatmapSet = database.GetWithChildren<BeatmapSetInfo>(beatmapSet.ID); beatmapSet.Beatmaps.ForEach(b => { database.GetChildren(b); if (b.Metadata == null) b.Metadata = beatmapSet.Metadata; }); beatmapSet.Beatmaps = beatmapSet.Beatmaps.OrderBy(b => b.BaseDifficulty.OverallDifficulty).ToList(); var beatmap = new WorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault(), beatmapSet, database); var group = new BeatmapGroup(beatmap) { SelectionChanged = selectionChanged, StartRequested = b => start() }; //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 { carousel.AddGroup(group); if (Beatmap == null) carousel.SelectBeatmap(beatmapSet.Beatmaps.First()); else { var panel = group.BeatmapPanels.FirstOrDefault(p => p.Beatmap.Equals(Beatmap.BeatmapInfo)); if (panel != null) carousel.SelectGroup(group, panel); } })); }
private void handleBeatmapAdded(BeatmapSetInfo obj) => beatmapSets.Add(obj);