Skip to content

Commit

Permalink
Merge branch 'master' into hitcircleNumberSkinnableUsingSpriteText2
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragicafit committed Sep 28, 2018
2 parents 0993b83 + 3281b7e commit 262e518
Show file tree
Hide file tree
Showing 76 changed files with 317 additions and 160 deletions.
4 changes: 2 additions & 2 deletions osu.Desktop/Overlays/VersionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ public class VersionManager : OverlayContainer
private NotificationOverlay notificationOverlay;
private GameHost host;

public override bool HandleKeyboardInput => false;
public override bool HandleMouseInput => false;
public override bool HandleNonPositionalInput => false;
public override bool HandlePositionalInput => false;

[BackgroundDependencyLoader]
private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ protected override void Update()
}

// Todo: This is temporary, since the note masks don't do anything special yet. In the future they will handle input.
public override bool HandleMouseInput => false;
public override bool HandlePositionalInput => false;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@ protected override void Update()
}

// Todo: This is temporary, since the slider circle masks don't do anything special yet. In the future they will handle input.
public override bool HandleMouseInput => false;
public override bool HandlePositionalInput => false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ protected override void Update()
body.UpdateProgress(0);
}

public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => body.ReceiveMouseInputAt(screenSpacePos);
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => body.ReceivePositionalInputAt(screenSpacePos);

public override Vector2 SelectionPoint => ToScreenSpace(OriginPosition);
public override Quad SelectionQuad => body.PathDrawQuad;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,6 @@ protected override void UpdateCurrentState(ArmedState state)

public Drawable ProxiedLayer => HeadCircle.ApproachCircle;

public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => Body.ReceiveMouseInputAt(screenSpacePos);
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Body.ReceivePositionalInputAt(screenSpacePos);
}
}
4 changes: 2 additions & 2 deletions osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ protected override void Update()

if (Time.Current < slider.EndTime)
{
// Make sure to use the base version of ReceiveMouseInputAt so that we correctly check the position.
// Make sure to use the base version of ReceivePositionalInputAt so that we correctly check the position.
Tracking = canCurrentlyTrack
&& lastState != null
&& ReceiveMouseInputAt(lastState.Mouse.NativeState.Position)
&& ReceivePositionalInputAt(lastState.Mouse.NativeState.Position)
&& (drawableSlider?.OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public SliderBody(Slider s)
container.Attach(RenderbufferInternalFormat.DepthComponent16);
}

public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => path.ReceiveMouseInputAt(screenSpacePos);
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => path.ReceivePositionalInputAt(screenSpacePos);

public void SetRange(double p0, double p1)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{
public class SpinnerBackground : CircularContainer, IHasAccentColour
{
public override bool HandleKeyboardInput => false;
public override bool HandleMouseInput => false;
public override bool HandleNonPositionalInput => false;
public override bool HandlePositionalInput => false;

protected Box Disc;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public SpinnerDisc(Spinner s)
};
}

public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;

private bool tracking;
public bool Tracking
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public CursorTrail()
}
}

public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true;

[BackgroundDependencyLoader]
private void load(ShaderManager shaders, TextureStore textures)
Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public bool OnReleased(OsuAction action)
return false;
}

public override bool HandleMouseInput => true; // OverlayContainer will set this false when we go hidden, but we always want to receive input.
public override bool HandlePositionalInput => true; // OverlayContainer will set this false when we go hidden, but we always want to receive input.

