Exemple #1
0
        private void DrawTroop(Frame frame, Frame.TroopInfo t, bool showNumber)
        {
            Pen p = new Pen(Color.Black, (int)(10.0 * _scaleFactor));

            Frame.FactoryInfo sf = frame.Factories[t.SourceId];
            Frame.FactoryInfo df = frame.Factories[t.DestinationId];

            int tt = t.TotalTurns;
            int rt = t.RemaingTurns;
            int pt = tt - rt;

            tt += 2;
            tt *= 5;

            rt += 1;
            rt *= 5;
            rt -= _tickCounter;
            pt += 1;
            pt *= 5;
            pt += _tickCounter;
            double tx = (sf.X * rt + df.X * pt) / tt;
            double ty = (sf.Y * rt + df.Y * pt) / tt;

            int x = (int)(tx * _scaleFactor) + _leftCorrection;
            int y = (int)(ty * _scaleFactor) + _topCorrection;
            int r = (int)(120 * _scaleFactor);

            g.FillEllipse(p.Brush, x - r, y - r, 2 * r, 2 * r);
            string drawString = t.UnitCount.ToString();

            if (showNumber)
            {
                g.FillRectangle(p.Brush, x, y, (int)(200 * _scaleFactor * drawString.Length), (int)(250 * _scaleFactor));
            }

            rt--;
            pt++;
            tx = (sf.X * rt + df.X * pt) / tt;
            ty = (sf.Y * rt + df.Y * pt) / tt;

            x       = (int)(tx * _scaleFactor) + _leftCorrection;
            y       = (int)(ty * _scaleFactor) + _topCorrection;
            r       = (int)(100 * _scaleFactor);
            p.Color = GetColor(t.OwnerId);

            g.DrawEllipse(p, x - r, y - r, 2 * r, 2 * r);

            if (showNumber)
            {
                SolidBrush brush = new SolidBrush(GetLightColor(t.OwnerId));

                Font drawFond = new Font("Arial", (int)(150 * _scaleFactor));
                g.DrawString(drawString, drawFond, brush, x, y);
            }
        }
Exemple #2
0
        private void DrawFactory(Frame.FactoryInfo factory)
        {
            int x  = (int)(factory.X * _scaleFactor) + _leftCorrection;
            int y  = (int)(factory.Y * _scaleFactor) + _topCorrection;
            int r  = (int)(1000.0 * _scaleFactor);
            int pr = (int)(150.0 * _scaleFactor);
            int pd = (int)(350.0 * _scaleFactor);
            int tc = (int)(200.0 * _scaleFactor);

            Pen p = new Pen(Color.Black, (int)(50.0 * _scaleFactor));

            g.FillEllipse(p.Brush, x - r, y - r, 2 * r, 2 * r);
            p.Color = GetColor(factory.OwnerId);
            r       = (int)(600.0 * _scaleFactor);
            g.DrawEllipse(p, x - r, y - r, 2 * r, 2 * r);

            p.Width = 1;

            for (int i = 0; i < 3; i++)
            {
                if (factory.CurrentProduction > i)
                {
                    g.FillEllipse(p.Brush, x + (i - 1) * pd - pr, y - pr, 2 * pr, 2 * pr);
                }
                else
                {
                    g.DrawEllipse(p, x + (i - 1) * pd - pr, y - pr, 2 * pr, 2 * pr);
                }
            }
            // print the number of units

            Font drawFond = new Font("Arial", (int)(300 * _scaleFactor));

            SolidBrush brush      = new SolidBrush(GetLightColor(factory.OwnerId));
            string     drawString = factory.UnitCount.ToString();

            g.DrawString(drawString, drawFond, brush, x - tc * drawString.Length, y - tc * 3);

            drawString = factory.Id.ToString();
            drawFond   = new Font("Arial", (int)(150 * _scaleFactor));
            brush      = new SolidBrush(Color.Green);
            g.DrawString(drawString, drawFond, brush, x + tc * 2, y + tc * 2);
        }
Exemple #3
0
        private void DrawBomb(Frame frame, Frame.BombInfo b)
        {
            Frame.FactoryInfo sf = frame.Factories[b.SourceId];
            Frame.FactoryInfo df = frame.Factories[b.DestinationId];

            int tt = b.TotalTurns;
            int rt = b.RemainingTurns;
            int pt = tt - rt;

            tt += 2;
            tt *= 5;

            rt += 1;
            rt *= 5;
            rt -= _tickCounter;
            pt += 1;
            pt *= 5;
            pt += _tickCounter;
            double tx = (sf.X * rt + df.X * pt) / tt;
            double ty = (sf.Y * rt + df.Y * pt) / tt;

            int x = (int)(tx * _scaleFactor) + _leftCorrection;
            int y = (int)(ty * _scaleFactor) + _topCorrection;
            int r = (int)(120 * _scaleFactor);

            Brush br = new SolidBrush(Color.Black);

            g.FillEllipse(br, x - r - 1, y - r - 1, 2 * r + 2, 2 * r + 2);
            rt--;
            pt++;
            tx = (sf.X * rt + df.X * pt) / tt;
            ty = (sf.Y * rt + df.Y * pt) / tt;

            x = (int)(tx * _scaleFactor) + _leftCorrection;
            y = (int)(ty * _scaleFactor) + _topCorrection;
            r = (int)(100 * _scaleFactor);

            Pen p = new Pen(GetColor(b.OwnerId), (int)(50.0 * _scaleFactor));

            g.DrawEllipse(p, x - r, y - r, 2 * r, 2 * r);
            br = new SolidBrush(Color.Yellow);
            g.FillEllipse(br, x - r, y - r, 2 * r, 2 * r);
        }