mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 12:42:54 +08:00
Merge branch 'master' into fix-api-request-abort
This commit is contained in:
commit
cbc504c1ed
@ -52,7 +52,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.722.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.723.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.Android" Version="2021.728.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Transitive Dependencies">
|
||||
<!-- Realm needs to be directly referenced in all Xamarin projects, as it will not pull in its transitive dependencies otherwise. -->
|
||||
|
@ -130,7 +130,8 @@ namespace osu.Game.Rulesets.Catch
|
||||
return new Mod[]
|
||||
{
|
||||
new MultiMod(new ModWindUp(), new ModWindDown()),
|
||||
new CatchModFloatingFruits()
|
||||
new CatchModFloatingFruits(),
|
||||
new CatchModMuted(),
|
||||
};
|
||||
|
||||
default:
|
||||
|
12
osu.Game.Rulesets.Catch/Mods/CatchModMuted.cs
Normal file
12
osu.Game.Rulesets.Catch/Mods/CatchModMuted.cs
Normal file
@ -0,0 +1,12 @@
|
||||
// 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.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.Mods
|
||||
{
|
||||
public class CatchModMuted : ModMuted<CatchHitObject>
|
||||
{
|
||||
}
|
||||
}
|
@ -253,7 +253,8 @@ namespace osu.Game.Rulesets.Mania
|
||||
case ModType.Fun:
|
||||
return new Mod[]
|
||||
{
|
||||
new MultiMod(new ModWindUp(), new ModWindDown())
|
||||
new MultiMod(new ModWindUp(), new ModWindDown()),
|
||||
new ManiaModMuted(),
|
||||
};
|
||||
|
||||
default:
|
||||
|
12
osu.Game.Rulesets.Mania/Mods/ManiaModMuted.cs
Normal file
12
osu.Game.Rulesets.Mania/Mods/ManiaModMuted.cs
Normal file
@ -0,0 +1,12 @@
|
||||
// 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.Game.Rulesets.Mania.Objects;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
|
||||
namespace osu.Game.Rulesets.Mania.Mods
|
||||
{
|
||||
public class ManiaModMuted : ModMuted<ManiaHitObject>
|
||||
{
|
||||
}
|
||||
}
|
12
osu.Game.Rulesets.Osu/Mods/OsuModMuted.cs
Normal file
12
osu.Game.Rulesets.Osu/Mods/OsuModMuted.cs
Normal file
@ -0,0 +1,12 @@
|
||||
// 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.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Mods
|
||||
{
|
||||
public class OsuModMuted : ModMuted<OsuHitObject>
|
||||
{
|
||||
}
|
||||
}
|
@ -4,8 +4,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@ -16,7 +14,6 @@ using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Beatmaps.Timing;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Overlays.Settings;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
@ -29,7 +26,6 @@ using osu.Game.Rulesets.Osu.UI;
|
||||
using osu.Game.Rulesets.Osu.Utils;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -67,11 +63,6 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
/// </summary>
|
||||
private const float distance_cap = 380f;
|
||||
|
||||
// The distances from the hit objects to the borders of the playfield they start to "turn around" and curve towards the middle.
|
||||
// The closer the hit objects draw to the border, the sharper the turn
|
||||
private const byte border_distance_x = 192;
|
||||
private const byte border_distance_y = 144;
|
||||
|
||||
/// <summary>
|
||||
/// The extent of rotation towards playfield centre when a circle is near the edge
|
||||
/// </summary>
|
||||
@ -341,46 +332,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
|
||||
public void ApplyToDrawableRuleset(DrawableRuleset<OsuHitObject> drawableRuleset)
|
||||
{
|
||||
drawableRuleset.Overlays.Add(new TargetBeatContainer(drawableRuleset.Beatmap.HitObjects.First().StartTime));
|
||||
}
|
||||
|
||||
public class TargetBeatContainer : BeatSyncedContainer
|
||||
{
|
||||
private readonly double firstHitTime;
|
||||
|
||||
private PausableSkinnableSound sample;
|
||||
|
||||
public TargetBeatContainer(double firstHitTime)
|
||||
{
|
||||
this.firstHitTime = firstHitTime;
|
||||
AllowMistimedEventFiring = false;
|
||||
Divisor = 1;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
sample = new PausableSkinnableSound(new SampleInfo("Gameplay/catch-banana"))
|
||||
};
|
||||
}
|
||||
|
||||
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
|
||||
{
|
||||
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
|
||||
|
||||
if (!IsBeatSyncedWithTrack) return;
|
||||
|
||||
int timeSignature = (int)timingPoint.TimeSignature;
|
||||
|
||||
// play metronome from one measure before the first object.
|
||||
if (BeatSyncClock.CurrentTime < firstHitTime - timingPoint.BeatLength * timeSignature)
|
||||
return;
|
||||
|
||||
sample.Frequency.Value = beatIndex % timeSignature == 0 ? 1 : 0.5f;
|
||||
sample.Play();
|
||||
}
|
||||
drawableRuleset.Overlays.Add(new Metronome(drawableRuleset.Beatmap.HitObjects.First().StartTime));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -189,6 +189,7 @@ namespace osu.Game.Rulesets.Osu
|
||||
new OsuModTraceable(),
|
||||
new OsuModBarrelRoll(),
|
||||
new OsuModApproachDifferent(),
|
||||
new OsuModMuted(),
|
||||
};
|
||||
|
||||
case ModType.System:
|
||||
|
12
osu.Game.Rulesets.Taiko/Mods/TaikoModMuted.cs
Normal file
12
osu.Game.Rulesets.Taiko/Mods/TaikoModMuted.cs
Normal file
@ -0,0 +1,12 @@
|
||||
// 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.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Taiko.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Taiko.Mods
|
||||
{
|
||||
public class TaikoModMuted : ModMuted<TaikoHitObject>
|
||||
{
|
||||
}
|
||||
}
|
@ -149,7 +149,8 @@ namespace osu.Game.Rulesets.Taiko
|
||||
case ModType.Fun:
|
||||
return new Mod[]
|
||||
{
|
||||
new MultiMod(new ModWindUp(), new ModWindDown())
|
||||
new MultiMod(new ModWindUp(), new ModWindDown()),
|
||||
new TaikoModMuted(),
|
||||
};
|
||||
|
||||
default:
|
||||
|
@ -1,21 +1,18 @@
|
||||
// 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 System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Tournament.Configuration;
|
||||
using osu.Game.Tests;
|
||||
using osu.Game.Tournament.Configuration;
|
||||
|
||||
namespace osu.Game.Tournament.Tests.NonVisual
|
||||
{
|
||||
[TestFixture]
|
||||
public class CustomTourneyDirectoryTest
|
||||
public class CustomTourneyDirectoryTest : TournamentHostTest
|
||||
{
|
||||
[Test]
|
||||
public void TestDefaultDirectory()
|
||||
@ -24,7 +21,7 @@ namespace osu.Game.Tournament.Tests.NonVisual
|
||||
{
|
||||
try
|
||||
{
|
||||
var osu = loadOsu(host);
|
||||
var osu = LoadTournament(host);
|
||||
var storage = osu.Dependencies.Get<Storage>();
|
||||
|
||||
Assert.That(storage.GetFullPath("."), Is.EqualTo(Path.Combine(host.Storage.GetFullPath("."), "tournaments", "default")));
|
||||
@ -54,7 +51,7 @@ namespace osu.Game.Tournament.Tests.NonVisual
|
||||
|
||||
try
|
||||
{
|
||||
var osu = loadOsu(host);
|
||||
var osu = LoadTournament(host);
|
||||
|
||||
storage = osu.Dependencies.Get<Storage>();
|
||||
|
||||
@ -111,7 +108,7 @@ namespace osu.Game.Tournament.Tests.NonVisual
|
||||
|
||||
try
|
||||
{
|
||||
var osu = loadOsu(host);
|
||||
var osu = LoadTournament(host);
|
||||
|
||||
var storage = osu.Dependencies.Get<Storage>();
|
||||
|
||||
@ -151,25 +148,6 @@ namespace osu.Game.Tournament.Tests.NonVisual
|
||||
}
|
||||
}
|
||||
|
||||
private TournamentGameBase loadOsu(GameHost host)
|
||||
{
|
||||
var osu = new TournamentGameBase();
|
||||
Task.Run(() => host.Run(osu))
|
||||
.ContinueWith(t => Assert.Fail($"Host threw exception {t.Exception}"), TaskContinuationOptions.OnlyOnFaulted);
|
||||
waitForOrAssert(() => osu.IsLoaded, @"osu! failed to start in a reasonable amount of time");
|
||||
return osu;
|
||||
}
|
||||
|
||||
private static void waitForOrAssert(Func<bool> result, string failureMessage, int timeout = 90000)
|
||||
{
|
||||
Task task = Task.Run(() =>
|
||||
{
|
||||
while (!result()) Thread.Sleep(200);
|
||||
});
|
||||
|
||||
Assert.IsTrue(task.Wait(timeout), failureMessage);
|
||||
}
|
||||
|
||||
private string basePath(string testInstance) => Path.Combine(RuntimeInfo.StartupDirectory, "headless", testInstance);
|
||||
}
|
||||
}
|
||||
|
45
osu.Game.Tournament.Tests/NonVisual/DataLoadTest.cs
Normal file
45
osu.Game.Tournament.Tests/NonVisual/DataLoadTest.cs
Normal file
@ -0,0 +1,45 @@
|
||||
// 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 System.IO;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Platform;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Tests;
|
||||
|
||||
namespace osu.Game.Tournament.Tests.NonVisual
|
||||
{
|
||||
public class DataLoadTest : TournamentHostTest
|
||||
{
|
||||
[Test]
|
||||
public void TestUnavailableRuleset()
|
||||
{
|
||||
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(TestUnavailableRuleset)))
|
||||
{
|
||||
try
|
||||
{
|
||||
var osu = new TestTournament();
|
||||
|
||||
LoadTournament(host, osu);
|
||||
var storage = osu.Dependencies.Get<Storage>();
|
||||
|
||||
Assert.That(storage.GetFullPath("."), Is.EqualTo(Path.Combine(host.Storage.GetFullPath("."), "tournaments", "default")));
|
||||
}
|
||||
finally
|
||||
{
|
||||
host.Exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TestTournament : TournamentGameBase
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
Ruleset.Value = new RulesetInfo(); // not available
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,10 +1,7 @@
|
||||
// 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 System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
@ -15,7 +12,7 @@ using osu.Game.Tournament.IPC;
|
||||
namespace osu.Game.Tournament.Tests.NonVisual
|
||||
{
|
||||
[TestFixture]
|
||||
public class IPCLocationTest
|
||||
public class IPCLocationTest : TournamentHostTest
|
||||
{
|
||||
[Test]
|
||||
public void CheckIPCLocation()
|
||||
@ -34,11 +31,11 @@ namespace osu.Game.Tournament.Tests.NonVisual
|
||||
|
||||
try
|
||||
{
|
||||
var osu = loadOsu(host);
|
||||
var osu = LoadTournament(host);
|
||||
TournamentStorage storage = (TournamentStorage)osu.Dependencies.Get<Storage>();
|
||||
FileBasedIPC ipc = null;
|
||||
|
||||
waitForOrAssert(() => (ipc = osu.Dependencies.Get<MatchIPCInfo>() as FileBasedIPC) != null, @"ipc could not be populated in a reasonable amount of time");
|
||||
WaitForOrAssert(() => (ipc = osu.Dependencies.Get<MatchIPCInfo>() as FileBasedIPC) != null, @"ipc could not be populated in a reasonable amount of time");
|
||||
|
||||
Assert.True(ipc.SetIPCLocation(testStableInstallDirectory));
|
||||
Assert.True(storage.AllTournaments.Exists("stable.json"));
|
||||
@ -51,24 +48,5 @@ namespace osu.Game.Tournament.Tests.NonVisual
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private TournamentGameBase loadOsu(GameHost host)
|
||||
{
|
||||
var osu = new TournamentGameBase();
|
||||
Task.Run(() => host.Run(osu))
|
||||
.ContinueWith(t => Assert.Fail($"Host threw exception {t.Exception}"), TaskContinuationOptions.OnlyOnFaulted);
|
||||
waitForOrAssert(() => osu.IsLoaded, @"osu! failed to start in a reasonable amount of time");
|
||||
return osu;
|
||||
}
|
||||
|
||||
private static void waitForOrAssert(Func<bool> result, string failureMessage, int timeout = 90000)
|
||||
{
|
||||
Task task = Task.Run(() =>
|
||||
{
|
||||
while (!result()) Thread.Sleep(200);
|
||||
});
|
||||
|
||||
Assert.IsTrue(task.Wait(timeout), failureMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
33
osu.Game.Tournament.Tests/NonVisual/TournamentHostTest.cs
Normal file
33
osu.Game.Tournament.Tests/NonVisual/TournamentHostTest.cs
Normal file
@ -0,0 +1,33 @@
|
||||
// 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 System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Platform;
|
||||
|
||||
namespace osu.Game.Tournament.Tests.NonVisual
|
||||
{
|
||||
public abstract class TournamentHostTest
|
||||
{
|
||||
public static TournamentGameBase LoadTournament(GameHost host, TournamentGameBase tournament = null)
|
||||
{
|
||||
tournament ??= new TournamentGameBase();
|
||||
Task.Run(() => host.Run(tournament))
|
||||
.ContinueWith(t => Assert.Fail($"Host threw exception {t.Exception}"), TaskContinuationOptions.OnlyOnFaulted);
|
||||
WaitForOrAssert(() => tournament.IsLoaded, @"osu! failed to start in a reasonable amount of time");
|
||||
return tournament;
|
||||
}
|
||||
|
||||
public static void WaitForOrAssert(Func<bool> result, string failureMessage, int timeout = 90000)
|
||||
{
|
||||
Task task = Task.Run(() =>
|
||||
{
|
||||
while (!result()) Thread.Sleep(200);
|
||||
});
|
||||
|
||||
Assert.IsTrue(task.Wait(timeout), failureMessage);
|
||||
}
|
||||
}
|
||||
}
|
@ -66,7 +66,9 @@ namespace osu.Game.Tournament
|
||||
}
|
||||
|
||||
ladder ??= new LadderInfo();
|
||||
ladder.Ruleset.Value ??= RulesetStore.AvailableRulesets.First();
|
||||
|
||||
ladder.Ruleset.Value = RulesetStore.GetRuleset(ladder.Ruleset.Value?.ShortName)
|
||||
?? RulesetStore.AvailableRulesets.First();
|
||||
|
||||
bool addedInfo = false;
|
||||
|
||||
|
@ -1058,7 +1058,7 @@ namespace osu.Game
|
||||
OverlayActivationMode.BindTo(newOsuScreen.OverlayActivationMode);
|
||||
API.Activity.BindTo(newOsuScreen.Activity);
|
||||
|
||||
MusicController.AllowRateAdjustments = newOsuScreen.AllowRateAdjustments;
|
||||
MusicController.AllowTrackAdjustments = newOsuScreen.AllowTrackAdjustments;
|
||||
|
||||
if (newOsuScreen.HideOverlaysOnEnter)
|
||||
CloseAllOverlays();
|
||||
|
@ -479,7 +479,7 @@ namespace osu.Game
|
||||
if (r.NewValue?.Available != true)
|
||||
{
|
||||
// reject the change if the ruleset is not available.
|
||||
Ruleset.Value = r.OldValue;
|
||||
Ruleset.Value = r.OldValue?.Available == true ? r.OldValue : RulesetStore.AvailableRulesets.First();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,8 @@ using osu.Game.Scoring;
|
||||
using osu.Game.Users.Drawables;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
{
|
||||
@ -211,11 +213,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
return content.ToArray();
|
||||
}
|
||||
|
||||
protected override Drawable CreateHeader(int index, TableColumn column) => new HeaderText(column?.Header ?? string.Empty);
|
||||
protected override Drawable CreateHeader(int index, TableColumn column) => new HeaderText(column?.Header ?? default);
|
||||
|
||||
private class HeaderText : OsuSpriteText
|
||||
{
|
||||
public HeaderText(string text)
|
||||
public HeaderText(LocalisableString text)
|
||||
{
|
||||
Text = text.ToUpper();
|
||||
Font = OsuFont.GetFont(size: 10, weight: FontWeight.Bold);
|
||||
|
@ -400,35 +400,38 @@ namespace osu.Game.Overlays
|
||||
NextTrack();
|
||||
}
|
||||
|
||||
private bool allowRateAdjustments;
|
||||
private bool allowTrackAdjustments;
|
||||
|
||||
/// <summary>
|
||||
/// Whether mod rate adjustments are allowed to be applied.
|
||||
/// Whether mod track adjustments are allowed to be applied.
|
||||
/// </summary>
|
||||
public bool AllowRateAdjustments
|
||||
public bool AllowTrackAdjustments
|
||||
{
|
||||
get => allowRateAdjustments;
|
||||
get => allowTrackAdjustments;
|
||||
set
|
||||
{
|
||||
if (allowRateAdjustments == value)
|
||||
if (allowTrackAdjustments == value)
|
||||
return;
|
||||
|
||||
allowRateAdjustments = value;
|
||||
allowTrackAdjustments = value;
|
||||
ResetTrackAdjustments();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resets the speed adjustments currently applied on <see cref="CurrentTrack"/> and applies the mod adjustments if <see cref="AllowRateAdjustments"/> is <c>true</c>.
|
||||
/// Resets the adjustments currently applied on <see cref="CurrentTrack"/> and applies the mod adjustments if <see cref="AllowTrackAdjustments"/> is <c>true</c>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Does not reset speed adjustments applied directly to the beatmap track.
|
||||
/// Does not reset any adjustments applied directly to the beatmap track.
|
||||
/// </remarks>
|
||||
public void ResetTrackAdjustments()
|
||||
{
|
||||
CurrentTrack.ResetSpeedAdjustments();
|
||||
CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Balance);
|
||||
CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Frequency);
|
||||
CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Tempo);
|
||||
CurrentTrack.RemoveAllAdjustments(AdjustableProperty.Volume);
|
||||
|
||||
if (allowRateAdjustments)
|
||||
if (allowTrackAdjustments)
|
||||
{
|
||||
foreach (var mod in mods.Value.OfType<IApplicableToTrack>())
|
||||
mod.ApplyToTrack(CurrentTrack);
|
||||
|
@ -13,6 +13,7 @@ using osu.Framework.Extensions.IEnumerableExtensions;
|
||||
using osu.Game.Users;
|
||||
using osu.Game.Users.Drawables;
|
||||
using osuTK;
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Overlays.Rankings.Tables
|
||||
{
|
||||
@ -74,7 +75,7 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
|
||||
protected override Drawable CreateHeader(int index, TableColumn column)
|
||||
{
|
||||
var title = column?.Header ?? string.Empty;
|
||||
var title = column?.Header ?? default;
|
||||
return new HeaderText(title, title == HighlightedColumn);
|
||||
}
|
||||
|
||||
@ -109,7 +110,7 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
{
|
||||
private readonly bool isHighlighted;
|
||||
|
||||
public HeaderText(string text, bool isHighlighted)
|
||||
public HeaderText(LocalisableString text, bool isHighlighted)
|
||||
{
|
||||
this.isHighlighted = isHighlighted;
|
||||
|
||||
|
@ -9,6 +9,7 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Users;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Framework.Localisation;
|
||||
|
||||
namespace osu.Game.Overlays.Rankings.Tables
|
||||
{
|
||||
@ -31,8 +32,8 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
|
||||
protected override Drawable CreateHeader(int index, TableColumn column)
|
||||
{
|
||||
var title = column?.Header ?? string.Empty;
|
||||
return new UserTableHeaderText(title, HighlightedColumn == title, GradeColumns.Contains(title));
|
||||
var title = column?.Header ?? default;
|
||||
return new UserTableHeaderText(title, HighlightedColumn == title, GradeColumns.Contains(title.ToString()));
|
||||
}
|
||||
|
||||
protected sealed override Country GetCountry(UserStatistics item) => item.User.Country;
|
||||
@ -66,7 +67,7 @@ namespace osu.Game.Overlays.Rankings.Tables
|
||||
|
||||
private class UserTableHeaderText : HeaderText
|
||||
{
|
||||
public UserTableHeaderText(string text, bool isHighlighted, bool isGrade)
|
||||
public UserTableHeaderText(LocalisableString text, bool isHighlighted, bool isGrade)
|
||||
: base(text, isHighlighted)
|
||||
{
|
||||
Margin = new MarginPadding
|
||||
|
53
osu.Game/Rulesets/Mods/Metronome.cs
Normal file
53
osu.Game/Rulesets/Mods/Metronome.cs
Normal file
@ -0,0 +1,53 @@
|
||||
// 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.Track;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Skinning;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public class Metronome : BeatSyncedContainer
|
||||
{
|
||||
private readonly double firstHitTime;
|
||||
|
||||
private PausableSkinnableSound sample;
|
||||
|
||||
/// <param name="firstHitTime">Start time of the first hit object, used for providing a count down.</param>
|
||||
public Metronome(double firstHitTime)
|
||||
{
|
||||
this.firstHitTime = firstHitTime;
|
||||
AllowMistimedEventFiring = false;
|
||||
Divisor = 1;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
sample = new PausableSkinnableSound(new SampleInfo("Gameplay/catch-banana"))
|
||||
};
|
||||
}
|
||||
|
||||
protected override void OnNewBeat(int beatIndex, TimingControlPoint timingPoint, EffectControlPoint effectPoint, ChannelAmplitudes amplitudes)
|
||||
{
|
||||
base.OnNewBeat(beatIndex, timingPoint, effectPoint, amplitudes);
|
||||
|
||||
if (!IsBeatSyncedWithTrack) return;
|
||||
|
||||
int timeSignature = (int)timingPoint.TimeSignature;
|
||||
|
||||
// play metronome from one measure before the first object.
|
||||
if (BeatSyncClock.CurrentTime < firstHitTime - timingPoint.BeatLength * timeSignature)
|
||||
return;
|
||||
|
||||
sample.Frequency.Value = beatIndex % timeSignature == 0 ? 1 : 0.5f;
|
||||
sample.Play();
|
||||
}
|
||||
}
|
||||
}
|
48
osu.Game/Rulesets/Mods/ModMuted.cs
Normal file
48
osu.Game/Rulesets/Mods/ModMuted.cs
Normal file
@ -0,0 +1,48 @@
|
||||
// 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 System.Linq;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Rulesets.Objects;
|
||||
using osu.Game.Rulesets.UI;
|
||||
|
||||
namespace osu.Game.Rulesets.Mods
|
||||
{
|
||||
public abstract class ModMuted : Mod
|
||||
{
|
||||
public override string Name => "Muted";
|
||||
public override string Acronym => "MU";
|
||||
public override IconUsage? Icon => FontAwesome.Solid.VolumeMute;
|
||||
public override string Description => "Can you still feel the rhythm without music?";
|
||||
public override ModType Type => ModType.Fun;
|
||||
public override double ScoreMultiplier => 1;
|
||||
}
|
||||
|
||||
public abstract class ModMuted<TObject> : ModMuted, IApplicableToDrawableRuleset<TObject>, IApplicableToTrack
|
||||
where TObject : HitObject
|
||||
{
|
||||
private readonly BindableNumber<double> volumeAdjust = new BindableDouble();
|
||||
|
||||
[SettingSource("Enable metronome", "Add a metronome to help you keep track of the rhythm.")]
|
||||
public BindableBool EnableMetronome { get; } = new BindableBool
|
||||
{
|
||||
Default = true,
|
||||
Value = true
|
||||
};
|
||||
|
||||
public void ApplyToTrack(ITrack track)
|
||||
{
|
||||
track.AddAdjustment(AdjustableProperty.Volume, volumeAdjust);
|
||||
}
|
||||
|
||||
public void ApplyToDrawableRuleset(DrawableRuleset<TObject> drawableRuleset)
|
||||
{
|
||||
if (EnableMetronome.Value)
|
||||
drawableRuleset.Overlays.Add(new Metronome(drawableRuleset.Beatmap.HitObjects.First().StartTime));
|
||||
}
|
||||
}
|
||||
}
|
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Edit
|
||||
|
||||
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
||||
|
||||
public override bool AllowRateAdjustments => false;
|
||||
public override bool AllowTrackAdjustments => false;
|
||||
|
||||
protected bool HasUnsavedChanges => lastSavedHash != changeHandler.CurrentStateHash;
|
||||
|
||||
|
@ -2,10 +2,12 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
@ -42,11 +44,11 @@ namespace osu.Game.Screens.Edit
|
||||
});
|
||||
}
|
||||
|
||||
protected override Drawable CreateHeader(int index, TableColumn column) => new HeaderText(column?.Header ?? string.Empty);
|
||||
protected override Drawable CreateHeader(int index, TableColumn column) => new HeaderText(column?.Header ?? default);
|
||||
|
||||
private class HeaderText : OsuSpriteText
|
||||
{
|
||||
public HeaderText(string text)
|
||||
public HeaderText(LocalisableString text)
|
||||
{
|
||||
Text = text.ToUpper();
|
||||
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold);
|
||||
|
@ -59,9 +59,9 @@ namespace osu.Game.Screens
|
||||
Bindable<RulesetInfo> Ruleset { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether mod rate adjustments are allowed to be applied.
|
||||
/// Whether mod track adjustments are allowed to be applied.
|
||||
/// </summary>
|
||||
bool AllowRateAdjustments { get; }
|
||||
bool AllowTrackAdjustments { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Invoked when the back button has been pressed to close any overlays before exiting this <see cref="IOsuScreen"/>.
|
||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
public override bool AllowExternalScreenChange => true;
|
||||
|
||||
public override bool AllowRateAdjustments => false;
|
||||
public override bool AllowTrackAdjustments => false;
|
||||
|
||||
private Screen songSelect;
|
||||
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
||||
|
||||
// We are managing our own adjustments. For now, this happens inside the Player instances themselves.
|
||||
public override bool AllowRateAdjustments => false;
|
||||
public override bool AllowTrackAdjustments => false;
|
||||
|
||||
/// <summary>
|
||||
/// Whether all spectating players have finished loading.
|
||||
|
@ -81,7 +81,7 @@ namespace osu.Game.Screens
|
||||
|
||||
public virtual float BackgroundParallaxAmount => 1;
|
||||
|
||||
public virtual bool AllowRateAdjustments => true;
|
||||
public virtual bool AllowTrackAdjustments => true;
|
||||
|
||||
public Bindable<WorkingBeatmap> Beatmap { get; private set; }
|
||||
|
||||
|
@ -56,7 +56,7 @@ namespace osu.Game.Screens.Play
|
||||
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.UserTriggered;
|
||||
|
||||
// We are managing our own adjustments (see OnEntering/OnExiting).
|
||||
public override bool AllowRateAdjustments => false;
|
||||
public override bool AllowTrackAdjustments => false;
|
||||
|
||||
private readonly IBindable<bool> gameActive = new Bindable<bool>(true);
|
||||
|
||||
|
@ -16,7 +16,7 @@ namespace osu.Game.Screens
|
||||
|
||||
public override bool CursorVisible => false;
|
||||
|
||||
public override bool AllowRateAdjustments => false;
|
||||
public override bool AllowTrackAdjustments => false;
|
||||
|
||||
protected override OverlayActivation InitialOverlayActivationMode => OverlayActivation.Disabled;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Realm" Version="10.3.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2021.723.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2021.728.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.722.0" />
|
||||
<PackageReference Include="Sentry" Version="3.8.2" />
|
||||
<PackageReference Include="SharpCompress" Version="0.28.3" />
|
||||
|
@ -70,7 +70,7 @@
|
||||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Label="Package References">
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.723.0" />
|
||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2021.728.0" />
|
||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2021.722.0" />
|
||||
</ItemGroup>
|
||||
<!-- See https://github.com/dotnet/runtime/issues/35988 (can be removed after Xamarin uses net5.0 / net6.0) -->
|
||||
@ -93,7 +93,7 @@
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2021.723.0" />
|
||||
<PackageReference Include="ppy.osu.Framework" Version="2021.728.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.28.3" />
|
||||
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
|
Loading…
Reference in New Issue
Block a user