//Uses the given list of control points to construct a list of curves //to account for red points public LinearSlider(string id, Beatmap amap) : base(id, amap) { //Get the initial hit point of the slider //Split into three lines for readibility Point initialcoord = new Point(); initialcoord.x = Int32.Parse(HitObjectParser.GetProperty(id, "x")); initialcoord.y = Int32.Parse(HitObjectParser.GetProperty(id, "y")); //List<Point> curvepoints = new List<Point>(); List <LinearCurve> accumulatedcurves = new List <LinearCurve>(); //Normal linear slider if (controlpoints.Length == 1) { accumulatedcurves.Add(new LinearCurve(initialcoord, controlpoints[0])); } else { List <Point> allcontrolpoints = new List <Point>(); //Add first point only if it's not repeated in the control points (old maps) if (initialcoord.IntX() != controlpoints[0].IntX() && initialcoord.IntY() != controlpoints[0].IntY()) { allcontrolpoints.Add(initialcoord); } allcontrolpoints.AddRange(controlpoints); Point[][] curvepoints = Dewlib.SplitPointList(allcontrolpoints.ToArray()); foreach (Point[] curve in curvepoints) { if (curve.Length > 2) { for (int i = 1; i < curve.Length; i++) { accumulatedcurves.Add(new LinearCurve(curve[i - 1], curve[i])); } } else { accumulatedcurves.Add(new LinearCurve(curve[0], curve[1])); } } } curves = accumulatedcurves.ToArray(); }
//Uses the given list of control points to construct a list of bezier curves //to account for red points public BezierSlider(string id, Beatmap amap) : base(id, amap) { //Get the initial hit point of the slider //Split into three lines for readibility Point initialcoord = new Point(); initialcoord.x = Int32.Parse(HitObjectParser.GetProperty(id, "x")); initialcoord.y = Int32.Parse(HitObjectParser.GetProperty(id, "y")); List <BezierCurve> accumulatedcurves = new List <BezierCurve>(); List <Point> allcontrolpoints = new List <Point>(); allcontrolpoints.Add(initialcoord); allcontrolpoints.AddRange(controlpoints); Point[][] curvepoints = Dewlib.SplitPointList(allcontrolpoints.ToArray()); foreach (Point[] curve in curvepoints) { accumulatedcurves.Add(new BezierCurve(curve)); } curves = accumulatedcurves.ToArray(); }