private void add(DrawableOsuHitObject h) { h.Anchor = Anchor.Centre; h.Depth = depth++; if (auto) { h.State = ArmedState.Hit; } playfieldContainer.Add(h); var proxyable = h as IDrawableHitObjectWithProxiedApproach; if (proxyable != null) { approachContainer.Add(proxyable.ProxiedLayer.CreateProxy()); } }
public override void Add(DrawableHitObject h) { h.OnNewResult += onNewResult; h.OnLoadComplete += d => { if (d is IDrawableHitObjectWithProxiedApproach c) { approachCircles.Add(c.ProxiedLayer.CreateProxy()); } }; base.Add(h); DrawableOsuHitObject osuHitObject = (DrawableOsuHitObject)h; osuHitObject.CheckHittable = hitPolicy.IsHittable; followPoints.AddFollowPoints(osuHitObject); }
private void reorderObjectStep(int startIndex, int endIndex) { AddStep($"move object {startIndex} to {endIndex}", () => { DrawableOsuHitObject toReorder = getObject(startIndex); double targetTime; if (endIndex < hitObjectContainer.Count) { targetTime = getObject(endIndex).HitObject.StartTime - 1; } else { targetTime = getObject(hitObjectContainer.Count - 1).HitObject.StartTime + 1; } hitObjectContainer.Remove(toReorder); toReorder.HitObject.StartTime = targetTime; hitObjectContainer.Add(toReorder); }); }
private void assertDirections() { AddAssert("group directions are correct", () => { for (int i = 0; i < hitObjectContainer.Count; i++) { DrawableOsuHitObject expectedStart = getObject(i); DrawableOsuHitObject expectedEnd = i < hitObjectContainer.Count - 1 ? getObject(i + 1) : null; if (expectedEnd == null) { continue; } var points = getGroup(i).ChildrenOfType <FollowPoint>().ToArray(); if (points.Length == 0) { continue; } float expectedDirection = MathF.Atan2(expectedStart.Position.Y - expectedEnd.Position.Y, expectedStart.Position.X - expectedEnd.Position.X); float realDirection = MathF.Atan2(expectedStart.Position.Y - points[^ 1].Position.Y, expectedStart.Position.X - points[^ 1].Position.X);
private void assertGroups() { AddAssert("has correct group count", () => followPointRenderer.Entries.Count == hitObjectContainer.Count); AddAssert("group endpoints are correct", () => { for (int i = 0; i < hitObjectContainer.Count; i++) { DrawableOsuHitObject expectedStart = getObject(i); DrawableOsuHitObject expectedEnd = i < hitObjectContainer.Count - 1 ? getObject(i + 1) : null; if (getEntry(i).Start != expectedStart.HitObject) { throw new AssertionException($"Object {i} expected to be the start of group {i}."); } if (getEntry(i).End != expectedEnd?.HitObject) { throw new AssertionException($"Object {(expectedEnd == null ? "null" : i.ToString())} expected to be the end of group {i}."); } } return(true); }); }
/// <summary> /// Removes the <see cref="FollowPoint"/>s around a <see cref="DrawableOsuHitObject"/>. /// This includes <see cref="FollowPoint"/>s leading into <paramref name="hitObject"/>, and <see cref="FollowPoint"/>s exiting <paramref name="hitObject"/>. /// </summary> /// <param name="hitObject">The <see cref="DrawableOsuHitObject"/> to remove <see cref="FollowPoint"/>s for.</param> public void RemoveFollowPoints(DrawableOsuHitObject hitObject) => removeGroup(connections.Single(g => g.Start == hitObject));
/// <summary> /// Adds the <see cref="FollowPoint"/>s around a <see cref="DrawableOsuHitObject"/>. /// This includes <see cref="FollowPoint"/>s leading into <paramref name="hitObject"/>, and <see cref="FollowPoint"/>s exiting <paramref name="hitObject"/>. /// </summary> /// <param name="hitObject">The <see cref="DrawableOsuHitObject"/> to add <see cref="FollowPoint"/>s for.</param> public void AddFollowPoints(DrawableOsuHitObject hitObject) => addConnection(new FollowPointConnection(hitObject).With(g => g.StartTime.BindValueChanged(_ => onStartTimeChanged(g))));