示例#1
0
        private void DrawDigit(int digitIndex, int digit, double milliseconds)
        {
            MyParticles particles = null;

            int ox = 0;
            int dx = SIZE * SEGMENTS_X;

            if (digitIndex == 0)
            {
                particles = Particles1;
                ox        = OrigoX - dx / 2;
            }
            else
            {
                particles = Particles2;
                ox        = OrigoX + dx / 2;
            }


            LineConnector connector = GetDigit(digit);

            if (connector != null)
            {
                double f = milliseconds / 1000.0f;

                var points = connector.DistributePoints(particles.Count, f);
                for (int i = 0; i < points.Count; i++)
                {
                    var particle = particles[i];
                    var point    = points[i];
                    int position = 2 * Radius * i / particles.Count - Radius;
                    particle.Destination = new Vector2(ox + point.X, OrigoY + point.Y);
                }
            }
        }
示例#2
0
        private void SetCharacterData(int characterIndex, int characterType)
        {
            var           particles = Particles[characterIndex];
            LineConnector connector = GetConnector(characterType);

            if (connector != null)
            {
                var points = connector.DistributePoints(particles.Count, 0);
                for (int i = 0; i < points.Count; i++)
                {
                    var particle = particles[i];
                    var point    = points[i];
                    int position = 2 * Radius * i / particles.Count - Radius;
                    particle.Destination = new Vector2(point.X, point.Y);
                }
            }
        }
示例#3
0
        public void DigitUpdate(GameTime gameTime)
        {
            int milliseconds = gameTime.ElapsedGameTime.Milliseconds;
            int second       = gameTime.TotalGameTime.Seconds;
            int digit        = second % 10;

            bool rotate = true;

            if (rotate)
            {
                LineConnector connector = GetDigit(digit);
                if (connector != null)
                {
                    double f = gameTime.TotalGameTime.Milliseconds / 1000.0f;
                    //double f = (gameTime.TotalGameTime.Seconds % 10) / 10.0f;

                    var points = connector.DistributePoints(Particles.Count, f);
                    for (int i = 0; i < points.Count; i++)
                    {
                        var particle = Particles[i];
                        var point    = points[i];
                        int position = 2 * Radius * i / Particles.Count - Radius;
                        particle.Destination = new Vector2(OrigoX + point.X, OrigoY + point.Y);
                    }
                }
            }
            else if (second != fLastSecond)
            {
                LineConnector connector = GetDigit(digit);
                if (connector != null)
                {
                    var points = connector.DistributePoints(Particles.Count, 0.0f);
                    for (int i = 0; i < points.Count; i++)
                    {
                        var particle = Particles[i];
                        var point    = points[i];
                        int position = 2 * Radius * i / Particles.Count - Radius;
                        particle.Destination = new Vector2(OrigoX + point.X, OrigoY + point.Y);
                    }
                }
            }
        }
示例#4
0
        public void UpdateDigits(GameTime gameTime)
        {
            TimeSpan span    = fGoalDate - DateTime.Now;
            int      days    = 0;
            int      hours   = 0;
            int      minutes = 0;
            int      seconds = 0;

            if (span.TotalSeconds > 0)
            {
                days    = span.Days;
                hours   = span.Hours;
                minutes = span.Minutes;
                seconds = span.Seconds;
                if (days > 999)
                {
                    days    = 999;
                    hours   = 99;
                    minutes = 99;
                    seconds = 99;
                }
            }
            DigitType colonType = DigitType.colon1;

            if ((seconds % 2) == 1)
            {
                colonType = DigitType.colon2;
            }

            int days1    = days / 100;
            int days2    = (days / 10) % 10;
            int days3    = days % 10;
            int hours1   = hours / 10;
            int hours2   = hours % 10;
            int minutes1 = minutes / 10;
            int minutes2 = minutes % 10;
            int seconds1 = seconds / 10;
            int seconds2 = seconds % 10;

            int index = 0;

            fCurrentDigits[index++] = (DigitType)days1;
            fCurrentDigits[index++] = (DigitType)days2;
            fCurrentDigits[index++] = (DigitType)days3;
            fCurrentDigits[index++] = colonType;
            fCurrentDigits[index++] = (DigitType)hours1;
            fCurrentDigits[index++] = (DigitType)hours2;
            fCurrentDigits[index++] = colonType;
            fCurrentDigits[index++] = (DigitType)minutes1;
            fCurrentDigits[index++] = (DigitType)minutes2;
            fCurrentDigits[index++] = colonType;
            fCurrentDigits[index++] = (DigitType)seconds1;
            fCurrentDigits[index++] = (DigitType)seconds2;

            //int  milliseconds = gameTime.TotalGameTime.Milliseconds;
            //double f = milliseconds / 1000.0f;

            int x0 = SIZE * SEGMENTS_X / 2;

            //int y0 = SIZE * SEGMENTS_X / 2;


            //if ((seconds1%2)==0)
            //{
            //    y0 = Height - SIZE * SEGMENTS_X;
            //}
            for (int digitIndex = 0; digitIndex < fCurrentDigits.Length; digitIndex++)
            {
                int ox = Width / 2 + (SIZE * SEGMENTS_X) * (digitIndex - 6);
                int y0 = SIZE * SEGMENTS_X / 2;
                int ms = gameTime.TotalGameTime.Seconds * 1000 + gameTime.TotalGameTime.Milliseconds + 50 * digitIndex;
                ms = ms % 60000;

                if (ms > 30000)
                {
                    y0 = Height - SIZE * SEGMENTS_X;
                }


                DigitType     dType     = fCurrentDigits[digitIndex];
                MyParticles   particles = fParticles[digitIndex];
                LineConnector connector = GetDigit(dType);

                if (connector != null)
                {
                    var points = connector.DistributePoints(particles.Count, 0);
                    for (int i = 0; i < points.Count; i++)
                    {
                        var particle = particles[i];
                        var point    = points[i];
                        particle.Destination = new Vector2(x0 + ox + point.X, y0 + point.Y);
                    }
                }
            }
        }
