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

📄 dataio.java

📁 J2SE版的俄罗斯方块。SWING界面.有分数记录功能
💻 JAVA
字号:

public class DataIO 
//数据处理类
{

	private BackGround BG;
	private Box box;
	public DataIO(BackGround BG,Box box)
	{
	this.BG=BG;
	this.box=box;
	}
	public void WriteBoxToGround()
	{
		int temp;
		for(int y=box.y;y<box.y+4;y++)
			for(int x=box.x;x<box.x+4;x++)
			{
				temp=x;
				if(temp>10)temp=10;
				if(BG.ground[y][temp]==5)
					BG.ground[y][temp]=3;
			}
		//把背景中的临时块转化为死块
	}
	public void Del(int dy)
	{
		int buff[][]=new int[26][12]; 
		int temp;
		for(int y=3;y<dy;y++)
			for(int x=1;x<11;x++)
			{
				temp=y;
				//if(temp>=22)temp=21;
				buff[temp][x]=BG.ground[temp][x];
				
			}
		
		for(int y=3;y<dy;y++)
			for(int x=1;x<11;x++)
			{
				temp=y;
				//if(temp>=21)temp=21;
				BG.ground[temp+1][x]=buff[temp][x];
			}
	}
	public void addscore(int l)
	{
		if(l==0)return;
		if(l==1)box.score=box.score+10;
		else 
		{
			box.score=box.score+(l*l-1)*10;
		}
	}
}

⌨️ 快捷键说明

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