Merge remote-tracking branch 'refs/remotes/ppy/master' into overlay-header-web-colours

This commit is contained in:
Andrei Zavatski
2020-01-18 08:51:10 +03:00
19 changed files with 62 additions and 42 deletions

View File

@ -63,7 +63,7 @@ namespace osu.Game.Graphics.Containers
} }
public void AddUserLink(User user, Action<SpriteText> creationParameters = null) public void AddUserLink(User user, Action<SpriteText> creationParameters = null)
=> createLink(AddText(user.Username, creationParameters), new LinkDetails(LinkAction.OpenUserProfile, user.Id.ToString()), "View Profile"); => createLink(AddText(user.Username, creationParameters), new LinkDetails(LinkAction.OpenUserProfile, user.Id.ToString()), "view profile");
private void createLink(IEnumerable<Drawable> drawables, LinkDetails link, string tooltipText, Action action = null) private void createLink(IEnumerable<Drawable> drawables, LinkDetails link, string tooltipText, Action action = null)
{ {

View File

@ -57,6 +57,6 @@ namespace osu.Game.Graphics.UserInterface
return true; return true;
} }
public string TooltipText => "View in browser"; public string TooltipText => "view in browser";
} }
} }

View File

@ -104,7 +104,7 @@ namespace osu.Game.Graphics.UserInterface
private class CapsWarning : SpriteIcon, IHasTooltip private class CapsWarning : SpriteIcon, IHasTooltip
{ {
public string TooltipText => @"Caps lock is active"; public string TooltipText => @"caps lock is active";
public CapsWarning() public CapsWarning()
{ {

View File

@ -16,7 +16,7 @@ namespace osu.Game.Online.API
{ {
protected override WebRequest CreateWebRequest() => new OsuJsonWebRequest<T>(Uri); protected override WebRequest CreateWebRequest() => new OsuJsonWebRequest<T>(Uri);
public T Result => ((JsonWebRequest<T>)WebRequest).ResponseObject; public T Result => ((OsuJsonWebRequest<T>)WebRequest).ResponseObject;
protected APIRequest() protected APIRequest()
{ {
@ -30,16 +30,6 @@ namespace osu.Game.Online.API
/// This will be scheduled to the API's internal scheduler (run on update thread automatically). /// This will be scheduled to the API's internal scheduler (run on update thread automatically).
/// </summary> /// </summary>
public new event APISuccessHandler<T> Success; public new event APISuccessHandler<T> Success;
private class OsuJsonWebRequest<U> : JsonWebRequest<U>
{
public OsuJsonWebRequest(string uri)
: base(uri)
{
}
protected override string UserAgent => "osu!";
}
} }
/// <summary> /// <summary>
@ -162,16 +152,6 @@ namespace osu.Game.Online.API
[JsonProperty("error")] [JsonProperty("error")]
public string ErrorMessage { get; set; } public string ErrorMessage { get; set; }
} }
private class OsuWebRequest : WebRequest
{
public OsuWebRequest(string uri)
: base(uri)
{
}
protected override string UserAgent => "osu!";
}
} }
public class APIException : InvalidOperationException public class APIException : InvalidOperationException

View File

@ -4,7 +4,6 @@
using System.Diagnostics; using System.Diagnostics;
using System.Net.Http; using System.Net.Http;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.IO.Network;
namespace osu.Game.Online.API namespace osu.Game.Online.API
{ {
@ -166,7 +165,7 @@ namespace osu.Game.Online.API
} }
} }
private class AccessTokenRequest : JsonWebRequest<OAuthToken> private class AccessTokenRequest : OsuJsonWebRequest<OAuthToken>
{ {
protected string GrantType; protected string GrantType;

View File

@ -0,0 +1,21 @@
// 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.IO.Network;
namespace osu.Game.Online.API
{
public class OsuJsonWebRequest<T> : JsonWebRequest<T>
{
public OsuJsonWebRequest(string uri)
: base(uri)
{
}
public OsuJsonWebRequest()
{
}
protected override string UserAgent => "osu!";
}
}

View File

@ -0,0 +1,21 @@
// 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.IO.Network;
namespace osu.Game.Online.API
{
public class OsuWebRequest : WebRequest
{
public OsuWebRequest(string uri)
: base(uri)
{
}
public OsuWebRequest()
{
}
protected override string UserAgent => "osu!";
}
}

View File

@ -2,11 +2,10 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using Newtonsoft.Json; using Newtonsoft.Json;
using osu.Framework.IO.Network;
namespace osu.Game.Online.API namespace osu.Game.Online.API
{ {
public class RegistrationRequest : WebRequest public class RegistrationRequest : OsuWebRequest
{ {
internal string Username; internal string Username;
internal string Email; internal string Email;

View File

@ -24,7 +24,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons
{ {
private readonly bool noVideo; private readonly bool noVideo;
public string TooltipText => button.Enabled.Value ? "Download this beatmap" : "Login to download"; public string TooltipText => button.Enabled.Value ? "download this beatmap" : "login to download";
private readonly IBindable<User> localUser = new Bindable<User>(); private readonly IBindable<User> localUser = new Bindable<User>();

View File

@ -48,7 +48,7 @@ namespace osu.Game.Overlays.Direct
if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false) if (BeatmapSet.Value.OnlineInfo.Availability?.DownloadDisabled ?? false)
{ {
button.Enabled.Value = false; button.Enabled.Value = false;
button.TooltipText = "This beatmap is currently not available for download."; button.TooltipText = "this beatmap is currently not available for download.";
return; return;
} }

View File

@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
public LevelBadge() public LevelBadge()
{ {
TooltipText = "Level"; TooltipText = "level";
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -25,7 +25,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
public LevelProgressBar() public LevelProgressBar()
{ {
TooltipText = "Progress to next level"; TooltipText = "progress to next level";
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
new SettingsButton new SettingsButton
{ {
Text = "Key configuration", Text = "Key configuration",
TooltipText = "Change global shortcut keys and gameplay bindings", TooltipText = "change global shortcut keys and gameplay bindings",
Action = keyConfig.ToggleVisibility Action = keyConfig.ToggleVisibility
}, },
}; };

View File

@ -87,7 +87,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input
private class SensitivitySlider : OsuSliderBar<double> private class SensitivitySlider : OsuSliderBar<double>
{ {
public override string TooltipText => Current.Disabled ? "Enable raw input to adjust sensitivity" : $"{base.TooltipText}x"; public override string TooltipText => Current.Disabled ? "enable raw input to adjust sensitivity" : $"{base.TooltipText}x";
} }
} }
} }

View File

@ -161,7 +161,7 @@ namespace osu.Game.Overlays.Settings
UpdateState(); UpdateState();
} }
public string TooltipText => "Revert to default"; public string TooltipText => "revert to default";
protected override bool OnClick(ClickEvent e) protected override bool OnClick(ClickEvent e)
{ {

View File

@ -74,15 +74,15 @@ namespace osu.Game.Screens.Ranking.Pages
switch (replayAvailability) switch (replayAvailability)
{ {
case ReplayAvailability.Local: case ReplayAvailability.Local:
button.TooltipText = @"Watch replay"; button.TooltipText = @"watch replay";
break; break;
case ReplayAvailability.Online: case ReplayAvailability.Online:
button.TooltipText = @"Download replay"; button.TooltipText = @"download replay";
break; break;
default: default:
button.TooltipText = @"Replay unavailable"; button.TooltipText = @"replay unavailable";
break; break;
} }
}, true); }, true);

View File

@ -39,7 +39,7 @@ namespace osu.Game.Screens.Ranking.Pages
}, },
}; };
TooltipText = "Retry"; TooltipText = "retry";
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]

View File

@ -7,8 +7,8 @@ using Newtonsoft.Json;
using osu.Framework; using osu.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.IO.Network;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Online.API;
using osu.Game.Overlays.Notifications; using osu.Game.Overlays.Notifications;
namespace osu.Game.Updater namespace osu.Game.Updater
@ -36,7 +36,7 @@ namespace osu.Game.Updater
{ {
try try
{ {
var releases = new JsonWebRequest<GitHubRelease>("https://api.github.com/repos/ppy/osu/releases/latest"); var releases = new OsuJsonWebRequest<GitHubRelease>("https://api.github.com/repos/ppy/osu/releases/latest");
await releases.PerformAsync(); await releases.PerformAsync();

View File

@ -74,7 +74,7 @@ namespace osu.Game.Users.Drawables
private class ClickableArea : OsuClickableContainer private class ClickableArea : OsuClickableContainer
{ {
public override string TooltipText => Enabled.Value ? @"View Profile" : null; public override string TooltipText => Enabled.Value ? @"view profile" : null;
protected override bool OnClick(ClickEvent e) protected override bool OnClick(ClickEvent e)
{ {