mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 00:13:10 +08:00
Merge branch 'master' into hitobject-tests
This commit is contained in:
commit
fb7ff32c07
@ -5,6 +5,8 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Input;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
@ -22,6 +24,48 @@ namespace osu.Game.Graphics.Containers
|
||||
StateChanged += onStateChanged;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Whether mouse input should be blocked screen-wide while this overlay is visible.
|
||||
/// Performing mouse actions outside of the valid extents will hide the overlay but pass the events through.
|
||||
/// </summary>
|
||||
public virtual bool BlockScreenWideMouse => BlockPassThroughMouse;
|
||||
|
||||
// receive input outside our bounds so we can trigger a close event on ourselves.
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceiveMouseInputAt(screenSpacePos);
|
||||
|
||||
protected override bool OnWheel(InputState state)
|
||||
{
|
||||
// always allow wheel to pass through to stuff outside our DrawRectangle.
|
||||
if (!base.ReceiveMouseInputAt(state.Mouse.NativeState.Position))
|
||||
return false;
|
||||
|
||||
return BlockPassThroughMouse;
|
||||
}
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
{
|
||||
if (!base.ReceiveMouseInputAt(state.Mouse.NativeState.Position))
|
||||
{
|
||||
State = Visibility.Hidden;
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnClick(state);
|
||||
}
|
||||
|
||||
protected override bool OnDragStart(InputState state)
|
||||
{
|
||||
if (!base.ReceiveMouseInputAt(state.Mouse.NativeState.Position))
|
||||
{
|
||||
State = Visibility.Hidden;
|
||||
return true;
|
||||
}
|
||||
|
||||
return base.OnDragStart(state);
|
||||
}
|
||||
|
||||
protected override bool OnDrag(InputState state) => State == Visibility.Hidden;
|
||||
|
||||
private void onStateChanged(Visibility visibility)
|
||||
{
|
||||
switch (visibility)
|
||||
|
@ -27,6 +27,7 @@ using osu.Game.Overlays.Notifications;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Screens.Play;
|
||||
using osu.Game.Input.Bindings;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game
|
||||
{
|
||||
@ -284,10 +285,10 @@ namespace osu.Game
|
||||
|
||||
notifications.Enabled.BindTo(ShowOverlays);
|
||||
|
||||
ShowOverlays.ValueChanged += visible =>
|
||||
ShowOverlays.ValueChanged += show =>
|
||||
{
|
||||
//central game screen change logic.
|
||||
if (!visible)
|
||||
if (!show)
|
||||
{
|
||||
hideAllOverlays();
|
||||
musicController.State = Visibility.Hidden;
|
||||
@ -331,10 +332,21 @@ namespace osu.Game
|
||||
}
|
||||
|
||||
private Task asyncLoadStream;
|
||||
private int visibleOverlayCount;
|
||||
|
||||
private void loadComponentSingleFile<T>(T d, Action<T> add)
|
||||
where T : Drawable
|
||||
{
|
||||
var focused = d as FocusedOverlayContainer;
|
||||
if (focused != null)
|
||||
{
|
||||
focused.StateChanged += s =>
|
||||
{
|
||||
visibleOverlayCount += s == Visibility.Visible ? 1 : -1;
|
||||
screenStack.FadeColour(visibleOverlayCount > 0 ? OsuColour.Gray(0.5f) : Color4.White, 500, Easing.OutQuint);
|
||||
};
|
||||
}
|
||||
|
||||
// schedule is here to ensure that all component loads are done after LoadComplete is run (and thus all dependencies are cached).
|
||||
// with some better organisation of LoadComplete to do construction and dependency caching in one step, followed by calls to loadComponentSingleFile,
|
||||
// we could avoid the need for scheduling altogether.
|
||||
|
@ -240,8 +240,6 @@ namespace osu.Game.Overlays
|
||||
|
||||
public override bool AcceptsFocus => true;
|
||||
|
||||
protected override bool OnClick(InputState state) => true;
|
||||
|
||||
protected override void OnFocus(InputState state)
|
||||
{
|
||||
//this is necessary as textbox is masked away and therefore can't get focus :(
|
||||
|
@ -65,10 +65,10 @@ namespace osu.Game.Overlays
|
||||
AlwaysPresent = true;
|
||||
}
|
||||
|
||||
protected override bool OnDragStart(InputState state) => true;
|
||||
|
||||
protected override bool OnDrag(InputState state)
|
||||
{
|
||||
if (base.OnDrag(state)) return true;
|
||||
|
||||
Trace.Assert(state.Mouse.PositionMouseDown != null, "state.Mouse.PositionMouseDown != null");
|
||||
|
||||
Vector2 change = state.Mouse.Position - state.Mouse.PositionMouseDown.Value;
|
||||
@ -77,7 +77,7 @@ namespace osu.Game.Overlays
|
||||
change *= change.Length <= 0 ? 0 : (float)Math.Pow(change.Length, 0.7f) / change.Length;
|
||||
|
||||
dragContainer.MoveTo(change);
|
||||
return base.OnDrag(state);
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool OnDragEnd(InputState state)
|
||||
|
@ -177,8 +177,6 @@ namespace osu.Game.Overlays
|
||||
|
||||
public override bool AcceptsFocus => true;
|
||||
|
||||
protected override bool OnClick(InputState state) => true;
|
||||
|
||||
protected override void OnFocus(InputState state)
|
||||
{
|
||||
GetContainingInputManager().ChangeFocus(searchTextBox);
|
||||
|
@ -62,10 +62,10 @@ namespace osu.Game.Overlays.Toolbar
|
||||
new ToolbarChatButton(),
|
||||
new ToolbarSocialButton(),
|
||||
new ToolbarMusicButton(),
|
||||
new ToolbarButton
|
||||
{
|
||||
Icon = FontAwesome.fa_search
|
||||
},
|
||||
//new ToolbarButton
|
||||
//{
|
||||
// Icon = FontAwesome.fa_search
|
||||
//},
|
||||
userArea = new ToolbarUserArea(),
|
||||
new ToolbarNotificationButton(),
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
@ -34,15 +33,6 @@ namespace osu.Game.Overlays
|
||||
|
||||
public const float CONTENT_X_MARGIN = 50;
|
||||
|
||||
// receive input outside our bounds so we can trigger a close event on ourselves.
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
{
|
||||
State = Visibility.Hidden;
|
||||
return true;
|
||||
}
|
||||
|
||||
public UserProfileOverlay()
|
||||
{
|
||||
FirstWaveColour = OsuColour.Gray(0.4f);
|
||||
|
@ -29,5 +29,6 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override string Description => "Watch a perfect automated play through the song";
|
||||
public override double ScoreMultiplier => 0;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) };
|
||||
public override bool AllowFail => false;
|
||||
}
|
||||
}
|
||||
|
@ -109,6 +109,13 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
{
|
||||
if (value == placeholderState) return;
|
||||
|
||||
if (value != PlaceholderState.Successful)
|
||||
{
|
||||
getScoresRequest?.Cancel();
|
||||
getScoresRequest = null;
|
||||
Scores = null;
|
||||
}
|
||||
|
||||
switch (placeholderState = value)
|
||||
{
|
||||
case PlaceholderState.NetworkFailure:
|
||||
@ -211,10 +218,6 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
|
||||
private void updateScores()
|
||||
{
|
||||
getScoresRequest?.Cancel();
|
||||
getScoresRequest = null;
|
||||
Scores = null;
|
||||
|
||||
if (Scope == LeaderboardScope.Local)
|
||||
{
|
||||
// TODO: get local scores from wherever here.
|
||||
@ -234,16 +237,15 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
return;
|
||||
}
|
||||
|
||||
PlaceholderState = PlaceholderState.Retrieving;
|
||||
loading.Show();
|
||||
|
||||
if (Scope != LeaderboardScope.Global && !api.LocalUser.Value.IsSupporter)
|
||||
{
|
||||
loading.Hide();
|
||||
PlaceholderState = PlaceholderState.NotSupporter;
|
||||
return;
|
||||
}
|
||||
|
||||
PlaceholderState = PlaceholderState.Retrieving;
|
||||
loading.Show();
|
||||
|
||||
getScoresRequest = new GetScoresRequest(Beatmap, osuGame?.Ruleset.Value ?? Beatmap.Ruleset, Scope);
|
||||
getScoresRequest.Success += r =>
|
||||
{
|
||||
|
@ -25,6 +25,8 @@ namespace osu.Game.Screens.Select.Options
|
||||
private readonly Box holder;
|
||||
private readonly FillFlowContainer<BeatmapOptionsButton> buttonsContainer;
|
||||
|
||||
public override bool BlockScreenWideMouse => false;
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
base.PopIn();
|
||||
|
Loading…
Reference in New Issue
Block a user