在线演示地址:Silverlight+WCF 新手实例 象棋 在线演示
上一系列四十篇索引:Silverlight+WCF 新手实例 象棋 专题索引
本篇紧接着上一篇:Silverlight+WCF 实战-网络象棋最终篇之房间装修-WCF端(二)
继续为房间进行如下的装修:
代码实现[Silverlight端]
说明:
由于更换背景引入图片,房间的属性发生了较大的变化,由此引发了客户端房间类较大的改动。
1:Silverlight端:GameRoom类大调整[被注释的是原来的代码,未注释的是修改的代码]
由于房间本次装修的变化较大,成本也是不低的。
a:增加的全局变量
TextBlock redText;//红色玩家文字
TextBlock blackText;//黑色玩家文字
private SolidColorBrush defaultBrush = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));//默认透明的背景色
TextBlock blackText;//黑色玩家文字
private SolidColorBrush defaultBrush = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0));//默认透明的背景色
b:增加的属性[同样删除两个字段RedPlayerInChair/BlackPlayerInChair]
///// <summary>
///// 红色座位有人
///// </summary>
//public bool RedPlayerInChair
//{
// get;
// set;
//}
///// <summary>
///// 黑色座位有人
///// </summary>
//public bool BlackPlayerInChair
//{
// get;
// set;
//}
public bool IsGaming
{
get;
set;
}
public GameService.Player RedPlayer
{
get;
set;
}
public GameService.Player BlackPlayer
{
get;
set;
}
/// <summary>
/// 背景图片[还没玩游戏]
/// </summary>
public ImageBrush BackgroundBrush
{
get;
set;
}
/// <summary>
/// 背景图片[游戏中]
/// </summary>
public ImageBrush GamingBrush
{
get;
set;
}
///// 红色座位有人
///// </summary>
//public bool RedPlayerInChair
//{
// get;
// set;
//}
///// <summary>
///// 黑色座位有人
///// </summary>
//public bool BlackPlayerInChair
//{
// get;
// set;
//}
public bool IsGaming
{
get;
set;
}
public GameService.Player RedPlayer
{
get;
set;
}
public GameService.Player BlackPlayer
{
get;
set;
}
/// <summary>
/// 背景图片[还没玩游戏]
/// </summary>
public ImageBrush BackgroundBrush
{
get;
set;
}
/// <summary>
/// 背景图片[游戏中]
/// </summary>
public ImageBrush GamingBrush
{
get;
set;
}