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

📄 gameframe.cs

📁 嵌入式程序
💻 CS
字号:
using System;

namespace DiamondPet.LogicLayer.GameStateRunLogic
{
	/// <summary>
	/// GameFrame 的摘要说明。
	/// </summary>
	public class GameFrame
	{
		/// <summary>
		/// 框架数组,0,0为左上角
		/// </summary>
		public GameObject[,] gameFrame;

		/// <summary>
		/// 每列最高的block的行号
		/// </summary>
		public int[] highestBlock;

		public GameFrame()
		{
			Init();
		}

		#region 初始化
		/// <summary>
		/// 初始化
		/// </summary>
		private void Init()
		{			
			//初始化二维数组,每个元素都置位Null
			gameFrame = new GameObject[GameConstResource.BlockFrameHeight,GameConstResource.BlockFrameWidth];
			//
			for (int i = 0; i < GameConstResource.BlockFrameHeight; i++)
				for (int j = 0; j < GameConstResource.BlockFrameWidth; j++)
					gameFrame[i,j] = null;


			//初始化highestBlock始初始为0
			highestBlock = new int[ GameConstResource.BlockFrameWidth ];

			for(int i = 0; i < GameConstResource.BlockFrameWidth;++i)
			{
				highestBlock[i] = GameConstResource.BlockFrameHeight;
			}
		}
		#endregion

		#region 获取、得到行号
		/// <summary>
		/// 得到对应列的最高块的行号
		/// </summary>
		/// <param name="Column">列号</param>
		/// <returns></returns>
		public int GetRowIndex(int Column)
		{
			return this.highestBlock[ Column ];
		}

		/// <summary>
		/// 设置固定列号的行值
		/// </summary>
		/// <param name="Column"></param>
		/// <param name="RowValue"></param>
		public void SetRowIndex(int Column,int RowValue)
		{
			this.highestBlock[ Column ] = RowValue;
		}

		#endregion

		#region 得到缩略图
		/// <summary>
		/// 得到游戏缩略图
		/// </summary>
		/// <returns></returns>
		public int[,] GetSmallFrame()
		{
			int[,] retarr = new int[ GameConstResource.BlockFrameHeight,GameConstResource.BlockFrameWidth ];
			for ( int i = 0; i < GameConstResource.BlockFrameHeight; i++)
			{
				for ( int j = 0; j < GameConstResource.BlockFrameWidth; j++)
				{
					retarr[i,j] = gameFrame[i,j].BackColorId;
				}
			}
			return retarr;
		}
		#endregion		
	}
}

⌨️ 快捷键说明

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