基本信息
源码名称:android 俄罗斯方块游戏源码
源码大小:0.73M
文件格式:.rar
开发语言:Java
更新时间:2015-08-23
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
一款俄罗斯方块的源码,里面有三个模块,一个简单版,一个复杂版,还有一个扫雷。复杂版的可以暂停游戏还可以更换游戏背景跟主题。
一款俄罗斯方块的源码,里面有三个模块,一个简单版,一个复杂版,还有一个扫雷。复杂版的可以暂停游戏还可以更换游戏背景跟主题。
package com.china.square; import java.util.ArrayList; import java.util.List; import com.china.square.elos.Elos; import com.china.square.eloscomplex.ElosComplex; import com.china.square.elossap.ElosSap; import com.china.square.linksee.LinkSee; import android.app.Activity; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.AdapterView.OnItemClickListener; public class Square extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); PackageManager pm = getPackageManager(); Intent mainIntent = new Intent("SQUARE", null); mainIntent.addCategory("android.intent.category.SQUARE"); List<ResolveInfo> ls = pm.queryIntentActivities(mainIntent, 0); int i = 0; ArrayList<String>al = new ArrayList<String>(); setTitle(String.valueOf(ls.size())); while (i < ls.size()){ ResolveInfo ri = ls.get(i); al.add(ri.loadLabel(pm).toString()); i ; } ArrayAdapter<String>a = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, al); ListView lv = (ListView)this.findViewById(R.id.lv); lv.setAdapter(a); lv.setOnItemClickListener(new ItemClickListener()); } private class ItemClickListener implements OnItemClickListener{ @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub String strText = ((TextView)arg1).getText().toString(); if (strText == null) return; else if (strText.equals("俄罗斯方块")){ Intent in = new Intent(Square.this, Elos.class); startActivity(in); }else if (strText.equals("俄罗斯方块-复杂版")){ Intent in = new Intent(Square.this, ElosComplex.class); startActivity(in); }else if (strText.equals("连连看")){ Intent in = new Intent(Square.this, LinkSee.class); startActivity(in); } else if (strText.equals("扫雷")){ Intent in = new Intent(Square.this, ElosSap.class); startActivity(in); } } } }