欢迎来到天天文库
浏览记录
ID:38426746
大小:386.50 KB
页数:23页
时间:2019-06-12
《连连看的详细设计文档》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、主要功能实现伪代码1、1OnePieceGame类的伪代码连连看的主要实现过程publicclassOnePieceGameextendsActivity{/**Calledwhentheactivityisfirstcreated.*/privateProgressBarpb;privateTextViewshow_RemainTime;privateCtrlViewcv;publicstaticfinalintSTART_ID=Menu.FIRST;publicstaticfinalintREARRARY_ID=Menu.FIRST+1;publicstaticfinalint
2、END_ID=REARRARY_ID+1;privateintdormant=1000;privatebooleanisCancel=true;@OverridepublicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.main);findViews();mRedrawHandler.sleep(dormant);}privateRefreshHandlermRedrawHandler=newRefreshHandler();clas
3、sRefreshHandlerextendsHandler{@OverridepublicvoidhandleMessage(Messagemsg){if(isCancel){run();}else{}}publicvoidsleep(longdelayMillis){this.removeMessages(0);//移除信息队列中最顶部的信息(从顶部取出信息)sendMessageDelayed(obtainMessage(0),delayMillis);//获得顶部信息并延时发送}};publicvoidrun(){if(cv.PROCESS_VALUE>0&&cv.much!
4、=0){cv.PROCESS_VALUE--;pb.setProgress(cv.PROCESS_VALUE);show_RemainTime.setText(String.valueOf(cv.PROCESS_VALUE));mRedrawHandler.sleep(dormant);}elseif(cv.PROCESS_VALUE==0&&cv.much!=0){cv.setEnabled(false);dialogForFail().show();}elseif(cv.PROCESS_VALUE!=0&&cv.much==0){cv.setEnabled(false);dia
5、logForSucceed().show();}}privatevoidfindViews(){pb=(ProgressBar)findViewById(R.id.pb);show_RemainTime=(TextView)findViewById(R.id.show_remainTime);cv=(CtrlView)findViewById(R.id.cv);pb.setMax(cv.GAMETIME);pb.incrementProgressBy(-1);pb.setProgress(cv.PROCESS_VALUE);}@OverridepublicbooleanonCrea
6、teOptionsMenu(Menumenu){//TODOAuto-generatedmethodstubmenu.add(0,START_ID,0,R.string.newgame);menu.add(0,REARRARY_ID,0,R.string.rearrage);returnsuper.onCreateOptionsMenu(menu);}@OverridepublicbooleanonOptionsItemSelected(MenuItemitem){switch(item.getItemId()){caseSTART_ID:newPlay();break;caseR
7、EARRARY_ID:cv.rearrange();cv.PROCESS_VALUE=cv.PROCESS_VALUE-5;pb.setProgress(cv.PROCESS_VALUE);break;default:break;}returnsuper.onOptionsItemSelected(item);}@OverrideprotectedvoidonStop(){isCancel=false;pb=null;cv=null;super.onStop();}@
此文档下载收益归作者所有