本游戏是微软SMART PHONE平台下的手机游戏
源代码在线查看: gamehscore.cs
using System;
using System.Drawing;
using System.Windows.Forms;
namespace DiamondPet.UserLayer.GameHScore
{
///
/// GameHScore 的摘要说明。
///
public class GameHScore : GameState
{
///
/// 最高分,从xml文件中装入
///
private int higeScore = 100;
#region 构造函数
///
/// 默认构造函数
///
public GameHScore()
{}
public GameHScore(UserLayerStateManager r) : base(r)
{}
#endregion
#region 画图
private void DrawHScore()
{
Draw.DrawImage(Pictures.picturesImage[GameConstResource.highestPic],57,0,0,0,Pictures.picturesImage[GameConstResource.highestPic].Width,Pictures.picturesImage[GameConstResource.highestPic].Height);
}
private void DrawHScoreString()
{
Draw.DrawScoreString("最高分", Color.Black, GameConstResource.ScoreStartX + 5, GameConstResource.ScoreStartY,true);
Draw.DrawScoreString("日期", Color.Black, GameConstResource.DateStartX + 15, GameConstResource.DateStartY,true);
for (int i = 0; i < this.userLayerStateManager.diamondPet.hs.Len; i++)
{
Draw.DrawScoreString(this.userLayerStateManager.diamondPet.hs[i].score.ToString(),
Color.Green,
GameConstResource.ScoreStartX ,
GameConstResource.ScoreStartY + (i+1)*GameConstResource.ScoreHeight,
false);
Draw.DrawScoreString(this.userLayerStateManager.diamondPet.hs[i].date,
Color.Green,
GameConstResource.DateStartX ,
GameConstResource.DateStartY + (i+1)*GameConstResource.ScoreHeight,
false);
}
}
#endregion
#region 主循环
public override void UserLayerRunning()
{
Draw.DrawImage(Pictures.picturesImage[GameConstResource.boardPic],0,0);
DrawHScore();
DrawHScoreString();
}
#endregion
#region 按键控制
public override void UserLayerKeyDown(System.Windows.Forms.Keys key)
{
this.userLayerStateManager.AnotherChangeState(UserLayerStateManager.GAMESTATESTART);
}
#endregion
}
}