Merge remote-tracking branch 'refs/remotes/ppy/master' into accuracy-bar

This commit is contained in:
Andrei Zavatski
2019-08-18 01:14:27 +03:00
80 changed files with 2307 additions and 901 deletions

View File

@ -11,8 +11,11 @@ namespace osu.Game.Screens
{
public abstract class BackgroundScreen : Screen, IEquatable<BackgroundScreen>
{
protected BackgroundScreen()
private readonly bool animateOnEnter;
protected BackgroundScreen(bool animateOnEnter = true)
{
this.animateOnEnter = animateOnEnter;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
@ -39,11 +42,14 @@ namespace osu.Game.Screens
public override void OnEntering(IScreen last)
{
this.FadeOut();
this.MoveToX(x_movement_amount);
if (animateOnEnter)
{
this.FadeOut();
this.MoveToX(x_movement_amount);
this.FadeIn(transition_length, Easing.InOutQuart);
this.MoveToX(0, transition_length, Easing.InOutQuart);
this.FadeIn(transition_length, Easing.InOutQuart);
this.MoveToX(0, transition_length, Easing.InOutQuart);
}
base.OnEntering(last);
}

View File

@ -25,6 +25,11 @@ namespace osu.Game.Screens.Backgrounds
private Bindable<User> user;
private Bindable<Skin> skin;
public BackgroundScreenDefault(bool animateOnEnter = true)
: base(animateOnEnter)
{
}
[BackgroundDependencyLoader]
private void load(IAPIProvider api, SkinManager skinManager)
{

View File

@ -9,6 +9,8 @@ using osu.Framework.Graphics.Shaders;
using osu.Game.Screens.Menu;
using osuTK;
using osu.Framework.Screens;
using osu.Game.Configuration;
using IntroSequence = osu.Game.Configuration.IntroSequence;
namespace osu.Game.Screens
{
@ -45,6 +47,8 @@ namespace osu.Game.Screens
private OsuScreen loadableScreen;
private ShaderPrecompiler precompiler;
private IntroSequence introSequence;
protected virtual OsuScreen CreateLoadableScreen()
{
if (showDisclaimer)
@ -53,7 +57,17 @@ namespace osu.Game.Screens
return getIntroSequence();
}
private IntroScreen getIntroSequence() => new IntroCircles();
private IntroScreen getIntroSequence()
{
switch (introSequence)
{
case IntroSequence.Circles:
return new IntroCircles();
default:
return new IntroTriangles();
}
}
protected virtual ShaderPrecompiler CreateShaderPrecompiler() => new ShaderPrecompiler();
@ -79,9 +93,10 @@ namespace osu.Game.Screens
}
[BackgroundDependencyLoader]
private void load(OsuGameBase game)
private void load(OsuGameBase game, OsuConfigManager config)
{
showDisclaimer = game.IsDeployedBuild;
introSequence = config.Get<IntroSequence>(OsuSetting.IntroSequence);
}
/// <summary>

View File

@ -0,0 +1,413 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.IO;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Screens;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Textures;
using osu.Framework.Graphics.Video;
using osu.Framework.MathUtils;
using osu.Framework.Timing;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.IO.Archives;
using osu.Game.Rulesets;
using osu.Game.Screens.Backgrounds;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Screens.Menu
{
public class IntroTriangles : IntroScreen
{
private const string menu_music_beatmap_hash = "a1556d0801b3a6b175dda32ef546f0ec812b400499f575c44fccbe9c67f9b1e5";
private SampleChannel welcome;
protected override BackgroundScreen CreateBackground() => background = new BackgroundScreenDefault(false)
{
Alpha = 0,
};
[Resolved]
private AudioManager audio { get; set; }
private Bindable<bool> menuMusic;
private Track track;
private WorkingBeatmap introBeatmap;
private BackgroundScreenDefault background;
[BackgroundDependencyLoader]
private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
{
menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
BeatmapSetInfo setInfo = null;
if (!menuMusic.Value)
{
var sets = beatmaps.GetAllUsableBeatmapSets();
if (sets.Count > 0)
setInfo = beatmaps.QueryBeatmapSet(s => s.ID == sets[RNG.Next(0, sets.Count - 1)].ID);
}
if (setInfo == null)
{
setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == menu_music_beatmap_hash);
if (setInfo == null)
{
// we need to import the default menu background beatmap
setInfo = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream(@"Tracks/triangles.osz"), "triangles.osz")).Result;
setInfo.Protected = true;
beatmaps.Update(setInfo);
}
}
introBeatmap = beatmaps.GetWorkingBeatmap(setInfo.Beatmaps[0]);
track = introBeatmap.Track;
track.Reset();
if (config.Get<bool>(OsuSetting.MenuVoice) && !menuMusic.Value)
// triangles has welcome sound included in the track. only play this if the user doesn't want menu music.
welcome = audio.Samples.Get(@"welcome");
}
protected override void LogoArriving(OsuLogo logo, bool resuming)
{
base.LogoArriving(logo, resuming);
logo.Triangles = true;
if (!resuming)
{
Beatmap.Value = introBeatmap;
introBeatmap = null;
PrepareMenuLoad();
LoadComponentAsync(new TrianglesIntroSequence(logo, background)
{
RelativeSizeAxes = Axes.Both,
Clock = new FramedClock(menuMusic.Value ? track : null),
LoadMenu = LoadMenu
}, t =>
{
AddInternal(t);
welcome?.Play();
// Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Menu.
if (menuMusic.Value)
track.Start();
});
}
}
public override void OnResuming(IScreen last)
{
base.OnResuming(last);
background.FadeOut(100);
}
public override void OnSuspending(IScreen next)
{
track = null;
base.OnSuspending(next);
}
private class TrianglesIntroSequence : CompositeDrawable
{
private readonly OsuLogo logo;
private readonly BackgroundScreenDefault background;
private OsuSpriteText welcomeText;
private RulesetFlow rulesets;
private Container rulesetsScale;
private Drawable logoContainerSecondary;
private Drawable logoContainer;
private GlitchingTriangles triangles;
public Action LoadMenu;
public TrianglesIntroSequence(OsuLogo logo, BackgroundScreenDefault background)
{
this.logo = logo;
this.background = background;
}
private OsuGameBase game;
[BackgroundDependencyLoader]
private void load(TextureStore textures, OsuGameBase game)
{
this.game = game;
InternalChildren = new[]
{
triangles = new GlitchingTriangles
{
Alpha = 0,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Size = new Vector2(0.4f, 0.16f)
},
welcomeText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Padding = new MarginPadding { Bottom = 10 },
Font = OsuFont.GetFont(weight: FontWeight.Light, size: 42),
Alpha = 1,
Spacing = new Vector2(5),
},
rulesetsScale = new Container
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new Drawable[]
{
rulesets = new RulesetFlow()
}
},
logoContainerSecondary = new Container
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Child = logoContainer = new LazerLogo(textures.GetStream("Menu/logo-triangles.mp4"))
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
},
};
}
private const double text_1 = 200;
private const double text_2 = 400;
private const double text_3 = 700;
private const double text_4 = 900;
private const double text_glitch = 1060;
private const double rulesets_1 = 1450;
private const double rulesets_2 = 1650;
private const double rulesets_3 = 1850;
private const double logo_scale_duration = 920;
private const double logo_1 = 2080;
private const double logo_2 = logo_1 + logo_scale_duration;
protected override void LoadComplete()
{
base.LoadComplete();
const float scale_start = 1.2f;
const float scale_adjust = 0.8f;
rulesets.Hide();
logoContainer.Hide();
background.Hide();
using (BeginAbsoluteSequence(0, true))
{
using (BeginDelayedSequence(text_1, true))
welcomeText.FadeIn().OnComplete(t => t.Text = "wel");
using (BeginDelayedSequence(text_2, true))
welcomeText.FadeIn().OnComplete(t => t.Text = "welcome");
using (BeginDelayedSequence(text_3, true))
welcomeText.FadeIn().OnComplete(t => t.Text = "welcome to");
using (BeginDelayedSequence(text_4, true))
{
welcomeText.FadeIn().OnComplete(t => t.Text = "welcome to osu!");
welcomeText.TransformTo(nameof(welcomeText.Spacing), new Vector2(50, 0), 5000);
}
using (BeginDelayedSequence(text_glitch, true))
triangles.FadeIn();
using (BeginDelayedSequence(rulesets_1, true))
{
rulesetsScale.ScaleTo(0.8f, 1000);
rulesets.FadeIn().ScaleTo(1).TransformSpacingTo(new Vector2(200, 0));
welcomeText.FadeOut();
triangles.FadeOut();
}
using (BeginDelayedSequence(rulesets_2, true))
{
rulesets.ScaleTo(2).TransformSpacingTo(new Vector2(30, 0));
}
using (BeginDelayedSequence(rulesets_3, true))
{
rulesets.ScaleTo(4).TransformSpacingTo(new Vector2(10, 0));
rulesetsScale.ScaleTo(1.3f, 1000);
}
using (BeginDelayedSequence(logo_1, true))
{
rulesets.FadeOut();
// matching flyte curve y = 0.25x^2 + (max(0, x - 0.7) / 0.3) ^ 5
logoContainer.FadeIn().ScaleTo(scale_start).Then().Delay(logo_scale_duration * 0.7f).ScaleTo(scale_start - scale_adjust, logo_scale_duration * 0.3f, Easing.InQuint);
logoContainerSecondary.ScaleTo(scale_start).Then().ScaleTo(scale_start - scale_adjust * 0.25f, logo_scale_duration, Easing.InQuad);
}
using (BeginDelayedSequence(logo_2, true))
{
logoContainer.FadeOut().OnComplete(_ =>
{
logo.FadeIn();
background.FadeIn();
game.Add(new GameWideFlash());
LoadMenu();
});
}
}
}
private class GameWideFlash : Box
{
private const double flash_length = 1000;
public GameWideFlash()
{
Colour = Color4.White;
RelativeSizeAxes = Axes.Both;
Blending = BlendingMode.Additive;
}
protected override void LoadComplete()
{
base.LoadComplete();
this.FadeOutFromOne(flash_length, Easing.Out);
}
}
private class LazerLogo : CompositeDrawable
{
public LazerLogo(Stream videoStream)
{
Size = new Vector2(960);
InternalChild = new VideoSprite(videoStream)
{
RelativeSizeAxes = Axes.Both,
Clock = new FramedOffsetClock(Clock) { Offset = -logo_1 }
};
}
}
private class RulesetFlow : FillFlowContainer
{
[BackgroundDependencyLoader]
private void load(RulesetStore rulesets)
{
var modes = new List<Drawable>();
foreach (var ruleset in rulesets.AvailableRulesets)
{
var icon = new ConstrainedIconContainer
{
Icon = ruleset.CreateInstance().CreateIcon(),
Size = new Vector2(30),
};
modes.Add(icon);
}
AutoSizeAxes = Axes.Both;
Children = modes;
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
}
}
private class GlitchingTriangles : CompositeDrawable
{
public GlitchingTriangles()
{
RelativeSizeAxes = Axes.Both;
}
private double? lastGenTime;
private const double time_between_triangles = 22;
protected override void Update()
{
base.Update();
if (lastGenTime == null || Time.Current - lastGenTime > time_between_triangles)
{
lastGenTime = (lastGenTime ?? Time.Current) + time_between_triangles;
Drawable triangle = new OutlineTriangle(RNG.NextBool(), (RNG.NextSingle() + 0.2f) * 80)
{
RelativePositionAxes = Axes.Both,
Position = new Vector2(RNG.NextSingle(), RNG.NextSingle()),
};
AddInternal(triangle);
triangle.FadeOutFromOne(120);
}
}
/// <summary>
/// Represents a sprite that is drawn in a triangle shape, instead of a rectangle shape.
/// </summary>
public class OutlineTriangle : BufferedContainer
{
public OutlineTriangle(bool outlineOnly, float size)
{
Size = new Vector2(size);
InternalChildren = new Drawable[]
{
new Triangle { RelativeSizeAxes = Axes.Both },
};
if (outlineOnly)
{
AddInternal(new Triangle
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Colour = Color4.Black,
Size = new Vector2(size - 5),
Blending = BlendingMode.None,
});
}
Blending = BlendingMode.Additive;
CacheDrawnFrameBuffer = true;
}
}
}
}
}
}

