Exemple #1
0
        public void CreateButtons(Label lPlayer)
        {
            float perc   = 1;
            int   width  = (int)(90 * CCheckBox.PERCENTAGE);
            int   height = (int)(130 * CCheckBox.PERCENTAGE);

            lPlayer.Text = Name;

            foreach (var n in Enum.GetNames(typeof(Names)))
            {
                Image myimage = GUIUtilities.GetImageFromName(n);

                CCheckBox b = new CCheckBox()
                {
                    Player          = this,
                    BackColor       = Color,
                    Color           = Color,
                    Character       = Board.GetCharacterByName(n),
                    Image           = myimage,
                    Name            = Name + "_" + n,
                    BackgroundImage = myimage,
                    Width           = width,
                    Height          = height,
                    Appearance      = Appearance.Button
                };

                if (Inteligence.Level == AICategory.Human)
                {
                    b.CheckedChanged += new System.EventHandler(b.SetTransparency);
                }
                else
                {
                    b.Enabled = false;
                }
                b.BackgroundImage = new Bitmap(b.BackgroundImage, b.Width, b.Height);
                Buttons.Add(b);
                Panel.Controls.Add(b);
            }

            Picture.Image = GUIUtilities.GetImageFromName(Secret.Name);
        }
Exemple #2
0
        public void SetTransparency(object sender, EventArgs e)
        {
            CheckBox cb = (CheckBox)sender;

            if (cb.Checked)
            {
                cb.BackColor = Color.Transparent;
                if (!Player.Board.Characters.Where(x => x.Name == Character.Name).FirstOrDefault().Discarded)
                {
                    cb.BackgroundImage = GUIUtilities.SetImageOpacity(Image, PERCENTAGE, 0.5F);
                }
            }
            else
            {
                cb.BackColor = Color;
                if (!Player.Board.Characters.Where(x => x.Name == Character.Name).FirstOrDefault().Discarded)
                {
                    cb.BackgroundImage = GUIUtilities.SetImageOpacity(Image, PERCENTAGE, 1F);
                }
            }
        }