Ejemplo n.º 1
0
        public Tile(ICase tile, TileFactory tileFactory, List<Unite> listUnite, SolidColorBrush playerBrush)
        {
            InitializeComponent();
            this.tile = tile;
            this.nbUnite = listUnite.Count;
            VisualBrush myBrush = new VisualBrush();
            aPanel = new Grid();

            aPanel.Background = tileFactory.getViewTile(tile);

            // Create some text.
            TextBlock backText = new TextBlock();
            Canvas.SetZIndex(backText, 3);
            if (listUnite != null && listUnite.Count > 0)
            {
                backText.Text = " " + listUnite.Count.ToString() + " ";
                backText.Background = (SolidColorBrush)new BrushConverter().ConvertFromString(listUnite[0].Proprietaire.Couleur);
                backText.Foreground = Brushes.White;
            }
            FontSizeConverter fSizeConverter = new FontSizeConverter();
            backText.FontSize = (double)fSizeConverter.ConvertFromString("10pt");
            backText.Margin = new Thickness(10);
            Grid.SetColumn(backText, 0);
            Grid.SetRow(backText, 0);
            DropShadowEffect myDropShadowEffect  = new DropShadowEffect();
            myDropShadowEffect.BlurRadius = 1;
            myDropShadowEffect.Color = Color.FromRgb(0,0,0);
            myDropShadowEffect.ShadowDepth = 2;
            backText.Effect=myDropShadowEffect;
            aPanel.Children.Add(backText);
            myBrush.Visual = aPanel;
            rect.Fill = myBrush;
            rect1.Stroke = playerBrush;
        }