mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:07:52 +08:00
Merge branch 'master' into fix-results-f-rank
This commit is contained in:
commit
ad69259eb8
@ -3,13 +3,13 @@
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"jetbrains.resharper.globaltools": {
|
||||
"version": "2022.2.3",
|
||||
"version": "2023.3.3",
|
||||
"commands": [
|
||||
"jb"
|
||||
]
|
||||
},
|
||||
"nvika": {
|
||||
"version": "2.2.0",
|
||||
"version": "3.0.0",
|
||||
"commands": [
|
||||
"nvika"
|
||||
]
|
||||
|
@ -1,5 +1,3 @@
|
||||
is_global = true
|
||||
|
||||
# .NET Code Style
|
||||
# IDE styles reference: https://docs.microsoft.com/dotnet/fundamentals/code-analysis/style-rules/
|
||||
|
||||
@ -56,4 +54,4 @@ dotnet_diagnostic.RS0030.severity = error
|
||||
|
||||
# Temporarily disable analysing CanBeNull = true in NRT contexts due to mobile issues.
|
||||
# See: https://github.com/ppy/osu/pull/19677
|
||||
dotnet_diagnostic.OSUF001.severity = none
|
||||
dotnet_diagnostic.OSUF001.severity = none
|
||||
|
@ -15,6 +15,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
public abstract int KeyCount { get; }
|
||||
public override ModType Type => ModType.Conversion;
|
||||
public override double ScoreMultiplier => 1; // TODO: Implement the mania key mod score multiplier
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
|
||||
public void ApplyToBeatmapConverter(IBeatmapConverter beatmapConverter)
|
||||
{
|
||||
|
@ -8,5 +8,6 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
public class ManiaModHardRock : ModHardRock
|
||||
{
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override bool Ranked => false;
|
||||
}
|
||||
}
|
||||
|
@ -11,5 +11,6 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
public override string Name => "One Key";
|
||||
public override string Acronym => "1K";
|
||||
public override LocalisableString Description => @"Play with one key.";
|
||||
public override bool Ranked => false;
|
||||
}
|
||||
}
|
||||
|
@ -11,5 +11,6 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
public override string Name => "Ten Keys";
|
||||
public override string Acronym => "10K";
|
||||
public override LocalisableString Description => @"Play with ten keys.";
|
||||
public override bool Ranked => false;
|
||||
}
|
||||
}
|
||||
|
@ -11,5 +11,6 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
public override string Name => "Two Keys";
|
||||
public override string Acronym => "2K";
|
||||
public override LocalisableString Description => @"Play with two keys.";
|
||||
public override bool Ranked => false;
|
||||
}
|
||||
}
|
||||
|
@ -11,5 +11,6 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
public override string Name => "Three Keys";
|
||||
public override string Acronym => "3K";
|
||||
public override LocalisableString Description => @"Play with three keys.";
|
||||
public override bool Ranked => false;
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
||||
public class ManiaModMirror : ModMirror, IApplicableToBeatmap
|
||||
{
|
||||
public override LocalisableString Description => "Notes are flipped horizontally.";
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
|
||||
public void ApplyToBeatmap(IBeatmap beatmap)
|
||||
{
|
||||
|
@ -206,7 +206,7 @@ namespace osu.Game.Rulesets.Osu.Tests.Editor
|
||||
{
|
||||
AddStep($"click context menu item \"{contextMenuText}\"", () =>
|
||||
{
|
||||
MenuItem item = visualiser.ContextMenuItems.FirstOrDefault(menuItem => menuItem.Text.Value == "Curve type")?.Items.FirstOrDefault(menuItem => menuItem.Text.Value == contextMenuText);
|
||||
MenuItem item = visualiser.ContextMenuItems!.FirstOrDefault(menuItem => menuItem.Text.Value == "Curve type")?.Items.FirstOrDefault(menuItem => menuItem.Text.Value == contextMenuText);
|
||||
|
||||
item?.Action.Value?.Invoke();
|
||||
});
|
||||
|
@ -183,7 +183,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
break;
|
||||
}
|
||||
|
||||
hitObjectContainer.Add(drawableObject);
|
||||
hitObjectContainer.Add(drawableObject!);
|
||||
followPointRenderer.AddFollowPoints(objects[i]);
|
||||
}
|
||||
});
|
||||
|
@ -6,6 +6,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
@ -173,6 +174,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
|
||||
public IEnumerable<ISkin> AllSources => new[] { this };
|
||||
|
||||
[CanBeNull]
|
||||
public event Action SourceChanged;
|
||||
|
||||
private bool enabled = true;
|
||||
|
@ -22,6 +22,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
public override LocalisableString Description => @"Spinners will be automatically completed.";
|
||||
public override double ScoreMultiplier => 0.9;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(OsuModAutopilot), typeof(OsuModTargetPractice) };
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
|
||||
public void ApplyToDrawableHitObject(DrawableHitObject hitObject)
|
||||
{
|
||||
|
@ -10,5 +10,6 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
public class OsuModTouchDevice : ModTouchDevice
|
||||
{
|
||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(OsuModAutopilot) }).ToArray();
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
}
|
||||
}
|
||||
|
@ -179,10 +179,9 @@ namespace osu.Game.Rulesets.Taiko.UI
|
||||
TaikoAction taikoAction = getTaikoActionFromPosition(position);
|
||||
|
||||
// Not too sure how this can happen, but let's avoid throwing.
|
||||
if (trackedActions.ContainsKey(source))
|
||||
if (!trackedActions.TryAdd(source, taikoAction))
|
||||
return;
|
||||
|
||||
trackedActions.Add(source, taikoAction);
|
||||
keyBindingContainer.TriggerPressed(taikoAction);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using osu.Game.Beatmaps;
|
||||
@ -98,9 +99,10 @@ namespace osu.Game.Tests.Beatmaps
|
||||
Beatmap = beatmap;
|
||||
}
|
||||
|
||||
#pragma warning disable CS0067
|
||||
[CanBeNull]
|
||||
public event Action<HitObject, IEnumerable<HitObject>> ObjectConverted;
|
||||
|
||||
protected virtual void OnObjectConverted(HitObject arg1, IEnumerable<HitObject> arg2) => ObjectConverted?.Invoke(arg1, arg2);
|
||||
#pragma warning restore CS0067
|
||||
|
||||
public IBeatmap Beatmap { get; }
|
||||
|
||||
|
@ -79,7 +79,7 @@ namespace osu.Game.Tests.Database
|
||||
Assert.That(realm.Run(r => r.Find<RulesetInfo>(rulesetShortName)!.Available), Is.True);
|
||||
|
||||
// Availability is updated on construction of a RealmRulesetStore
|
||||
var _ = new RealmRulesetStore(realm, storage);
|
||||
_ = new RealmRulesetStore(realm, storage);
|
||||
|
||||
Assert.That(realm.Run(r => r.Find<RulesetInfo>(rulesetShortName)!.Available), Is.False);
|
||||
});
|
||||
@ -104,13 +104,13 @@ namespace osu.Game.Tests.Database
|
||||
Assert.That(realm.Run(r => r.Find<RulesetInfo>(rulesetShortName)!.Available), Is.True);
|
||||
|
||||
// Availability is updated on construction of a RealmRulesetStore
|
||||
var _ = new RealmRulesetStore(realm, storage);
|
||||
_ = new RealmRulesetStore(realm, storage);
|
||||
|
||||
Assert.That(realm.Run(r => r.Find<RulesetInfo>(rulesetShortName)!.Available), Is.False);
|
||||
|
||||
// Simulate the ruleset getting updated
|
||||
LoadTestRuleset.Version = Ruleset.CURRENT_RULESET_API_VERSION;
|
||||
var __ = new RealmRulesetStore(realm, storage);
|
||||
_ = new RealmRulesetStore(realm, storage);
|
||||
|
||||
Assert.That(realm.Run(r => r.Find<RulesetInfo>(rulesetShortName)!.Available), Is.True);
|
||||
});
|
||||
|
@ -203,9 +203,9 @@ namespace osu.Game.Tests.Gameplay
|
||||
|
||||
public IRenderer Renderer => host.Renderer;
|
||||
public AudioManager AudioManager => Audio;
|
||||
public IResourceStore<byte[]> Files => null;
|
||||
public IResourceStore<byte[]> Files => null!;
|
||||
public new IResourceStore<byte[]> Resources => base.Resources;
|
||||
public RealmAccess RealmAccess => null;
|
||||
public RealmAccess RealmAccess => null!;
|
||||
public IResourceStore<TextureUpload> CreateTextureLoaderStore(IResourceStore<byte[]> underlyingStore) => null;
|
||||
|
||||
#endregion
|
||||
|
@ -56,9 +56,9 @@ namespace osu.Game.Tests.Rulesets
|
||||
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type) => new Mod[] { null };
|
||||
|
||||
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => null;
|
||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => null;
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => null;
|
||||
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => null!;
|
||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => null!;
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => null!;
|
||||
}
|
||||
|
||||
private class TestAPIIncompatibleRuleset : Ruleset
|
||||
@ -69,9 +69,9 @@ namespace osu.Game.Tests.Rulesets
|
||||
// simulate API incompatibility by throwing similar exceptions.
|
||||
public override IEnumerable<Mod> GetModsFor(ModType type) => throw new MissingMethodException();
|
||||
|
||||
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => null;
|
||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => null;
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => null;
|
||||
public override DrawableRuleset CreateDrawableRulesetWith(IBeatmap beatmap, IReadOnlyList<Mod> mods = null) => null!;
|
||||
public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => null!;
|
||||
public override DifficultyCalculator CreateDifficultyCalculator(IWorkingBeatmap beatmap) => null!;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
|
||||
AddStep("dismiss prompt", () =>
|
||||
{
|
||||
var button = DialogOverlay.CurrentDialog.Buttons.Last();
|
||||
var button = DialogOverlay.CurrentDialog!.Buttons.Last();
|
||||
InputManager.MoveMouseTo(button);
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
@ -167,7 +167,7 @@ namespace osu.Game.Tests.Visual.Editing
|
||||
});
|
||||
AddUntilStep("save prompt shown", () => DialogOverlay.CurrentDialog is SaveRequiredPopupDialog);
|
||||
|
||||
AddStep("save changes", () => DialogOverlay.CurrentDialog.PerformOkAction());
|
||||
AddStep("save changes", () => DialogOverlay.CurrentDialog!.PerformOkAction());
|
||||
|
||||
EditorPlayer editorPlayer = null;
|
||||
AddUntilStep("player pushed", () => (editorPlayer = Stack.CurrentScreen as EditorPlayer) != null);
|
||||
|
@ -120,7 +120,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
playbackManager?.ReplayInputHandler.SetFrameFromTime(Time.Current - 100);
|
||||
playbackManager?.ReplayInputHandler?.SetFrameFromTime(Time.Current - 100);
|
||||
}
|
||||
|
||||
[TearDownSteps]
|
||||
|
@ -198,7 +198,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
||||
foreach (var legacyFrame in frames.Frames)
|
||||
{
|
||||
var frame = new TestReplayFrame();
|
||||
frame.FromLegacy(legacyFrame, null);
|
||||
frame.FromLegacy(legacyFrame, null!);
|
||||
playbackReplay.Frames.Add(frame);
|
||||
}
|
||||
|
||||
|
@ -250,7 +250,7 @@ namespace osu.Game.Tests.Visual.Menus
|
||||
{
|
||||
}
|
||||
|
||||
public virtual IBindable<int> UnreadCount => null;
|
||||
public virtual IBindable<int> UnreadCount { get; } = new Bindable<int>();
|
||||
|
||||
public IEnumerable<Notification> AllNotifications => Enumerable.Empty<Notification>();
|
||||
}
|
||||
|
@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
.SkipWhile(r => r.Room.Category.Value == RoomCategory.Spotlight)
|
||||
.All(r => r.Room.Category.Value == RoomCategory.Normal));
|
||||
|
||||
AddStep("remove first room", () => RoomManager.RemoveRoom(RoomManager.Rooms.FirstOrDefault(r => r.RoomID.Value == 0)));
|
||||
AddStep("remove first room", () => RoomManager.RemoveRoom(RoomManager.Rooms.First(r => r.RoomID.Value == 0)));
|
||||
AddAssert("has 4 rooms", () => container.Rooms.Count == 4);
|
||||
AddAssert("first room removed", () => container.Rooms.All(r => r.Room.RoomID.Value != 0));
|
||||
|
||||
|
@ -10,6 +10,7 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Testing;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays;
|
||||
@ -67,5 +68,34 @@ namespace osu.Game.Tests.Visual.Online
|
||||
});
|
||||
AddUntilStep("overlay is hidden", () => accountCreation.State.Value == Visibility.Hidden);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestFullFlow()
|
||||
{
|
||||
AddStep("log out", () => API.Logout());
|
||||
|
||||
AddStep("show manually", () => accountCreation.Show());
|
||||
AddUntilStep("overlay is visible", () => accountCreation.State.Value == Visibility.Visible);
|
||||
|
||||
AddStep("click button", () => accountCreation.ChildrenOfType<SettingsButton>().Single().TriggerClick());
|
||||
AddUntilStep("warning screen is present", () => accountCreation.ChildrenOfType<ScreenWarning>().SingleOrDefault()?.IsPresent == true);
|
||||
|
||||
AddStep("proceed", () => accountCreation.ChildrenOfType<DangerousSettingsButton>().Single().TriggerClick());
|
||||
AddUntilStep("entry screen is present", () => accountCreation.ChildrenOfType<ScreenEntry>().SingleOrDefault()?.IsPresent == true);
|
||||
|
||||
AddStep("input details", () =>
|
||||
{
|
||||
var entryScreen = accountCreation.ChildrenOfType<ScreenEntry>().Single();
|
||||
entryScreen.ChildrenOfType<OsuTextBox>().ElementAt(0).Text = "new_user";
|
||||
entryScreen.ChildrenOfType<OsuTextBox>().ElementAt(1).Text = "new.user@fake.mail";
|
||||
entryScreen.ChildrenOfType<OsuTextBox>().ElementAt(2).Text = "password";
|
||||
});
|
||||
AddStep("click button", () => accountCreation.ChildrenOfType<ScreenEntry>().Single()
|
||||
.ChildrenOfType<SettingsButton>().Single().TriggerClick());
|
||||
AddUntilStep("verification screen is present", () => accountCreation.ChildrenOfType<ScreenEmailVerification>().SingleOrDefault()?.IsPresent == true);
|
||||
|
||||
AddStep("verify", () => ((DummyAPIAccess)API).AuthenticateSecondFactor("abcdefgh"));
|
||||
AddUntilStep("overlay is hidden", () => accountCreation.State.Value == Visibility.Hidden);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
||||
|
||||
public IBindable<bool> InitialRoomsReceived { get; } = new Bindable<bool>(true);
|
||||
|
||||
public IBindableList<Room> Rooms => null;
|
||||
public IBindableList<Room> Rooms => null!;
|
||||
|
||||
public void AddOrUpdateRoom(Room room) => throw new NotImplementedException();
|
||||
|
||||
|
@ -52,11 +52,11 @@ namespace osu.Game.Tests.Visual.Playlists
|
||||
[SetUpSteps]
|
||||
public void SetupSteps()
|
||||
{
|
||||
AddStep("set room", () => SelectedRoom.Value = new Room());
|
||||
AddStep("set room", () => SelectedRoom!.Value = new Room());
|
||||
|
||||
importBeatmap();
|
||||
|
||||
AddStep("load match", () => LoadScreen(match = new TestPlaylistsRoomSubScreen(SelectedRoom.Value)));
|
||||
AddStep("load match", () => LoadScreen(match = new TestPlaylistsRoomSubScreen(SelectedRoom!.Value)));
|
||||
AddUntilStep("wait for load", () => match.IsCurrentScreen());
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
||||
});
|
||||
});
|
||||
|
||||
AddAssert("first playlist item selected", () => match.SelectedItem.Value == SelectedRoom.Value.Playlist[0]);
|
||||
AddAssert("first playlist item selected", () => match.SelectedItem.Value == SelectedRoom!.Value.Playlist[0]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@ -201,7 +201,7 @@ namespace osu.Game.Tests.Visual.Playlists
|
||||
|
||||
private void setupAndCreateRoom(Action<Room> room)
|
||||
{
|
||||
AddStep("setup room", () => room(SelectedRoom.Value));
|
||||
AddStep("setup room", () => room(SelectedRoom!.Value));
|
||||
|
||||
AddStep("click create button", () =>
|
||||
{
|
||||
|
@ -486,7 +486,7 @@ namespace osu.Game.Tests.Visual.Ranking
|
||||
|
||||
private class RulesetWithNoPerformanceCalculator : OsuRuleset
|
||||
{
|
||||
public override PerformanceCalculator CreatePerformanceCalculator() => null;
|
||||
public override PerformanceCalculator CreatePerformanceCalculator() => null!;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,7 +213,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
}
|
||||
|
||||
public virtual IBindable<int> UnreadCount => null;
|
||||
public virtual IBindable<int> UnreadCount { get; } = new Bindable<int>();
|
||||
|
||||
public IEnumerable<Notification> AllNotifications => Enumerable.Empty<Notification>();
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu.Mods;
|
||||
@ -67,6 +68,15 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddAssert(@"Check empty multiplier", () => assertModsMultiplier(Array.Empty<Mod>()));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestUnrankedBadge()
|
||||
{
|
||||
AddStep(@"Add unranked mod", () => changeMods(new[] { new OsuModDeflate() }));
|
||||
AddAssert("Unranked badge shown", () => footerButtonMods.UnrankedBadge.Alpha == 1);
|
||||
AddStep(@"Clear selected mod", () => changeMods(Array.Empty<Mod>()));
|
||||
AddAssert("Unranked badge not shown", () => footerButtonMods.UnrankedBadge.Alpha == 0);
|
||||
}
|
||||
|
||||
private void changeMods(IReadOnlyList<Mod> mods)
|
||||
{
|
||||
footerButtonMods.Current.Value = mods;
|
||||
@ -83,6 +93,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
private partial class TestFooterButtonMods : FooterButtonMods
|
||||
{
|
||||
public new OsuSpriteText MultiplierText => base.MultiplierText;
|
||||
public new Drawable UnrankedBadge => base.UnrankedBadge;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddAssert("mod multiplier correct", () =>
|
||||
{
|
||||
double multiplier = SelectedMods.Value.Aggregate(1d, (m, mod) => m * mod.ScoreMultiplier);
|
||||
return Precision.AlmostEquals(multiplier, modSelectOverlay.ChildrenOfType<ScoreMultiplierDisplay>().Single().Current.Value);
|
||||
return Precision.AlmostEquals(multiplier, modSelectOverlay.ChildrenOfType<RankingInformationDisplay>().Single().ModMultiplier.Value);
|
||||
});
|
||||
assertCustomisationToggleState(disabled: false, active: false);
|
||||
AddAssert("setting items created", () => modSelectOverlay.ChildrenOfType<ISettingsItem>().Any());
|
||||
@ -134,7 +134,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddAssert("mod multiplier correct", () =>
|
||||
{
|
||||
double multiplier = SelectedMods.Value.Aggregate(1d, (m, mod) => m * mod.ScoreMultiplier);
|
||||
return Precision.AlmostEquals(multiplier, modSelectOverlay.ChildrenOfType<ScoreMultiplierDisplay>().Single().Current.Value);
|
||||
return Precision.AlmostEquals(multiplier, modSelectOverlay.ChildrenOfType<RankingInformationDisplay>().Single().ModMultiplier.Value);
|
||||
});
|
||||
assertCustomisationToggleState(disabled: false, active: false);
|
||||
AddAssert("setting items created", () => modSelectOverlay.ChildrenOfType<ISettingsItem>().Any());
|
||||
@ -846,7 +846,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
InputManager.Click(MouseButton.Left);
|
||||
});
|
||||
AddAssert("difficulty multiplier display shows correct value",
|
||||
() => modSelectOverlay.ChildrenOfType<ScoreMultiplierDisplay>().Single().Current.Value, () => Is.EqualTo(0.1).Within(Precision.DOUBLE_EPSILON));
|
||||
() => modSelectOverlay.ChildrenOfType<RankingInformationDisplay>().Single().ModMultiplier.Value, () => Is.EqualTo(0.1).Within(Precision.DOUBLE_EPSILON));
|
||||
|
||||
// this is highly unorthodox in a test, but because the `ModSettingChangeTracker` machinery heavily leans on events and object disposal and re-creation,
|
||||
// it is instrumental in the reproduction of the failure scenario that this test is supposed to cover.
|
||||
@ -856,7 +856,7 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
AddStep("reset half time speed to default", () => modSelectOverlay.ChildrenOfType<ModSettingsArea>().Single()
|
||||
.ChildrenOfType<RevertToDefaultButton<double>>().Single().TriggerClick());
|
||||
AddUntilStep("difficulty multiplier display shows correct value",
|
||||
() => modSelectOverlay.ChildrenOfType<ScoreMultiplierDisplay>().Single().Current.Value, () => Is.EqualTo(0.3).Within(Precision.DOUBLE_EPSILON));
|
||||
() => modSelectOverlay.ChildrenOfType<RankingInformationDisplay>().Single().ModMultiplier.Value, () => Is.EqualTo(0.3).Within(Precision.DOUBLE_EPSILON));
|
||||
}
|
||||
|
||||
private void waitForColumnLoad() => AddUntilStep("all column content loaded", () =>
|
||||
|
@ -11,7 +11,7 @@ using osu.Game.Overlays.Mods;
|
||||
namespace osu.Game.Tests.Visual.UserInterface
|
||||
{
|
||||
[TestFixture]
|
||||
public partial class TestSceneScoreMultiplierDisplay : OsuTestScene
|
||||
public partial class TestSceneRankingInformationDisplay : OsuTestScene
|
||||
{
|
||||
[Cached]
|
||||
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green);
|
||||
@ -19,22 +19,24 @@ namespace osu.Game.Tests.Visual.UserInterface
|
||||
[Test]
|
||||
public void TestBasic()
|
||||
{
|
||||
ScoreMultiplierDisplay multiplierDisplay = null!;
|
||||
RankingInformationDisplay onlinePropertiesDisplay = null!;
|
||||
|
||||
AddStep("create content", () => Child = multiplierDisplay = new ScoreMultiplierDisplay
|
||||
AddStep("create content", () => Child = onlinePropertiesDisplay = new RankingInformationDisplay
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre
|
||||
});
|
||||
|
||||
AddStep("set multiplier below 1", () => multiplierDisplay.Current.Value = 0.5);
|
||||
AddStep("set multiplier to 1", () => multiplierDisplay.Current.Value = 1);
|
||||
AddStep("set multiplier above 1", () => multiplierDisplay.Current.Value = 1.5);
|
||||
AddToggleStep("toggle ranked", ranked => onlinePropertiesDisplay.Ranked.Value = ranked);
|
||||
|
||||
AddStep("set multiplier below 1", () => onlinePropertiesDisplay.ModMultiplier.Value = 0.5);
|
||||
AddStep("set multiplier to 1", () => onlinePropertiesDisplay.ModMultiplier.Value = 1);
|
||||
AddStep("set multiplier above 1", () => onlinePropertiesDisplay.ModMultiplier.Value = 1.5);
|
||||
|
||||
AddSliderStep("set multiplier", 0, 2, 1d, multiplier =>
|
||||
{
|
||||
if (multiplierDisplay.IsNotNull())
|
||||
multiplierDisplay.Current.Value = multiplier;
|
||||
if (onlinePropertiesDisplay.IsNotNull())
|
||||
onlinePropertiesDisplay.ModMultiplier.Value = multiplier;
|
||||
});
|
||||
}
|
||||
}
|
@ -567,10 +567,9 @@ namespace osu.Game.Beatmaps.Formats
|
||||
for (int i = pendingControlPoints.Count - 1; i >= 0; i--)
|
||||
{
|
||||
var type = pendingControlPoints[i].GetType();
|
||||
if (pendingControlPointTypes.Contains(type))
|
||||
if (!pendingControlPointTypes.Add(type))
|
||||
continue;
|
||||
|
||||
pendingControlPointTypes.Add(type);
|
||||
beatmap.ControlPointInfo.Add(pendingControlPointsTime, pendingControlPoints[i]);
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ namespace osu.Game.Beatmaps
|
||||
ITrackStore IBeatmapResourceProvider.Tracks => trackStore;
|
||||
IRenderer IStorageResourceProvider.Renderer => host?.Renderer ?? new DummyRenderer();
|
||||
AudioManager IStorageResourceProvider.AudioManager => audioManager;
|
||||
RealmAccess IStorageResourceProvider.RealmAccess => null;
|
||||
RealmAccess IStorageResourceProvider.RealmAccess => null!;
|
||||
IResourceStore<byte[]> IStorageResourceProvider.Files => files;
|
||||
IResourceStore<byte[]> IStorageResourceProvider.Resources => resources;
|
||||
IResourceStore<TextureUpload> IStorageResourceProvider.CreateTextureLoaderStore(IResourceStore<byte[]> underlyingStore) => host?.CreateTextureLoaderStore(underlyingStore);
|
||||
|
@ -52,10 +52,10 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
public override void Add(T drawable)
|
||||
{
|
||||
base.Add(drawable);
|
||||
|
||||
Debug.Assert(drawable != null);
|
||||
|
||||
base.Add(drawable);
|
||||
|
||||
drawable.StateChanged += state => selectionChanged(drawable, state);
|
||||
}
|
||||
|
||||
|
@ -10,6 +10,7 @@ using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Graphics.UserInterface
|
||||
@ -48,6 +49,7 @@ namespace osu.Game.Graphics.UserInterface
|
||||
{
|
||||
protected virtual float ChevronSize => 10;
|
||||
|
||||
[CanBeNull]
|
||||
public event Action<Visibility> StateChanged;
|
||||
|
||||
public readonly SpriteIcon Chevron;
|
||||
|
@ -41,6 +41,6 @@ namespace osu.Game.IO
|
||||
/// </summary>
|
||||
/// <param name="underlyingStore">The underlying provider of texture data (in arbitrary image formats).</param>
|
||||
/// <returns>A texture loader store.</returns>
|
||||
IResourceStore<TextureUpload> CreateTextureLoaderStore(IResourceStore<byte[]> underlyingStore);
|
||||
IResourceStore<TextureUpload>? CreateTextureLoaderStore(IResourceStore<byte[]> underlyingStore);
|
||||
}
|
||||
}
|
||||
|
@ -49,6 +49,26 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString ScoreMultiplier => new TranslatableString(getKey(@"score_multiplier"), @"Score Multiplier");
|
||||
|
||||
/// <summary>
|
||||
/// "Ranked"
|
||||
/// </summary>
|
||||
public static LocalisableString Ranked => new TranslatableString(getKey(@"ranked"), @"Ranked");
|
||||
|
||||
/// <summary>
|
||||
/// "Performance points can be granted for the active mods."
|
||||
/// </summary>
|
||||
public static LocalisableString RankedExplanation => new TranslatableString(getKey(@"ranked_explanation"), @"Performance points can be granted for the active mods.");
|
||||
|
||||
/// <summary>
|
||||
/// "Unranked"
|
||||
/// </summary>
|
||||
public static LocalisableString Unranked => new TranslatableString(getKey(@"unranked"), @"Unranked");
|
||||
|
||||
/// <summary>
|
||||
/// "Performance points will not be granted due to active mods."
|
||||
/// </summary>
|
||||
public static LocalisableString UnrankedExplanation => new TranslatableString(getKey(@"ranked_explanation"), @"Performance points will not be granted due to active mods.");
|
||||
|
||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,11 @@ namespace osu.Game.Localisation
|
||||
/// </summary>
|
||||
public static LocalisableString Connecting => new TranslatableString(getKey(@"connecting"), @"Connecting...");
|
||||
|
||||
/// <summary>
|
||||
/// "Verification required"
|
||||
/// </summary>
|
||||
public static LocalisableString VerificationRequired => new TranslatableString(getKey(@"verification_required"), @"Verification required");
|
||||
|
||||
/// <summary>
|
||||
/// "home"
|
||||
/// </summary>
|
||||
|
@ -264,13 +264,12 @@ namespace osu.Game.Online.Spectator
|
||||
{
|
||||
Debug.Assert(ThreadSafety.IsUpdateThread);
|
||||
|
||||
if (watchedUsersRefCounts.ContainsKey(userId))
|
||||
if (!watchedUsersRefCounts.TryAdd(userId, 1))
|
||||
{
|
||||
watchedUsersRefCounts[userId]++;
|
||||
return;
|
||||
}
|
||||
|
||||
watchedUsersRefCounts.Add(userId, 1);
|
||||
WatchUserInternal(userId);
|
||||
}
|
||||
|
||||
|
24
osu.Game/Overlays/AccountCreation/ScreenEmailVerification.cs
Normal file
24
osu.Game/Overlays/AccountCreation/ScreenEmailVerification.cs
Normal file
@ -0,0 +1,24 @@
|
||||
// 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.Graphics;
|
||||
using osu.Game.Overlays.Login;
|
||||
|
||||
namespace osu.Game.Overlays.AccountCreation
|
||||
{
|
||||
public partial class ScreenEmailVerification : AccountCreationScreen
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
InternalChild = new SecondFactorAuthForm
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Padding = new MarginPadding(20),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,11 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -28,28 +27,30 @@ namespace osu.Game.Overlays.AccountCreation
|
||||
{
|
||||
public partial class ScreenEntry : AccountCreationScreen
|
||||
{
|
||||
private ErrorTextFlowContainer usernameDescription;
|
||||
private ErrorTextFlowContainer emailAddressDescription;
|
||||
private ErrorTextFlowContainer passwordDescription;
|
||||
private ErrorTextFlowContainer usernameDescription = null!;
|
||||
private ErrorTextFlowContainer emailAddressDescription = null!;
|
||||
private ErrorTextFlowContainer passwordDescription = null!;
|
||||
|
||||
private OsuTextBox usernameTextBox;
|
||||
private OsuTextBox emailTextBox;
|
||||
private OsuPasswordTextBox passwordTextBox;
|
||||
private OsuTextBox usernameTextBox = null!;
|
||||
private OsuTextBox emailTextBox = null!;
|
||||
private OsuPasswordTextBox passwordTextBox = null!;
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; }
|
||||
private IAPIProvider api { get; set; } = null!;
|
||||
|
||||
private ShakeContainer registerShake;
|
||||
private ITextPart characterCheckText;
|
||||
private IBindable<APIState> apiState = null!;
|
||||
|
||||
private OsuTextBox[] textboxes;
|
||||
private LoadingLayer loadingLayer;
|
||||
private ShakeContainer registerShake = null!;
|
||||
private ITextPart characterCheckText = null!;
|
||||
|
||||
private OsuTextBox[] textboxes = null!;
|
||||
private LoadingLayer loadingLayer = null!;
|
||||
|
||||
[Resolved]
|
||||
private GameHost host { get; set; }
|
||||
private GameHost? host { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private OsuGame game { get; set; }
|
||||
private OsuGame? game { get; set; }
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
@ -144,6 +145,8 @@ namespace osu.Game.Overlays.AccountCreation
|
||||
|
||||
passwordTextBox.Current.BindValueChanged(_ => updateCharacterCheckTextColour(), true);
|
||||
characterCheckText.DrawablePartsRecreated += _ => updateCharacterCheckTextColour();
|
||||
|
||||
apiState = api.State.GetBoundCopy();
|
||||
}
|
||||
|
||||
private void updateCharacterCheckTextColour()
|
||||
@ -180,7 +183,7 @@ namespace osu.Game.Overlays.AccountCreation
|
||||
Task.Run(() =>
|
||||
{
|
||||
bool success;
|
||||
RegistrationRequest.RegistrationRequestErrors errors = null;
|
||||
RegistrationRequest.RegistrationRequestErrors? errors = null;
|
||||
|
||||
try
|
||||
{
|
||||
@ -210,7 +213,7 @@ namespace osu.Game.Overlays.AccountCreation
|
||||
if (!string.IsNullOrEmpty(errors.Message))
|
||||
passwordDescription.AddErrors(new[] { errors.Message });
|
||||
|
||||
game.OpenUrlExternally($"{errors.Redirect}?username={usernameTextBox.Text}&email={emailTextBox.Text}", true);
|
||||
game?.OpenUrlExternally($"{errors.Redirect}?username={usernameTextBox.Text}&email={emailTextBox.Text}", true);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -223,6 +226,12 @@ namespace osu.Game.Overlays.AccountCreation
|
||||
return;
|
||||
}
|
||||
|
||||
apiState.BindValueChanged(state =>
|
||||
{
|
||||
if (state.NewValue == APIState.RequiresSecondFactorAuth)
|
||||
this.Push(new ScreenEmailVerification());
|
||||
});
|
||||
|
||||
api.Login(usernameTextBox.Text, passwordTextBox.Text);
|
||||
});
|
||||
});
|
||||
@ -241,6 +250,6 @@ namespace osu.Game.Overlays.AccountCreation
|
||||
return false;
|
||||
}
|
||||
|
||||
private OsuTextBox nextUnfilledTextBox() => textboxes.FirstOrDefault(t => string.IsNullOrEmpty(t.Text));
|
||||
private OsuTextBox? nextUnfilledTextBox() => textboxes.FirstOrDefault(t => string.IsNullOrEmpty(t.Text));
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -23,14 +21,14 @@ namespace osu.Game.Overlays.AccountCreation
|
||||
{
|
||||
public partial class ScreenWarning : AccountCreationScreen
|
||||
{
|
||||
private OsuTextFlowContainer multiAccountExplanationText;
|
||||
private LinkFlowContainer furtherAssistance;
|
||||
private OsuTextFlowContainer multiAccountExplanationText = null!;
|
||||
private LinkFlowContainer furtherAssistance = null!;
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private IAPIProvider api { get; set; }
|
||||
[Resolved]
|
||||
private IAPIProvider? api { get; set; }
|
||||
|
||||
[Resolved(canBeNull: true)]
|
||||
private OsuGame game { get; set; }
|
||||
[Resolved]
|
||||
private OsuGame? game { get; set; }
|
||||
|
||||
private const string help_centre_url = "/help/wiki/Help_Centre#login";
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -25,7 +23,9 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
private const float transition_time = 400;
|
||||
|
||||
private ScreenWelcome welcomeScreen;
|
||||
private ScreenWelcome welcomeScreen = null!;
|
||||
|
||||
private ScheduledDelegate? scheduledHide;
|
||||
|
||||
public AccountCreationOverlay()
|
||||
{
|
||||
@ -108,8 +108,6 @@ namespace osu.Game.Overlays
|
||||
this.FadeOut(100);
|
||||
}
|
||||
|
||||
private ScheduledDelegate scheduledHide;
|
||||
|
||||
private void apiStateChanged(ValueChangedEvent<APIState> state)
|
||||
{
|
||||
switch (state.NewValue)
|
||||
|
@ -30,7 +30,7 @@ namespace osu.Game.Overlays.Comments
|
||||
|
||||
public Color4 AccentColour { get; set; }
|
||||
|
||||
protected override IEnumerable<Drawable> EffectTargets => null;
|
||||
protected override IEnumerable<Drawable> EffectTargets => Enumerable.Empty<Drawable>();
|
||||
|
||||
[Resolved]
|
||||
private IAPIProvider api { get; set; }
|
||||
|
@ -4,6 +4,7 @@
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework;
|
||||
using osuTK;
|
||||
using osu.Framework.Allocation;
|
||||
@ -24,6 +25,7 @@ namespace osu.Game.Overlays.MedalSplash
|
||||
private const float scale_when_unlocked = 0.76f;
|
||||
private const float scale_when_full = 0.6f;
|
||||
|
||||
[CanBeNull]
|
||||
public event Action<DisplayState> StateChanged;
|
||||
|
||||
private readonly Medal medal;
|
||||
|
@ -125,7 +125,7 @@ namespace osu.Game.Overlays.Mods
|
||||
private DeselectAllModsButton deselectAllModsButton = null!;
|
||||
|
||||
private Container aboveColumnsContent = null!;
|
||||
private ScoreMultiplierDisplay? multiplierDisplay;
|
||||
private RankingInformationDisplay? rankingInformationDisplay;
|
||||
private BeatmapAttributesDisplay? beatmapAttributesDisplay;
|
||||
|
||||
protected ShearedButton BackButton { get; private set; } = null!;
|
||||
@ -185,7 +185,7 @@ namespace osu.Game.Overlays.Mods
|
||||
aboveColumnsContent = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Height = ScoreMultiplierDisplay.HEIGHT,
|
||||
Height = RankingInformationDisplay.HEIGHT,
|
||||
Padding = new MarginPadding { Horizontal = 100 },
|
||||
Child = SearchTextBox = new ShearedSearchTextBox
|
||||
{
|
||||
@ -200,7 +200,7 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
Padding = new MarginPadding
|
||||
{
|
||||
Top = ScoreMultiplierDisplay.HEIGHT + PADDING,
|
||||
Top = RankingInformationDisplay.HEIGHT + PADDING,
|
||||
Bottom = PADDING
|
||||
},
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -269,7 +269,7 @@ namespace osu.Game.Overlays.Mods
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
multiplierDisplay = new ScoreMultiplierDisplay
|
||||
rankingInformationDisplay = new RankingInformationDisplay
|
||||
{
|
||||
Anchor = Anchor.BottomRight,
|
||||
Origin = Anchor.BottomRight
|
||||
@ -315,7 +315,7 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
SelectedMods.BindValueChanged(_ =>
|
||||
{
|
||||
updateMultiplier();
|
||||
updateRankingInformation();
|
||||
updateFromExternalSelection();
|
||||
updateCustomisation();
|
||||
|
||||
@ -328,7 +328,7 @@ namespace osu.Game.Overlays.Mods
|
||||
//
|
||||
// See https://github.com/ppy/osu/pull/23284#issuecomment-1529056988
|
||||
modSettingChangeTracker = new ModSettingChangeTracker(SelectedMods.Value);
|
||||
modSettingChangeTracker.SettingChanged += _ => updateMultiplier();
|
||||
modSettingChangeTracker.SettingChanged += _ => updateRankingInformation();
|
||||
}
|
||||
}, true);
|
||||
|
||||
@ -450,9 +450,9 @@ namespace osu.Game.Overlays.Mods
|
||||
modState.ValidForSelection.Value = modState.Mod.Type != ModType.System && modState.Mod.HasImplementation && IsValidMod.Invoke(modState.Mod);
|
||||
}
|
||||
|
||||
private void updateMultiplier()
|
||||
private void updateRankingInformation()
|
||||
{
|
||||
if (multiplierDisplay == null)
|
||||
if (rankingInformationDisplay == null)
|
||||
return;
|
||||
|
||||
double multiplier = 1.0;
|
||||
@ -460,7 +460,8 @@ namespace osu.Game.Overlays.Mods
|
||||
foreach (var mod in SelectedMods.Value)
|
||||
multiplier *= mod.ScoreMultiplier;
|
||||
|
||||
multiplierDisplay.Current.Value = multiplier;
|
||||
rankingInformationDisplay.ModMultiplier.Value = multiplier;
|
||||
rankingInformationDisplay.Ranked.Value = SelectedMods.Value.All(m => m.Ranked);
|
||||
}
|
||||
|
||||
private void updateCustomisation()
|
||||
|
@ -6,8 +6,8 @@ using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
@ -22,15 +22,13 @@ namespace osu.Game.Overlays.Mods
|
||||
/// <summary>
|
||||
/// On the mod select overlay, this provides a local updating view of the aggregate score multiplier coming from mods.
|
||||
/// </summary>
|
||||
public partial class ScoreMultiplierDisplay : ModFooterInformationDisplay, IHasCurrentValue<double>
|
||||
public partial class RankingInformationDisplay : ModFooterInformationDisplay
|
||||
{
|
||||
public const float HEIGHT = 42;
|
||||
|
||||
public Bindable<double> Current
|
||||
{
|
||||
get => current.Current;
|
||||
set => current.Current = value;
|
||||
}
|
||||
public Bindable<double> ModMultiplier = new BindableDouble(1);
|
||||
|
||||
public Bindable<bool> Ranked { get; } = new BindableBool(true);
|
||||
|
||||
private readonly BindableWithCurrent<double> current = new BindableWithCurrent<double>();
|
||||
|
||||
@ -39,16 +37,11 @@ namespace osu.Game.Overlays.Mods
|
||||
private RollingCounter<double> counter = null!;
|
||||
|
||||
private Box flashLayer = null!;
|
||||
private TextWithTooltip rankedText = null!;
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; } = null!;
|
||||
|
||||
public ScoreMultiplierDisplay()
|
||||
{
|
||||
Current.Default = 1d;
|
||||
Current.Value = 1d;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
@ -75,13 +68,20 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
LeftContent.AddRange(new Drawable[]
|
||||
{
|
||||
new OsuSpriteText
|
||||
new Container
|
||||
{
|
||||
Width = 50,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
Margin = new MarginPadding(10),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
|
||||
Text = ModSelectOverlayStrings.ScoreMultiplier,
|
||||
Font = OsuFont.Default.With(size: 17, weight: FontWeight.SemiBold)
|
||||
Child = rankedText = new TextWithTooltip
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
|
||||
Font = OsuFont.Default.With(size: 17, weight: FontWeight.SemiBold)
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@ -97,7 +97,7 @@ namespace osu.Game.Overlays.Mods
|
||||
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Current = { BindTarget = Current }
|
||||
Current = { BindTarget = ModMultiplier }
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -106,30 +106,22 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
Current.BindValueChanged(e =>
|
||||
ModMultiplier.BindValueChanged(e =>
|
||||
{
|
||||
if (e.NewValue > Current.Default)
|
||||
if (e.NewValue > ModMultiplier.Default)
|
||||
{
|
||||
MainBackground
|
||||
.FadeColour(colours.ForModType(ModType.DifficultyIncrease), transition_duration, Easing.OutQuint);
|
||||
counter.FadeColour(ColourProvider.Background5, transition_duration, Easing.OutQuint);
|
||||
counter.FadeColour(colours.ForModType(ModType.DifficultyIncrease), transition_duration, Easing.OutQuint);
|
||||
}
|
||||
else if (e.NewValue < Current.Default)
|
||||
else if (e.NewValue < ModMultiplier.Default)
|
||||
{
|
||||
MainBackground
|
||||
.FadeColour(colours.ForModType(ModType.DifficultyReduction), transition_duration, Easing.OutQuint);
|
||||
counter.FadeColour(ColourProvider.Background5, transition_duration, Easing.OutQuint);
|
||||
counter.FadeColour(colours.ForModType(ModType.DifficultyReduction), transition_duration, Easing.OutQuint);
|
||||
}
|
||||
else
|
||||
{
|
||||
MainBackground.FadeColour(ColourProvider.Background4, transition_duration, Easing.OutQuint);
|
||||
counter.FadeColour(Colour4.White, transition_duration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
flashLayer
|
||||
.FadeOutFromOne()
|
||||
.FadeTo(0.15f, 60, Easing.OutQuint)
|
||||
.Then().FadeOut(500, Easing.OutQuint);
|
||||
flash();
|
||||
|
||||
const float move_amount = 4;
|
||||
if (e.NewValue > e.OldValue)
|
||||
@ -140,10 +132,43 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
// required to prevent the counter initially rolling up from 0 to 1
|
||||
// due to `Current.Value` having a nonstandard default value of 1.
|
||||
counter.SetCountWithoutRolling(Current.Value);
|
||||
counter.SetCountWithoutRolling(ModMultiplier.Value);
|
||||
|
||||
Ranked.BindValueChanged(e =>
|
||||
{
|
||||
flash();
|
||||
|
||||
if (e.NewValue)
|
||||
{
|
||||
rankedText.Text = ModSelectOverlayStrings.Ranked;
|
||||
rankedText.TooltipText = ModSelectOverlayStrings.RankedExplanation;
|
||||
rankedText.FadeColour(Colour4.White, transition_duration, Easing.OutQuint);
|
||||
FrontBackground.FadeColour(ColourProvider.Background3, transition_duration, Easing.OutQuint);
|
||||
}
|
||||
else
|
||||
{
|
||||
rankedText.Text = ModSelectOverlayStrings.Unranked;
|
||||
rankedText.TooltipText = ModSelectOverlayStrings.UnrankedExplanation;
|
||||
rankedText.FadeColour(ColourProvider.Background5, transition_duration, Easing.OutQuint);
|
||||
FrontBackground.FadeColour(colours.Orange1, transition_duration, Easing.OutQuint);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
|
||||
private partial class EffectCounter : RollingCounter<double>
|
||||
private void flash()
|
||||
{
|
||||
flashLayer
|
||||
.FadeOutFromOne()
|
||||
.FadeTo(0.15f, 60, Easing.OutQuint)
|
||||
.Then().FadeOut(500, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private partial class TextWithTooltip : OsuSpriteText, IHasTooltip
|
||||
{
|
||||
public LocalisableString TooltipText { get; set; }
|
||||
}
|
||||
|
||||
private partial class EffectCounter : RollingCounter<double>, IHasTooltip
|
||||
{
|
||||
protected override double RollingDuration => 250;
|
||||
|
||||
@ -155,6 +180,8 @@ namespace osu.Game.Overlays.Mods
|
||||
Origin = Anchor.Centre,
|
||||
Font = OsuFont.Default.With(size: 17, weight: FontWeight.SemiBold)
|
||||
};
|
||||
|
||||
public LocalisableString TooltipText => ModSelectOverlayStrings.ScoreMultiplier;
|
||||
}
|
||||
}
|
||||
}
|
@ -95,11 +95,10 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
private void onlineStateChanged(ValueChangedEvent<APIState> state) => Schedule(() =>
|
||||
{
|
||||
failingIcon.FadeTo(state.NewValue == APIState.Failing ? 1 : 0, 200, Easing.OutQuint);
|
||||
failingIcon.FadeTo(state.NewValue == APIState.Failing || state.NewValue == APIState.RequiresSecondFactorAuth ? 1 : 0, 200, Easing.OutQuint);
|
||||
|
||||
switch (state.NewValue)
|
||||
{
|
||||
case APIState.RequiresSecondFactorAuth:
|
||||
case APIState.Connecting:
|
||||
TooltipText = ToolbarStrings.Connecting;
|
||||
spinner.Show();
|
||||
@ -108,6 +107,13 @@ namespace osu.Game.Overlays.Toolbar
|
||||
case APIState.Failing:
|
||||
TooltipText = ToolbarStrings.AttemptingToReconnect;
|
||||
spinner.Show();
|
||||
failingIcon.Icon = FontAwesome.Solid.ExclamationTriangle;
|
||||
break;
|
||||
|
||||
case APIState.RequiresSecondFactorAuth:
|
||||
TooltipText = ToolbarStrings.VerificationRequired;
|
||||
spinner.Show();
|
||||
failingIcon.Icon = FontAwesome.Solid.Key;
|
||||
break;
|
||||
|
||||
case APIState.Offline:
|
||||
|
@ -5,6 +5,7 @@
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
@ -48,6 +49,7 @@ namespace osu.Game.Overlays.Volume
|
||||
private Sample notchSample;
|
||||
private double sampleLastPlaybackTime;
|
||||
|
||||
[CanBeNull]
|
||||
public event Action<SelectionState> StateChanged;
|
||||
|
||||
private SelectionState state;
|
||||
|
@ -66,6 +66,11 @@ namespace osu.Game.Rulesets.Mods
|
||||
/// </summary>
|
||||
bool AlwaysValidForSubmission { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether scores with this mod active can give performance points.
|
||||
/// </summary>
|
||||
bool Ranked { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a fresh <see cref="Mod"/> instance based on this mod.
|
||||
/// </summary>
|
||||
|
@ -167,6 +167,12 @@ namespace osu.Game.Rulesets.Mods
|
||||
[JsonIgnore]
|
||||
public virtual bool RequiresConfiguration => false;
|
||||
|
||||
/// <summary>
|
||||
/// Whether scores with this mod active can give performance points.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public virtual bool Ranked => false;
|
||||
|
||||
/// <summary>
|
||||
/// The mods this mod cannot be enabled with.
|
||||
/// </summary>
|
||||
|
@ -17,6 +17,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override IconUsage? Icon => null;
|
||||
public override ModType Type => ModType.DifficultyReduction;
|
||||
public override LocalisableString Description => "Whoaaaaa...";
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
|
||||
[SettingSource("Speed decrease", "The actual decrease to apply", SettingControlType = typeof(MultiplierSettingsSlider))]
|
||||
public override BindableNumber<double> SpeedChange { get; } = new BindableDouble(0.75)
|
||||
|
@ -18,6 +18,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override IconUsage? Icon => OsuIcon.ModDoubleTime;
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override LocalisableString Description => "Zoooooooooom...";
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
|
||||
[SettingSource("Speed increase", "The actual increase to apply", SettingControlType = typeof(MultiplierSettingsSlider))]
|
||||
public override BindableNumber<double> SpeedChange { get; } = new BindableDouble(1.5)
|
||||
|
@ -16,6 +16,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override ModType Type => ModType.DifficultyReduction;
|
||||
public override double ScoreMultiplier => 0.5;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModHardRock), typeof(ModDifficultyAdjust) };
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
|
||||
public virtual void ReadFromDifficulty(BeatmapDifficulty difficulty)
|
||||
{
|
||||
|
@ -33,6 +33,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override IconUsage? Icon => OsuIcon.ModFlashlight;
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override LocalisableString Description => "Restricted view area.";
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
|
||||
[SettingSource("Flashlight size", "Multiplier applied to the default flashlight size.")]
|
||||
public abstract BindableFloat SizeMultiplier { get; }
|
||||
|
@ -18,6 +18,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override IconUsage? Icon => OsuIcon.ModHalftime;
|
||||
public override ModType Type => ModType.DifficultyReduction;
|
||||
public override LocalisableString Description => "Less zoom...";
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
|
||||
[SettingSource("Speed decrease", "The actual decrease to apply", SettingControlType = typeof(MultiplierSettingsSlider))]
|
||||
public override BindableNumber<double> SpeedChange { get; } = new BindableDouble(0.75)
|
||||
|
@ -17,6 +17,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override LocalisableString Description => "Everything just got a bit harder...";
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModEasy), typeof(ModDifficultyAdjust) };
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
|
||||
protected const float ADJUST_RATIO = 1.4f;
|
||||
|
||||
|
@ -14,6 +14,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override string Acronym => "HD";
|
||||
public override IconUsage? Icon => OsuIcon.ModHidden;
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
|
||||
public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor)
|
||||
{
|
||||
|
@ -25,6 +25,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override LocalisableString Description => "Can you still feel the rhythm without music?";
|
||||
public override ModType Type => ModType.Fun;
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
}
|
||||
|
||||
public abstract class ModMuted<TObject> : ModMuted, IApplicableToDrawableRuleset<TObject>, IApplicableToTrack, IApplicableToScoreProcessor
|
||||
|
@ -28,6 +28,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override IconUsage? Icon => OsuIcon.ModNightcore;
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override LocalisableString Description => "Uguuuuuuuu...";
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
|
||||
[SettingSource("Speed increase", "The actual increase to apply", SettingControlType = typeof(MultiplierSettingsSlider))]
|
||||
public override BindableNumber<double> SpeedChange { get; } = new BindableDouble(1.5)
|
||||
|
@ -20,6 +20,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override LocalisableString Description => "You can't fail, no matter what.";
|
||||
public override double ScoreMultiplier => 0.5;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModFailCondition), typeof(ModCinema) };
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
|
||||
private readonly Bindable<bool> showHealthBar = new Bindable<bool>();
|
||||
|
||||
|
@ -19,6 +19,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override LocalisableString Description => "SS or quit.";
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
|
||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Concat(new[] { typeof(ModSuddenDeath), typeof(ModAccuracyChallenge) }).ToArray();
|
||||
|
||||
|
@ -19,6 +19,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
public override ModType Type => ModType.DifficultyIncrease;
|
||||
public override LocalisableString Description => "Miss and fail.";
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override bool Ranked => UsesDefaultConfiguration;
|
||||
|
||||
public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(ModPerfect)).ToArray();
|
||||
|
||||
|
@ -11,6 +11,7 @@ using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Extensions.TypeExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
@ -139,7 +140,7 @@ namespace osu.Game.Rulesets.Objects.Drawables
|
||||
|
||||
protected override bool RequiresChildrenUpdate => true;
|
||||
|
||||
public override bool IsPresent => base.IsPresent || (State.Value == ArmedState.Idle && Clock?.CurrentTime >= LifetimeStart);
|
||||
public override bool IsPresent => base.IsPresent || (State.Value == ArmedState.Idle && Clock.IsNotNull() && Clock.CurrentTime >= LifetimeStart);
|
||||
|
||||
private readonly Bindable<ArmedState> state = new Bindable<ArmedState>();
|
||||
|
||||
|
@ -47,12 +47,9 @@ namespace osu.Game.Rulesets.Objects.Pooling
|
||||
{
|
||||
HitObject hitObject = entry.HitObject;
|
||||
|
||||
if (entryMap.ContainsKey(hitObject))
|
||||
if (!entryMap.TryAdd(hitObject, entry))
|
||||
throw new InvalidOperationException($@"The {nameof(HitObjectLifetimeEntry)} is already added to this {nameof(HitObjectEntryManager)}.");
|
||||
|
||||
// Add the entry.
|
||||
entryMap[hitObject] = entry;
|
||||
|
||||
// If the entry has a parent, set it and add the entry to the parent's children.
|
||||
if (parent != null)
|
||||
{
|
||||
|
@ -247,10 +247,14 @@ namespace osu.Game.Rulesets.UI
|
||||
nestedPlayfields.Add(otherPlayfield);
|
||||
}
|
||||
|
||||
private Mod[] mods;
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
mods = Mods?.ToArray();
|
||||
|
||||
// in the case a consumer forgets to add the HitObjectContainer, we will add it here.
|
||||
if (HitObjectContainer.Parent == null)
|
||||
AddInternal(HitObjectContainer);
|
||||
@ -260,9 +264,9 @@ namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (!IsNested && Mods != null)
|
||||
if (!IsNested && mods != null)
|
||||
{
|
||||
foreach (var mod in Mods)
|
||||
foreach (Mod mod in mods)
|
||||
{
|
||||
if (mod is IUpdatableByPlayfield updatable)
|
||||
updatable.Update(this);
|
||||
@ -403,10 +407,13 @@ namespace osu.Game.Rulesets.UI
|
||||
|
||||
// If this is the first time this DHO is being used, then apply the DHO mods.
|
||||
// This is done before Apply() so that the state is updated once when the hitobject is applied.
|
||||
if (Mods != null)
|
||||
if (mods != null)
|
||||
{
|
||||
foreach (var m in Mods.OfType<IApplicableToDrawableHitObject>())
|
||||
m.ApplyToDrawableHitObject(dho);
|
||||
foreach (Mod mod in mods)
|
||||
{
|
||||
if (mod is IApplicableToDrawableHitObject applicable)
|
||||
applicable.ApplyToDrawableHitObject(dho);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
@ -69,6 +70,7 @@ namespace osu.Game.Screens.Edit.Compose.Components
|
||||
|
||||
public override void Show() => State = Visibility.Visible;
|
||||
|
||||
[CanBeNull]
|
||||
public event Action<Visibility> StateChanged;
|
||||
|
||||
public partial class BoxWithBorders : CompositeDrawable
|
||||
|
@ -4,6 +4,7 @@
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -88,6 +89,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
public override void Show() => State = Visibility.Visible;
|
||||
|
||||
[CanBeNull]
|
||||
public event Action<Visibility> StateChanged;
|
||||
|
||||
private partial class ButtonAreaBackground : Box, IStateful<ButtonAreaBackgroundState>
|
||||
@ -146,6 +148,7 @@ namespace osu.Game.Screens.Menu
|
||||
}
|
||||
}
|
||||
|
||||
[CanBeNull]
|
||||
public event Action<ButtonAreaBackgroundState> StateChanged;
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
sideFlashes.Delay(FADE_IN_DURATION).FadeIn(64, Easing.InQuint);
|
||||
}
|
||||
else if (!api.IsLoggedIn)
|
||||
else if (!api.IsLoggedIn || api.State.Value == APIState.RequiresSecondFactorAuth)
|
||||
{
|
||||
// copy out old action to avoid accidentally capturing logo.Action in closure, causing a self-reference loop.
|
||||
var previousAction = logo.Action;
|
||||
|
@ -7,6 +7,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Development;
|
||||
@ -19,6 +20,7 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
{
|
||||
public partial class RoomManager : Component, IRoomManager
|
||||
{
|
||||
[CanBeNull]
|
||||
public event Action RoomsUpdated;
|
||||
|
||||
private readonly BindableList<Room> rooms = new BindableList<Room>();
|
||||
|
@ -509,7 +509,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
|
||||
|
||||
private void cancelTrackLooping()
|
||||
{
|
||||
var track = Beatmap?.Value?.Track;
|
||||
var track = Beatmap.Value?.Track;
|
||||
|
||||
if (track != null)
|
||||
track.Looping = false;
|
||||
|
@ -109,7 +109,7 @@ namespace osu.Game.Screens.Play.HUD
|
||||
|
||||
protected override bool OnMouseMove(MouseMoveEvent e)
|
||||
{
|
||||
positionalAdjust = Vector2.Distance(e.MousePosition, button.ToSpaceOfOtherDrawable(button.DrawRectangle.Centre, Parent)) / 100;
|
||||
positionalAdjust = Vector2.Distance(e.MousePosition, button.ToSpaceOfOtherDrawable(button.DrawRectangle.Centre, Parent!)) / 100;
|
||||
return base.OnMouseMove(e);
|
||||
}
|
||||
|
||||
|
@ -1,17 +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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Screens.Play.HUD;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Extensions.LocalisationExtensions;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
@ -19,6 +19,7 @@ using osu.Game.Graphics.Sprites;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
using osu.Game.Input.Bindings;
|
||||
using osu.Game.Localisation;
|
||||
using osu.Game.Utils;
|
||||
|
||||
namespace osu.Game.Screens.Select
|
||||
@ -31,26 +32,26 @@ namespace osu.Game.Screens.Select
|
||||
set => modDisplay.Current = value;
|
||||
}
|
||||
|
||||
protected readonly OsuSpriteText MultiplierText;
|
||||
protected OsuSpriteText MultiplierText { get; private set; } = null!;
|
||||
protected Container UnrankedBadge { get; private set; } = null!;
|
||||
|
||||
private readonly ModDisplay modDisplay;
|
||||
|
||||
private ModSettingChangeTracker? modSettingChangeTracker;
|
||||
|
||||
private Color4 lowMultiplierColour;
|
||||
private Color4 highMultiplierColour;
|
||||
|
||||
public FooterButtonMods()
|
||||
{
|
||||
ButtonContentContainer.Add(modDisplay = new ModDisplay
|
||||
// must be created in ctor for correct operation of `Current`.
|
||||
modDisplay = new ModDisplay
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Scale = new Vector2(0.8f),
|
||||
ExpansionMode = ExpansionMode.AlwaysContracted,
|
||||
});
|
||||
ButtonContentContainer.Add(MultiplierText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -62,10 +63,43 @@ namespace osu.Game.Screens.Select
|
||||
highMultiplierColour = colours.Green;
|
||||
Text = @"mods";
|
||||
Hotkey = GlobalAction.ToggleModSelection;
|
||||
}
|
||||
|
||||
[CanBeNull]
|
||||
private ModSettingChangeTracker modSettingChangeTracker;
|
||||
ButtonContentContainer.AddRange(new Drawable[]
|
||||
{
|
||||
modDisplay,
|
||||
MultiplierText = new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Bold),
|
||||
},
|
||||
UnrankedBadge = new Container
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new Circle
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Colour = colours.Yellow,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Colour = colours.Gray2,
|
||||
Padding = new MarginPadding(5),
|
||||
UseFullGlyphHeight = false,
|
||||
Text = ModSelectOverlayStrings.Unranked.ToLower()
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
@ -101,6 +135,9 @@ namespace osu.Game.Screens.Select
|
||||
modDisplay.FadeIn();
|
||||
else
|
||||
modDisplay.FadeOut();
|
||||
|
||||
bool anyUnrankedMods = Current.Value?.Any(m => !m.Ranked) == true;
|
||||
UnrankedBadge.FadeTo(anyUnrankedMods ? 1 : 0);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
public TestMultiplayerClient MultiplayerClient => OnlinePlayDependencies.MultiplayerClient;
|
||||
public new TestMultiplayerRoomManager RoomManager => OnlinePlayDependencies.RoomManager;
|
||||
public TestSpectatorClient SpectatorClient => OnlinePlayDependencies?.SpectatorClient;
|
||||
public TestSpectatorClient SpectatorClient => OnlinePlayDependencies.SpectatorClient;
|
||||
|
||||
protected new MultiplayerTestSceneDependencies OnlinePlayDependencies => (MultiplayerTestSceneDependencies)base.OnlinePlayDependencies;
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
// 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.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
@ -22,23 +20,23 @@ namespace osu.Game.Tests.Visual.OnlinePlay
|
||||
/// </summary>
|
||||
public abstract partial class OnlinePlayTestScene : ScreenTestScene, IOnlinePlayTestSceneDependencies
|
||||
{
|
||||
public Bindable<Room> SelectedRoom => OnlinePlayDependencies?.SelectedRoom;
|
||||
public IRoomManager RoomManager => OnlinePlayDependencies?.RoomManager;
|
||||
public OngoingOperationTracker OngoingOperationTracker => OnlinePlayDependencies?.OngoingOperationTracker;
|
||||
public OnlinePlayBeatmapAvailabilityTracker AvailabilityTracker => OnlinePlayDependencies?.AvailabilityTracker;
|
||||
public TestUserLookupCache UserLookupCache => OnlinePlayDependencies?.UserLookupCache;
|
||||
public BeatmapLookupCache BeatmapLookupCache => OnlinePlayDependencies?.BeatmapLookupCache;
|
||||
public Bindable<Room> SelectedRoom => OnlinePlayDependencies.SelectedRoom;
|
||||
public IRoomManager RoomManager => OnlinePlayDependencies.RoomManager;
|
||||
public OngoingOperationTracker OngoingOperationTracker => OnlinePlayDependencies.OngoingOperationTracker;
|
||||
public OnlinePlayBeatmapAvailabilityTracker AvailabilityTracker => OnlinePlayDependencies.AvailabilityTracker;
|
||||
public TestUserLookupCache UserLookupCache => OnlinePlayDependencies.UserLookupCache;
|
||||
public BeatmapLookupCache BeatmapLookupCache => OnlinePlayDependencies.BeatmapLookupCache;
|
||||
|
||||
/// <summary>
|
||||
/// All dependencies required for online play components and screens.
|
||||
/// </summary>
|
||||
protected OnlinePlayTestSceneDependencies OnlinePlayDependencies => dependencies?.OnlinePlayDependencies;
|
||||
protected OnlinePlayTestSceneDependencies OnlinePlayDependencies => dependencies.OnlinePlayDependencies!;
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
private readonly Container content;
|
||||
private readonly Container drawableDependenciesContainer;
|
||||
private DelegatedDependencyContainer dependencies;
|
||||
private DelegatedDependencyContainer dependencies = null!;
|
||||
|
||||
protected OnlinePlayTestScene()
|
||||
{
|
||||
@ -50,10 +48,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay
|
||||
}
|
||||
|
||||
protected sealed override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
|
||||
{
|
||||
dependencies = new DelegatedDependencyContainer(base.CreateChildDependencies(parent));
|
||||
return dependencies;
|
||||
}
|
||||
=> dependencies = new DelegatedDependencyContainer(base.CreateChildDependencies(parent));
|
||||
|
||||
public override void SetUpSteps()
|
||||
{
|
||||
@ -62,9 +57,9 @@ namespace osu.Game.Tests.Visual.OnlinePlay
|
||||
AddStep("setup dependencies", () =>
|
||||
{
|
||||
// Reset the room dependencies to a fresh state.
|
||||
drawableDependenciesContainer.Clear();
|
||||
dependencies.OnlinePlayDependencies = CreateOnlinePlayDependencies();
|
||||
drawableDependenciesContainer.AddRange(OnlinePlayDependencies.DrawableComponents);
|
||||
drawableDependenciesContainer.Clear();
|
||||
drawableDependenciesContainer.AddRange(dependencies.OnlinePlayDependencies.DrawableComponents);
|
||||
|
||||
var handler = OnlinePlayDependencies.RequestsHandler;
|
||||
|
||||
@ -106,7 +101,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay
|
||||
/// <summary>
|
||||
/// The online play dependencies.
|
||||
/// </summary>
|
||||
public OnlinePlayTestSceneDependencies OnlinePlayDependencies { get; set; }
|
||||
public OnlinePlayTestSceneDependencies? OnlinePlayDependencies { get; set; }
|
||||
|
||||
private readonly IReadOnlyDependencyContainer parent;
|
||||
private readonly DependencyContainer injectableDependencies;
|
||||
|
@ -56,10 +56,10 @@ namespace osu.Game.Tests.Visual.OnlinePlay
|
||||
CacheAs(BeatmapLookupCache);
|
||||
}
|
||||
|
||||
public object Get(Type type)
|
||||
public object? Get(Type type)
|
||||
=> dependencies.Get(type);
|
||||
|
||||
public object Get(Type type, CacheInfo info)
|
||||
public object? Get(Type type, CacheInfo info)
|
||||
=> dependencies.Get(type, info);
|
||||
|
||||
public void Inject<T>(T instance)
|
||||
|
@ -171,10 +171,10 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
public IRenderer Renderer => host.Renderer;
|
||||
public AudioManager AudioManager => Audio;
|
||||
public IResourceStore<byte[]> Files => null;
|
||||
public IResourceStore<byte[]> Files => null!;
|
||||
public new IResourceStore<byte[]> Resources => base.Resources;
|
||||
public IResourceStore<TextureUpload> CreateTextureLoaderStore(IResourceStore<byte[]> underlyingStore) => host.CreateTextureLoaderStore(underlyingStore);
|
||||
RealmAccess IStorageResourceProvider.RealmAccess => null;
|
||||
RealmAccess IStorageResourceProvider.RealmAccess => null!;
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -66,6 +66,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=CompareOfFloatsByEqualityOperator/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertClosureToMethodGroup/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertConditionalTernaryExpressionToSwitchExpression/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertConstructorToMemberInitializers/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertIfDoToWhile/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertIfStatementToConditionalTernaryExpression/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertIfStatementToNullCoalescingAssignment/@EntryIndexedValue">WARNING</s:String>
|
||||
@ -81,6 +82,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToConstant_002ELocal/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToLambdaExpression/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToLocalFunction/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToPrimaryConstructor/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToStaticClass/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToUsingDeclaration/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertTypeCheckPatternToNullCheck/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
@ -165,6 +167,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantImmediateDelegateInvocation/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantLambdaSignatureParentheses/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantReadonlyModifier/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantTypeDeclarationBody/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantTypeSpecificationInDefaultExpression/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantLinebreak/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=RedundantSpace/@EntryIndexedValue">WARNING</s:String>
|
||||
@ -251,6 +254,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UnusedType_002EGlobal/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseAwaitUsing/@EntryIndexedValue">DO_NOT_SHOW</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseCollectionCountProperty/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseCollectionExpression/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseConfigureAwaitFalseForAsyncDisposable/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseFormatSpecifierInFormatString/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseFormatSpecifierInInterpolation/@EntryIndexedValue">WARNING</s:String>
|
||||
@ -263,6 +267,7 @@
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseObjectOrCollectionInitializer/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UsePatternMatching/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseStringInterpolation/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=UseUtf8StringLiteral/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=VariableCanBeMadeConst/@EntryIndexedValue">WARNING</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=VirtualMemberCallInConstructor/@EntryIndexedValue">HINT</s:String>
|
||||
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=VirtualMemberNeverOverridden_002EGlobal/@EntryIndexedValue">HINT</s:String>
|
||||
|
Loading…
Reference in New Issue
Block a user