protected override void PopIn()
{
Expand Down
3 changes: 2 additions & 1 deletion osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ private void onNewResult(DrawableHitObject judgedObject, JudgementResult result)
DrawableOsuJudgement explosion = new DrawableOsuJudgement(result, judgedObject)
{
Origin = Anchor.Centre,
Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition
Position = ((OsuHitObject)judgedObject.HitObject).StackedEndPosition,
Scale = new Vector2(((OsuHitObject)judgedObject.HitObject).Scale * 1.65f)
};

judgementLayer.Add(explosion);
Expand Down
13 changes: 13 additions & 0 deletions osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableHit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public abstract class DrawableHit : DrawableTaikoHitObject<Hit>

private bool validActionPressed;

private bool pressHandledThisFrame;

protected DrawableHit(Hit hit)
: base(hit)
{
Expand Down Expand Up @@ -51,6 +53,9 @@ protected override void CheckForResult(bool userTriggered, double timeOffset)

public override bool OnPressed(TaikoAction action)
{
if (pressHandledThisFrame)
return true;

if (Judged)
return false;

Expand All @@ -62,6 +67,10 @@ public override bool OnPressed(TaikoAction action)
if (IsHit)
HitAction = action;

// Regardless of whether we've hit or not, any secondary key presses in the same frame should be discarded
// E.g. hitting a non-strong centre as a strong should not fall through and perform a hit on the next note
pressHandledThisFrame = true;

return result;
}

Expand All @@ -76,6 +85,10 @@ protected override void Update()
{
base.Update();

// The input manager processes all input prior to us updating, so this is the perfect time
// for us to remove the extra press blocking, before input is handled in the next frame
pressHandledThisFrame = false;

Size = BaseSize * Parent.RelativeChildSize;
}

Expand Down
2 changes: 1 addition & 1 deletion osu.Game.Tests/Visual/TestCaseCursors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ private class CustomCursorBox : Container, IProvideCursor
public CursorContainer Cursor { get; }
public bool ProvidingUserCursor { get; }

public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => base.ReceiveMouseInputAt(screenSpacePos) || SmoothTransition && !ProvidingUserCursor;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => base.ReceivePositionalInputAt(screenSpacePos) || SmoothTransition && !ProvidingUserCursor;

private readonly Box background;

Expand Down
8 changes: 5 additions & 3 deletions osu.Game/Database/ArchiveModelManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,17 +282,19 @@ public TModel Import(TModel item, ArchiveReader archive = null)
/// Is a no-op for already deleted items.
/// </summary>
/// <param name="item">The item to delete.</param>
public void Delete(TModel item)
/// <returns>false if no operation was performed</returns>
public bool Delete(TModel item)
{
using (ContextFactory.GetForWrite())
{
// re-fetch the model on the import context.
var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).First(s => s.ID == item.ID);
var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).FirstOrDefault(s => s.ID == item.ID);

if (foundModel.DeletePending) return;
if (foundModel == null || foundModel.DeletePending) return false;

if (ModelStore.Delete(foundModel))
Files.Dereference(foundModel.Files.Select(f => f.FileInfo).ToArray());
return true;
}
}

Expand Down
4 changes: 2 additions & 2 deletions osu.Game/Graphics/Backgrounds/Triangles.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public class Triangles : Drawable
/// </summary>
private const float edge_smoothness = 1;

public override bool HandleKeyboardInput => false;
public override bool HandleMouseInput => false;
public override bool HandleNonPositionalInput => false;
public override bool HandlePositionalInput => false;


public Color4 ColourLight = Color4.White;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Graphics/Containers/LinkFlowContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public LinkFlowContainer(Action<SpriteText> defaultCreationParameters = null)
{
}

public override bool HandleMouseInput => true;
public override bool HandlePositionalInput => true;

private OsuGame game;

Expand Down
8 changes: 4 additions & 4 deletions osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class OsuFocusedOverlayContainer : FocusedOverlayContainer, IPreviewTrack

protected virtual bool PlaySamplesOnStateChange => true;

protected override bool BlockPassThroughKeyboard => true;
protected override bool BlockNonPositionalInput => true;

private PreviewTrackManager previewTrackManager;

Expand Down Expand Up @@ -54,14 +54,14 @@ private void load(OsuGame osuGame, AudioManager audio, PreviewTrackManager previ
/// 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.
/// </summary>
public virtual bool BlockScreenWideMouse => BlockPassThroughMouse;
public virtual bool BlockScreenWideMouse => BlockPositionalInput;

// receive input outside our bounds so we can trigger a close event on ourselves.
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceiveMouseInputAt(screenSpacePos);
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => BlockScreenWideMouse || base.ReceivePositionalInputAt(screenSpacePos);

protected override bool OnClick(InputState state)
{
if (!base.ReceiveMouseInputAt(state.Mouse.NativeState.Position))
if (!base.ReceivePositionalInputAt(state.Mouse.NativeState.Position))
{
State = Visibility.Hidden;
return true;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Graphics/DrawableDate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private void updateTimeWithReschedule()
Scheduler.AddDelayed(updateTimeWithReschedule, timeUntilNextUpdate);
}

public override bool HandleMouseInput => true;
public override bool HandlePositionalInput => true;

protected virtual string Format() => Date.Humanize();

Expand Down
6 changes: 3 additions & 3 deletions osu.Game/Graphics/UserInterface/BreadcrumbControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@ private class BreadcrumbTabItem : OsuTabItem, IStateful<Visibility>
public readonly SpriteIcon Chevron;

//don't allow clicking between transitions and don't make the chevron clickable
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => Alpha == 1f && Text.ReceiveMouseInputAt(screenSpacePos);
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Alpha == 1f && Text.ReceivePositionalInputAt(screenSpacePos);

public override bool HandleKeyboardInput => State == Visibility.Visible;
public override bool HandleMouseInput => State == Visibility.Visible;
public override bool HandleNonPositionalInput => State == Visibility.Visible;
public override bool HandlePositionalInput => State == Visibility.Visible;
public override bool IsRemovable => true;

private Visibility state;
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Graphics/UserInterface/DialogButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public float TextSize
}
}

