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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? gameframe.java~1~

?? java編的俄羅斯方塊
?? JAVA~1~
?? 第 1 頁 / 共 2 頁
字號(hào):
package RussiaBlock;/** * <p>Title: RussionBlock</p> * <p>Description: TheSmallGame</p> * <p>Copyright: Copyright (c) 2002</p> * @author sunwei * @version 1.0 */import java.awt.*;import java.awt.event.*;public class GameFrame extends Frame implements ActionListener,ItemListener{				private MenuBar m_MenuBar;		private Menu m_level,m_height,m_music;		private Menu m_play,m_option,m_about;		private MenuItem mi_start,mi_hero,mi_pause,mi_close;		private MenuItem mi_setkey;		private MenuItem mi_about,mi_readme;		private CheckboxMenuItem mi_level[] = new CheckboxMenuItem[10],		                         mi_height[] = new CheckboxMenuItem[10],		                         mi_bgmusic,mi_sound;		private Dialog helpDialog; 		private Button btnY;		private GameCanvas gameCanvas;		private String s[] = {"0","1","2","3","4","5","6","7","8","9"};		GameFrame(){		super("俄羅斯方塊 V1.0 孫偉");		System.out.print("游戲開始...");		btnY = new Button("確定");		gameCanvas = new GameCanvas();gameCanvas.setSize(450,400);		add(gameCanvas);				m_MenuBar = new MenuBar();		m_play = new Menu("游戲");		mi_start = new MenuItem("新游戲");		mi_pause = new MenuItem("暫停游戲");		mi_hero = new MenuItem("英雄榜");		mi_close = new MenuItem("退出");		mi_pause.disable();		m_play.add(mi_start);		m_play.add(mi_pause);		m_play.addSeparator();		m_play.add(mi_hero);		m_play.addSeparator();		m_play.add(mi_close);		m_MenuBar.add(m_play);		mi_start.addActionListener(this);		mi_hero.addActionListener(this);		mi_pause.addActionListener(this);		mi_close.addActionListener(this);		m_option = new Menu("選項(xiàng)");		m_level = new Menu("級(jí)別設(shè)置");		m_height = new Menu("高度設(shè)置");		mi_setkey = new MenuItem("鍵盤設(shè)置");		m_music = new Menu("音效設(shè)置");		mi_bgmusic = new CheckboxMenuItem("聲音");		mi_sound = new CheckboxMenuItem("音樂");		for(int i = 0; i<10;i++){			mi_level[i] = new CheckboxMenuItem(s[i]);			mi_height[i] = new CheckboxMenuItem(s[i]);			m_level.add(mi_level[i]);			m_height.add(mi_height[i]);			mi_level[i].addItemListener(this);			m_height.add(mi_height[i]);			mi_height[i].addItemListener(this);					}		mi_level[0].setState(true);		mi_height[0].setState(true);		mi_bgmusic.setState(true);		mi_sound.setState(true);		m_option.add(m_level);		m_option.add(m_height);		m_option.addSeparator();		m_option.add(m_music);		m_option.addSeparator();		m_option.add(mi_setkey);		m_music.add(mi_bgmusic);		m_music.add(mi_sound);		m_MenuBar.add(m_option);		mi_bgmusic.addActionListener(this);		mi_sound.addActionListener(this);		mi_setkey.addActionListener(this);				m_about=new Menu("幫助");		mi_readme = new MenuItem("幫助");		mi_about=new MenuItem("關(guān)于...");		m_about.add(mi_readme);		m_about.addSeparator();		m_about.add(mi_about);		m_MenuBar.add(m_about);		mi_about.addActionListener(this);		mi_readme.addActionListener(this);		this.setMenuBar(m_MenuBar);		btnY.addActionListener(this);        this.addWindowListener(new WindowAdapter() {	               public void windowClosing(WindowEvent e) {	                         ((Frame)e.getWindow()).dispose();	                          gameCanvas.thread.stop();                              System.exit(0);	                }		 });	}	public void actionPerformed(ActionEvent e){		if(e.getSource() == mi_start){		   mi_pause.enable();		   if(!gameCanvas.thread.isAlive())			  gameCanvas.thread.start();		   else gameCanvas.reset();		}		else if(e.getSource() == mi_pause){			    if(gameCanvas.getPause()==true){			       gameCanvas.setPause(false);			       mi_pause.setLabel("繼續(xù)游戲");			    }			    else { gameCanvas.setPause(true);			           mi_pause.setLabel("暫停游戲");			    }		}		else if(e.getSource() == mi_hero){			BlockDialog heroDialog = new BlockDialog(this,"英雄榜",false);			heroDialog.setBounds(200,150,320,230);			heroDialog.show();		        }		else if(e.getSource() == mi_close){			gameCanvas.thread.stop();			this.dispose();			System.exit(0);		 }		else if(e.getSource() == mi_setkey){			SetDialog setDialog = new SetDialog(this,"鍵盤設(shè)定",true);			setDialog.setBounds(200,150,300,220);			setDialog.show();		}	    else if(e.getSource() == mi_about){						helpDialog=new Dialog(this,"關(guān)于",false);			Panel p1=new Panel();			Panel p3=new Panel();			p1.add(new Label("俄羅斯方塊 v1.0  作者:孫偉"));			p3.add(new Label("試用版 v1.0"));			helpDialog.add("North",p1);			helpDialog.add("Center",p3);			Panel p2 = new Panel();			p2.add(btnY);			helpDialog.add("South",p2);			helpDialog.setSize(300,200);			helpDialog.setBounds(200,150,250,150);			helpDialog.show();        helpDialog.addWindowListener(new WindowAdapter() {	               public void windowClosing(WindowEvent e) {	                                 helpDialog.dispose();	               }			 });		}		else if(e.getSource() == btnY){			    helpDialog.dispose();		}	}	public void itemStateChanged(ItemEvent e){		int i,j;		for(i = 0; i < 10; i++)		    if(e.getSource() == mi_level[i]){		       for(j = 0; j < 10; j++)		           mi_level[j].setState(false);		       mi_level[i].setState(true);		       gameCanvas.setSleepTime(i);	         }		 for(i = 0; i < 10; i++)		    if(e.getSource() == mi_height[i]){		       for(j = 0; j < 10; j++)		           mi_height[j].setState(false);		       mi_height[i].setState(true);		       gameCanvas.setHeight(i);	         }	}} class Block{       		private int cubeEach = 4;                          //小方塊的個(gè)數(shù)	private int cubeKind = 7;                           //大方塊的種類	private int cubeWidth = 20;                           //小方塊的寬	private int cubeHeight = 20;                            //小方塊的高	private int bgX = 200,bgY = 50;                          //背景起始位置	private int currentX = 4,currentY = 0;                    //大方塊起始位置	private int bgWidth = 11,bgHeight = 19;                       //背景寬和高	public byte[][] bgInformation = new byte[this.getbgWidth()][this.getbgHeight()];      private byte[][]                                              //保存背景信息的數(shù)組        line = new byte[][]{        	{1, 1, 1, 1},			{0, 0, 0, 0},			{0, 0, 0, 0},			{0, 0, 0, 0}		},		square = new byte[][]{			{1, 1, 0, 0},			{1, 1, 0, 0},			{0, 0, 0, 0},			{0, 0, 0, 0}		},		l = new byte[][]{			{1, 1, 1, 0},			{1, 0, 0, 0},			{0, 0, 0, 0},			{0, 0, 0, 0}		},		turnL = new byte[][]{			{1, 1, 1, 0},			{0, 0, 1, 0},			{0, 0, 0, 0},			{0, 0, 0, 0}		},		s = new byte[][]{			{1, 1, 0, 0},			{0, 1, 1, 0},			{0, 0, 0, 0},			{0, 0, 0, 0}		},		turnS = new byte[][]{			{0, 1, 1, 0},			{1, 1, 0, 0},			{0, 0, 0, 0},			{0, 0, 0, 0}		},		t = new byte[][]{			{0, 1, 0, 0},			{1, 1, 1, 0},			{0, 0, 0, 0},			{0, 0, 0, 0}		},		currentBlock = new byte[][]{			{0, 0, 0, 0},			{0, 0, 0, 0},			{0, 0, 0, 0},			{0, 0, 0, 0}		},		nextBlock = new byte[][]{			{0, 0, 0, 0},			{0, 0, 0, 0},			{0, 0, 0, 0},			{0, 0, 0, 0}		};    private Color currentBlockColor,nextBlockColor;              //保存顏色變量	private byte[][][] cube = new byte [][][]{ line,square,l,turnL,s,turnS,t };	private Color colors[] = { Color.red,Color.orange,Color.gray,Color.green,                               Color.blue,Color.pink,Color.magenta,Color.white };                                   /* 以下是方塊的方法 */    public int getBGX()       { return this.bgX;       }	public int getBGY()       {	return this.bgY;       }	public int getbgWidth()   { return this.bgWidth;   } 	public int getbgHeight()  { return this.bgHeight;  }	public int getCubeKind()  { return this.cubeKind;  }	public int getCubeEach()  { return this.cubeEach;  }                         		public int getCubeWidth() { return this.cubeWidth; }	public int getCubeHeight(){ return this.cubeHeight;}	public int getCurrentX()  { return this.currentX;  }	public int getCurrentY()  { return this.currentY;  }	public void setCurrentXY(int x,int y){ this.currentX = x; this.currentY = y;}	public Color getCurrentBlockColor(){ return this.currentBlockColor; }	public Color getNextBlockColor(){ return this.nextBlockColor; }	public byte[][] getCurrentBlock(){ return this.currentBlock; }	public byte[][] getNextBlock(){ return this.nextBlock; }			public void reset(){		int random = (int)(Math.random()*7);		this.currentBlock = this.cube[random];		this.currentBlockColor = this.colors[random];	}	public void setNextBlock(){		int random = (int)(Math.random()*7);	    this.nextBlock = this.cube[random];	    this.nextBlockColor = this.colors[random];	}	public void setCurrentBlock(){		this.currentBlock = this.nextBlock;		this.currentBlockColor = this.nextBlockColor;	}	public boolean goLeft(){		if(this.isBound(this.currentX - 1,this.currentY,this.getCurrentBlock())){			this.currentX--;return true;		}		else return false;	}	public boolean goRight(){		if(this.isBound(this.currentX + 1,this.currentY,this.getCurrentBlock())){			this.currentX++;return true;		}		else return false;	}	public boolean goDown(){		if(this.isBound(this.currentX,this.currentY + 1,this.getCurrentBlock())){			this.currentY++;return true;		}		else return false;	}	public boolean goTurn(){		if(this.isBound(this.currentX,this.currentY,this.getTurnBlock())){			currentBlock = this.getTurnBlock();			return true;		}		else for(int i = 1; i<4; i++)		         if(this.isBound(this.currentX - i,this.currentY,this.getTurnBlock())){			        this.currentX = this.currentX - i;			        currentBlock = this.getTurnBlock();			        return true;		          }		 return false;	}	public boolean isBound(int locateX,int locateY,byte[][] block){		int tempx, tempy;		if((locateX >= 0)&&(locateX <= this.getbgWidth())&&(locateY >=0)&&(locateY < this.getbgHeight())) {				for(int x = 0; x < this.getCubeEach(); x++)				for(int y = 0; y < this.getCubeEach(); y++) {					tempx = locateX + x;					tempy = locateY + y;					if(block[y][x] == 1) {						if((tempx >= this.getbgWidth()) || (tempy >= this.getbgHeight()))							return false;						else if(block[y][x] == this.bgInformation[tempx][tempy])							return false;					}				}			return true;		} else				return false;	}	public byte[][] getTurnBlock(){		byte[][] turnBlock = new byte[getCubeEach()][getCubeEach()];	    	boolean goBreak = false;	    	int x, y;	    	for(y = 0; y < getCubeEach(); y++){	    		for(x=0; x < getCubeEach(); x++)	    			turnBlock[getCubeEach()-1-x][y] = this.currentBlock[y][x]; 	    	}	    	for(y = 0; y < getCubeEach(); y++) {                        	    		for(x=0; x < getCubeEach(); x++)	    			if(turnBlock[y][x] == 1) {                                	    				goBreak = true;	    				break;	    			}	    		if(goBreak) break;	    	}	    	int yy = y;	    	for(; y < getCubeEach(); y++) {	                         	    		for(x=0; x < getCubeEach(); x++)	    			turnBlock[y-yy][x] = turnBlock[y][x];	    	}	    	for(y = getCubeEach()-yy; y < getCubeEach(); y++) {		    		for(x=0; x < getCubeEach(); x++)	    			turnBlock[y][x] = 0;	    	}	    	return turnBlock;	}	public void delLine(int position){		int x,y;		if(position == 0){		   for(x = 0; x < this.getbgWidth(); x++)		       this.bgInformation[x][0] = 0;		}		else { for(y = position; y > 0; y--)		           for(x = 0; x < this.getbgWidth(); x++)					   this.bgInformation[x][y] = this.bgInformation[x][y-1];		}	}	public int[] getDelLine(){		int[] line = new int[this.getCubeEach()];		int x, y;		for(y = this.getCurrentY(); y < this.getCurrentY() + line.length; y++) {			if(y >= this.getbgHeight()) break;			for(x = 0; x < this.getbgWidth(); x++)				if(this.bgInformation[x][y] == 0) break;			if(x == this.getbgWidth())				line[y - this.getCurrentY()] = y;			else				line[y - this.getCurrentY()] = 0;		}		return line;	}}class GameCanvas extends Canvas implements Runnable{		Thread thread;	private Block block;	private int height = 0;	private int sleep = 700;	private Color bgColor = Color.white;	private int blockScore = 0,blockLevel = 0,blockSpeed = 0;	private boolean isStart = true,isPause = true;	private Color colors[] = {Color.red,Color.orange,Color.gray,Color.green,                              Color.blue,Color.pink,Color.magenta,Color.white};                                    	public GameCanvas(){		block = new Block();		thread = new Thread(this,"gamethread");	    this.addKeyListener(new KeyAdapter() {		            public void keyPressed(KeyEvent e) {		                handleKeyEvent(e);		            }				});		}    public void setPause(boolean b){ isPause = b;}	public boolean getPause(){ return isPause; }	public Color getBGColor(){ return this.bgColor;}			public void run(){		block.setNextBlock();		block.reset();		paintNextBlock(getGraphics());		while(true){			if(!isStart)continue;		    if(!isPause)continue;		    repaint();		    try{thread.sleep(this.sleep);}catch(InterruptedException e){ return; }			if(!block.goDown()){				this.setBGInformation();				this.delLine();				block.setCurrentXY(4,0);				block.setCurrentBlock();				block.setNextBlock();				paintNextBlock(getGraphics());				repaint();				if(this.isStop()){this.paintStop(); this.isStart = false;this.popDialog();} 				continue;			}		 }    }    public void popDialog(){    	GameFrame gameFrame = new GameFrame();    	InputDialog inputDialog = new InputDialog(gameFrame,"請(qǐng)輸入您的名字",true);    	inputDialog.setBounds(200,150,300,150);    	inputDialog.show();    }    public void setSleepTime(int i){    	switch(i){    		case 0: this.sleep = 800;break;			case 1: this.sleep = 700;break;			case 2: this.sleep = 600;break;			case 3: this.sleep = 500;break;			case 4: this.sleep = 400;break;			case 5: this.sleep = 300;break;			case 6: this.sleep = 200;break;			case 7: this.sleep = 100;break;			case 8: this.sleep = 70;break;			case 9: this.sleep = 40;break;		}    }    public void delLine(){    	int oneTime = 0;    	int[] line = block.getDelLine();

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美影院一区二区三区| 久久99精品一区二区三区| 91免费国产在线观看| 91官网在线免费观看| 日韩一二三区视频| 中文字幕+乱码+中文字幕一区| 一区二区三区产品免费精品久久75| 视频一区国产视频| 懂色av一区二区在线播放| 欧美日韩一卡二卡| 国产欧美精品一区| 午夜精彩视频在线观看不卡| 国产精品一区三区| 在线免费一区三区| 久久久久久久性| 亚洲va国产va欧美va观看| 国产九色精品成人porny| 色播五月激情综合网| 精品国产一区二区三区忘忧草| 亚洲精品美腿丝袜| 国产精品一区二区黑丝| 欧美日韩美女一区二区| 国产日产欧产精品推荐色| 亚洲国产一区二区三区青草影视| 国产精品小仙女| 欧美精品日日鲁夜夜添| 国产精品久久久久久一区二区三区| 免费成人在线视频观看| 在线中文字幕不卡| 国产女同互慰高潮91漫画| 日本午夜精品视频在线观看| 色综合久久中文综合久久牛| 日韩欧美不卡在线观看视频| 亚洲精品免费在线| 高清国产一区二区| 精品成人一区二区三区| 性久久久久久久久| 91亚洲精品久久久蜜桃网站 | 国产偷v国产偷v亚洲高清| 亚洲第一二三四区| 99精品视频免费在线观看| 精品国产乱子伦一区| 亚洲va天堂va国产va久| 91官网在线观看| 亚洲天堂成人在线观看| 国产成人aaa| 日韩欧美高清在线| 日本中文在线一区| 欧美日韩国产另类一区| 一区二区三区在线视频免费观看| 成人免费高清在线| 国产三级一区二区三区| 欧美日韩一区二区三区高清| 亚洲欧美在线aaa| 国产传媒日韩欧美成人| 精品电影一区二区| 美美哒免费高清在线观看视频一区二区| 欧美在线观看一区| 亚洲视频免费在线观看| eeuss鲁片一区二区三区在线看| 久久综合色8888| 蜜桃av一区二区三区| 日韩一卡二卡三卡| 日韩av电影免费观看高清完整版在线观看| 在线视频欧美精品| 亚洲黄色录像片| 91久久精品国产91性色tv | 一本久久a久久精品亚洲| 国产精品网站一区| 暴力调教一区二区三区| 日本一区二区高清| 国产suv一区二区三区88区| 久久久激情视频| 成人小视频免费在线观看| 亚洲国产精品av| av激情亚洲男人天堂| 国产精品午夜免费| 91一区在线观看| 一区二区欧美精品| 欧美日韩精品高清| 美女视频第一区二区三区免费观看网站| 欧美一区二区三区免费在线看| 蜜桃视频在线观看一区二区| 日韩欧美国产一区二区在线播放| 极品销魂美女一区二区三区| 精品1区2区在线观看| 成人一区在线看| 亚洲视频一二区| 欧美三级电影在线观看| 麻豆国产精品一区二区三区| 久久综合久久综合亚洲| 成人一级黄色片| 亚洲精品ww久久久久久p站| 欧美三级电影精品| 久久精品国产77777蜜臀| 久久久激情视频| 色老汉一区二区三区| 爽爽淫人综合网网站| 欧美xxxx老人做受| 成人性生交大片| 亚洲一区二区三区四区在线观看| 717成人午夜免费福利电影| 激情深爱一区二区| 国产精品久久二区二区| 欧美三电影在线| 精品一区二区日韩| 成人免费视频在线观看| 欧美日韩国产系列| 精品亚洲国产成人av制服丝袜| 国产精品色噜噜| 欧美午夜片在线观看| 久久精品国产99| 最新国产精品久久精品| 91.com视频| 成人免费观看视频| 日韩电影在线一区二区三区| 久久精品日韩一区二区三区| 在线免费观看成人短视频| 精品一区二区国语对白| 亚洲婷婷在线视频| 精品国产一区二区三区不卡| 97久久人人超碰| 精品一区二区三区蜜桃| 一区二区三区蜜桃| 国产亚洲欧洲一区高清在线观看| 91久久精品午夜一区二区| 国产综合色在线| 亚洲一区自拍偷拍| 国产欧美日韩精品在线| 91精品国产综合久久国产大片| 成人一区二区三区| 久久成人免费网| 一区二区三区欧美在线观看| 国产欧美精品一区二区三区四区| 欧美精品久久99| 91美女在线观看| 国产一区二区伦理| 五月婷婷久久综合| 亚洲欧洲制服丝袜| 久久午夜色播影院免费高清| 欧美三级日韩在线| 91亚洲精品久久久蜜桃网站| 亚洲成人av免费| 国产一区二区视频在线| 成人深夜在线观看| 色屁屁一区二区| 国产日韩欧美不卡在线| 亚洲综合免费观看高清完整版| 看片的网站亚洲| 色噜噜夜夜夜综合网| 欧美成va人片在线观看| 成人欧美一区二区三区在线播放| 午夜视频在线观看一区二区三区| 成人一区在线看| 欧美一区二区在线看| 亚洲欧美中日韩| 国产精品一区二区你懂的| 欧美色网一区二区| 亚洲视频你懂的| 粉嫩在线一区二区三区视频| 日韩一卡二卡三卡国产欧美| 一区二区三区中文字幕电影| 欧美视频日韩视频| 亚洲精品国产品国语在线app| 久久电影网电视剧免费观看| 精品一区二区影视| 欧美日韩亚洲国产综合| 国产日韩综合av| 国内成人免费视频| 欧美一区二区久久久| 蜜桃视频在线观看一区| 欧美一区二区女人| 美女国产一区二区| 国产精品成人一区二区三区夜夜夜 | www国产精品av| 国产高清视频一区| 一区二区三区精品在线观看| 中文字幕欧美激情一区| 精品动漫一区二区三区在线观看| 色诱视频网站一区| 奇米影视一区二区三区| 亚洲成人自拍网| 一区二区三区中文字幕在线观看| 久久精品欧美日韩精品| 精品国产乱码久久久久久闺蜜| 欧美日韩精品是欧美日韩精品| 色综合婷婷久久| 精品在线播放午夜| 日本女优在线视频一区二区| 一区二区成人在线视频| 亚洲国产精品视频| 偷窥国产亚洲免费视频| 亚洲一级二级在线| 日韩成人一区二区| 久久99精品久久久久婷婷| 蜜桃91丨九色丨蝌蚪91桃色| 黄色日韩三级电影| 成人综合在线观看| 91麻豆福利精品推荐| 欧洲亚洲精品在线|