Ejemplo n.º 1
0
        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();
                    }
                }
            }
        }
Ejemplo n.º 2
0
        protected virtual void checkDistanceSpacing(HitObjectBase h, HitObjectBase h2, HitObjectManagerBase hitObjectManager)
        {
            //check combo distance
            if (!CheckDistanceSnap)
            {
                return;
            }

            if (h2 == null || h2.NewCombo || h2 is Spinner)
            {
                return;
            }

            float thisSpacingFactor = getSpacingFactor(h, h2, hitObjectManager);

            //If the current hitobject is a new combo, get a new distance factor from the current and next object.
            if (h.NewCombo || comboSpacingFactor < MIN_SPACING_FACTOR)
            {
                comboSpacingFactor  = thisSpacingFactor;
                comboSpacingObject1 = h;
                comboSpacingObject2 = h2;

                return;
            }

            if (comboSpacingFactor > MIN_SPACING_FACTOR &&
                thisSpacingFactor > MIN_SPACING_FACTOR &&
                (thisSpacingFactor - comboSpacingFactor > comboSpacingFactor * 0.1 * spacingFactor ||
                 comboSpacingFactor - thisSpacingFactor > comboSpacingFactor * 0.2 * spacingFactor))
            {
                HitObjectBase object1 = comboSpacingObject1;
                HitObjectBase object2 = comboSpacingObject2;

                AiReportTwoObjects report = new AiReportTwoObjects(
                    h,
                    h2,
                    delegate { return(Math.Abs(getSpacingFactor(h, h2, hitObjectManager) - getSpacingFactor(object1, object2, hitObjectManager)) < ERROR_FACTOR); },
                    Severity.Warning,
                    thisSpacingFactor < comboSpacingFactor ? LocalisationManager.GetString(OsuString.AICompose_ObjectTooClose) : LocalisationManager.GetString(OsuString.AICompose_ObjectTooFar), 82809);
                Reports.Add(report);
            }
        }