mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Merge pull request #11271 from peppy/dev-server
Prefer connecting to dev server when running in DEBUG
This commit is contained in:
@ -13,6 +13,7 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Online;
|
||||||
using osu.Game.Online.Spectator;
|
using osu.Game.Online.Spectator;
|
||||||
using osu.Game.Replays.Legacy;
|
using osu.Game.Replays.Legacy;
|
||||||
using osu.Game.Rulesets.Osu.Scoring;
|
using osu.Game.Rulesets.Osu.Scoring;
|
||||||
@ -87,6 +88,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
private readonly int totalUsers;
|
private readonly int totalUsers;
|
||||||
|
|
||||||
public TestMultiplayerStreaming(int totalUsers)
|
public TestMultiplayerStreaming(int totalUsers)
|
||||||
|
: base(new DevelopmentEndpointConfiguration())
|
||||||
{
|
{
|
||||||
this.totalUsers = totalUsers;
|
this.totalUsers = totalUsers;
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ using osu.Framework.Screens;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Framework.Utils;
|
using osu.Framework.Utils;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Online;
|
||||||
using osu.Game.Online.Spectator;
|
using osu.Game.Online.Spectator;
|
||||||
using osu.Game.Replays.Legacy;
|
using osu.Game.Replays.Legacy;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
@ -238,6 +239,11 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
private int beatmapId;
|
private int beatmapId;
|
||||||
|
|
||||||
|
public TestSpectatorStreamingClient()
|
||||||
|
: base(new DevelopmentEndpointConfiguration())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
protected override Task Connect()
|
protected override Task Connect()
|
||||||
{
|
{
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
|
@ -41,6 +41,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
[Ignore("needs to be updated to not be so server dependent")]
|
||||||
public void ShowWithBuild()
|
public void ShowWithBuild()
|
||||||
{
|
{
|
||||||
AddStep(@"Show with Lazer 2018.712.0", () =>
|
AddStep(@"Show with Lazer 2018.712.0", () =>
|
||||||
@ -49,7 +50,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
{
|
{
|
||||||
Version = "2018.712.0",
|
Version = "2018.712.0",
|
||||||
DisplayVersion = "2018.712.0",
|
DisplayVersion = "2018.712.0",
|
||||||
UpdateStream = new APIUpdateStream { Id = 7, Name = OsuGameBase.CLIENT_STREAM_NAME },
|
UpdateStream = new APIUpdateStream { Id = 5, Name = OsuGameBase.CLIENT_STREAM_NAME },
|
||||||
ChangelogEntries = new List<APIChangelogEntry>
|
ChangelogEntries = new List<APIChangelogEntry>
|
||||||
{
|
{
|
||||||
new APIChangelogEntry
|
new APIChangelogEntry
|
||||||
@ -64,7 +65,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
|
|
||||||
AddUntilStep(@"wait for streams", () => changelog.Streams?.Count > 0);
|
AddUntilStep(@"wait for streams", () => changelog.Streams?.Count > 0);
|
||||||
AddAssert(@"correct build displayed", () => changelog.Current.Value.Version == "2018.712.0");
|
AddAssert(@"correct build displayed", () => changelog.Current.Value.Version == "2018.712.0");
|
||||||
AddAssert(@"correct stream selected", () => changelog.Header.Streams.Current.Value.Id == 7);
|
AddAssert(@"correct stream selected", () => changelog.Header.Streams.Current.Value.Id == 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -70,7 +70,7 @@ namespace osu.Game.Tests.Visual.Online
|
|||||||
AddStep("Run command", () => Add(new NowPlayingCommand()));
|
AddStep("Run command", () => Add(new NowPlayingCommand()));
|
||||||
|
|
||||||
if (hasOnlineId)
|
if (hasOnlineId)
|
||||||
AddAssert("Check link presence", () => postTarget.LastMessage.Contains("https://osu.ppy.sh/b/1234"));
|
AddAssert("Check link presence", () => postTarget.LastMessage.Contains("/b/1234"));
|
||||||
else
|
else
|
||||||
AddAssert("Check link not present", () => !postTarget.LastMessage.Contains("https://"));
|
AddAssert("Check link not present", () => !postTarget.LastMessage.Contains("https://"));
|
||||||
}
|
}
|
||||||
|
19
osu.Game/Configuration/DevelopmentOsuConfigManager.cs
Normal file
19
osu.Game/Configuration/DevelopmentOsuConfigManager.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// 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.Platform;
|
||||||
|
using osu.Framework.Testing;
|
||||||
|
|
||||||
|
namespace osu.Game.Configuration
|
||||||
|
{
|
||||||
|
[ExcludeFromDynamicCompile]
|
||||||
|
public class DevelopmentOsuConfigManager : OsuConfigManager
|
||||||
|
{
|
||||||
|
protected override string Filename => base.Filename.Replace(".ini", ".dev.ini");
|
||||||
|
|
||||||
|
public DevelopmentOsuConfigManager(Storage storage)
|
||||||
|
: base(storage)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -26,12 +26,12 @@ namespace osu.Game.Online.API
|
|||||||
|
|
||||||
private readonly OAuth authentication;
|
private readonly OAuth authentication;
|
||||||
|
|
||||||
public string Endpoint => @"https://osu.ppy.sh";
|
|
||||||
private const string client_id = @"5";
|
|
||||||
private const string client_secret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk";
|
|
||||||
|
|
||||||
private readonly Queue<APIRequest> queue = new Queue<APIRequest>();
|
private readonly Queue<APIRequest> queue = new Queue<APIRequest>();
|
||||||
|
|
||||||
|
public string APIEndpointUrl { get; }
|
||||||
|
|
||||||
|
public string WebsiteRootUrl { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The username/email provided by the user when initiating a login.
|
/// The username/email provided by the user when initiating a login.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -55,11 +55,14 @@ namespace osu.Game.Online.API
|
|||||||
|
|
||||||
private readonly Logger log;
|
private readonly Logger log;
|
||||||
|
|
||||||
public APIAccess(OsuConfigManager config)
|
public APIAccess(OsuConfigManager config, EndpointConfiguration endpointConfiguration)
|
||||||
{
|
{
|
||||||
this.config = config;
|
this.config = config;
|
||||||
|
|
||||||
authentication = new OAuth(client_id, client_secret, Endpoint);
|
APIEndpointUrl = endpointConfiguration.APIEndpointUrl;
|
||||||
|
WebsiteRootUrl = endpointConfiguration.WebsiteRootUrl;
|
||||||
|
|
||||||
|
authentication = new OAuth(endpointConfiguration.APIClientID, endpointConfiguration.APIClientSecret, APIEndpointUrl);
|
||||||
log = Logger.GetLogger(LoggingTarget.Network);
|
log = Logger.GetLogger(LoggingTarget.Network);
|
||||||
|
|
||||||
ProvidedUsername = config.Get<string>(OsuSetting.Username);
|
ProvidedUsername = config.Get<string>(OsuSetting.Username);
|
||||||
@ -245,7 +248,7 @@ namespace osu.Game.Online.API
|
|||||||
|
|
||||||
var req = new RegistrationRequest
|
var req = new RegistrationRequest
|
||||||
{
|
{
|
||||||
Url = $@"{Endpoint}/users",
|
Url = $@"{APIEndpointUrl}/users",
|
||||||
Method = HttpMethod.Post,
|
Method = HttpMethod.Post,
|
||||||
Username = username,
|
Username = username,
|
||||||
Email = email,
|
Email = email,
|
||||||
|
@ -57,7 +57,7 @@ namespace osu.Game.Online.API
|
|||||||
|
|
||||||
protected virtual WebRequest CreateWebRequest() => new OsuWebRequest(Uri);
|
protected virtual WebRequest CreateWebRequest() => new OsuWebRequest(Uri);
|
||||||
|
|
||||||
protected virtual string Uri => $@"{API.Endpoint}/api/v2/{Target}";
|
protected virtual string Uri => $@"{API.APIEndpointUrl}/api/v2/{Target}";
|
||||||
|
|
||||||
protected APIAccess API;
|
protected APIAccess API;
|
||||||
protected WebRequest WebRequest;
|
protected WebRequest WebRequest;
|
||||||
|
@ -28,7 +28,9 @@ namespace osu.Game.Online.API
|
|||||||
|
|
||||||
public string ProvidedUsername => LocalUser.Value.Username;
|
public string ProvidedUsername => LocalUser.Value.Username;
|
||||||
|
|
||||||
public string Endpoint => "http://localhost";
|
public string APIEndpointUrl => "http://localhost";
|
||||||
|
|
||||||
|
public string WebsiteRootUrl => "http://localhost";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Provide handling logic for an arbitrary API request.
|
/// Provide handling logic for an arbitrary API request.
|
||||||
|
@ -46,7 +46,12 @@ namespace osu.Game.Online.API
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// The URL endpoint for this API. Does not include a trailing slash.
|
/// The URL endpoint for this API. Does not include a trailing slash.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
string Endpoint { get; }
|
string APIEndpointUrl { get; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The root URL of of the website, excluding the trailing slash.
|
||||||
|
/// </summary>
|
||||||
|
string WebsiteRootUrl { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current connection state of the API.
|
/// The current connection state of the API.
|
||||||
|
@ -48,6 +48,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
public enum ChangelogEntryType
|
public enum ChangelogEntryType
|
||||||
{
|
{
|
||||||
Add,
|
Add,
|
||||||
Fix
|
Fix,
|
||||||
|
Misc
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ namespace osu.Game.Online.Chat
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var beatmapString = beatmap.OnlineBeatmapID.HasValue ? $"[https://osu.ppy.sh/b/{beatmap.OnlineBeatmapID} {beatmap}]" : beatmap.ToString();
|
var beatmapString = beatmap.OnlineBeatmapID.HasValue ? $"[{api.WebsiteRootUrl}/b/{beatmap.OnlineBeatmapID} {beatmap}]" : beatmap.ToString();
|
||||||
|
|
||||||
channelManager.PostMessage($"is {verb} {beatmapString}", true);
|
channelManager.PostMessage($"is {verb} {beatmapString}", true);
|
||||||
Expire();
|
Expire();
|
||||||
|
17
osu.Game/Online/DevelopmentEndpointConfiguration.cs
Normal file
17
osu.Game/Online/DevelopmentEndpointConfiguration.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
namespace osu.Game.Online
|
||||||
|
{
|
||||||
|
public class DevelopmentEndpointConfiguration : EndpointConfiguration
|
||||||
|
{
|
||||||
|
public DevelopmentEndpointConfiguration()
|
||||||
|
{
|
||||||
|
WebsiteRootUrl = APIEndpointUrl = @"https://dev.ppy.sh";
|
||||||
|
APIClientSecret = @"3LP2mhUrV89xxzD1YKNndXHEhWWCRLPNKioZ9ymT";
|
||||||
|
APIClientID = "5";
|
||||||
|
SpectatorEndpointUrl = $"{APIEndpointUrl}/spectator";
|
||||||
|
MultiplayerEndpointUrl = $"{APIEndpointUrl}/multiplayer";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
41
osu.Game/Online/EndpointConfiguration.cs
Normal file
41
osu.Game/Online/EndpointConfiguration.cs
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
namespace osu.Game.Online
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Holds configuration for API endpoints.
|
||||||
|
/// </summary>
|
||||||
|
public class EndpointConfiguration
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// The base URL for the website.
|
||||||
|
/// </summary>
|
||||||
|
public string WebsiteRootUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The endpoint for the main (osu-web) API.
|
||||||
|
/// </summary>
|
||||||
|
public string APIEndpointUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The OAuth client secret.
|
||||||
|
/// </summary>
|
||||||
|
public string APIClientSecret { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The OAuth client ID.
|
||||||
|
/// </summary>
|
||||||
|
public string APIClientID { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The endpoint for the SignalR spectator server.
|
||||||
|
/// </summary>
|
||||||
|
public string SpectatorEndpointUrl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The endpoint for the SignalR multiplayer server.
|
||||||
|
/// </summary>
|
||||||
|
public string MultiplayerEndpointUrl { get; set; }
|
||||||
|
}
|
||||||
|
}
|
17
osu.Game/Online/ProductionEndpointConfiguration.cs
Normal file
17
osu.Game/Online/ProductionEndpointConfiguration.cs
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
namespace osu.Game.Online
|
||||||
|
{
|
||||||
|
public class ProductionEndpointConfiguration : EndpointConfiguration
|
||||||
|
{
|
||||||
|
public ProductionEndpointConfiguration()
|
||||||
|
{
|
||||||
|
WebsiteRootUrl = APIEndpointUrl = @"https://osu.ppy.sh";
|
||||||
|
APIClientSecret = @"FGc9GAtyHzeQDshWP5Ah7dega8hJACAJpQtw6OXk";
|
||||||
|
APIClientID = "5";
|
||||||
|
SpectatorEndpointUrl = "https://spectator.ppy.sh/spectator";
|
||||||
|
MultiplayerEndpointUrl = "https://spectator.ppy.sh/multiplayer";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -19,8 +19,6 @@ namespace osu.Game.Online.RealtimeMultiplayer
|
|||||||
{
|
{
|
||||||
public class RealtimeMultiplayerClient : StatefulMultiplayerClient
|
public class RealtimeMultiplayerClient : StatefulMultiplayerClient
|
||||||
{
|
{
|
||||||
private const string endpoint = "https://spectator.ppy.sh/multiplayer";
|
|
||||||
|
|
||||||
public override IBindable<bool> IsConnected => isConnected;
|
public override IBindable<bool> IsConnected => isConnected;
|
||||||
|
|
||||||
private readonly Bindable<bool> isConnected = new Bindable<bool>();
|
private readonly Bindable<bool> isConnected = new Bindable<bool>();
|
||||||
@ -31,6 +29,13 @@ namespace osu.Game.Online.RealtimeMultiplayer
|
|||||||
|
|
||||||
private HubConnection? connection;
|
private HubConnection? connection;
|
||||||
|
|
||||||
|
private readonly string endpoint;
|
||||||
|
|
||||||
|
public RealtimeMultiplayerClient(EndpointConfiguration endpoints)
|
||||||
|
{
|
||||||
|
endpoint = endpoints.MultiplayerEndpointUrl;
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
|
@ -81,6 +81,13 @@ namespace osu.Game.Online.Spectator
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event Action<int, SpectatorState> OnUserFinishedPlaying;
|
public event Action<int, SpectatorState> OnUserFinishedPlaying;
|
||||||
|
|
||||||
|
private readonly string endpoint;
|
||||||
|
|
||||||
|
public SpectatorStreamingClient(EndpointConfiguration endpoints)
|
||||||
|
{
|
||||||
|
endpoint = endpoints.SpectatorEndpointUrl;
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -104,8 +111,6 @@ namespace osu.Game.Online.Spectator
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private const string endpoint = "https://spectator.ppy.sh/spectator";
|
|
||||||
|
|
||||||
protected virtual async Task Connect()
|
protected virtual async Task Connect()
|
||||||
{
|
{
|
||||||
if (connection != null)
|
if (connection != null)
|
||||||
|
@ -294,7 +294,7 @@ namespace osu.Game
|
|||||||
public void OpenUrlExternally(string url) => waitForReady(() => externalLinkOpener, _ =>
|
public void OpenUrlExternally(string url) => waitForReady(() => externalLinkOpener, _ =>
|
||||||
{
|
{
|
||||||
if (url.StartsWith('/'))
|
if (url.StartsWith('/'))
|
||||||
url = $"{API.Endpoint}{url}";
|
url = $"{API.APIEndpointUrl}{url}";
|
||||||
|
|
||||||
externalLinkOpener.OpenUrlExternally(url);
|
externalLinkOpener.OpenUrlExternally(url);
|
||||||
});
|
});
|
||||||
|
@ -30,6 +30,7 @@ using osu.Game.Database;
|
|||||||
using osu.Game.Input;
|
using osu.Game.Input;
|
||||||
using osu.Game.Input.Bindings;
|
using osu.Game.Input.Bindings;
|
||||||
using osu.Game.IO;
|
using osu.Game.IO;
|
||||||
|
using osu.Game.Online;
|
||||||
using osu.Game.Online.RealtimeMultiplayer;
|
using osu.Game.Online.RealtimeMultiplayer;
|
||||||
using osu.Game.Online.Spectator;
|
using osu.Game.Online.Spectator;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
@ -54,6 +55,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
public const int SAMPLE_CONCURRENCY = 6;
|
public const int SAMPLE_CONCURRENCY = 6;
|
||||||
|
|
||||||
|
public bool UseDevelopmentServer { get; }
|
||||||
|
|
||||||
protected OsuConfigManager LocalConfig;
|
protected OsuConfigManager LocalConfig;
|
||||||
|
|
||||||
protected BeatmapManager BeatmapManager;
|
protected BeatmapManager BeatmapManager;
|
||||||
@ -132,6 +135,7 @@ namespace osu.Game
|
|||||||
|
|
||||||
public OsuGameBase()
|
public OsuGameBase()
|
||||||
{
|
{
|
||||||
|
UseDevelopmentServer = DebugUtils.IsDebugBuild;
|
||||||
Name = @"osu!lazer";
|
Name = @"osu!lazer";
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +174,7 @@ namespace osu.Game
|
|||||||
dependencies.Cache(largeStore);
|
dependencies.Cache(largeStore);
|
||||||
|
|
||||||
dependencies.CacheAs(this);
|
dependencies.CacheAs(this);
|
||||||
dependencies.Cache(LocalConfig);
|
dependencies.CacheAs(LocalConfig);
|
||||||
|
|
||||||
AddFont(Resources, @"Fonts/osuFont");
|
AddFont(Resources, @"Fonts/osuFont");
|
||||||
|
|
||||||
@ -210,10 +214,12 @@ namespace osu.Game
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
dependencies.CacheAs(API ??= new APIAccess(LocalConfig));
|
EndpointConfiguration endpoints = UseDevelopmentServer ? (EndpointConfiguration)new DevelopmentEndpointConfiguration() : new ProductionEndpointConfiguration();
|
||||||
|
|
||||||
dependencies.CacheAs(spectatorStreaming = new SpectatorStreamingClient());
|
dependencies.CacheAs(API ??= new APIAccess(LocalConfig, endpoints));
|
||||||
dependencies.CacheAs(multiplayerClient = new RealtimeMultiplayerClient());
|
|
||||||
|
dependencies.CacheAs(spectatorStreaming = new SpectatorStreamingClient(endpoints));
|
||||||
|
dependencies.CacheAs(multiplayerClient = new RealtimeMultiplayerClient(endpoints));
|
||||||
|
|
||||||
var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures);
|
var defaultBeatmap = new DummyWorkingBeatmap(Audio, Textures);
|
||||||
|
|
||||||
@ -369,7 +375,9 @@ namespace osu.Game
|
|||||||
// may be non-null for certain tests
|
// may be non-null for certain tests
|
||||||
Storage ??= host.Storage;
|
Storage ??= host.Storage;
|
||||||
|
|
||||||
LocalConfig ??= new OsuConfigManager(Storage);
|
LocalConfig ??= UseDevelopmentServer
|
||||||
|
? new DevelopmentOsuConfigManager(Storage)
|
||||||
|
: new OsuConfigManager(Storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Storage CreateStorage(GameHost host, Storage defaultStorage) => new OsuStorage(host, defaultStorage);
|
protected override Storage CreateStorage(GameHost host, Storage defaultStorage) => new OsuStorage(host, defaultStorage);
|
||||||
|
@ -15,6 +15,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online;
|
using osu.Game.Online;
|
||||||
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Overlays.BeatmapListing.Panels;
|
using osu.Game.Overlays.BeatmapListing.Panels;
|
||||||
using osu.Game.Overlays.BeatmapSet.Buttons;
|
using osu.Game.Overlays.BeatmapSet.Buttons;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
@ -40,6 +41,9 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
|
|
||||||
public bool DownloadButtonsVisible => downloadButtonsContainer.Any();
|
public bool DownloadButtonsVisible => downloadButtonsContainer.Any();
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
public BeatmapRulesetSelector RulesetSelector => beatmapSetHeader.RulesetSelector;
|
public BeatmapRulesetSelector RulesetSelector => beatmapSetHeader.RulesetSelector;
|
||||||
public readonly BeatmapPicker Picker;
|
public readonly BeatmapPicker Picker;
|
||||||
|
|
||||||
@ -213,7 +217,7 @@ namespace osu.Game.Overlays.BeatmapSet
|
|||||||
Picker.Beatmap.ValueChanged += b =>
|
Picker.Beatmap.ValueChanged += b =>
|
||||||
{
|
{
|
||||||
Details.Beatmap = b.NewValue;
|
Details.Beatmap = b.NewValue;
|
||||||
externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineBeatmapID}";
|
externalLink.Link = $@"{api.WebsiteRootUrl}/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineBeatmapID}";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,33 +131,36 @@ namespace osu.Game.Overlays.Changelog
|
|||||||
t.Padding = new MarginPadding { Left = 10 };
|
t.Padding = new MarginPadding { Left = 10 };
|
||||||
});
|
});
|
||||||
|
|
||||||
if (entry.GithubUser.UserId != null)
|
if (entry.GithubUser != null)
|
||||||
{
|
{
|
||||||
title.AddUserLink(new User
|
if (entry.GithubUser.UserId != null)
|
||||||
{
|
{
|
||||||
Username = entry.GithubUser.OsuUsername,
|
title.AddUserLink(new User
|
||||||
Id = entry.GithubUser.UserId.Value
|
{
|
||||||
}, t =>
|
Username = entry.GithubUser.OsuUsername,
|
||||||
|
Id = entry.GithubUser.UserId.Value
|
||||||
|
}, t =>
|
||||||
|
{
|
||||||
|
t.Font = fontMedium;
|
||||||
|
t.Colour = entryColour;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else if (entry.GithubUser.GithubUrl != null)
|
||||||
{
|
{
|
||||||
t.Font = fontMedium;
|
title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, t =>
|
||||||
t.Colour = entryColour;
|
{
|
||||||
});
|
t.Font = fontMedium;
|
||||||
}
|
t.Colour = entryColour;
|
||||||
else if (entry.GithubUser.GithubUrl != null)
|
});
|
||||||
{
|
}
|
||||||
title.AddLink(entry.GithubUser.DisplayName, entry.GithubUser.GithubUrl, t =>
|
else
|
||||||
{
|
{
|
||||||
t.Font = fontMedium;
|
title.AddText(entry.GithubUser.DisplayName, t =>
|
||||||
t.Colour = entryColour;
|
{
|
||||||
});
|
t.Font = fontMedium;
|
||||||
}
|
t.Colour = entryColour;
|
||||||
else
|
});
|
||||||
{
|
}
|
||||||
title.AddText(entry.GithubUser.DisplayName, t =>
|
|
||||||
{
|
|
||||||
t.Font = fontMedium;
|
|
||||||
t.Colour = entryColour;
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChangelogEntries.Add(titleContainer);
|
ChangelogEntries.Add(titleContainer);
|
||||||
|
@ -12,6 +12,7 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -27,6 +28,9 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
|
|
||||||
private Color4 iconColour;
|
private Color4 iconColour;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
public BottomHeaderContainer()
|
public BottomHeaderContainer()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
@ -109,7 +113,7 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
}
|
}
|
||||||
|
|
||||||
topLinkContainer.AddText("Contributed ");
|
topLinkContainer.AddText("Contributed ");
|
||||||
topLinkContainer.AddLink($@"{user.PostCount:#,##0} forum posts", $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: embolden);
|
topLinkContainer.AddLink($@"{user.PostCount:#,##0} forum posts", $"{api.WebsiteRootUrl}/users/{user.Id}/posts", creationParameters: embolden);
|
||||||
|
|
||||||
string websiteWithoutProtocol = user.Website;
|
string websiteWithoutProtocol = user.Website;
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ using osu.Framework.Graphics.Shapes;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Overlays.Profile.Header.Components;
|
using osu.Game.Overlays.Profile.Header.Components;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using osu.Game.Users.Drawables;
|
using osu.Game.Users.Drawables;
|
||||||
@ -23,6 +24,9 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
|
|
||||||
public readonly Bindable<User> User = new Bindable<User>();
|
public readonly Bindable<User> User = new Bindable<User>();
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private IAPIProvider api { get; set; }
|
||||||
|
|
||||||
private SupporterIcon supporterTag;
|
private SupporterIcon supporterTag;
|
||||||
private UpdateableAvatar avatar;
|
private UpdateableAvatar avatar;
|
||||||
private OsuSpriteText usernameText;
|
private OsuSpriteText usernameText;
|
||||||
@ -166,7 +170,7 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
{
|
{
|
||||||
avatar.User = user;
|
avatar.User = user;
|
||||||
usernameText.Text = user?.Username ?? string.Empty;
|
usernameText.Text = user?.Username ?? string.Empty;
|
||||||
openUserExternally.Link = $@"https://osu.ppy.sh/users/{user?.Id ?? 0}";
|
openUserExternally.Link = $@"{api.WebsiteRootUrl}/users/{user?.Id ?? 0}";
|
||||||
userFlag.Country = user?.Country;
|
userFlag.Country = user?.Country;
|
||||||
userCountryText.Text = user?.Country?.FullName ?? "Alien";
|
userCountryText.Text = user?.Country?.FullName ?? "Alien";
|
||||||
supporterTag.SupportLevel = user?.SupportLevel ?? 0;
|
supporterTag.SupportLevel = user?.SupportLevel ?? 0;
|
||||||
|
@ -216,7 +216,7 @@ namespace osu.Game.Overlays.Profile.Sections.Recent
|
|||||||
private void addBeatmapsetLink()
|
private void addBeatmapsetLink()
|
||||||
=> content.AddLink(activity.Beatmapset?.Title, LinkAction.OpenBeatmapSet, getLinkArgument(activity.Beatmapset?.Url), creationParameters: t => t.Font = getLinkFont());
|
=> content.AddLink(activity.Beatmapset?.Title, LinkAction.OpenBeatmapSet, getLinkArgument(activity.Beatmapset?.Url), creationParameters: t => t.Font = getLinkFont());
|
||||||
|
|
||||||
private string getLinkArgument(string url) => MessageFormatter.GetLinkDetails($"{api.Endpoint}{url}").Argument;
|
private string getLinkArgument(string url) => MessageFormatter.GetLinkDetails($"{api.APIEndpointUrl}{url}").Argument;
|
||||||
|
|
||||||
private FontUsage getLinkFont(FontWeight fontWeight = FontWeight.Regular)
|
private FontUsage getLinkFont(FontWeight fontWeight = FontWeight.Regular)
|
||||||
=> OsuFont.GetFont(size: font_size, weight: fontWeight, italics: true);
|
=> OsuFont.GetFont(size: font_size, weight: fontWeight, italics: true);
|
||||||
|
Reference in New Issue
Block a user