文档详情

介绍成果软件包com realactionjava.pdf

发布:2025-06-06约1.57万字共10页下载文档
文本预览下载声明

packagecom.realaction.game.gamehit;

importandroid.annotation.SuppressLint;

importandroid.app.Activity;

importandroid.app.AlertDialog.Builder;

importandroid.content.Context;

importandroid.content.DialogInterface;

importandroid.media.AudioManager;

importandroid.media.MediaPlayer;

importandroid.media.SoundPool;

importandroid.os.Bundle;

importandroid.view.Gravity;

importandroid.view.KeyEvent;

importandroid.view.Window;

importandroid.view.WindowManager;

importandroid.widget.ImageView;

importandroid.widget.TextView;

importmon.Const;

@SuppressLint(ResourceAsColor)

publicclassMainActivityextendsActivity{

privateMediaPlayermBgMediaPlayer;

privatebooleanisMusic=true;

privateContextmContext;

privatestaticSoundPoolmSoundPool=newSoundPool(1,

AudioManager.STREAM_MUSIC,0);

/**0:;1:;2*/

privateint[]soundIds={-1,-1,-1,-1,-1};

publicbooleanisPause;

publicGameViewgameView;

@Override

publicvoidonCreate(BundlesavedInstanceState){

super.onCreate(savedInstanceState);

//setContentView(R.layout.activity_main);

requestWindowFeature(Window.FEATURE_NO_TITLE);//

getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,

WindowManager.LayoutParams.FLAG_FULLSCREEN);//

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);//

init();

gameView=newGameView(MainActivity.this);

setContentView(gameView);

//playBackgroundVoide();

}

/**

*

*/

privatevoidinit(){

mContext=MainActivity.this;

initGameMode();

mBgMediaPlayer=MediaPlayer.create(mContext,Const.voiceBackground);

mBgMediaPlayer.setLooping(true);//

soundIds[Const.voiceShoot]=mSoundPool.load(mContext,R.raw.shoot,1);

soundIds[Const.voiceHit]=mSoundPool.load(mContext,R.raw.hit,1);

soundIds[Const.vo

显示全部
相似文档