private void updateCurrentPlayer() { TokenColor playerColor = (TokenColor)_engine.CurrentPlayer; _lblCurrentPlayer = new Label(); TextBlock txtBlockDesc = new TextBlock(); txtBlockDesc.Text = "Current Player: "; TextBlock txtBlockClr = new TextBlock(); txtBlockClr.Background = getColorByTokenColor(playerColor, false); txtBlockClr.Text = playerColor.ToString(); StackPanel panel = new StackPanel(); panel.Orientation = Orientation.Horizontal; panel.Children.Add(txtBlockDesc); panel.Children.Add(txtBlockClr); _lblCurrentPlayer.FontSize = 24; _lblCurrentPlayer.Content = panel; _lblCurrentPlayer.Margin = new Thickness(_gameboardX + _homeYardLength, _gameboardY - 50, 0, 0); mainCanvas.Children.Add(_lblCurrentPlayer); Rectangle marker = new Rectangle(); marker.Fill = Brushes.Black; marker.Width = _homeYards[_engine.CurrentPlayer - 1].Width + _squareMargin; marker.Height = _homeYards[_engine.CurrentPlayer - 1].Height + _squareMargin; marker.Margin = _homeYards[_engine.CurrentPlayer - 1].Margin; Panel.SetZIndex(marker, -1); mainCanvas.Children.Add(marker); }
private void createToken(TokenColor tokenColor, double width, double height, Thickness margin) { Ellipse token = new Ellipse(); token.Fill = getColorByTokenColor(tokenColor, true); token.Width = width; token.Height = height; token.Margin = margin; token.Name = tokenColor.ToString(); token.MouseDown += HomeYard_MouseDown; mainCanvas.Children.Add(token); }
private void createHomeYard(TokenColor tokenColor, double width, double height, Thickness margin) { Rectangle homeYard = new Rectangle(); homeYard.Fill = getColorByTokenColor(tokenColor, false); homeYard.Width = width; homeYard.Height = height; homeYard.Margin = margin; homeYard.Name = tokenColor.ToString(); homeYard.MouseDown += HomeYard_MouseDown; _homeYards[((int)tokenColor) - 1] = homeYard; }