示例#5
0
        private LineConnector GetDigit(DigitType digit)
        {
            int ox = -3;
            int oy = -3;
            int dx = SIZE;
            int dy = SIZE;

            if (fDigits[(int)digit] == null)
            {
                LineConnector lc = new LineConnector();
                fDigits[(int)digit] = lc;
                switch (digit)
                {
                case DigitType.digit0:
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    break;

                case DigitType.digit1:
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((2 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((3 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((3 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((2 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((2 + ox) * dx, (0 + oy) * dy));
                    break;

                case DigitType.digit2:
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    break;

                case DigitType.digit3:
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    break;

                case DigitType.digit4:
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    break;

                case DigitType.digit5:
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    break;

                case DigitType.digit6:
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    break;

                case DigitType.digit7:
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    break;

                case DigitType.digit8:
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[2].Points.Add(new Point((1 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[2].Points.Add(new Point((4 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[2].Points.Add(new Point((4 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[2].Points.Add(new Point((1 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[2].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    break;

                case DigitType.digit9:
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    break;

                case DigitType.colon1:
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((2 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((2 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((2 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((2 + ox) * dx, (6 + oy) * dy));
                    break;

                case DigitType.colon2:
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((3 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((3 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((3 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((3 + ox) * dx, (6 + oy) * dy));
                    break;

                default:
                    fDigits[(int)digit] = null;
                    break;
                }
            }
            return(fDigits[(int)digit]);
        }
示例#6
0
        private LineConnector GetConnector(int index)
        {
            int ox = -300 + Width / 2;
            int oy = -300 + Height / 2;

            if (fCharacters[index] == null)
            {
                LineConnector lc = new LineConnector();
                fCharacters[index] = lc;
                switch (index)
                {
                case 0:
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((141 + ox) * SCALE), Convert.ToInt16((163 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((225 + ox) * SCALE), Convert.ToInt16((163 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((217 + ox) * SCALE), Convert.ToInt16((192 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((210 + ox) * SCALE), Convert.ToInt16((173 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((171 + ox) * SCALE), Convert.ToInt16((173 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((171 + ox) * SCALE), Convert.ToInt16((219 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((200 + ox) * SCALE), Convert.ToInt16((218 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((209 + ox) * SCALE), Convert.ToInt16((205 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((209 + ox) * SCALE), Convert.ToInt16((243 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((199 + ox) * SCALE), Convert.ToInt16((228 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((172 + ox) * SCALE), Convert.ToInt16((230 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((172 + ox) * SCALE), Convert.ToInt16((276 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((226 + ox) * SCALE), Convert.ToInt16((256 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((226 + ox) * SCALE), Convert.ToInt16((286 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((139 + ox) * SCALE), Convert.ToInt16((286 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((151 + ox) * SCALE), Convert.ToInt16((278 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((151 + ox) * SCALE), Convert.ToInt16((174 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((141 + ox) * SCALE), Convert.ToInt16((163 + oy) * SCALE)));
                    break;

                case 1:
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((235 + ox) * SCALE), Convert.ToInt16((163 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((281 + ox) * SCALE), Convert.ToInt16((163 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((269 + ox) * SCALE), Convert.ToInt16((173 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((300 + ox) * SCALE), Convert.ToInt16((261 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((335 + ox) * SCALE), Convert.ToInt16((172 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((322 + ox) * SCALE), Convert.ToInt16((163 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((362 + ox) * SCALE), Convert.ToInt16((163 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((350 + ox) * SCALE), Convert.ToInt16((173 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((301 + ox) * SCALE), Convert.ToInt16((288 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((290 + ox) * SCALE), Convert.ToInt16((288 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((245 + ox) * SCALE), Convert.ToInt16((172 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((235 + ox) * SCALE), Convert.ToInt16((163 + oy) * SCALE)));
                    break;

                case 2:
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((402 + ox) * SCALE), Convert.ToInt16((163 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((413 + ox) * SCALE), Convert.ToInt16((163 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((457 + ox) * SCALE), Convert.ToInt16((278 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((469 + ox) * SCALE), Convert.ToInt16((287 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((422 + ox) * SCALE), Convert.ToInt16((287 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((435 + ox) * SCALE), Convert.ToInt16((278 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((422 + ox) * SCALE), Convert.ToInt16((243 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((381 + ox) * SCALE), Convert.ToInt16((243 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((369 + ox) * SCALE), Convert.ToInt16((277 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((381 + ox) * SCALE), Convert.ToInt16((287 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((338 + ox) * SCALE), Convert.ToInt16((287 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((354 + ox) * SCALE), Convert.ToInt16((277 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((402 + ox) * SCALE), Convert.ToInt16((163 + oy) * SCALE)));
                    lc.Lines[1].Points.Add(new Point(Convert.ToInt16((403 + ox) * SCALE), Convert.ToInt16((188 + oy) * SCALE)));
                    lc.Lines[1].Points.Add(new Point(Convert.ToInt16((418 + ox) * SCALE), Convert.ToInt16((232 + oy) * SCALE)));
                    lc.Lines[1].Points.Add(new Point(Convert.ToInt16((386 + ox) * SCALE), Convert.ToInt16((232 + oy) * SCALE)));
                    lc.Lines[1].Points.Add(new Point(Convert.ToInt16((403 + ox) * SCALE), Convert.ToInt16((188 + oy) * SCALE)));
                    break;

                case 3:
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((281 + ox) * SCALE), Convert.ToInt16((375 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((263 + ox) * SCALE), Convert.ToInt16((359 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((263 + ox) * SCALE), Convert.ToInt16((349 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((279 + ox) * SCALE), Convert.ToInt16((336 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((292 + ox) * SCALE), Convert.ToInt16((335 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((300 + ox) * SCALE), Convert.ToInt16((364 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((287 + ox) * SCALE), Convert.ToInt16((367 + oy) * SCALE)));
                    lc.Lines[0].Points.Add(new Point(Convert.ToInt16((281 + ox) * SCALE), Convert.ToInt16((375 + oy) * SCALE)));

                    lc.Lines[1].Points.Add(new Point(Convert.ToInt16((290 + ox) * SCALE), Convert.ToInt16((396 + oy) * SCALE)));
                    lc.Lines[1].Points.Add(new Point(Convert.ToInt16((285 + ox) * SCALE), Convert.ToInt16((408 + oy) * SCALE)));
                    lc.Lines[1].Points.Add(new Point(Convert.ToInt16((278 + ox) * SCALE), Convert.ToInt16((415 + oy) * SCALE)));
                    lc.Lines[1].Points.Add(new Point(Convert.ToInt16((265 + ox) * SCALE), Convert.ToInt16((415 + oy) * SCALE)));
                    lc.Lines[1].Points.Add(new Point(Convert.ToInt16((254 + ox) * SCALE), Convert.ToInt16((398 + oy) * SCALE)));
                    lc.Lines[1].Points.Add(new Point(Convert.ToInt16((253 + ox) * SCALE), Convert.ToInt16((386 + oy) * SCALE)));
                    lc.Lines[1].Points.Add(new Point(Convert.ToInt16((264 + ox) * SCALE), Convert.ToInt16((377 + oy) * SCALE)));
                    lc.Lines[1].Points.Add(new Point(Convert.ToInt16((281 + ox) * SCALE), Convert.ToInt16((378 + oy) * SCALE)));
                    lc.Lines[1].Points.Add(new Point(Convert.ToInt16((283 + ox) * SCALE), Convert.ToInt16((389 + oy) * SCALE)));
                    lc.Lines[1].Points.Add(new Point(Convert.ToInt16((290 + ox) * SCALE), Convert.ToInt16((396 + oy) * SCALE)));

                    lc.Lines[2].Points.Add(new Point(Convert.ToInt16((313 + ox) * SCALE), Convert.ToInt16((387 + oy) * SCALE)));
                    lc.Lines[2].Points.Add(new Point(Convert.ToInt16((323 + ox) * SCALE), Convert.ToInt16((392 + oy) * SCALE)));
                    lc.Lines[2].Points.Add(new Point(Convert.ToInt16((333 + ox) * SCALE), Convert.ToInt16((402 + oy) * SCALE)));
                    lc.Lines[2].Points.Add(new Point(Convert.ToInt16((332 + ox) * SCALE), Convert.ToInt16((412 + oy) * SCALE)));
                    lc.Lines[2].Points.Add(new Point(Convert.ToInt16((315 + ox) * SCALE), Convert.ToInt16((425 + oy) * SCALE)));
                    lc.Lines[2].Points.Add(new Point(Convert.ToInt16((302 + ox) * SCALE), Convert.ToInt16((425 + oy) * SCALE)));
                    lc.Lines[2].Points.Add(new Point(Convert.ToInt16((295 + ox) * SCALE), Convert.ToInt16((413 + oy) * SCALE)));
                    lc.Lines[2].Points.Add(new Point(Convert.ToInt16((296 + ox) * SCALE), Convert.ToInt16((397 + oy) * SCALE)));
                    lc.Lines[2].Points.Add(new Point(Convert.ToInt16((306 + ox) * SCALE), Convert.ToInt16((395 + oy) * SCALE)));
                    lc.Lines[2].Points.Add(new Point(Convert.ToInt16((313 + ox) * SCALE), Convert.ToInt16((387 + oy) * SCALE)));

                    lc.Lines[3].Points.Add(new Point(Convert.ToInt16((305 + ox) * SCALE), Convert.ToInt16((365 + oy) * SCALE)));
                    lc.Lines[3].Points.Add(new Point(Convert.ToInt16((318 + ox) * SCALE), Convert.ToInt16((346 + oy) * SCALE)));
                    lc.Lines[3].Points.Add(new Point(Convert.ToInt16((329 + ox) * SCALE), Convert.ToInt16((346 + oy) * SCALE)));
                    lc.Lines[3].Points.Add(new Point(Convert.ToInt16((336 + ox) * SCALE), Convert.ToInt16((352 + oy) * SCALE)));
                    lc.Lines[3].Points.Add(new Point(Convert.ToInt16((341 + ox) * SCALE), Convert.ToInt16((364 + oy) * SCALE)));
                    lc.Lines[3].Points.Add(new Point(Convert.ToInt16((342 + ox) * SCALE), Convert.ToInt16((375 + oy) * SCALE)));
                    lc.Lines[3].Points.Add(new Point(Convert.ToInt16((333 + ox) * SCALE), Convert.ToInt16((384 + oy) * SCALE)));
                    lc.Lines[3].Points.Add(new Point(Convert.ToInt16((315 + ox) * SCALE), Convert.ToInt16((383 + oy) * SCALE)));
                    lc.Lines[3].Points.Add(new Point(Convert.ToInt16((313 + ox) * SCALE), Convert.ToInt16((372 + oy) * SCALE)));
                    lc.Lines[3].Points.Add(new Point(Convert.ToInt16((305 + ox) * SCALE), Convert.ToInt16((365 + oy) * SCALE)));

                    break;

                default:
                    fCharacters[index] = null;
                    break;
                }
            }
            return(fCharacters[index]);
        }
示例#7
0
        private LineConnector GetDigit(int digit)
        {
            int ox = -3;
            int oy = -3;
            int dx = 30;
            int dy = 30;

            if (fDigits[digit] == null)
            {
                LineConnector lc = new LineConnector();
                fDigits[digit] = lc;
                switch (digit)
                {
                case 0:
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    break;

                case 1:
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((2 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((3 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((3 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((2 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((2 + ox) * dx, (0 + oy) * dy));
                    break;

                case 2:
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    break;

                case 3:
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    break;

                case 4:
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    break;

                case 5:
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    break;

                case 6:
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((1 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    break;

                case 7:
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    break;

                case 8:
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[2].Points.Add(new Point((1 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[2].Points.Add(new Point((4 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[2].Points.Add(new Point((4 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[2].Points.Add(new Point((1 + ox) * dx, (6 + oy) * dy));
                    lc.Lines[2].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    break;

                case 9:
                    lc.Lines.Add(new Line());
                    lc.Lines.Add(new Line());
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((5 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (7 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((4 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (4 + oy) * dy));
                    lc.Lines[0].Points.Add(new Point((0 + ox) * dx, (0 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (1 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((4 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (3 + oy) * dy));
                    lc.Lines[1].Points.Add(new Point((1 + ox) * dx, (1 + oy) * dy));
                    break;

                default:
                    fDigits[digit] = null;
                    break;
                }
            }
            return(fDigits[digit]);
        }