GameOverScreen.jad
资源名称:J2ME&Game.rar [点击查看]
上传用户:gyyuli
上传日期:2013-07-09
资源大小:3050k
文件大小:3k
源码类别:
J2ME
开发平台:
Java
- // Decompiled by DJ v2.9.9.60 Copyright 2000 Atanas Neshkov Date: 2005-9-4 14:18:31
- // Home Page : http://members.fortunecity.com/neshkov/dj.html - Check often for new version!
- // Decompiler options: packimports(3)
- // Source File Name: GameOverScreen.java
- import javax.microedition.lcdui.*;
- class GameOverScreen extends Canvas
- {
- GameOverScreen(escapeeMIDlet midlet, long time, int BULLETS_NUM)
- {
- this.midlet = midlet;
- this.time = time;
- this.BULLETS_NUM = BULLETS_NUM;
- setFullScreenMode(true);
- if(midlet.checkBestTime(time))
- {
- wasBestTime = true;
- bestTime = time;
- SoundEffects.getInstance().startHighScoreSound();
- midlet.vibrate(1000);
- } else
- {
- wasBestTime = false;
- bestTime = midlet.getBestTime();
- SoundEffects.getInstance().startGameOverSound();
- }
- midlet.flashBacklight(1000);
- }
- public void paint(Graphics g)
- {
- int CanvasWidth = getWidth();
- int CanvasHeight = getHeight();
- g.setColor(245, 130, 35);
- g.fillRect(0, 0, CanvasWidth, CanvasHeight);
- g.setFont(Font.getFont(64, 1, 16));
- int centerX = CanvasWidth / 2;
- int centerY = CanvasHeight / 2;
- g.setColor(0xffffff);
- drawText(g, centerX, centerY - 1);
- drawText(g, centerX, centerY + 1);
- drawText(g, centerX - 1, centerY);
- drawText(g, centerX + 1, centerY);
- g.setColor(0);
- drawText(g, centerX, centerY);
- }
- private void drawText(Graphics g, int centerX, int centerY)
- {
- int fontHeight = g.getFont().getHeight();
- int textHeight = 4 * fontHeight;
- int topY = centerY - textHeight / 2;
- float Time_Second = (float)time / 1000F;
- float BestTime_Second = (float)bestTime / 1000F;
- g.drawString("GAME OVER", centerX, topY, 17);
- g.drawString("u65F6u95F4: " + Time_Second + "s", centerX, topY + fontHeight, 17);
- g.drawString("u5B50u5F39uFF1A" + BULLETS_NUM + "u53D1", centerX, topY + 2 * fontHeight, 17);
- g.drawString(wasBestTime ? "u8FD9u662Fu76EEu524Du6700u597Du8BB0u5F55!" : "u6700u957Fu65F6u95F4: " + BestTime_Second + "s", centerX, topY + 3 * fontHeight, 17);
- }
- public void keyPressed(int keyCode)
- {
- midlet.gameOverDone();
- }
- private final escapeeMIDlet midlet;
- private boolean wasBestTime;
- private long time;
- private long bestTime;
- private int BULLETS_NUM;
- }