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

📄 player.cs

📁 Line2008 by Do Minh Duc
💻 CS
字号:
/**********************************/
/*                                */
/* Author: BUI VAN NGHIA          */
/* Email: katatunix@yahoo.com     */
/*                 [May, 2008]    */
/*                                */
/**********************************/

using System;
using System.Collections.Generic;
using System.Text;

namespace Lines2008
{
	[Serializable()]
	class Player
	{
		public string name;
		public int scores;
		public int hours;
		public int minutes;
		public int seconds;

		public Player(string name, int scores, int hours, int minutes, int seconds)
		{
			this.name = name;
			this.scores = scores;
			this.hours = hours;
			this.minutes = minutes;
			this.seconds = seconds;
		}

		public int getTotalSeconds()
		{
			return hours * 3600 + minutes * 60 + seconds;
		}

		public static bool less(Player p1, Player p2)
		{
			if (p1.scores != p2.scores)
				return p1.scores < p2.scores;
			return p1.getTotalSeconds() > p2.getTotalSeconds();
		}

		public string[] convert(int index)
		{
			string[] s = new string[4];
			s[0] = index.ToString();

			s[1] = name;

			s[2] = scores.ToString();

			s[3] = hours.ToString() + ":";
			
			if (minutes < 10) s[3] += "0";
			s[3] += minutes.ToString() + ":";

			if (seconds < 10) s[3] += "0";
			s[3] += seconds.ToString();

			return s;
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -