哪位高手能帮我用中文注解一下啊?谢谢
namespace MySnake{
public partial class frmGame : Form
{
private Controller objController;
private Snake objSnake;
private string strUp = "";
private string strDown = "";
private string strLeft = "";
private string strRight = "";
private bool blIsGameStart;
public frmGame()
{
InitializeComponent();
}
private void frmGame_Load(object sender, EventArgs e)
{
blIsGameStart = false;
Config objConfig = new Config();
strUp = objConfig.GetConfigValue("Up");
strDown = objConfig.GetConfigValue("Down");
strLeft = objConfig.GetConfigValue("Left");
strRight = objConfig.GetConfigValue("Right");
lblUp.Text = strUp;
lblDown.Text = strDown;
lblLeft.Text = strLeft;
lblRight.Text = strRight;
}
private void timer1_Tick(object sender, EventArgs e)
{
objController.Move();
if (objController.IsGameOver)
{
timer1.Enabled = false;
开始ToolStripMenuItem.Enabled = true;
暂停ToolStripMenuItem.Enabled = false;
MessageBox.Show("Game Over");
}
else
{
if (objController.IsGetTarget)
{
lblTargetCount.Text = objController.TargetCount.ToString();
lblSnakeLength.Text = objSnake.Length.ToString();
lblScore.Text = objController.Score.ToString();
lblSpeedLevel.Text = objSnake.Speed.ToString();
timer1.Interval = 245 - objSnake.Speed * 20;
}
}
}
private void 暂停ToolStripMenuItem_Click(object sender, EventArgs e)
{
timer1.Enabled = !timer1.Enabled;
}
private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void 开始ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (objController != null)
{
objController.ClearSnake();
}
initializeSnake();
timer1.Enabled = true;
开始ToolStripMenuItem.Enabled = false;
暂停ToolStripMenuItem.Enabled = true;
结束游戏ToolStripMenuItem.Enabled = true;
}
private void initializeSnake()
{
objSnake = new Snake();
objController = new Controller(plGame, objSnake);
lblDirection.Text = "向右";
lblSnakeLength.Text = "6";
lblTargetCount.Text = "0";
timer1.Interval = 245 - objSnake.Speed * 20;
Config objConfig = new Config();
strUp = objConfig.GetConfigValue("Up");
strDown = objConfig.GetConfigValue("Down");
strLeft = objConfig.GetConfigValue("Left");
strRight = objConfig.GetConfigValue("Right");
lblUp.Text = strUp;
lblDown.Text = strDown;
lblLeft.Text = strLeft;
lblRight.Text = strRight;
objController.InitializeSnake();
blIsGameStart = true;
}
private void 结束游戏ToolStripMenuItem_Click(object sender, EventArgs e)
{
timer1.Enabled = false;
开始ToolStripMenuItem.Enabled = true;
暂停ToolStripMenuItem.Enabled = false;
结束游戏ToolStripMenuItem.Enabled = false;
}
private void frmGame_KeyDown(object sender, KeyEventArgs e)
{
string strKey = e.KeyData.ToString();
if (strKey == strUp)
{
if (objSnake.Direction != "D")
{
objSnake.Direction = "U";
lblDirection.Text = "向上";
}
}
else if (strKey == strLeft)
{
if (objSnake.Direction != "R")
{
objSnake.Direction = "L";
lblDirection.Text = "向左";
}
}
else if (strKey == strDown)
{
if (objSnake.Direction != "U")
{
objSnake.Direction = "D";
lblDirection.Text = "向下";
}
}
else if (strKey == strRight)
{
if (objSnake.Direction != "L")
{
objSnake.Direction = "R";
lblDirection.Text = "向右";
}
}
}
private void frmGame_Paint(object sender, PaintEventArgs e)
{
if (blIsGameStart)
{
objController.DrawSnakeAndTarget();
}
}
private void 游戏设置ToolStripMenuItem_Click(object sender, EventArgs e)
{
frmSettings objFrm = new frmSettings();
objFrm.ShowDialog();
}
private void 关于AToolStripMenuItem_Click(object sender, EventArgs e)
{
frmAbout newFrm = new frmAbout();
newFrm.ShowDialog();
(这个是我游戏的界面)
namespace MySnake
{
public partial class frmSettings : Form
{
private IList<Point> objPointList;
private Pen objPenEdge;
private SolidBrush objSBBody;
private Graphics g;
public frmSettings()
{
InitializeComponent();
}
private void txtUp_KeyDown(object sender, KeyEventArgs e)
{
((TextBox)sender).Text = e.KeyData.ToString();
}
private void frmSettings_Load(object sender, EventArgs e)
{
objPointList = new List<Point>();
for (int i = 5; i < 11; i++)
{
objPointList.Add(new Point(i, 2));
}
try
{
Config objConfig = new Config();
string strMaxLength = objConfig.GetConfigValue("MaxLength");
string strSpeed = objConfig.GetConfigValue("Speed");
string strUp = objConfig.GetConfigValue("Up");
string strDown = objConfig.GetConfigValue("Down");
string strLeft = objConfig.GetConfigValue("Left");
string strRight = objConfig.GetConfigValue("Right");
txtMaxLength.Text = strMaxLength;
}
catch
{
MessageBox.Show("加载配置文件失败!");
}
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnSave_Click(object sender, EventArgs e)
{
MessageBox.Show("修改设置成功!新设置将在游戏开始是生效!");
}
}
}
(这个是游戏设置的界面)