Example #1
0
 public ConfirmBuy(string name, short price, short treasury) : base(100, 80, 9, 23, new string[] { "Cost to complete", $"{name}: ${price}", $"Treasury: ${treasury}" })
 {
     for (int i = 0; i < TextLines.Length; i++)
     {
         DialogBox.AddLayer(TextLines[i], 5, (TextLines[i].Height * i) + 5);
     }
 }
Example #2
0
 public MessageBox(params string[] message) : base(100, 80, 9, 7, message)
 {
     for (int i = 0; i < TextLines.Length; i++)
     {
         DialogBox.AddLayer(TextLines[i], 5, (TextLines[i].Height * i) + 5);
     }
 }
Example #3
0
        public ConfirmSell(IBuilding building) : base(128, 80, 9, 23, new string[] { "Do you want to sell", $"your {building.Name} for {building.SellPrice}$?" })
        {
            Building = building;

            for (int i = 0; i < TextLines.Length; i++)
            {
                DialogBox.AddLayer(TextLines[i], 5, (TextLines[i].Height * i) + 5);
            }
        }
Example #4
0
        public SpyMessage(string[] message) : base(38, 72, DialogWidth(message), 57)
        {
            IBitmap spyPortrait = Icons.Spy;

            Palette palette = Common.DefaultPalette;

            for (int i = 144; i < 256; i++)
            {
                palette[i] = spyPortrait.Palette[i];
            }
            this.SetPalette(palette);

            _textLines = TextBitmaps(message);
            DialogBox.AddLayer(spyPortrait, 2, 2);
            for (int i = 0; i < _textLines.Length; i++)
            {
                DialogBox.AddLayer(_textLines[i], 47, (_textLines[i].Height * (i - 1)) + 13);
            }
        }
Example #5
0
        internal DiplomatSabotage(City enemyCity, Diplomat diplomat) : base(60, 80, 220, 56)
        {
            _enemyCity = enemyCity ?? throw new ArgumentNullException(nameof(enemyCity));
            _diplomat  = diplomat ?? throw new ArgumentNullException(nameof(diplomat));

            IBitmap spyPortrait = Icons.Spy;

            Palette palette = Common.DefaultPalette;

            for (int i = 144; i < 256; i++)
            {
                palette[i] = spyPortrait.Palette[i];
            }
            this.SetPalette(palette);

            DialogBox.AddLayer(spyPortrait, 2, 2);

            DialogBox.DrawText($"Spies Report", 0, 15, 45, 5);
            DialogBox.DrawText(_diplomat.Sabotage(_enemyCity), 0, 15, 45, 5 + Resources.GetFontHeight(FONT_ID));
            DialogBox.DrawText($"in {_enemyCity.Name}", 0, 15, 45, 5 + (2 * Resources.GetFontHeight(FONT_ID)));
        }
Example #6
0
        public DisbandUnit(City city, IUnit unit) : base(58, 72, TextPictures(city, unit).Max(b => b.Width) + 52, 62)
        {
            bool    modernGovernment   = Human.HasAdvance <Invention>();
            Picture governmentPortrait = Icons.GovernmentPortrait(Human.Government, Advisor.Defense, modernGovernment);

            Color[] palette = Common.GamePlay.Palette;
            for (int i = 144; i < 256; i++)
            {
                palette[i] = governmentPortrait.Palette[i];
            }
            _canvas.SetPalette(palette);

            DialogBox.AddLayer(governmentPortrait, 2, 2);
            DialogBox.DrawText("Defense Minister:", 0, 15, 47, 4);
            DialogBox.FillRectangle(11, 47, 11, 94, 1);

            _textLines = TextPictures(city, unit);
            for (int i = 0; i < _textLines.Length; i++)
            {
                DialogBox.AddLayer(_textLines[i], 47, (_textLines[i].Height * i) + 13);
            }
        }
Example #7
0
        public AdvisorMessage(Advisor advisor, string[] message, bool leftAlign) : base((leftAlign ? 38 : 58), 72, DialogWidth(message), 62)
        {
            bool    modernGovernment   = Human.HasAdvance <Invention>();
            IBitmap governmentPortrait = Icons.GovernmentPortrait(Human.Government, advisor, modernGovernment);

            // TODO fire-eggs common operation
            Palette palette = Common.DefaultPalette;

            for (int i = 144; i < 256; i++)
            {
                palette[i] = governmentPortrait.Palette[i];
            }
            this.SetPalette(palette);

            _textLines = TextBitmaps(message);
            DialogBox.AddLayer(governmentPortrait, 2, 2);
            DialogBox.DrawText($"{advisorNames[(int)advisor]}:", 0, 15, 47, 4);
            DialogBox.FillRectangle(47, 11, Resources.GetText($"{advisorNames[(int)advisor]}:", 0, 15).Width + 1, 1, 11);
            for (int i = 0; i < _textLines.Length; i++)
            {
                DialogBox.AddLayer(_textLines[i], 47, (_textLines[i].Height * i) + 13);
            }
        }
Example #8
0
        internal DiplomatIncite(City cityToIncite, Diplomat diplomat) : base(100, 80, 180, 56)
        {
            _cityToIncite = cityToIncite ?? throw new ArgumentNullException(nameof(cityToIncite));
            _diplomat     = diplomat ?? throw new ArgumentNullException(nameof(diplomat));

            IBitmap spyPortrait = Icons.Spy;

            Palette palette = Common.DefaultPalette;

            for (int i = 144; i < 256; i++)
            {
                palette[i] = spyPortrait.Palette[i];
            }
            this.SetPalette(palette);

            DialogBox.AddLayer(spyPortrait, 2, 2);

            _inciteCost = Diplomat.InciteCost(cityToIncite);
            _canIncite  = Diplomat.CanIncite(cityToIncite, diplomat.Player.Gold);

            DialogBox.DrawText($"Spies Report", 0, 15, 45, 5);
            DialogBox.DrawText($"Dissidents in {_cityToIncite.Name}", 0, 15, 45, 5 + Resources.GetFontHeight(FONT_ID));
            DialogBox.DrawText($"will revolt for ${_inciteCost}", 0, 15, 45, 5 + (2 * Resources.GetFontHeight(FONT_ID)));
        }
Example #9
0
        public AdvisorMessage(Advisor advisor, string[] message, bool leftAlign) : base((leftAlign ? 38 : 58), 72, DialogWidth(message) + 52, 62)
        {
            Cursor = MouseCursor.None;

            string[] advisorNames       = new string[] { "Defense Minister", "Domestic Advisor", "Foreign Minister", "Science Advisor" };
            bool     modernGovernment   = Human.HasAdvance <Invention>();
            Picture  governmentPortrait = Icons.GovernmentPortrait(Human.Government, advisor, modernGovernment);

            Color[] palette = Common.GamePlay.Palette;
            for (int i = 144; i < 256; i++)
            {
                palette[i] = governmentPortrait.Palette[i];
            }
            _canvas.SetPalette(palette);

            _textLines = TextBitmaps(message);
            DialogBox.AddLayer(governmentPortrait, 2, 2);
            DialogBox.DrawText($"{advisorNames[(int)advisor]}:", 0, 15, 47, 4);
            DialogBox.FillRectangle(11, 47, 11, Resources.Instance.GetText($"{advisorNames[(int)advisor]}:", 0, 15).Width + 1, 1);
            for (int i = 0; i < _textLines.Length; i++)
            {
                DialogBox.AddLayer(_textLines[i], 47, (_textLines[i].Height * i) + 13);
            }
        }