1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 08:23:00 +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 hitOnce;
public void Update(DrawableHitObject o)
public void Update(DrawableHitObject drawable)
{
const float relax_leniency = 3;
if (!(o is DrawableOsuHitObject d))
if (!(drawable is DrawableOsuHitObject osuHit))
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;
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)
{
hit(d, false);
hit(d, true);
hit(osuHit, false);
hit(osuHit, true);
}
hit(d, hitStill);
hit(osuHit, hitStill);
hitOnce = false;
hitStill = false;
@ -61,22 +61,22 @@ namespace osu.Game.Rulesets.Osu.Mods
private bool wasHit;
private bool wasLeft;
private void hit(DrawableOsuHitObject d, bool hitting)
private void hit(DrawableOsuHitObject osuHit, bool hitting)
{
if (wasHit == hitting)
return;
wasHit = hitting;
var l = new ReplayState<OsuAction>
var state = new ReplayState<OsuAction>
{
PressedActions = new List<OsuAction>()
};
if (hitting)
{
l.PressedActions.Add(wasLeft ? OsuAction.LeftButton : OsuAction.RightButton);
state.PressedActions.Add(wasLeft ? OsuAction.LeftButton : OsuAction.RightButton);
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
{
void Update(DrawableHitObject o);
void Update(DrawableHitObject drawable);
}
}

View File

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

View File

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