本游戏是微软SMART PHONE平台下的手机游戏
源代码在线查看: gameframe.cs
using System;
namespace DiamondPet.LogicLayer.GameStateRunLogic
{
///
/// GameFrame 的摘要说明。
///
public class GameFrame
{
///
/// 框架数组,0,0为左上角
///
public GameObject[,] gameFrame;
///
/// 每列最高的block的行号
///
public int[] highestBlock;
public GameFrame()
{
Init();
}
#region 初始化
///
/// 初始化
///
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 获取、得到行号
///
/// 得到对应列的最高块的行号
///
/// 列号
///
public int GetRowIndex(int Column)
{
return this.highestBlock[ Column ];
}
///
/// 设置固定列号的行值
///
///
///
public void SetRowIndex(int Column,int RowValue)
{
this.highestBlock[ Column ] = RowValue;
}
#endregion
#region 得到缩略图
///
/// 得到游戏缩略图
///
///
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
}
}