1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 08:07:24 +08:00

Merge branch 'master' into hitobject-tests

This commit is contained in:
Dean Herbert 2018-01-03 12:35:43 +09:00 committed by GitHub
commit fb7ff32c07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 78 additions and 31 deletions

View File

@ -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)

View File

@ -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.

View File

@ -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 :(

View File

@ -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)

View File

@ -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);

View File

@ -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(),
}

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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 =>
{

View File

@ -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();