1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:07:52 +08:00

Remove touch device toasts entirely

This commit is contained in:
Bartłomiej Dach 2023-11-06 10:54:32 +01:00
parent 204cd541e2
commit 682668ccf0
No known key found for this signature in database
3 changed files with 0 additions and 48 deletions

View File

@ -4,13 +4,11 @@
using System.Linq;
using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Input;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.Timing;
using osu.Game.Configuration;
using osu.Game.Input;
using osu.Game.Overlays;
using osu.Game.Rulesets.Osu.Beatmaps;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Rulesets.Osu.Objects;
@ -25,8 +23,6 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
[Resolved]
private SessionStatics statics { get; set; } = null!;
private TestOnScreenDisplay testOnScreenDisplay = null!;
protected override Ruleset CreatePlayerRuleset() => new OsuRuleset();
protected override IBeatmap CreateBeatmap(RulesetInfo ruleset) =>
@ -54,14 +50,11 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
[BackgroundDependencyLoader]
private void load()
{
Add(testOnScreenDisplay = new TestOnScreenDisplay());
Add(new TouchInputInterceptor());
Dependencies.CacheAs<OnScreenDisplay>(testOnScreenDisplay);
}
public override void SetUpSteps()
{
AddStep("reset OSD toast count", () => testOnScreenDisplay.ToastCount = 0);
AddStep("reset static", () => statics.SetValue(Static.TouchInputActive, false));
base.SetUpSteps();
}
@ -85,7 +78,6 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
InputManager.EndTouch(touch);
});
AddAssert("touch device mod activated", () => Player.Score.ScoreInfo.Mods, () => Has.One.InstanceOf<OsuModTouchDevice>());
AddAssert("no toasts displayed", () => testOnScreenDisplay.ToastCount, () => Is.Zero);
}
[Test]
@ -101,7 +93,6 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
InputManager.EndTouch(touch);
});
AddAssert("touch device mod not activated", () => Player.Score.ScoreInfo.Mods, () => Has.None.InstanceOf<OsuModTouchDevice>());
AddAssert("no toasts displayed", () => testOnScreenDisplay.ToastCount, () => Is.Zero);
}
[Test]
@ -149,18 +140,6 @@ namespace osu.Game.Rulesets.Osu.Tests.Mods
InputManager.EndTouch(touch);
});
AddAssert("touch device mod activated", () => Player.Score.ScoreInfo.Mods, () => Has.One.InstanceOf<OsuModTouchDevice>());
AddAssert("toast displayed", () => testOnScreenDisplay.ToastCount, () => Is.EqualTo(1));
}
private partial class TestOnScreenDisplay : OnScreenDisplay
{
public int ToastCount { get; set; }
protected override void DisplayTemporarily(Drawable toDisplay)
{
base.DisplayTemporarily(toDisplay);
ToastCount++;
}
}
}
}

View File

@ -1,15 +0,0 @@
// 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;
namespace osu.Game.Overlays.OSD
{
public partial class TouchDeviceDetectedToast : Toast
{
public TouchDeviceDetectedToast(RulesetInfo ruleset)
: base(ruleset.Name, "Touch device detected", "Touch Device mod applied to score")
{
}
}
}

View File

@ -6,10 +6,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Configuration;
using osu.Game.Overlays;
using osu.Game.Overlays.OSD;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Scoring;
namespace osu.Game.Screens.Play
{
@ -21,9 +18,6 @@ namespace osu.Game.Screens.Play
[Resolved]
private GameplayState gameplayState { get; set; } = null!;
[Resolved]
private OnScreenDisplay? onScreenDisplay { get; set; }
private IBindable<bool> touchActive = new BindableBool();
[BackgroundDependencyLoader]
@ -51,12 +45,6 @@ namespace osu.Game.Screens.Play
if (touchDeviceMod == null)
return;
// do not show the toast if the user hasn't hit anything yet.
// we're kind of assuming that the user just switches to touch for gameplay
// and we don't want to spam them with obvious toasts.
if (gameplayState.ScoreProcessor.HitEvents.Any(ev => ev.Result.IsHit()))
onScreenDisplay?.Display(new TouchDeviceDetectedToast(gameplayState.Ruleset.RulesetInfo));
// `Player` (probably rightly so) assumes immutability of mods,
// so this will not be shown immediately on the mod display in the top right.
// if this is to change, the mod immutability should be revisited.