⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 levelgui.cs

📁 Pocket 1945 is a classic shooter inspired by the classic 1942 game. The game is written in C# target
💻 CS
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -