예제 #1
0
 @Override
 protected void render(Canvas c) {
   super.render(c);
   float f = UIUtil.getPixel(18, HORIZONTAL);
   c.drawBitmap(
       img_title, (width - img_title.getWidth()) / 2, UIUtil.getPixel(40, VERTICAL), paint);
   c.drawBitmap(butn_shezhi.getBitmap(), f, UIUtil.getPixel(710, VERTICAL), paint);
   c.drawBitmap(
       butn_bangzhu.getBitmap(), f + (width >> 2) * 1, UIUtil.getPixel(710, VERTICAL), paint);
   c.drawBitmap(
       butn_paiming.getBitmap(), f + (width >> 2) * 2, UIUtil.getPixel(710, VERTICAL), paint);
   c.drawBitmap(
       butn_tuichu.getBitmap(), f + (width >> 2) * 3, UIUtil.getPixel(710, VERTICAL), paint);
   c.drawBitmap(
       butn_start.getBitmap(),
       (width - img_start1.getWidth()) >> 1,
       UIUtil.getPixel(400, VERTICAL),
       paint);
   c.drawBitmap(
       butn_help.getBitmap(),
       (width - img_help1.getWidth()) >> 1,
       UIUtil.getPixel(500, VERTICAL),
       paint);
 }
예제 #2
0
  @Override
  protected void handleEvent() {
    super.handleEvent();
    float f = UIUtil.getPixel(18, HORIZONTAL);

    // 关于
    if (HandleTouch.isTouchBitmap(
        HandleTouch.DOWN, img_bangzhu, f + (width >> 2) * 1, UIUtil.getPixel(710, VERTICAL))) {
      butn_bangzhu.bePressed();
      GameView.rePaint();
      GameView.setGameScreen(new AboutScreen(), Constants.MENU_ID);
      return;
    }

    // 帮助
    if (HandleTouch.isTouchBitmap(
        HandleTouch.DOWN,
        img_help1,
        (width - img_help1.getWidth()) >> 1,
        UIUtil.getPixel(500, VERTICAL))) {
      butn_help.bePressed();
      GameView.rePaint();
      GameView.setGameScreen(new HelpScreen(), Constants.MENU_ID);
      return;
    }

    // 开始
    if (HandleTouch.isTouchBitmap(
        HandleTouch.DOWN,
        img_start1, // start_menu
        (width - img_start1.getWidth()) >> 1,
        UIUtil.getPixel(400, VERTICAL))) {
      butn_start.bePressed();
      GameView.rePaint();
      GameView.setGameScreen(new FirstLevelScreen());
      return;
    }

    // 退出
    if (HandleTouch.isTouchBitmap(
        img_tuichu, f + (width >> 2) * 3, UIUtil.getPixel(710, VERTICAL))) {
      context.getHandler().obtainMessage(Constants.EXITGAME_DIALOG).sendToTarget();
    }

    // 排名
    if (HandleTouch.isTouchBitmap(
        HandleTouch.DOWN,
        img_paiming, // about_menu
        f + (width >> 2) * 2,
        UIUtil.getPixel(710, VERTICAL))) {
      butn_paiming.bePressed();
      GameView.rePaint();
      GameView.setGameScreen(new RankScreen());
      return;
    }

    // 设置
    if (HandleTouch.isTouchBitmap(
        HandleTouch.DOWN,
        img_shezhi, // about_menu
        f,
        UIUtil.getPixel(710, VERTICAL))) {
      butn_paiming.bePressed();
      GameView.rePaint();
      GameView.setGameScreen(new ConfigrationScreen(), Constants.MENU_ID);
      return;
    }
  }