rename trackable to enabled and cleanup code

This commit is contained in:
mcendu 2020-02-09 13:46:06 +08:00
parent c9520b299a
commit d314b38699
No known key found for this signature in database
GPG Key ID: FBCD5D45163D6364
3 changed files with 7 additions and 6 deletions

View File

@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Osu.Mods
{
if (hitObject is DrawableSpinner spinner)
{
spinner.Disc.Trackable = false;
spinner.Disc.Enabled = false;
spinner.Disc.OnUpdate += d =>
{
var s = d as SpinnerDisc;

View File

@ -177,7 +177,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
protected override void Update()
{
Disc.Tracking = OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false;
if (!SpmCounter.IsPresent && (Disc.Tracking || !Disc.Trackable))
if (!SpmCounter.IsPresent && Disc.Tracking)
SpmCounter.FadeIn(HitObject.TimeFadeIn);
base.Update();

View File

@ -50,9 +50,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
get => tracking;
set
{
if (value == tracking) return;
if ((Enabled && value) == tracking) return;
tracking = value;
tracking = Enabled && value;
background.FadeTo(tracking ? tracking_alpha : idle_alpha, 100);
}
@ -74,7 +74,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
}
public bool Valid => spinner.StartTime <= Time.Current && spinner.EndTime > Time.Current;
public bool Trackable { get; set; } = true;
public bool Enabled { get; set; } = true;
protected override bool OnMouseMove(MouseMoveEvent e)
{
@ -100,7 +101,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
var delta = thisAngle - lastAngle;
if (Valid && tracking && Trackable)
if (Valid && tracking)
Rotate(delta);
lastAngle = thisAngle;