1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 18:47:27 +08:00

Revert "Remove X setter from CatchHitObject"

This reverts commit 7cbbd74d
This commit is contained in:
ekrctb 2020-12-14 13:18:14 +09:00
parent 7cbbd74df2
commit d96399ea42
12 changed files with 44 additions and 36 deletions

View File

@ -32,22 +32,22 @@ namespace osu.Game.Rulesets.Catch.Tests.Mods
{
new Fruit
{
OriginalX = CatchPlayfield.CENTER_X,
X = CatchPlayfield.CENTER_X,
StartTime = 0
},
new Fruit
{
OriginalX = 0,
X = 0,
StartTime = 1000
},
new Fruit
{
OriginalX = CatchPlayfield.WIDTH,
X = CatchPlayfield.WIDTH,
StartTime = 2000
},
new JuiceStream
{
OriginalX = CatchPlayfield.CENTER_X,
X = CatchPlayfield.CENTER_X,
StartTime = 3000,
Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, Vector2.UnitY * 200 })
}

View File

@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.Tests
beatmap.HitObjects.Add(new JuiceStream
{
OriginalX = CatchPlayfield.CENTER_X - width / 2,
X = CatchPlayfield.CENTER_X - width / 2,
Path = new SliderPath(PathType.Linear, new[]
{
Vector2.Zero,

View File

@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{
StartTime = 1000,
Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, new Vector2(0, -192) }),
OriginalX = CatchPlayfield.WIDTH / 2
X = CatchPlayfield.WIDTH / 2
}
}
},

View File

