1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 22:22:54 +08:00

Rename variables to be human readable

This commit is contained in:
tgi74000 2018-08-04 00:18:09 +02:00
parent 7310c38df9
commit 07d6a75e23
5 changed files with 28 additions and 28 deletions

View File

@ -24,35 +24,35 @@ namespace osu.Game.Rulesets.Osu.Mods
private bool hitStill; private bool hitStill;
private bool hitOnce; private bool hitOnce;
public void Update(DrawableHitObject o) public void Update(DrawableHitObject drawable)
{ {
const float relax_leniency = 3; const float relax_leniency = 3;
if (!(o is DrawableOsuHitObject d)) if (!(drawable is DrawableOsuHitObject osuHit))
return; return;
double t = d.Clock.CurrentTime; double time = osuHit.Clock.CurrentTime;
if (t >= d.HitObject.StartTime - relax_leniency) if (time >= osuHit.HitObject.StartTime - relax_leniency)
{ {
if (d.HitObject is IHasEndTime e && t > e.EndTime || d.IsHit) if (osuHit.HitObject is IHasEndTime hasEnd && time > hasEnd.EndTime || osuHit.IsHit)
return; return;
hitStill |= d is DrawableSlider s && (s.Ball.IsHovered || d.IsHovered) || d is DrawableSpinner; hitStill |= osuHit is DrawableSlider slider && (slider.Ball.IsHovered || osuHit.IsHovered) || osuHit is DrawableSpinner;
hitOnce |= d is DrawableHitCircle && d.IsHovered; hitOnce |= osuHit is DrawableHitCircle && osuHit.IsHovered;
} }
} }
public void Update(Playfield r) public void Update(Playfield playfield)
{ {
var d = r.HitObjects.Objects.First(h => h is DrawableOsuHitObject) as DrawableOsuHitObject; var osuHit = playfield.HitObjects.Objects.First(d => d is DrawableOsuHitObject) as DrawableOsuHitObject;
if (hitOnce) if (hitOnce)
{ {
hit(d, false); hit(osuHit, false);
hit(d, true); hit(osuHit, true);
} }
hit(d, hitStill); hit(osuHit, hitStill);
hitOnce = false; hitOnce = false;
hitStill = false; hitStill = false;
@ -61,22 +61,22 @@ namespace osu.Game.Rulesets.Osu.Mods
private bool wasHit; private bool wasHit;
private bool wasLeft; private bool wasLeft;
private void hit(DrawableOsuHitObject d, bool hitting) private void hit(DrawableOsuHitObject osuHit, bool hitting)
{ {
if (wasHit == hitting) if (wasHit == hitting)
return; return;
wasHit = hitting; wasHit = hitting;
var l = new ReplayState<OsuAction> var state = new ReplayState<OsuAction>
{ {
PressedActions = new List<OsuAction>() PressedActions = new List<OsuAction>()
}; };
if (hitting) if (hitting)
{ {
l.PressedActions.Add(wasLeft ? OsuAction.LeftButton : OsuAction.RightButton); state.PressedActions.Add(wasLeft ? OsuAction.LeftButton : OsuAction.RightButton);
wasLeft = !wasLeft; wasLeft = !wasLeft;
} }
d.OsuActionInputManager.HandleCustomInput(new InputState(), l); osuHit.OsuActionInputManager.HandleCustomInput(new InputState(), state);
} }
} }
} }

View File

@ -7,6 +7,6 @@ namespace osu.Game.Rulesets.Mods
{ {
public interface IUpdatableByHitObject : IApplicableMod public interface IUpdatableByHitObject : IApplicableMod
{ {
void Update(DrawableHitObject o); void Update(DrawableHitObject drawable);
} }
} }

View File

@ -7,6 +7,6 @@ namespace osu.Game.Rulesets.Mods
{ {
public interface IUpdatableByPlayfield : IApplicableMod public interface IUpdatableByPlayfield : IApplicableMod
{ {
void Update(Playfield r); void Update(Playfield playfield);
} }
} }

View File

@ -84,9 +84,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(IBindableBeatmap b) private void load(IBindableBeatmap bBeatmap)
{ {
beatmap = b.Value; beatmap = bBeatmap.Value;
var samples = GetSamples().ToArray(); var samples = GetSamples().ToArray();
if (samples.Any()) if (samples.Any())
@ -138,9 +138,9 @@ namespace osu.Game.Rulesets.Objects.Drawables
base.Update(); base.Update();
if(beatmap != null) if(beatmap != null)
foreach (var m in beatmap.Mods.Value) foreach (var mod in beatmap.Mods.Value)
if (m is IUpdatableByHitObject u) if (mod is IUpdatableByHitObject updatable)
u.Update(this); updatable.Update(this);
var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime; var endTime = (HitObject as IHasEndTime)?.EndTime ?? HitObject.StartTime;

View File

@ -47,9 +47,9 @@ namespace osu.Game.Rulesets.UI
private WorkingBeatmap beatmap; private WorkingBeatmap beatmap;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(IBindableBeatmap b) private void load(IBindableBeatmap bBeatmap)
{ {
beatmap = b.Value; beatmap = bBeatmap.Value;
HitObjects = CreateHitObjectContainer(); HitObjects = CreateHitObjectContainer();
HitObjects.RelativeSizeAxes = Axes.Both; HitObjects.RelativeSizeAxes = Axes.Both;
@ -98,9 +98,9 @@ namespace osu.Game.Rulesets.UI
base.Update(); base.Update();
if (beatmap != null) if (beatmap != null)
foreach (var m in beatmap.Mods.Value) foreach (var mod in beatmap.Mods.Value)
if (m is IUpdatableByPlayfield u) if (mod is IUpdatableByPlayfield updatable)
u.Update(this); updatable.Update(this);
} }
} }
} }