levelgui.cs
来自「Pocket 1945 is a classic shooter inspire」· CS 代码 · 共 35 行
CS
35 行
using System;
using System.Drawing;
namespace Pocket1945
{
/// <summary>
/// This class is the level graphical user interface. The class
/// gives the user information about current score, current level,
/// number of lives etc.
/// </summary>
public class LevelGui : IDrawable
{
private Font font;
private Brush brush;
private string text;
public LevelGui()
{
brush = new SolidBrush(Color.Yellow);
font = new Font(FontFamily.GenericSansSerif, 8, FontStyle.Bold);
}
public void Draw(Graphics g)
{
text = string.Format("Score: {0}\r\nHealth: {1}%\r\nLives: {2}",
GameForm.Player.Score,
GameForm.Player.Health,
GameForm.Player.Lives);
g.DrawString(text, font, brush, 7, 7);
text = string.Format("Level: {0} - Progress: {1}%", GameForm.LevelCount + 1, GameForm.CurrentLevel.GetProgress());
g.DrawString(text, font, brush, 7, GameForm.GameArea.Height - 16);
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?