亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? game.cs

?? C#開發(fā)的運行于windows mobile PDA上的游戲
?? CS
?? 第 1 頁 / 共 2 頁
字號:
			GenerateNextBalls();
			NextStep();

			// Reset step counter
			stepCount = 0;
			// Reset score
			score = 0;

			// New game
			isGameOver = false;

			// Unlock in any case
			UnlockBoard();
		}

		/// <summary>
		/// Saves the current player score in a hi score list.
		/// </summary>
		/// <param name="player">The player name.</param>
		public void SaveResults(string player)
		{
			// Save in the high score table
			if (IsRecord)
			{
				Records.AddRecord(player, score, stepCount);
				Records.Save(RecordsFilename);
			}
		}

		/// <summary>
		/// Generates balls (position, colors) that will apper on the board at next step.
		/// </summary>
		public void GenerateNextBalls()
		{
			virtualBalls = board.GenerateVirtualBalls(ballsPerStep);
		}

		/// <summary>
		/// Performs operation to go for the next step.
		/// </summary>
		/// <returns><c>true</c> if operations are succeeded, <c>false</c> if the game is over.</returns>
		public bool NextStep()
		{
			// Remove lines that have reached a limit ballsInLine
			if (!DestroyLines())
			{
				// Materialize virtual balls :)
				for (int i = 0; i < virtualBalls.Length; i++)
				{
					Ball ball = virtualBalls[i];
					if (board.GetBallAt(ball.X, ball.Y) != null)
					{
						Point newPos = board.GetRandomEmptySquare();
						ball.MoveTo(newPos.X, newPos.Y);
					}
					board.SetBallAt(ball, ball.X, ball.Y);
					FireBallAdd(ball);
				}

				virtualBalls = null;
				
				// Collapse those that appeared after materializing virtual balls
				DestroyLines();
				
				// Generate following up set of balls
				GenerateNextBalls();
			}
			
			// Increment step counter
			stepCount++;

			// Each step gives one point to score
			score++;

			if (virtualBalls == null)
			{
				// Game over
				isGameOver = true;
				return false;
			}

			return true;
		}

		/// <summary>
		/// Moves currently selected ball to a new position.
		/// <seealso cref="MoveBall(Point, Point)"/>
		/// </summary>
		/// <param name="pos">The position to move selected ball to.</param>
		/// <returns><c>true</c> if the specified posion is free and reachable, <c>false</c> otherwise.</returns>
		/// <remarks>
		/// Moves currently selected ball to a certain position if possible. The animation of a 
		/// ball movement is started in a separate thread if this method has returned <c>true</c>.
		/// </remarks>
		public bool MoveTo(Point pos)
		{
			Ball destination = board.GetBallAt(pos.X, pos.Y);
			Ball ball = board.GetSelectedBall();
			if ((destination == null) && (ball != null))
			{
				Point[] route = board.CreateRoute(ball.Position, pos);
				if (route != null)
				{
					// Fire move event and then move the ball to appropriate pos.
					ball.Select(false);
					AnimateMove(ball, route);
					// ball.MoveTo(pos.X, pos.Y);
					return true;
				}
			}

			return false;
		}

		/// <summary>
		/// Animates ball movement.
		/// </summary>
		/// <param name="ball">The ball to move.</param>
		/// <param name="route">The ball's route.</param>
		/// <remarks>
		/// Launches an instance of <see cref="MoveBallWorker"/> in a separate thread to animate ball
		/// movement.
		/// </remarks>
		protected void AnimateMove(Ball ball, Point[] route)
		{
			MoveBallWorker worker = new MoveBallWorker(this, ball, route);
			Thread moveThread = new Thread(new ThreadStart(worker.Execute));
			moveThread.Start();
		}

		/// <summary>
		/// Moves a ball from one position to another.
		/// <seealso cref="MoveTo(Point)"/>
		/// </summary>
		/// <param name="from">The initial ball lacation.</param>
		/// <param name="to">The ball destination.</param>
		/// <remarks>
		/// <p>Moves a ball from position defined by <c>from</c> to posion <c>to</c>. Unlike <see cref="MoveTo(Point)"/>
		/// method this one does not calculate a route to move the ball and does not start a separate thread to animate
		/// movement, instead it simply transfers the ball and fires <see cref="BallMove"/> event.</p>
		/// <p>This method is used by <see cref="MoveBallWorker"/> to move a ball for one step.</p>
		/// </remarks>
		public void MoveBall(Point from, Point to)
		{
			Ball ball = board.GetBallAt(from.X, from.Y);
			if (ball != null)
			{
				board.MoveBall(from, to);
				FireBallMove(ball, from, to);
			}
		}

		/// <summary>
		/// Removes all lins that were found by <see cref="DestroyFinder"/>.
		/// </summary>
		/// <returns><c>true</c> if <see cref="DestroyFinder"/> has found something to destroy and balls 
		/// were removed from the <see cref="Board"/>, <c>false</c> otherwise.</returns>
		/// <remarks>
		/// Removes all balls that compose lines which were found by <see cref="DestroyFinder"/>. Depending 
		/// on <see cref="OneByOneDestruction"/> flag it either removes balls from the 
		/// <see cref="Board"/> all at once and fires <see cref="BallsDelete"/> event or destroys balls
		/// one by one with <see cref="DestroyBallPause"/> interval and fires <see cref="BallDelete"/> event
		/// each time the ball is about to be removed from the <see cref="Board"/>.
		/// </remarks>
		public bool DestroyLines()
		{
			Ball[] ballsToDestroy = board.FindBallsToDestroy(ballsInLine);
			bool hasBallsToDestroy = ballsToDestroy.Length > 0 ? true : false;
			UpdateScore(ballsToDestroy.Length);

			if (oneByOneDestruction)
			{
				foreach (Ball ball in ballsToDestroy)
				{
					FireBallDelete(ball);
					board.DeleteBallAt(ball.X, ball.Y);
					Thread.Sleep(destroyBallPause);
				}
			}
			else if (hasBallsToDestroy)
			{
				FireBallsDelete(ballsToDestroy);
				foreach (Ball ball in ballsToDestroy)
				{
					board.DeleteBallAt(ball.X, ball.Y);
				}
			}

			return hasBallsToDestroy;
		}

		/// <summary>
		/// Updates player's score.
		/// </summary>
		/// <param name="destroyedBalls">The amount of balls that were destroyed.</param>
		/// <remarks>
		/// <p>Updates player's score according to the amount of balls that were removed at one step.</p>
		/// <p>The score is calculated according to following rules:</p>
		/// <list type="bullet">
		///		<item>
		///			<description>For all mandatory amount of balls in line to be destroyed player receive
		///			corresponding amount of points. So each ball weighs 1 point.</description>
		///		</item>
		///		<item>
		///			<description>For the first extra-ball player receive 2 points.</description>
		///		</item>
		///		<item>
		///			<description>Each farther extra-ball is rewarded with weight of previous
		///			extra-ball plus 2 points.</description>
		///		</item>
		/// </list>
		/// <p>For instance if <see cref="BallsInLine"/> is equal to 5 and player has hit 8 
		/// balls at one step he will be awarded with 
		/// <c>score = 5 (5 required balls) + 2 (1st extra-ball) + 4 (2nd extra-ball) + 6 (3rd extra-ball) = 17 points.</c></p>
		/// </remarks>
		public void UpdateScore(int destroyedBalls)
		{
			if (destroyedBalls >= ballsInLine)
			{
				// Give one for each ball from minimum
				score += ballsInLine;

				// Each extra ball is valued with weight of previous + 2 starting from 2
				int extraValue = 2;
				destroyedBalls -= ballsInLine;
				while (destroyedBalls > 0)
				{
					score += extraValue;
					extraValue += 2;
					destroyedBalls--;
				}
			}
		}

		/// <summary>
		/// Fires <see cref="BallAdd"/> event with a reference to this game.
		/// </summary>
		/// <param name="ball">The ball that has been added.</param>
		public void FireBallAdd(Ball ball)
		{
			BallAdd(this, ball);
		}
		
		/// <summary>
		/// Fires <see cref="BallDelete"/> event with a reference to this game.
		/// </summary>
		/// <param name="ball">The ball that is about to be deleted.</param>
		public void FireBallDelete(Ball ball)
		{
			BallDelete(this, ball);
		}
		
		/// <summary>
		/// Fires <see cref="BallsDelete"/> event with a reference to this game.
		/// </summary>
		/// <param name="balls">The balls that are about to be deleted.</param>
		public void FireBallsDelete(Ball[] balls)
		{
			BallsDelete(this, balls);
		}
		
		/// <summary>
		/// Fires <see cref="BallMove"/> event with a reference to this game.
		/// </summary>
		/// <param name="ball">The ball to move.</param>
		/// <param name="oldPos">The old position of ball.</param>
		/// <param name="newPos">The destination of ball.</param>
		public void FireBallMove(Ball ball, Point oldPos, Point newPos)
		{
			BallMove(this, ball, oldPos, newPos);
		}
		
		/// <summary>
		/// Fires <see cref="BallMoved"/> event with a reference to this game.
		/// </summary>
		/// <param name="ball">The ball that has been moved.</param>
		public void FireBallMoved(Ball ball)
		{
			BallMoved(this, ball);
		}

		/// <summary>
		/// Locks an access to the <see cref="Board"/>.
		/// <seealso cref="UnlockBoard"/>
		/// </summary>
		/// <returns><c>true</c> if the <see cref="Board"/> were locked, <c>false</c>
		/// in case the board were already locked by another process.</returns>
		/// <remarks>
		/// Trys to lock an access to the <see cref="Board"/>. It is a simple way to resolve 
		/// problems of concurrency access to the <see cref="Board"/> so that a player cannot 
		/// move another ball untill the first one didn't finished its movement.
		/// </remarks>
		public bool LockBoard()
		{
			if (isLocked)
				return false;

			isLocked = true;
			return true;
		}

		/// <summary>
		/// Unlocks an access to the <see cref="Board"/>.
		/// <seealso cref="LockBoard"/>
		/// </summary>
		public void UnlockBoard()
		{
			isLocked = false;
		}
	}
}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
精品处破学生在线二十三| 色菇凉天天综合网| 久久只精品国产| 经典三级一区二区| 中文字幕免费观看一区| www.欧美色图| 亚洲一区在线观看视频| 91精品国产黑色紧身裤美女| 看电影不卡的网站| 国产欧美一区二区精品秋霞影院| 丁香婷婷综合色啪| 亚洲少妇最新在线视频| 欧美日韩视频一区二区| 精品中文字幕一区二区| 国产精品对白交换视频| 欧美特级限制片免费在线观看| 五月婷婷激情综合网| 精品噜噜噜噜久久久久久久久试看| 国产在线不卡视频| 一区二区三区四区在线播放| 欧美大片顶级少妇| 成人91在线观看| 日一区二区三区| 久久久精品黄色| 欧美日韩久久不卡| 国内国产精品久久| 亚洲精品伦理在线| 日韩视频123| 91麻豆蜜桃一区二区三区| 日本视频在线一区| 亚洲免费视频中文字幕| 亚洲精品一区二区三区蜜桃下载| 91麻豆免费在线观看| 麻豆久久久久久久| 亚洲乱码国产乱码精品精可以看| 日韩午夜av电影| 91浏览器在线视频| 国产剧情在线观看一区二区| 偷拍日韩校园综合在线| 国产精品入口麻豆原神| 日韩视频在线永久播放| 欧美最猛性xxxxx直播| 成人综合在线视频| 美腿丝袜亚洲综合| 亚洲一区二区三区免费视频| 国产精品无圣光一区二区| 91精品国产麻豆| 在线观看国产一区二区| 风间由美中文字幕在线看视频国产欧美| 亚洲高清三级视频| 亚洲欧美激情在线| 国产精品久久久久毛片软件| 亚洲精品在线网站| 日韩一区二区免费电影| 欧美性感一区二区三区| 91丨porny丨国产入口| 国产白丝网站精品污在线入口| 久久精品国产精品青草| 日韩二区三区四区| 亚洲成va人在线观看| 亚洲综合免费观看高清完整版在线 | 岛国精品在线观看| 精品影视av免费| 日本sm残虐另类| 日本欧美在线观看| 亚洲成人免费观看| 一区二区三区久久| 一区二区三区日本| 一区二区三区.www| 亚洲一二三区不卡| 一区二区三区 在线观看视频| 亚洲桃色在线一区| 亚洲视频中文字幕| 亚洲啪啪综合av一区二区三区| 国产精品国产三级国产有无不卡| 国产精品无码永久免费888| 国产女主播视频一区二区| 久久精品一区二区三区不卡牛牛| 久久免费国产精品| 国产免费久久精品| 亚洲欧美另类在线| 亚洲一二三专区| 日韩vs国产vs欧美| 久久精品国产秦先生| 国产成人在线视频免费播放| 国产成人精品亚洲777人妖| 成人免费视频播放| 日本韩国一区二区三区视频| 欧美中文字幕一区二区三区| 欧美福利视频一区| 精品国产污污免费网站入口| 久久天天做天天爱综合色| 中文字幕免费不卡在线| 亚洲黄色av一区| 奇米四色…亚洲| 懂色av一区二区三区免费观看| 91视视频在线观看入口直接观看www | 国内精品不卡在线| 成人妖精视频yjsp地址| 91影视在线播放| 欧美精品自拍偷拍动漫精品| 日韩美女主播在线视频一区二区三区| 久久影视一区二区| 亚洲天堂网中文字| 日韩精品电影在线观看| 国产精品一二三四区| 色婷婷综合久久久久中文一区二区| 色乱码一区二区三区88| 欧美成va人片在线观看| 中文字幕亚洲不卡| 日本三级亚洲精品| 成人av在线一区二区| 欧美美女bb生活片| 欧美国产成人精品| 婷婷国产v国产偷v亚洲高清| 国产jizzjizz一区二区| 欧美精品在线观看播放| 国产精品网站在线观看| 日韩精品欧美精品| 97国产精品videossex| 日韩精品一区二区三区三区免费| 亚洲图片欧美激情| 国产在线精品免费av| 欧美性xxxxxxxx| 欧美国产日韩精品免费观看| 性感美女极品91精品| 粉嫩绯色av一区二区在线观看| 欧美男人的天堂一二区| 亚洲国产精品二十页| 久久精品久久精品| 欧美日韩在线免费视频| 欧美经典一区二区三区| 蜜桃精品在线观看| 欧美写真视频网站| 综合亚洲深深色噜噜狠狠网站| 久久不见久久见免费视频7| 欧美日韩视频在线观看一区二区三区 | 91色在线porny| 国产三级精品在线| 久久se精品一区二区| 欧美挠脚心视频网站| 艳妇臀荡乳欲伦亚洲一区| 国产传媒日韩欧美成人| 日韩免费在线观看| 日本大胆欧美人术艺术动态| 91色在线porny| 亚洲四区在线观看| 国产·精品毛片| 国产亚洲精品精华液| 麻豆成人久久精品二区三区红| 欧美日韩视频在线一区二区| 一区二区三区四区高清精品免费观看| 国产成人午夜99999| 精品国产在天天线2019| 看电视剧不卡顿的网站| 欧美成人三级电影在线| 免费日韩伦理电影| 日韩欧美一区二区视频| 喷水一区二区三区| 欧美一级在线观看| 看电影不卡的网站| 久久综合色综合88| 国产在线视频一区二区| 国产无人区一区二区三区| 国产成人h网站| 国产婷婷精品av在线| 国产99久久精品| 最近日韩中文字幕| 欧美在线你懂的| 亚洲一区二区欧美| 欧美酷刑日本凌虐凌虐| 日韩成人av影视| 欧美精品一区二区久久久| 国产一区免费电影| 国产午夜亚洲精品理论片色戒 | jvid福利写真一区二区三区| 中文字幕第一区综合| 99re这里只有精品首页| 亚洲精品高清在线观看| 欧美日韩一区二区三区不卡| 婷婷久久综合九色综合绿巨人 | 国产成人三级在线观看| 国产精品久久久久久久蜜臀| 色诱亚洲精品久久久久久| 亚洲一区二区欧美日韩| 日韩亚洲国产中文字幕欧美| 国产乱码一区二区三区| 国产精品国产精品国产专区不蜜| 日本韩国一区二区| 日本美女一区二区三区| 久久久蜜桃精品| 91麻豆国产福利在线观看| 午夜视频在线观看一区二区| 精品国精品自拍自在线| av不卡在线观看| 日本美女一区二区三区| 国产精品卡一卡二| 91精品国产入口在线| 大尺度一区二区| 五月天网站亚洲|