Page 437 - MDP2020-3
P. 437

················································································  명장양성프로젝트  【MDP】  과제발표회  자료집  Ⅲ    |  431


            -  Playgame_off.java  :  오프라인  게임  동작  코드



            package  com.example.mdp;


            import  android.content.Intent;
            import  android.os.Bundle;
            import  android.os.Handler;

            import  android.os.Message;
            import  android.util.Log;
            import  android.view.View;
            import  android.widget.ImageButton;
            import  android.widget.ImageView;

            import  android.widget.TextView;
            import  android.widget.Toast;
            import  androidx.appcompat.app.AppCompatActivity;
            import  java.util.Random;



            public  class  Playgame_off  extends  AppCompatActivity  {
                    TextView  time;
                    TextView  scoretx;
                    int  score=0;
                    int  t=30;

                    private  int  modetime;


                    ImageView[]  img_array=new  ImageView[8];
                    int[]  imgID={R.id.mole1,  R.id.mole2,  R.id.mole3,  R.id.mole4,  R.id.mole5,  R.id.mole6,
            R.id.mole7,  R.id.mole8};

                    int[]  img={R.drawable.mole,  R.drawable.mole1,  R.drawable.mole2};
                    final  String  TAG_ON="on";
                    final  String  TAG_OFF="off";


                    @Override

                    protected  void  onCreate(Bundle  savedInstanceState)  {
                            super.onCreate(savedInstanceState);
                            setContentView(R.layout.playgame_layout);
                            final  Variable  variable  =  (Variable)  getApplication();
                            time  =  findViewById(R.id.Time);

                            scoretx  =  findViewById(R.id.scoretx);
                            if  (variable.getMode().equals("easy")){
                                    modetime=500;
                            }  else  if  (variable.getMode().equals("normal")){
   432   433   434   435   436   437   438   439   440   441   442