internal void Draw() { if (!Visible) { return; } if (!hasDrawn) { hasDrawn = true; dataGridView1.ClearSelection(); //ensure we don't make a selection before the first draw. } if (selectedReport != null) { AiReportOneObject oneObject = selectedReport as AiReportOneObject; AiReportTwoObjects twoObjects = selectedReport as AiReportTwoObjects; selectedReport.Draw(); HitObject h1 = null; HitObject h2 = null; bool corrected = selectedReport.Check(); if (twoObjects != null) { h1 = matchObject(twoObjects.h1); h2 = matchObject(twoObjects.h2); } else if (oneObject != null) { h1 = matchObject(oneObject.h1); } if (h1 != null && h2 != null) { if (h1.IsVisible && h2.IsVisible) { Line line = new Line(GameBase.GameField.FieldToDisplay(h1.EndPosition), GameBase.GameField.FieldToDisplay(h2.Position)); bool correct = twoObjects.Check(); GameBase.LineManager.Draw(line, 8, GameBase.Time % 1000 > 500 || correct ? Microsoft.Xna.Framework.Graphics.Color.Black : Microsoft.Xna.Framework.Graphics.Color.White); GameBase.LineManager.Draw(line, 5, correct ? Microsoft.Xna.Framework.Graphics.Color.YellowGreen : Microsoft.Xna.Framework.Graphics.Color.Red); } } else if (h1 != null) { if (h1.IsVisible) { h1.Select(); } } } }
protected virtual void runSanityRules() { List <HitObjectBase> hitObjects = hitObjectManager.GetHitObjects(); for (int i = 0; i < hitObjects.Count; i++) { bool isLast = i == hitObjects.Count - 1; HitObjectBase h = hitObjects[i]; HitObjectBase h1 = isLast ? null : hitObjects[i + 1]; //Check for hitobjects which share the same startTime... if (i > 0 && !isLast) { if (hitObjects[i].StartTime != hitObjects[i + 1].StartTime && hitObjects[i].StartTime < hitObjects[i - 1].EndTime + 10) { HitObjectBase last = hitObjects[i - 1]; Reports.Add(new AiReportTwoObjects(last, h, delegate { return(Math.Abs(last.StartTime - h.StartTime) > 10); }, Severity.Error, LocalisationManager.GetString(OsuString.AICompose_ObjectsTooClose), -1)); } } //check snap if (AiMod.TestBeatSnap(h.StartTime, true)) { int index = i; AiReport report = new AiReportOneObject(h, h.StartTime, delegate { return(AiMod.TestBeatSnap(h.StartTime, true)); }, Severity.Warning, LocalisationManager.GetString(OsuString.AICompose_UnsnappedObject), 0); Reports.Add(report); } if (h.EndTime != h.StartTime) { if (AiMod.TestBeatSnap(h.EndTime, true)) //Need to account for slider velocity buffer. { int index = i; AiReport report = new AiReportOneObject(h, h.EndTime, delegate { return(AiMod.TestBeatSnap(h.EndTime, true)); }, Severity.Warning, LocalisationManager.GetString(OsuString.AICompose_UnsnappedObjectEnd), 0); Reports.Add(report); } } } }
protected override void runComposeRules() { HitObjectManager hom = hitObjectManager as HitObjectManager; List <HitObjectBase> hitObjects = hitObjectManager.GetHitObjects(); int column = (int)Math.Round(BeatmapManager.Current.DifficultyCircleSize); List <Dictionary <int, int> > columns = new List <Dictionary <int, int> >(column); int[] pressArr = new int[column]; int[] lastNoteInColumn = new int[column]; // used to check distance between notes on the same column for (int i = 0; i < column; i++) { columns.Add(new Dictionary <int, int>()); } for (int i = 0; i < hitObjects.Count; i++) { HitObjectBase h = hitObjects[i]; int col = hom.ManiaStage.ColumnAt(h.Position); //check snap if (AiMod.TestBeatSnap(h.StartTime, false)) { AiReport report = new AiReportOneObject(h, h.StartTime, delegate { return(AiMod.TestBeatSnap(h.StartTime, false)); }, Severity.Warning, LocalisationManager.GetString(OsuString.AICompose_UnsnappedObject), 0); Reports.Add(report); } if (h.IsType(HitObjectType.Hold)) { if (h.EndTime - h.StartTime < 10) { Reports.Add(new AiReportOneObject(h, h.StartTime, null, Severity.Error, LocalisationManager.GetString(OsuString.AIComposeMania_HoldNoteTooShort), 0)); } if (AiMod.TestBeatSnap(h.EndTime, false)) { AiReport report = new AiReportOneObject(h, h.EndTime, delegate { return(AiMod.TestBeatSnap(h.EndTime, false)); }, Severity.Warning, LocalisationManager.GetString(OsuString.AICompose_UnsnappedObjectEnd), 0); Reports.Add(report); } } if (h.StartTime != lastNoteInColumn[col] && lastNoteInColumn[col] != 0 && h.StartTime < lastNoteInColumn[col] + 10) { Reports.Add(new AiReportOneObject(h, h.StartTime, delegate { return(Math.Abs(lastNoteInColumn[col] - h.StartTime) > 10); }, Severity.Error, LocalisationManager.GetString(OsuString.AICompose_ObjectsTooClose), -1)); } //check for 7 notes simultaneously int existCount = 1; for (int j = 0; j < column; j++) { if (pressArr[j] >= h.StartTime) { existCount++; } } //pressArr[col] = h.EndTime; if (h.StartTime == h.EndTime) { pressArr[col] = h.StartTime; } else { pressArr[col] = h.EndTime - 2;//hack, holds' end are not counted here. } if (existCount >= 7) { AiReportOneObject report = new AiReportOneObject(h, h.StartTime, null, Severity.Error, LocalisationManager.GetString(OsuString.AIComposeMania_TooManyNotes), 0); Reports.Add(report); } //note stack on another note's startTime if (columns[col].ContainsKey(h.StartTime) || columns[col].ContainsKey(h.EndTime)) { AiReportOneObject report = new AiReportOneObject(h, h.StartTime, null, Severity.Error, LocalisationManager.GetString(OsuString.AIComposeMania_StackedObjects), 0); Reports.Add(report); continue; } bool needReport = false; foreach (KeyValuePair <int, int> pair in columns[col]) { //normal note, already checked above if (pair.Key == pair.Value) { continue; } if (h.StartTime <= pair.Key && h.EndTime >= pair.Key) { needReport = true; break; } if (h.StartTime <= pair.Value && h.EndTime >= pair.Value) { needReport = true; break; } if (h.StartTime >= pair.Key && h.EndTime <= pair.Value) { needReport = true; break; } if (h.StartTime < pair.Key && h.EndTime > pair.Value) { needReport = true; break; } } if (needReport) { AiReportOneObject report = new AiReportOneObject(h, h.StartTime, null, Severity.Error, LocalisationManager.GetString(OsuString.AIComposeMania_OverlappingObject), 0); Reports.Add(report); continue; } else { columns[col][h.StartTime] = h.EndTime; } // we don't want to mark this note as the previous note in the column until it's been processed lastNoteInColumn[col] = h.StartTime; } }