Example #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();
                    }
                }
            }
        }