mirror of
https://github.com/osukey/osukey.git
synced 2025-05-02 20:27:27 +09:00
47 lines
1.7 KiB
C#
47 lines
1.7 KiB
C#
// 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.Framework.Graphics.Containers;
|
|
using osu.Framework.Input;
|
|
using osu.Framework.Input.Bindings;
|
|
using osu.Framework.Input.Events;
|
|
using osu.Game.Rulesets.Catch.Objects;
|
|
using osu.Game.Rulesets.Catch.UI;
|
|
using osu.Game.Rulesets.Mods;
|
|
using osu.Game.Rulesets.UI;
|
|
using osuTK;
|
|
using System;
|
|
|
|
namespace osu.Game.Rulesets.Catch.Mods
|
|
{
|
|
public class CatchModRelax : ModRelax, IApplicableToDrawableRuleset<CatchHitObject>
|
|
{
|
|
public override string Description => @"Use the mouse to control the catcher.";
|
|
|
|
public void ApplyToDrawableRuleset(DrawableRuleset<CatchHitObject> drawableRuleset) =>
|
|
((Container)drawableRuleset.Playfield.Parent).Add(new CatchModRelaxHelper(drawableRuleset.Playfield as CatchPlayfield));
|
|
|
|
private class CatchModRelaxHelper : Drawable, IKeyBindingHandler<CatchAction>, IRequireHighFrequencyMousePosition
|
|
{
|
|
private readonly CatcherArea.Catcher catcher;
|
|
|
|
public CatchModRelaxHelper(CatchPlayfield catchPlayfield)
|
|
{
|
|
catcher = catchPlayfield.CatcherArea.MovableCatcher;
|
|
RelativeSizeAxes = Axes.Both;
|
|
}
|
|
|
|
//disable keyboard controls
|
|
public bool OnPressed(CatchAction action) => true;
|
|
public bool OnReleased(CatchAction action) => true;
|
|
|
|
protected override bool OnMouseMove(MouseMoveEvent e)
|
|
{
|
|
catcher.UpdatePosition(e.MousePosition.X / DrawSize.X);
|
|
return base.OnMouseMove(e);
|
|
}
|
|
}
|
|
}
|
|
}
|