• 趣拼图——项目演示及代码


    拼图,游戏是广受欢迎的一种智力游戏,它的变化多端,难度不一,让人百玩不厌。
    个性化的拼图,拼凑的不仅仅是一张照片,而是一个故事,一段回忆,一缕温情。每一片的单片都有它自己的位置,就像每段回忆都有它的故事,你要将它放在专属的地方,放对了就慢慢丰富起来,放错了就无法完整。
    你可以把你记忆中最深的片段,可以是你挚爱的照片,可以是你最难忘的一瞬留念,做成拼图,在思念的季节里一一拼起,把片片散落的记忆重新组合,用指尖温习甜蜜,把心湖里最美丽的涟漪荡漾开来。

    代码:

    <LinearLayout
        android:orientation="horizontal"
    	android:layout_width="match_parent"
    	android:gravity="center"
    	android:layout_height="60sp">
    	<TextView
        	android:layout_width="100sp"
        	android:layout_height="wrap_content"
        	android:gravity="center"
        	android:textSize="30sp"
        	android:text="@string/yonghuming" />
        <EditText
            android:id="@+id/admin"
            android:layout_width="match_parent"
        	android:layout_height="match_parent"
        	android:inputType="number"
        	android:hint="@string/edit_yhm"
        	android:singleLine="true" />
    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
    	android:layout_width="match_parent"
    	android:layout_height="60sp"
    	android:gravity="center">
    	<TextView
        	android:layout_width="100sp"
        	android:layout_height="wrap_content"
        	android:gravity="center"
        	android:textSize="30sp"
        	android:text="@string/mima" />
        <EditText
            android:id="@+id/password"
            android:layout_width="match_parent"
        	android:layout_height="match_parent"
        	android:inputType="textPassword"
        	android:hint="@string/edit_mm"
        	android:singleLine="true" />
    </LinearLayout>
    <LinearLayout
        android:orientation="horizontal"
    	android:layout_width="match_parent"
    	android:layout_height="60sp"
    	android:gravity="center" >
    	<Button
    	    style="?android:attr/buttonBarButtonStyle"
    	    android:id="@+id/denglu"
    	    android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:textSize="30sp"
            android:text="@string/denglu" />
    	<Button
    	    style="?android:attr/buttonBarButtonStyle"
    	    android:id="@+id/zhuce"
    	    android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_weight="1"
            android:gravity="center"
            android:textSize="30sp"
            android:text="@string/zhuce" />
    </LinearLayout>
    

    关于难易度选择的界面代码:






    难易度选择的java代码:

    	jianDan=(ImageButton)findViewById(R.id.jiandan);
    	zhongDeng=(ImageButton)findViewById(R.id.zhongdeng);
    	kunNan=(ImageButton)findViewById(R.id.kunnan);
    	jianDan.setOnClickListener(this);
    	zhongDeng.setOnClickListener(this);
    	kunNan.setOnClickListener(this);
    }
    
    public void onClick(View view){
    	if(view==jianDan){
    		Intent intent = new Intent(ZnptChoseGradeActivity.this,GameZnptJianDanActivity.class);
    		startActivity(intent);
    	}else if(view==zhongDeng){
    		Intent intent = new Intent(ZnptChoseGradeActivity.this,GameZnptZhongDengActivity.class);
    		startActivity(intent);
    	}else if(view==kunNan){
    		Intent intent = new Intent(ZnptChoseGradeActivity.this,GameZnptKunNanActivity.class);
    		startActivity(intent);
    	}
    	
    }
    

    }

    简单拼图:

    简单拼图部分代码:

    	for( int i = 0 ; i < bc_gezi ; i ++ ){
    		for( int j = 0 ; j < bc_gezi ; j ++  ){
    			gezi[i][j].setOnClickListener(this);
    			if( i == (bc_gezi-1) && j == (bc_gezi-1) ){
    				continue;
    			}
    			gezi[i][j].setText(Integer.toString(Init_gz[num][i*bc_gezi+j]));
    		}
    	}
    }
    
    public void onChronometerTick(Chronometer chronometer){
    	time ++;
    }
    
    public void onClick(View view){
    	for( int i = 0 ; i < bc_gezi ; i ++ ){
    		for( int j = 0 ; j < bc_gezi ; j ++  ){
    			if(view == gezi[i][j]){
    				if(yidong_jd.move(bc_gezi,i,j)){
    					step ++;
    					text_step.setText(Integer.toString(step));
    					if(sign == 0){
    						timer.setBase(SystemClock.elapsedRealtime());
    						timer.start();
    						sign = 1;
    					}
    

    拼图具有计步功能,可以根据步数及时间进行评分。

  • 相关阅读:
    windows10下Mysql5.7安装指南
    SVN迁移Gitlab步骤
    java.lang.String中的replace方法到底替换了一个还是全部替换了。
    MongoDB升级导致启动失败
    阿里云CentOS7.3搭建多用户私有git服务器(从安装git开始)
    CentOS7.3编译安装Nginx设置开机启动
    关于使用Xshell远程连接启动tomcat导致图片不显示,报错Could not initialize class sun.awt.X11GraphicsEnvironment解决方案
    easyui报错“Cannot read poperty 'options' of undefined”问题解决方案之一
    Ubuntu18.04系统中vi键盘输入字符不匹配
    ux.form.field.TreePicker 扩展,修复火狐不能展开bug
  • 原文地址:https://www.cnblogs.com/tangshuang/p/6921649.html
Copyright © 2020-2023  润新知