1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 17:43:05 +08:00

Add right click scrolling in song select (and its option)

This commit is contained in:
tgi74000 2018-04-13 11:09:49 +02:00
parent 06efddd4b4
commit e3cd0ef200
3 changed files with 38 additions and 1 deletions

View File

@ -84,6 +84,8 @@ namespace osu.Game.Configuration
Set(OsuSetting.Version, string.Empty);
Set(OsuSetting.ScreenshotFormat, ScreenshotFormat.Jpg);
Set(OsuSetting.SelectScrollRightClick, false);
}
public OsuConfigManager(Storage storage) : base(storage)
@ -128,6 +130,7 @@ namespace osu.Game.Configuration
ShowConvertedBeatmaps,
SpeedChangeVisualisation,
Skin,
ScreenshotFormat
ScreenshotFormat,
SelectScrollRightClick
}
}

View File

@ -17,6 +17,11 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
{
Children = new Drawable[]
{
new SettingsCheckbox
{
LabelText = "Right click to scroll",
Bindable = config.GetBindable<bool>(OsuSetting.SelectScrollRightClick),
},
new SettingsCheckbox
{
LabelText = "Show converted beatmaps",

View File

@ -97,6 +97,9 @@ namespace osu.Game.Screens.Select
private readonly Container<DrawableCarouselItem> scrollableContent;
public Bindable<bool> RightClickScrollingEnabled = new Bindable<bool>();
public Bindable<RandomSelectAlgorithm> RandomAlgorithm = new Bindable<RandomSelectAlgorithm>();
private readonly List<CarouselBeatmapSet> previouslyVisitedRandomSets = new List<CarouselBeatmapSet>();
private readonly Stack<CarouselBeatmap> randomSelectedBeatmaps = new Stack<CarouselBeatmap>();
@ -121,6 +124,7 @@ namespace osu.Game.Screens.Select
private void load(OsuConfigManager config)
{
config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm);
config.BindWith(OsuSetting.SelectScrollRightClick, RightClickScrollingEnabled);
}
public void RemoveBeatmapSet(BeatmapSetInfo beatmapSet)
@ -398,6 +402,31 @@ namespace osu.Game.Screens.Select
return true;
}
private bool rightClickScrolling = false;
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
{
bool result = base.OnMouseDown(state, args);
if (RightClickScrollingEnabled.Value && !result && args.Button == MouseButton.Right)
{
rightClickScrolling = true;
return true;
}
return result;
}
protected override bool OnMouseMove(InputState state)
{
if (state.Mouse.Buttons.Contains(MouseButton.Right) && rightClickScrolling)
ScrollTo((state.Mouse.Position.Y / DrawHeight) * scrollableContent.Height);
else
rightClickScrolling = false;
return base.OnMouseMove(state);
}
protected override void Update()
{
base.Update();