@Override public void onClick(View v) { SoundManager.getInstance(activity).playButtonSound(); Game game = activity.getGame(); switch (v.getId()) { case R.id.pauseBtn: activity.pauseGame(); break; case R.id.hintBtn: if (game.isHinting()) return; if (game.isFreeHint()) game.useHint(); else activity.showHintMenu(); break; case R.id.nextBtn: game.nextLevel(); game.setStage(Game.Stages.MainStage); break; case R.id.restartBtn: game.restartLevel(); game.setStage(Game.Stages.MainStage); break; case R.id.menuBtn: activity.finish(); break; case R.id.helpBtn: activity.showHelp(); break; } }
public static void playButtonSoundIfPossible() { if (instance != null) instance.playButtonSound(); }
public static SoundManager getInstance(Activity context) { if (instance == null) instance = new SoundManager(context); else instance.context = context; return instance; }