@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{
beatmap.HitObjects.Add(new Fruit
{
OriginalX = (0.5f + i / 2048f * (i % 10 - 5)) * CatchPlayfield.WIDTH,
X = (0.5f + i / 2048f * (i % 10 - 5)) * CatchPlayfield.WIDTH,
StartTime = i * 100,
NewCombo = i % 8 == 0
});

View File

@ -66,7 +66,7 @@ namespace osu.Game.Rulesets.Catch.Tests
JudgementResult result2 = null;
AddStep("catch hyper fruit", () =>
{
attemptCatch(new Fruit { HyperDashTarget = new Fruit { OriginalX = 100 } }, out drawableObject1, out result1);
attemptCatch(new Fruit { HyperDashTarget = new Fruit { X = 100 } }, out drawableObject1, out result1);
});
AddStep("catch normal fruit", () =>
{
@ -107,14 +107,14 @@ namespace osu.Game.Rulesets.Catch.Tests
var halfWidth = Catcher.CalculateCatchWidth(new BeatmapDifficulty { CircleSize = 0 }) / 2;
AddStep("catch fruit", () =>
{
attemptCatch(new Fruit { OriginalX = -halfWidth + 1 });
attemptCatch(new Fruit { OriginalX = halfWidth - 1 });
attemptCatch(new Fruit { X = -halfWidth + 1 });
attemptCatch(new Fruit { X = halfWidth - 1 });
});
checkPlate(2);
AddStep("miss fruit", () =>
{
attemptCatch(new Fruit { OriginalX = -halfWidth - 1 });
attemptCatch(new Fruit { OriginalX = halfWidth + 1 });
attemptCatch(new Fruit { X = -halfWidth - 1 });
attemptCatch(new Fruit { X = halfWidth + 1 });
});
checkPlate(2);
}
@ -122,7 +122,7 @@ namespace osu.Game.Rulesets.Catch.Tests
[Test]
public void TestFruitChangesCatcherState()
{
AddStep("miss fruit", () => attemptCatch(new Fruit { OriginalX = 100 }));
AddStep("miss fruit", () => attemptCatch(new Fruit { X = 100 }));
checkState(CatcherAnimationState.Fail);
AddStep("catch fruit", () => attemptCatch(new Fruit()));
checkState(CatcherAnimationState.Idle);
@ -135,7 +135,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{
AddStep("catch hyper fruit", () => attemptCatch(new Fruit
{
HyperDashTarget = new Fruit { OriginalX = 100 }
HyperDashTarget = new Fruit { X = 100 }
}));
checkHyperDash(true);
AddStep("catch normal fruit", () => attemptCatch(new Fruit()));
@ -147,10 +147,10 @@ namespace osu.Game.Rulesets.Catch.Tests
{
AddStep("catch hyper kiai fruit", () => attemptCatch(new TestKiaiFruit
{
HyperDashTarget = new Fruit { OriginalX = 100 }
HyperDashTarget = new Fruit { X = 100 }
}));
AddStep("catch tiny droplet", () => attemptCatch(new TinyDroplet()));
AddStep("miss tiny droplet", () => attemptCatch(new TinyDroplet { OriginalX = 100 }));
AddStep("miss tiny droplet", () => attemptCatch(new TinyDroplet { X = 100 }));
// catcher state and hyper dash state is preserved
checkState(CatcherAnimationState.Kiai);
checkHyperDash(true);
@ -161,9 +161,9 @@ namespace osu.Game.Rulesets.Catch.Tests
{
AddStep("catch hyper kiai fruit", () => attemptCatch(new TestKiaiFruit
{
HyperDashTarget = new Fruit { OriginalX = 100 }
HyperDashTarget = new Fruit { X = 100 }
}));
AddStep("miss banana", () => attemptCatch(new Banana { OriginalX = 100 }));
AddStep("miss banana", () => attemptCatch(new Banana { X = 100 }));
// catcher state is preserved but hyper dash state is reset
checkState(CatcherAnimationState.Kiai);
checkHyperDash(false);

View File

@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Catch.Tests
AddStep("catch fruit", () => attemptCatch(new Fruit()));
AddStep("catch fruit last in combo", () => attemptCatch(new Fruit { LastInCombo = true }));
AddStep("catch kiai fruit", () => attemptCatch(new TestSceneCatcher.TestKiaiFruit()));
AddStep("miss last in combo", () => attemptCatch(new Fruit { OriginalX = 100, LastInCombo = true }));
AddStep("miss last in combo", () => attemptCatch(new Fruit { X = 100, LastInCombo = true }));
}
private void attemptCatch(Fruit fruit)

View File

@ -105,7 +105,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{
var fruit = new Fruit
{
OriginalX = getXCoords(hit),
X = getXCoords(hit),
LastInCombo = i % 4 == 0,
StartTime = playfieldTime + 800 + (200 * i)
};
@ -122,7 +122,7 @@ namespace osu.Game.Rulesets.Catch.Tests
var juice = new JuiceStream
{
OriginalX = xCoords,
X = xCoords,
StartTime = playfieldTime + 1000,
Path = new SliderPath(PathType.Linear, new[]
{
@ -145,7 +145,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{
var banana = new Banana
{
OriginalX = getXCoords(hit),
X = getXCoords(hit),
LastInCombo = i % 4 == 0,
StartTime = playfieldTime + 800 + (200 * i)
};

View File

@ -70,20 +70,20 @@ namespace osu.Game.Rulesets.Catch.Tests
beatmap.ControlPointInfo.Add(0, new TimingControlPoint());
// Should produce a hyper-dash (edge case test)
beatmap.HitObjects.Add(new Fruit { StartTime = 1816, OriginalX = 56, NewCombo = true });
beatmap.HitObjects.Add(new Fruit { StartTime = 2008, OriginalX = 308, NewCombo = true });
beatmap.HitObjects.Add(new Fruit { StartTime = 1816, X = 56, NewCombo = true });
beatmap.HitObjects.Add(new Fruit { StartTime = 2008, X = 308, NewCombo = true });
double startTime = 3000;
const float left_x = 0.02f * CatchPlayfield.WIDTH;
const float right_x = 0.98f * CatchPlayfield.WIDTH;
createObjects(() => new Fruit { OriginalX = left_x });
createObjects(() => new Fruit { X = left_x });
createObjects(() => new TestJuiceStream(right_x), 1);
createObjects(() => new TestJuiceStream(left_x), 1);
createObjects(() => new Fruit { OriginalX = right_x });
createObjects(() => new Fruit { OriginalX = left_x });
createObjects(() => new Fruit { OriginalX = right_x });
createObjects(() => new Fruit { X = right_x });
createObjects(() => new Fruit { X = left_x });
createObjects(() => new Fruit { X = right_x });
createObjects(() => new TestJuiceStream(left_x), 1);
beatmap.ControlPointInfo.Add(startTime, new TimingControlPoint
@ -121,7 +121,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{
public TestJuiceStream(float x)
{
OriginalX = x;
X = x;
Path = new SliderPath(new[]
{

View File

@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Catch.Tests
{
new JuiceStream
{
OriginalX = CatchPlayfield.CENTER_X,
X = CatchPlayfield.CENTER_X,
Path = new SliderPath(PathType.Linear, new[]
{
Vector2.Zero,
@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Catch.Tests
},
new Banana
{
OriginalX = CatchPlayfield.CENTER_X,
X = CatchPlayfield.CENTER_X,
StartTime = 1000,
NewCombo = true
}

View File

@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
Path = curveData.Path,
NodeSamples = curveData.NodeSamples,
RepeatCount = curveData.RepeatCount,
OriginalX = positionData?.X ?? 0,
X = positionData?.X ?? 0,
NewCombo = comboData?.NewCombo ?? false,
ComboOffset = comboData?.ComboOffset ?? 0,
LegacyLastTickOffset = (obj as IHasLegacyLastTickOffset)?.LegacyLastTickOffset ?? 0
@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
Samples = obj.Samples,
NewCombo = comboData?.NewCombo ?? false,
ComboOffset = comboData?.ComboOffset ?? 0,
OriginalX = positionData?.X ?? 0
X = positionData?.X ?? 0
}.Yield();
}
}

View File

@ -33,6 +33,14 @@ namespace osu.Game.Rulesets.Catch.Objects
float IHasXPosition.X => OriginalX;
/// <summary>
/// An alias of <see cref="OriginalX"/> setter.
/// </summary>
public float X
{
set => OriginalX = value;
}
public readonly Bindable<float> EffectiveXBindable = new Bindable<float>();
/// <summary>

View File

@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Catch.Objects
AddNested(new TinyDroplet
{
StartTime = t + lastEvent.Value.Time,
OriginalX = OriginalX + Path.PositionAt(
X = OriginalX + Path.PositionAt(
lastEvent.Value.PathProgress + (t / sinceLastTick) * (e.PathProgress - lastEvent.Value.PathProgress)).X,
});
}
@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.Catch.Objects
{
Samples = dropletSamples,
StartTime = e.Time,
OriginalX = OriginalX + Path.PositionAt(e.PathProgress).X,
X = OriginalX + Path.PositionAt(e.PathProgress).X,
});
break;
@ -104,7 +104,7 @@ namespace osu.Game.Rulesets.Catch.Objects
{
Samples = this.GetNodeSamples(nodeIndex++),
StartTime = e.Time,
OriginalX = OriginalX + Path.PositionAt(e.PathProgress).X,
X = OriginalX + Path.PositionAt(e.PathProgress).X,
});
break;
}