private
void
Draw()
{
redChair
=
new
Rectangle()
{
Width
=
32
,
Height
=
32
,
Fill
=
defaultBrush,
Margin
=
new
Thickness(
12
,
58
,
,
)
};
redText
=
new
TextBlock()
{
FontFamily
=
new
FontFamily(
"
宋体
"
),
FontSize
=
12
,
Margin
=
new
Thickness(
10
,
100
,
,
)
};
spectatorChair
=
new
Rectangle()
{
Width
=
RoomWidth
/
3
,
Height
=
RoomWidth
/
3
,
Fill
=
defaultBrush,
Margin
=
new
Thickness(RoomWidth
/
3
, RoomHeight
/
3
,
,
)
};
blackChair
=
new
Rectangle()
{
Width
=
redChair.Width,
Height
=
redChair.Height,
Fill
=
defaultBrush,
Margin
=
new
Thickness(
106
,
58
,
,
)
};
blackText
=
new
TextBlock()
{
FontFamily
=
new
FontFamily(
"
宋体
"
),
FontSize
=
12
,
Margin
=
new
Thickness(
84
,
20
,
,
)
};
TextBlock text
=
new
TextBlock()
{
Foreground
=
new
SolidColorBrush(Colors.White),
Text
=
"
-
"
+
RoomID
+
"
-
"
,
FontFamily
=
new
FontFamily(
"
宋体
"
),
FontSize
=
12
,
Margin
=
new
Thickness(
54
,
130
,
,
)
};
room
=
new
Canvas()
{
Width
=
RoomWidth,
Height
=
RoomHeight,
Margin
=
new
Thickness(InitPoint.X, InitPoint.Y,
,
),
Background
=
BackgroundBrush,
Opacity
=
0.8
};
redChair.MouseLeftButtonDown
+=
new
MouseButtonEventHandler(redChair_MouseLeftButtonDown);
blackChair.MouseLeftButtonDown
+=
new
MouseButtonEventHandler(blackChair_MouseLeftButtonDown);
spectatorChair.MouseLeftButtonDown
+=
new
MouseButtonEventHandler(spectatorChair_MouseLeftButtonDown);
room.Children.Add(redChair);
room.Children.Add(blackChair);
room.Children.Add(spectatorChair);
room.Children.Add(text);
room.Children.Add(redText);
room.Children.Add(blackText);
container.Children.Add(room);
}
public
void
ReDraw()
{
if
(RedPlayer
!=
null
)
{
redChair.Fill
=
GetPlayerBrush(RedPlayer.Head);
redText.Text
=
RedPlayer.NickName;
//
redChair.Effect= new System.Windows.Media.Effects.Effect().
}
else
{
redChair.Fill
=
defaultBrush;
redText.Text
=
""
;
}
if
(BlackPlayer
!=
null
)
{
blackChair.Fill
=
GetPlayerBrush(BlackPlayer.Head);
blackText.Text
=
BlackPlayer.NickName;
}
else
{
blackChair.Fill
=
defaultBrush;
blackText.Text
=
""
;
}
room.Background
=
IsGaming
?
GamingBrush : BackgroundBrush;
}