예제 #1
0
        private void ProductionPanel_Paint(object sender, PaintEventArgs e)
        {
            // Show item currently in production (ProductionItem=0...61 are units, 62...127 are improvements)
            // zoom: Units=-1(norm), Improvements=0(norm)
            using var font = new Font("Arial", 9, FontStyle.Bold);
            // Units
            int zoom;

            if (_thisCity.ItemInProduction < 62)
            {
                zoom = -1;
                using var unitPic = Images.Units[_thisCity.ItemInProduction].Resize(zoom);
                e.Graphics.DrawImage(unitPic, new Point(64, 0));
            }
            // Improvements
            else
            {
                Draw.Text(e.Graphics, Game.Rules.ImprovementName[_thisCity.ItemInProduction - 62 + 1], font, StringAlignment.Center, StringAlignment.Center, Color.FromArgb(63, 79, 167), new Point(98, 5), Color.Black, 1, 1);
                zoom = 0;
                using var improvPic = Images.Improvements[_thisCity.ItemInProduction - 62 + 1].Resize(zoom);
                e.Graphics.DrawImage(improvPic, new Point(79, 18));
            }

            using var cityProdPic = Draw.CityProduction(_thisCity);
            e.Graphics.DrawImage(cityProdPic, new Point(0, 0));  // Draw production shields and sqare around them
        }