Example #1
0
        // 08-19-2011 Scott
        public static void ReadDrawingUp(Drawing drawing, XElement element)
        {
            var figuresNode = element.Element("Figures");
            var figures = ReadFigures(figuresNode, drawing);

            drawing.Add(figures, false);

            // 08-19-2011 Scott
            System.Windows.Point ptBall = new System.Windows.Point(0, 0);

            foreach (IFigure figure in figures)
            {
                if (figure is Game.PBBall)
                {
                    ptBall = (figure as Game.PBBall).Coordinates;

                    break;
                }
            }

            System.Windows.Point ptPlayer = figures.OfType<Game.PBPlayer>().First().Coordinates;

            if (figures.OfType<Game.PBPlayer>().All(p => p.ScoutType == 1))  // 01-04-2010 Scott
            {
                if (ptBall.Y > ptPlayer.Y)
                {
                    figures.OfType<PointBase>().ForEach(p => { p.X = -p.Coordinates.X; p.Y = -p.Coordinates.Y; });
                }
            }
            // end

            drawing.Recalculate();
        }
Example #2
0
        public static void ReadDrawingReverse(Drawing drawing, XElement element)
        {
            var figuresNode = element.Element("Figures");
            var figures = ReadFigures(figuresNode, drawing);

            drawing.Add(figures, false);

            if (drawing.Figures.OfType<Game.PBPlayer>().All(p => p.Coordinates.Y < 0))  // 01-04-2010 Scott
            {
                drawing.Figures.OfType<PointBase>().ForEach(p => { p.X = -p.Coordinates.X; p.Y = -p.Coordinates.Y; });
            }
            drawing.Recalculate();
        }
Example #3
0
        //public static void ReadPlayer(Drawing drawing, Game.PBPlayer player, string strFile)    // 11-04-2010 Scott
        //{
        //    string text = System.IO.File.ReadAllText(strFile);
        //    XElement element = XElement.Parse(text);
        //    DrawingDeserializer.ReadPlayer(drawing, player, element);
        //}
        //public static void ReadPlayer(Drawing drawing, Game.PBPlayer player, XElement element)  // 11-04-2010 Scott
        //{
        //    var figuresNode = element.Element("Figures");
        //    var figures = ReadFigures(figuresNode, drawing);
        //    drawing.Add(figures, false);
        //    drawing.Recalculate();
        //}
        public static void ReadDrawing(Drawing drawing, XElement element)
        {
            if(element.Attribute("Title") != null)
            {
                drawing.Title = bool.Parse(element.ReadString("Title"));
            }
            if(element.Attribute("BackgroundPath") != null)
            {
                drawing.BackgroundPath = element.ReadString("BackgroundPath");
            }
            if (element.Attribute("YardLine") != null)  // 01-20-2012 Scott
            {
                drawing.YardLine = element.ReadDouble("YardLine");
            }
            var figuresNode = element.Element("Figures");
            var figures = ReadFigures(figuresNode, drawing);

            drawing.Add(figures, false);

            drawing.Recalculate();
            //drawing.CoordinateSystem.MoveTo(drawing.Figures.OfType<IPoint>().Midpoint().Minus());
        }