拼圖,游戲是廣受歡迎的一種智力游戲,它的變化多端,難度不一,讓人百玩不厭。 個性化的拼圖,拼湊的不僅僅是一張照片,而是一個故事,一段回憶,一縷溫情。每一片的單片都有它自己的位置,就像每段回憶都有它的故事,你要將它放在專屬的地方,放對了就慢慢豐富起來,放錯了就無法完整。 你可以把你記憶中最深的片段,可 ...
拼圖,游戲是廣受歡迎的一種智力游戲,它的變化多端,難度不一,讓人百玩不厭。
個性化的拼圖,拼湊的不僅僅是一張照片,而是一個故事,一段回憶,一縷溫情。每一片的單片都有它自己的位置,就像每段回憶都有它的故事,你要將它放在專屬的地方,放對了就慢慢豐富起來,放錯了就無法完整。
你可以把你記憶中最深的片段,可以是你摯愛的照片,可以是你最難忘的一瞬留念,做成拼圖,在思念的季節里一一拼起,把片片散落的記憶重新組合,用指尖溫習甜蜜,把心湖裡最美麗的漣漪蕩漾開來。
代碼:
<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;
}
拼圖具有計步功能,可以根據步數及時間進行評分。