View File

@ -25,10 +25,14 @@ namespace osu.Game.Screens.Multi.Match.Components
{
public const float HEIGHT = 200;
public MatchTabControl Tabs;
public readonly BindableBool ShowBeatmapPanel = new BindableBool();
public MatchTabControl Tabs { get; private set; }
public Action RequestBeatmapSelection;
private MatchBeatmapPanel beatmapPanel;
public Header()
{
RelativeSizeAxes = Axes.X;
@ -53,8 +57,14 @@ namespace osu.Game.Screens.Multi.Match.Components
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.4f), Color4.Black.Opacity(0.6f)),
Colour = ColourInfo.GradientVertical(Color4.Black.Opacity(0.7f), Color4.Black.Opacity(0.8f)),
},
beatmapPanel = new MatchBeatmapPanel
{
Anchor = Anchor.CentreRight,
Origin = Anchor.CentreRight,
Margin = new MarginPadding { Right = 100 },
}
}
},
new Box
@ -114,6 +124,12 @@ namespace osu.Game.Screens.Multi.Match.Components
beatmapButton.Action = () => RequestBeatmapSelection?.Invoke();
}
protected override void LoadComplete()
{
base.LoadComplete();
ShowBeatmapPanel.BindValueChanged(value => beatmapPanel.FadeTo(value.NewValue ? 1 : 0, 200, Easing.OutQuint), true);
}
private class BeatmapSelectButton : HeaderButton
{
[Resolved(typeof(Room), nameof(Room.RoomID))]

View File

@ -28,7 +28,6 @@ namespace osu.Game.Screens.Multi.Match.Components
private void load()
{
ReadyButton readyButton;
ViewBeatmapButton viewBeatmapButton;
HostInfo hostInfo;
InternalChildren = new Drawable[]
@ -80,7 +79,6 @@ namespace osu.Game.Screens.Multi.Match.Components
Direction = FillDirection.Horizontal,
Children = new Drawable[]
{
viewBeatmapButton = new ViewBeatmapButton(),
readyButton = new ReadyButton
{
Action = () => OnStart?.Invoke()
@ -91,11 +89,7 @@ namespace osu.Game.Screens.Multi.Match.Components
},
};
CurrentItem.BindValueChanged(item =>
{
viewBeatmapButton.Beatmap.Value = item.NewValue?.Beatmap;
readyButton.Beatmap.Value = item.NewValue?.Beatmap;
}, true);
CurrentItem.BindValueChanged(item => readyButton.Beatmap.Value = item.NewValue?.Beatmap, true);
hostInfo.Host.BindTo(Host);
}

View File

@ -0,0 +1,62 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Threading;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Direct;
using osu.Game.Rulesets;
namespace osu.Game.Screens.Multi.Match.Components
{
public class MatchBeatmapPanel : MultiplayerComposite
{
[Resolved]
private IAPIProvider api { get; set; }
[Resolved]
private RulesetStore rulesets { get; set; }
private CancellationTokenSource loadCancellation;
private GetBeatmapSetRequest request;
private DirectGridPanel panel;
public MatchBeatmapPanel()
{
AutoSizeAxes = Axes.Both;
}
[BackgroundDependencyLoader]
private void load()
{
CurrentItem.BindValueChanged(item => loadNewPanel(item.NewValue?.Beatmap), true);
}
private void loadNewPanel(BeatmapInfo beatmap)
{
loadCancellation?.Cancel();
request?.Cancel();
panel?.FadeOut(200);
panel?.Expire();
panel = null;
if (beatmap?.OnlineBeatmapID == null)
return;
loadCancellation = new CancellationTokenSource();
request = new GetBeatmapSetRequest(beatmap.OnlineBeatmapID.Value, BeatmapSetLookupType.BeatmapId);
request.Success += res => Schedule(() =>
{
panel = new DirectGridPanel(res.ToBeatmapSet(rulesets));
LoadComponentAsync(panel, AddInternal, loadCancellation.Token);
});
api.Queue(request);
}
}
}

View File

@ -1,46 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osuTK;
namespace osu.Game.Screens.Multi.Match.Components
{
public class ViewBeatmapButton : HeaderButton
{
public readonly Bindable<BeatmapInfo> Beatmap = new Bindable<BeatmapInfo>();
[Resolved(CanBeNull = true)]
private OsuGame osuGame { get; set; }
public ViewBeatmapButton()
{
RelativeSizeAxes = Axes.Y;
Size = new Vector2(200, 1);
Text = "View beatmap";
}
[BackgroundDependencyLoader]
private void load()
{
if (osuGame != null)
Beatmap.BindValueChanged(beatmap => updateAction(beatmap.NewValue), true);
}
private void updateAction(BeatmapInfo beatmap)
{
if (beatmap == null)
{
Enabled.Value = false;
return;
}
Action = () => osuGame.ShowBeatmap(beatmap.OnlineBeatmapID ?? 0);
Enabled.Value = true;
}
}
}

View File

@ -7,6 +7,7 @@ using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Screens;
using osu.Game.Audio;
using osu.Game.Beatmaps;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.Multiplayer.GameTypes;
@ -18,7 +19,8 @@ using PlaylistItem = osu.Game.Online.Multiplayer.PlaylistItem;
namespace osu.Game.Screens.Multi.Match
{
public class MatchSubScreen : MultiplayerSubScreen
[Cached(typeof(IPreviewTrackOwner))]
public class MatchSubScreen : MultiplayerSubScreen, IPreviewTrackOwner
{
public override bool DisallowExternalBeatmapRulesetChanges => true;
@ -44,6 +46,9 @@ namespace osu.Game.Screens.Multi.Match
[Resolved]
private BeatmapManager beatmapManager { get; set; }
[Resolved]
private PreviewTrackManager previewTrackManager { get; set; }
[Resolved(CanBeNull = true)]
private OsuGame game { get; set; }
@ -146,18 +151,12 @@ namespace osu.Game.Screens.Multi.Match
{
const float fade_duration = 500;
if (tab.NewValue is SettingsMatchPage)
{
settings.Show();
info.FadeOut(fade_duration, Easing.OutQuint);
bottomRow.FadeOut(fade_duration, Easing.OutQuint);
}
else
{
settings.Hide();
info.FadeIn(fade_duration, Easing.OutQuint);
bottomRow.FadeIn(fade_duration, Easing.OutQuint);
}
var settingsDisplayed = tab.NewValue is SettingsMatchPage;
header.ShowBeatmapPanel.Value = !settingsDisplayed;
settings.State.Value = settingsDisplayed ? Visibility.Visible : Visibility.Hidden;
info.FadeTo(settingsDisplayed ? 0 : 1, fade_duration, Easing.OutQuint);
bottomRow.FadeTo(settingsDisplayed ? 0 : 1, fade_duration, Easing.OutQuint);
}, true);
chat.Exit += () =>
@ -179,8 +178,8 @@ namespace osu.Game.Screens.Multi.Match
public override bool OnExiting(IScreen next)
{
RoomManager?.PartRoom();
Mods.Value = Array.Empty<Mod>();
previewTrackManager.StopAnyPlaying(this);
return base.OnExiting(next);
}
@ -198,6 +197,8 @@ namespace osu.Game.Screens.Multi.Match
if (e.NewValue?.Ruleset != null)
Ruleset.Value = e.NewValue.Ruleset;
previewTrackManager.StopAnyPlaying(this);
}
/// <summary>
@ -223,6 +224,8 @@ namespace osu.Game.Screens.Multi.Match
private void onStart()
{
previewTrackManager.StopAnyPlaying(this);
switch (type.Value)
{
default:

View File

@ -33,7 +33,7 @@ namespace osu.Game.Screens.Play
base.LoadComplete();
}
protected override bool ShowDimContent => ShowStoryboard.Value && UserDimLevel.Value < 1;
protected override bool ShowDimContent => ShowStoryboard.Value && DimLevel < 1;
private void initializeStoryboard(bool async)
{

View File

@ -24,7 +24,7 @@ using osu.Game.Screens.Select.Carousel;
namespace osu.Game.Screens.Select
{
public class BeatmapCarousel : OsuScrollContainer
public class BeatmapCarousel : CompositeDrawable
{
private const float bleed_top = FilterControl.HEIGHT;
private const float bleed_bottom = Footer.HEIGHT;
@ -61,6 +61,8 @@ namespace osu.Game.Screens.Select
/// </summary>
public bool BeatmapSetsLoaded { get; private set; }
private readonly OsuScrollContainer scroll;
private IEnumerable<CarouselBeatmapSet> beatmapSets => root.Children.OfType<CarouselBeatmapSet>();
public IEnumerable<BeatmapSetInfo> BeatmapSets
@ -110,13 +112,17 @@ namespace osu.Game.Screens.Select
public BeatmapCarousel()
{
root = new CarouselRoot(this);
Child = new OsuContextMenuContainer
InternalChild = new OsuContextMenuContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Child = scrollableContent = new Container<DrawableCarouselItem>
RelativeSizeAxes = Axes.Both,
Child = scroll = new CarouselScrollContainer
{
RelativeSizeAxes = Axes.X,
Masking = false,
RelativeSizeAxes = Axes.Both,
Child = scrollableContent = new Container<DrawableCarouselItem>
{
RelativeSizeAxes = Axes.X,
}
}
};
}
@ -127,7 +133,7 @@ namespace osu.Game.Screens.Select
config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm);
config.BindWith(OsuSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled);
RightClickScrollingEnabled.ValueChanged += enabled => RightMouseScrollbar = enabled.NewValue;
RightClickScrollingEnabled.ValueChanged += enabled => scroll.RightMouseScrollbar = enabled.NewValue;
RightClickScrollingEnabled.TriggerChange();
loadBeatmapSets(beatmaps.GetAllUsableBeatmapSetsEnumerable());
@ -351,12 +357,12 @@ namespace osu.Game.Screens.Select
/// <summary>
/// The position of the lower visible bound with respect to the current scroll position.
/// </summary>
private float visibleBottomBound => Current + DrawHeight + bleed_bottom;
private float visibleBottomBound => scroll.Current + DrawHeight + bleed_bottom;
/// <summary>
/// The position of the upper visible bound with respect to the current scroll position.
/// </summary>
private float visibleUpperBound => Current - bleed_top;
private float visibleUpperBound => scroll.Current - bleed_top;
public void FlushPendingFilterOperations()
{
@ -628,7 +634,7 @@ namespace osu.Game.Screens.Select
private void updateScrollPosition()
{
if (scrollTarget != null) ScrollTo(scrollTarget.Value);
if (scrollTarget != null) scroll.ScrollTo(scrollTarget.Value);
scrollPositionCache.Validate();
}
@ -688,5 +694,35 @@ namespace osu.Game.Screens.Select
base.PerformSelection();
}
}
private class CarouselScrollContainer : OsuScrollContainer
{
private bool rightMouseScrollBlocked;
protected override bool OnMouseDown(MouseDownEvent e)
{
if (e.Button == MouseButton.Right)
{
// we need to block right click absolute scrolling when hovering a carousel item so context menus can display.
// this can be reconsidered when we have an alternative to right click scrolling.
if (GetContainingInputManager().HoveredDrawables.OfType<DrawableCarouselItem>().Any())
{
rightMouseScrollBlocked = true;
return false;
}
}
rightMouseScrollBlocked = false;
return base.OnMouseDown(e);
}
protected override bool OnDragStart(DragStartEvent e)
{
if (rightMouseScrollBlocked)
return false;
return base.OnDragStart(e);
}
}
}
}

View File

@ -1,13 +1,22 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.ComponentModel;
namespace osu.Game.Screens.Select.Leaderboards
{
public enum BeatmapLeaderboardScope
{
[Description("Local Ranking")]
Local,
[Description("Country Ranking")]
Country,
[Description("Global Ranking")]
Global,
[Description("Friend Ranking")]
Friend,
}
}

View File

@ -157,7 +157,6 @@ namespace osu.Game.Screens.Select
},
Child = Carousel = new BeatmapCarousel
{
Masking = false,
RelativeSizeAxes = Axes.Both,
Size = new Vector2(1 - wedged_container_size.X, 1),
Anchor = Anchor.CentreRight,