Remove X setter from CatchHitObject

This commit is contained in:
ekrctb 2020-12-14 11:38:07 +09:00
parent f621d977fc
commit 7cbbd74df2
12 changed files with 36 additions and 44 deletions

View File

@ -32,22 +32,22 @@ namespace osu.Game.Rulesets.Catch.Tests.Mods
{ {
new Fruit new Fruit
{ {
X = CatchPlayfield.CENTER_X, OriginalX = CatchPlayfield.CENTER_X,
StartTime = 0 StartTime = 0
}, },
new Fruit new Fruit
{ {
X = 0, OriginalX = 0,
StartTime = 1000 StartTime = 1000
}, },
new Fruit new Fruit
{ {
X = CatchPlayfield.WIDTH, OriginalX = CatchPlayfield.WIDTH,
StartTime = 2000 StartTime = 2000
}, },
new JuiceStream new JuiceStream
{ {
X = CatchPlayfield.CENTER_X, OriginalX = CatchPlayfield.CENTER_X,
StartTime = 3000, StartTime = 3000,
Path = new SliderPath(PathType.Linear, new[] { Vector2.Zero, Vector2.UnitY * 200 }) 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 beatmap.HitObjects.Add(new JuiceStream
{ {
X = CatchPlayfield.CENTER_X - width / 2, OriginalX = CatchPlayfield.CENTER_X - width / 2,
Path = new SliderPath(PathType.Linear, new[] Path = new SliderPath(PathType.Linear, new[]
{ {
Vector2.Zero, Vector2.Zero,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -33,14 +33,6 @@ namespace osu.Game.Rulesets.Catch.Objects
float IHasXPosition.X => OriginalX; 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>(); public readonly Bindable<float> EffectiveXBindable = new Bindable<float>();
/// <summary> /// <summary>

View File

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