public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceiveMouseInputAt(screenSpacePos);
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceivePositionalInputAt(screenSpacePos);

protected override bool OnClick(InputState state)
{
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Graphics/UserInterface/FocusedTextBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public bool HoldFocus
}

// We may not be focused yet, but we need to handle keyboard input to be able to request focus
public override bool HandleKeyboardInput => HoldFocus || base.HandleKeyboardInput;
public override bool HandleNonPositionalInput => HoldFocus || base.HandleNonPositionalInput;

protected override void OnFocus(InputState state)
{
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/Graphics/UserInterface/TwoLayerButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public string Text
}
}

public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => IconLayer.ReceiveMouseInputAt(screenSpacePos) || TextLayer.ReceiveMouseInputAt(screenSpacePos);
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => IconLayer.ReceivePositionalInputAt(screenSpacePos) || TextLayer.ReceivePositionalInputAt(screenSpacePos);

protected override bool OnHover(InputState state)
{
Expand Down
2 changes: 1 addition & 1 deletion osu.Game/IPC/ArchiveImportIPCChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public async Task ImportAsync(string path)
return;
}

if (importer.HandledExtensions.Contains(Path.GetExtension(path)))
if (importer.HandledExtensions.Contains(Path.GetExtension(path)?.ToLowerInvariant()))
importer.Import(path);
}
}
Expand Down
5 changes: 3 additions & 2 deletions osu.Game/Online/API/OAuth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System.Diagnostics;
using System.Net.Http;
using osu.Framework.Configuration;
using osu.Framework.IO.Network;

Expand Down Expand Up @@ -40,7 +41,7 @@ internal bool AuthenticateWithLogin(string username, string password)
using (var req = new AccessTokenRequestPassword(username, password)
{
Url = $@"{endpoint}/oauth/token",
Method = HttpMethod.POST,
Method = HttpMethod.Post,
ClientId = clientId,
ClientSecret = clientSecret
})
Expand All @@ -66,7 +67,7 @@ internal bool AuthenticateWithRefresh(string refresh)
using (var req = new AccessTokenRequestRefresh(refresh)
{
Url = $@"{endpoint}/oauth/token",
Method = HttpMethod.POST,
Method = HttpMethod.Post,
ClientId = clientId,
ClientSecret = clientSecret
})
Expand Down
23 changes: 4 additions & 19 deletions osu.Game/Online/API/Requests/GetMessagesRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,19 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using System.Collections.Generic;
using System.Linq;
using osu.Framework.IO.Network;
using osu.Game.Online.Chat;

namespace osu.Game.Online.API.Requests
{
public class GetMessagesRequest : APIRequest<List<Message>>
{
private readonly List<Channel> channels;
private readonly long? since;
private readonly Channel channel;

public GetMessagesRequest(List<Channel> channels, long? sinceId)
public GetMessagesRequest(Channel channel)
{
this.channels = channels;
since = sinceId;
this.channel = channel;
}

protected override WebRequest CreateWebRequest()
{
string channelString = string.Join(",", channels.Select(x => x.Id));

var req = base.CreateWebRequest();
req.AddParameter(@"channels", channelString);
if (since.HasValue) req.AddParameter(@"since", since.Value.ToString());

return req;
}

protected override string Target => @"chat/messages";
protected override string Target => $@"chat/channels/{channel.Id}/messages";
}
}
32 changes: 32 additions & 0 deletions osu.Game/Online/API/Requests/GetUpdatesRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <[email protected]>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE

using JetBrains.Annotations;
using osu.Framework.IO.Network;
using osu.Game.Online.Chat;

namespace osu.Game.Online.API.Requests
{
public class GetUpdatesRequest : APIRequest<GetUpdatesResponse>
{
private readonly long since;
private readonly Channel channel;

public GetUpdatesRequest(long sinceId, [CanBeNull] Channel channel = null)
{
this.channel = channel;
since = sinceId;
}

protected override WebRequest CreateWebRequest()
{
var req = base.CreateWebRequest();
if (channel != null) req.AddParameter(@"channel", channel.Id.ToString());
req.AddParameter(@"since", since.ToString());

return req;
}

protected override string Target => @"chat/updates";
}
}
Loading

0 comments on commit 262e518

Please sign in to comment.