mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 10:23:02 +08:00
Hide the game mouse cursor when playing osu!catch with relax mod
This commit is contained in:
parent
005ce1c438
commit
5ce2d6f54a
@ -3,15 +3,19 @@
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets.Catch.Objects;
|
||||
using osu.Game.Rulesets.Catch.Objects.Drawables;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Objects.Drawables;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Rulesets.UI.Scrolling;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.UI
|
||||
{
|
||||
@ -49,6 +53,14 @@ namespace osu.Game.Rulesets.Catch.UI
|
||||
this.difficulty = difficulty;
|
||||
}
|
||||
|
||||
protected override GameplayCursorContainer CreateCursor()
|
||||
{
|
||||
if (Mods.Any(m => m is ModRelax))
|
||||
return new CatchRelaxCursorContainer();
|
||||
|
||||
return base.CreateCursor();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
|
15
osu.Game.Rulesets.Catch/UI/CatchRelaxCursorContainer.cs
Normal file
15
osu.Game.Rulesets.Catch/UI/CatchRelaxCursorContainer.cs
Normal file
@ -0,0 +1,15 @@
|
||||
// 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.Graphics;
|
||||
using osu.Game.Rulesets.UI;
|
||||
|
||||
namespace osu.Game.Rulesets.Catch.UI
|
||||
{
|
||||
public partial class CatchRelaxCursorContainer : GameplayCursorContainer
|
||||
{
|
||||
// Just hide the cursor in relax.
|
||||
// The main goal here is to show that we have a cursor so the game never shows the global one.
|
||||
protected override Drawable CreateCursor() => Empty();
|
||||
}
|
||||
}
|
@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.UI
|
||||
public readonly BindableBool DisplayJudgements = new BindableBool(true);
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private IReadOnlyList<Mod> mods { get; set; }
|
||||
protected IReadOnlyList<Mod> Mods { get; private set; }
|
||||
|
||||
private readonly HitObjectEntryManager entryManager = new HitObjectEntryManager();
|
||||
|
||||
@ -243,9 +243,9 @@ namespace osu.Game.Rulesets.UI
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (!IsNested && mods != null)
|
||||
if (!IsNested && Mods != null)
|
||||
{
|
||||
foreach (var mod in mods)
|
||||
foreach (var mod in Mods)
|
||||
{
|
||||
if (mod is IUpdatableByPlayfield updatable)
|
||||
updatable.Update(this);
|
||||
@ -374,9 +374,9 @@ 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>())
|
||||
foreach (var m in Mods.OfType<IApplicableToDrawableHitObject>())
|
||||
m.ApplyToDrawableHitObject(dho);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user