소개글
[멀티미디어] 안드로이드 기억력 게임(Memory Game) 어플 개발에 대한 자료입니다.
목차
1.아이디어 부분
2.구조&디자인
3.기술 &소스
본문내용
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mImage = (MyImage)findViewById(R.id.myimage);
registerForContextMenu(mImage);
} void GameMode() {
gv = new GameView(this);
setContentView(gv);
} void image() //서버 액티비티 호출 함수
{
Intent intent = new Intent(MemoryPower.this , android.class);
startActivity(intent); //액티비티 간의 통신
}
public boolean onContextItemSelected (MenuItem item) {
switch (item.getItemId()) {
case 1:
sw=1;
GameMode();
return true;
case 2:
sw=2;
GameMode();
return true;
case 3:
sw=3;
GameMode();
return true;
case 4:
sw=3;
image();
return true;}
return true; }}
class MyImage extends ImageView { //메인화면 이미지 터치 처리
public MyImage(Context context) {
super(context);}
public MyImage(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void onCreateContextMenu(ContextMenu menu) {
super.onCreateContextMenu(menu);
menu.setHeaderTitle("Game Level");
menu.add(0,1,0,"Easy Mode");
menu.add(0,2,0,"Normal Mode");
menu.add(0,3,0,"Crazy Mode");
menu.add(0,4,0,"그림 맞추기");
}}
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main2);
final GridView grid = (GridView)findViewById(R.id.grid); //main 의 그리드를 가지고와 그리드뷰 생성
Adapter = new ImageAdapter(this); //ImageAdapter 클래스 의 객체 참조 변수 생성
new CountDownTimer(22000, 10000) { // 처음에 한번 10초에뒤에 한번 수행 1
public void onTick(long millisUntilFinished) {
if(time==0)
{
grid.setAdapter(Adapter); //처음 랜덤 이미지
Toast.makeText(android.this, "빠르게 기억 하세요", Toast.LENGTH_SHORT).show();
imagechange=1;
time =1;
}
else if(imagechange==1)
{
grid.setAdapter(Adapter); //나중에 동일 한 이미지
Toast.makeText(android.this, "카드를 선택 하세요", Toast.LENGTH_SHORT).show(); imagechange=0;
}} public void onFinish() {}}.start();