-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31652 from peppy/beatmap-carousel-v2-split-panels
Split out beatmap and set panels in beatmap carousel v2
- Loading branch information
Showing
8 changed files
with
156 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
using System.Diagnostics; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Extensions.Color4Extensions; | ||
using osu.Framework.Graphics; | ||
using osu.Framework.Graphics.Pooling; | ||
using osu.Framework.Graphics.Shapes; | ||
using osu.Framework.Input.Events; | ||
using osu.Game.Beatmaps; | ||
using osu.Game.Graphics.Sprites; | ||
using osuTK; | ||
using osuTK.Graphics; | ||
|
||
namespace osu.Game.Screens.SelectV2 | ||
{ | ||
public partial class BeatmapSetPanel : PoolableDrawable, ICarouselPanel | ||
{ | ||
public const float HEIGHT = CarouselItem.DEFAULT_HEIGHT * 2; | ||
|
||
[Resolved] | ||
private BeatmapCarousel carousel { get; set; } = null!; | ||
|
||
private OsuSpriteText text = null!; | ||
|
||
[BackgroundDependencyLoader] | ||
private void load() | ||
{ | ||
Size = new Vector2(500, HEIGHT); | ||
Masking = true; | ||
|
||
InternalChildren = new Drawable[] | ||
{ | ||
new Box | ||
{ | ||
Colour = Color4.Yellow.Darken(5), | ||
Alpha = 0.8f, | ||
RelativeSizeAxes = Axes.Both, | ||
}, | ||
text = new OsuSpriteText | ||
{ | ||
Padding = new MarginPadding(5), | ||
Anchor = Anchor.CentreLeft, | ||
Origin = Anchor.CentreLeft, | ||
} | ||
}; | ||
|
||
KeyboardSelected.BindValueChanged(value => | ||
{ | ||
if (value.NewValue) | ||
{ | ||
BorderThickness = 5; | ||
BorderColour = Color4.Pink; | ||
} | ||
else | ||
{ | ||
BorderThickness = 0; | ||
} | ||
}); | ||
} | ||
|
||
protected override void PrepareForUse() | ||
{ | ||
base.PrepareForUse(); | ||
|
||
Debug.Assert(Item != null); | ||
Debug.Assert(Item.IsGroupSelectionTarget); | ||
|
||
var beatmapSetInfo = (BeatmapSetInfo)Item.Model; | ||
|
||
text.Text = $"{beatmapSetInfo.Metadata}"; | ||
|
||
this.FadeInFromZero(500, Easing.OutQuint); | ||
} | ||
|
||
protected override bool OnClick(ClickEvent e) | ||
{ | ||
carousel.CurrentSelection = Item!.Model; | ||
return true; | ||
} | ||
|
||
#region ICarouselPanel | ||
|
||
public CarouselItem? Item { get; set; } | ||
public BindableBool Selected { get; } = new BindableBool(); | ||
public BindableBool KeyboardSelected { get; } = new BindableBool(); | ||
|
||
public double DrawYPosition { get; set; } | ||
|
||
public void Activated() | ||
{ | ||
// sets should never be activated. | ||
throw new InvalidOperationException(); | ||
} | ||
|
||
#endregion | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters