1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 17:27:48 +08:00

Merge branch 'master' into realm-integration/score-and-beatmaps

This commit is contained in:
Dean Herbert 2022-01-17 12:29:02 +09:00
commit 5601f6f1fe
12 changed files with 118 additions and 80 deletions

View File

@ -51,7 +51,7 @@
<Reference Include="Java.Interop" /> <Reference Include="Java.Interop" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.114.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2022.115.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2022.111.0" /> <PackageReference Include="ppy.osu.Framework.Android" Version="2022.111.0" />
</ItemGroup> </ItemGroup>
<ItemGroup Label="Transitive Dependencies"> <ItemGroup Label="Transitive Dependencies">

View File

@ -10,14 +10,11 @@ using System.Runtime.Versioning;
using System.Threading.Tasks; using System.Threading.Tasks;
using Microsoft.Win32; using Microsoft.Win32;
using osu.Desktop.Security; using osu.Desktop.Security;
using osu.Desktop.Overlays;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game; using osu.Game;
using osu.Desktop.Updater; using osu.Desktop.Updater;
using osu.Framework; using osu.Framework;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Framework.Screens;
using osu.Game.Screens.Menu;
using osu.Game.Updater; using osu.Game.Updater;
using osu.Desktop.Windows; using osu.Desktop.Windows;
using osu.Framework.Threading; using osu.Framework.Threading;
@ -27,13 +24,9 @@ namespace osu.Desktop
{ {
internal class OsuGameDesktop : OsuGame internal class OsuGameDesktop : OsuGame
{ {
private readonly bool noVersionOverlay;
private VersionManager versionManager;
public OsuGameDesktop(string[] args = null) public OsuGameDesktop(string[] args = null)
: base(args) : base(args)
{ {
noVersionOverlay = args?.Any(a => a == "--no-version-overlay") ?? false;
} }
public override StableStorage GetStorageForStableInstall() public override StableStorage GetStorageForStableInstall()
@ -114,9 +107,6 @@ namespace osu.Desktop
{ {
base.LoadComplete(); base.LoadComplete();
if (!noVersionOverlay)
LoadComponentAsync(versionManager = new VersionManager { Depth = int.MinValue }, ScreenContainer.Add);
LoadComponentAsync(new DiscordRichPresence(), Add); LoadComponentAsync(new DiscordRichPresence(), Add);
if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows) if (RuntimeInfo.OS == RuntimeInfo.Platform.Windows)
@ -125,23 +115,6 @@ namespace osu.Desktop
LoadComponentAsync(new ElevatedPrivilegesChecker(), Add); LoadComponentAsync(new ElevatedPrivilegesChecker(), Add);
} }
protected override void ScreenChanged(IScreen lastScreen, IScreen newScreen)
{
base.ScreenChanged(lastScreen, newScreen);
switch (newScreen)
{
case IntroScreen _:
case MainMenu _:
versionManager?.Show();
break;
default:
versionManager?.Hide();
break;
}
}
public override void SetHost(GameHost host) public override void SetHost(GameHost host)
{ {
base.SetHost(host); base.SetHost(host);

View File

@ -4,11 +4,14 @@ Version: 2.5
[Mania] [Mania]
Keys: 4 Keys: 4
ColumnLineWidth: 3,1,3,1,1 ColumnLineWidth: 3,1,3,1,1
Hit0: mania/hit0 // some skins found in the wild had configuration keys where the @2x suffix was included in the values.
Hit50: mania/hit50 // the expected compatibility behaviour is that the presence of the @2x suffix shouldn't change anything
Hit100: mania/hit100 // if @2x assets are present.
Hit200: mania/hit200 Hit0: mania/hit0@2x
Hit300: mania/hit300 Hit50: mania/hit50@2x
Hit300g: mania/hit300g Hit100: mania/hit100@2x
Hit200: mania/hit200@2x
Hit300: mania/hit300@2x
Hit300g: mania/hit300g@2x
StageLeft: mania/stage-left StageLeft: mania/stage-left
StageRight: mania/stage-right StageRight: mania/stage-right

View File

@ -5,8 +5,10 @@ using System;
using System.Linq; using System.Linq;
using osu.Framework.Extensions; using osu.Framework.Extensions;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Testing;
using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Judgements;
using osu.Game.Rulesets.Mania.Scoring; using osu.Game.Rulesets.Mania.Scoring;
using osu.Game.Rulesets.Mania.Skinning.Legacy;
using osu.Game.Rulesets.Mania.UI; using osu.Game.Rulesets.Mania.UI;
using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.Scoring;
@ -23,15 +25,24 @@ namespace osu.Game.Rulesets.Mania.Tests.Skinning
{ {
if (hitWindows.IsHitResultAllowed(result)) if (hitWindows.IsHitResultAllowed(result))
{ {
AddStep("Show " + result.GetDescription(), () => SetContents(_ => AddStep("Show " + result.GetDescription(), () =>
new DrawableManiaJudgement(new JudgementResult(new HitObject { StartTime = Time.Current }, new Judgement()) {
{ SetContents(_ =>
Type = result new DrawableManiaJudgement(new JudgementResult(new HitObject { StartTime = Time.Current }, new Judgement())
}, null) {
{ Type = result
Anchor = Anchor.Centre, }, null)
Origin = Anchor.Centre, {
})); Anchor = Anchor.Centre,
Origin = Anchor.Centre,
});
// for test purposes, undo the Y adjustment related to the `ScorePosition` legacy positioning config value
// (see `LegacyManiaJudgementPiece.load()`).
// this prevents the judgements showing somewhere below or above the bounding box of the judgement.
foreach (var legacyPiece in this.ChildrenOfType<LegacyManiaJudgementPiece>())
legacyPiece.Y = 0;
});
} }
} }
} }

View File

@ -154,6 +154,8 @@ namespace osu.Game
private MainMenu menuScreen; private MainMenu menuScreen;
private VersionManager versionManager;
[CanBeNull] [CanBeNull]
private IntroScreen introScreen; private IntroScreen introScreen;
@ -746,6 +748,9 @@ namespace osu.Game
ScreenStack.ScreenPushed += screenPushed; ScreenStack.ScreenPushed += screenPushed;
ScreenStack.ScreenExited += screenExited; ScreenStack.ScreenExited += screenExited;
if (!args?.Any(a => a == @"--no-version-overlay") ?? true)
loadComponentSingleFile(versionManager = new VersionManager { Depth = int.MinValue }, ScreenContainer.Add);
loadComponentSingleFile(osuLogo, logo => loadComponentSingleFile(osuLogo, logo =>
{ {
logoContainer.Add(logo); logoContainer.Add(logo);
@ -1129,10 +1134,16 @@ namespace osu.Game
{ {
case IntroScreen intro: case IntroScreen intro:
introScreen = intro; introScreen = intro;
versionManager?.Show();
break; break;
case MainMenu menu: case MainMenu menu:
menuScreen = menu; menuScreen = menu;
versionManager?.Show();
break;
default:
versionManager?.Hide();
break; break;
} }

View File

@ -7,13 +7,12 @@ using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
namespace osu.Desktop.Overlays namespace osu.Game.Overlays
{ {
public class VersionManager : VisibilityContainer public class VersionManager : VisibilityContainer
{ {

View File

@ -21,6 +21,7 @@ using osu.Game.Overlays.Mods;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Screens.OnlinePlay.Match.Components; using osu.Game.Screens.OnlinePlay.Match.Components;
using osu.Game.Screens.OnlinePlay.Multiplayer;
namespace osu.Game.Screens.OnlinePlay.Match namespace osu.Game.Screens.OnlinePlay.Match
{ {
@ -101,6 +102,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
beatmapAvailabilityTracker, beatmapAvailabilityTracker,
new MultiplayerRoomSounds(),
new GridContainer new GridContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,

View File

@ -0,0 +1,65 @@
// 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.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Game.Online.API.Requests.Responses;
using osu.Game.Online.Multiplayer;
namespace osu.Game.Screens.OnlinePlay.Multiplayer
{
public class MultiplayerRoomSounds : MultiplayerRoomComposite
{
private Sample hostChangedSample;
private Sample userJoinedSample;
private Sample userLeftSample;
private Sample userKickedSample;
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
hostChangedSample = audio.Samples.Get(@"Multiplayer/host-changed");
userJoinedSample = audio.Samples.Get(@"Multiplayer/player-joined");
userLeftSample = audio.Samples.Get(@"Multiplayer/player-left");
userKickedSample = audio.Samples.Get(@"Multiplayer/player-kicked");
}
protected override void LoadComplete()
{
base.LoadComplete();
Host.BindValueChanged(hostChanged);
}
protected override void UserJoined(MultiplayerRoomUser user)
{
base.UserJoined(user);
userJoinedSample?.Play();
}
protected override void UserLeft(MultiplayerRoomUser user)
{
base.UserLeft(user);
userLeftSample?.Play();
}
protected override void UserKicked(MultiplayerRoomUser user)
{
base.UserKicked(user);
userKickedSample?.Play();
}
private void hostChanged(ValueChangedEvent<APIUser> value)
{
// only play sound when the host changes from an already-existing host.
if (value.OldValue == null) return;
hostChangedSample?.Play();
}
}
}

View File

@ -4,12 +4,10 @@
using System.Linq; using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Audio; using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Cursor; using osu.Game.Graphics.Cursor;
using osu.Game.Online.Multiplayer;
using osuTK; using osuTK;
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
@ -18,10 +16,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
{ {
private FillFlowContainer<ParticipantPanel> panels; private FillFlowContainer<ParticipantPanel> panels;
private Sample userJoinSample;
private Sample userLeftSample;
private Sample userKickedSample;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio) private void load(AudioManager audio)
{ {
@ -41,31 +35,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Participants
} }
} }
}; };
userJoinSample = audio.Samples.Get(@"Multiplayer/player-joined");
userLeftSample = audio.Samples.Get(@"Multiplayer/player-left");
userKickedSample = audio.Samples.Get(@"Multiplayer/player-kicked");
}
protected override void UserJoined(MultiplayerRoomUser user)
{
base.UserJoined(user);
userJoinSample?.Play();
}
protected override void UserLeft(MultiplayerRoomUser user)
{
base.UserLeft(user);
userLeftSample?.Play();
}
protected override void UserKicked(MultiplayerRoomUser user)
{
base.UserKicked(user);
userKickedSample?.Play();
} }
protected override void OnRoomUpdated() protected override void OnRoomUpdated()

View File

@ -474,13 +474,18 @@ namespace osu.Game.Skinning
{ {
foreach (string name in getFallbackNames(componentName)) foreach (string name in getFallbackNames(componentName))
{ {
// some component names (especially user-controlled ones, like `HitX` in mania)
// may contain `@2x` scale specifications.
// stable happens to check for that and strip them, so do the same to match stable behaviour.
string lookupName = name.Replace(@"@2x", string.Empty);
float ratio = 2; float ratio = 2;
var texture = Textures?.Get($"{name}@2x", wrapModeS, wrapModeT); var texture = Textures?.Get(@$"{lookupName}@2x", wrapModeS, wrapModeT);
if (texture == null) if (texture == null)
{ {
ratio = 1; ratio = 1;
texture = Textures?.Get(name, wrapModeS, wrapModeT); texture = Textures?.Get(lookupName, wrapModeS, wrapModeT);
} }
if (texture == null) if (texture == null)

View File

@ -37,7 +37,7 @@
</PackageReference> </PackageReference>
<PackageReference Include="Realm" Version="10.7.1" /> <PackageReference Include="Realm" Version="10.7.1" />
<PackageReference Include="ppy.osu.Framework" Version="2022.111.0" /> <PackageReference Include="ppy.osu.Framework" Version="2022.111.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.114.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2022.115.0" />
<PackageReference Include="Sentry" Version="3.12.1" /> <PackageReference Include="Sentry" Version="3.12.1" />
<PackageReference Include="SharpCompress" Version="0.30.1" /> <PackageReference Include="SharpCompress" Version="0.30.1" />
<PackageReference Include="NUnit" Version="3.13.2" /> <PackageReference Include="NUnit" Version="3.13.2" />

View File

@ -61,7 +61,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup Label="Package References"> <ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Framework.iOS" Version="2022.111.0" /> <PackageReference Include="ppy.osu.Framework.iOS" Version="2022.111.0" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2022.114.0" /> <PackageReference Include="ppy.osu.Game.Resources" Version="2022.115.0" />
</ItemGroup> </ItemGroup>
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) --> <!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
<PropertyGroup> <PropertyGroup>