⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 erixmidlet.java

📁 J2ME的游戏原代码!希望能帮助有需要帮助的师兄弟们!
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
/*
 * @(#)ErixMIDlet.java
 *
 * Copyright (c) 2001-2004 Sony Ericsson Mobile Communication AB (SEMC).
 *
 * German Branch
 * Heisenbergbogen 1, Aschheim 85609, Munich, Germany.
 * All Rights Reserved.
 *
 * This software is the confidential and proprietary information of
 * SEMC. ("Confidential Information"). You shall not disclose such
 * Confidential Information and shall use it only in accordance with
 * the terms of the license agreement you entered into with SEMC.
 *
 * @author  sudip
 * @version 1.7, 09/10/2003
*/


package com.sonyericsson.erix;

import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.CommandListener;
import javax.microedition.lcdui.Command;
import javax.microedition.lcdui.Displayable;
import javax.microedition.lcdui.Display;
import javax.microedition.lcdui.List;
import javax.microedition.rms.RecordStore;
import javax.microedition.rms.RecordStoreException;
import javax.microedition.rms.InvalidRecordIDException;
import javax.microedition.rms.RecordStoreFullException;
import javax.microedition.rms.RecordStoreNotOpenException;
import javax.microedition.lcdui.Alert;
import javax.microedition.lcdui.AlertType;
import javax.microedition.io.HttpConnection;
import java.io.InputStream;

/**
 * The ErixMIDlet class is the central controller of the entire game application.
 * This class handles the tasks like switching of the screens, control of timing issues, handling of user preferences, handling of high scores and the various states of the game. It updates the canvas whenever there is mode switching.
 */
public class ErixMIDlet extends MIDlet implements CommandListener,Runnable{

    /**
     * Keeps reference of the array containing all the names for the high score entry.
     */
    public StringBuffer m_arrHighScoreNames[];

    /**
     * The maximum length allowed for the length of the player's name.
     */
    public final int PLAYER_NAME_MAX_LENGTH = 3;

    /**
     * Keeps reference of the array containing all the scores.
     */
    public long m_arrHighScores[];

    /**
     * Keeps reference of the array having difficulty setting corresponding to high scores.
     */
    public byte m_arrDiffLevelHighScores[];

    /**
     * Keeps reference of the array containing the level corresponding to high scores .
     */
    public byte m_arrLevelForHighScores[];

    /**
     * Keeps reference of the name of player who score is among the high scores .
     */
    public String m_strHighScoreName;

    /**
     * The highscores server userID of the player, for uploading the scores.
     */
    public String m_strHighscoresServerUserid;

    /**
     * The highscores server password of the player, for uploading the scores.
     */
    public String m_strHighscoresServerPassword;

    /**
     * This is used to strip off disallowed characters,
     * if present in the signature of the player.
     * All the allowed characters (only) present in the signature
     * are copied into this StringBuffer, and the latter is then used to
     * create the name entered in the highscores list.
     */
    private StringBuffer m_objNewNameStringBuffer;

    /**
     * Keeps reference of the high score of the player.
     */
    public long m_nHighScore;

    /**
     * Keeps reference of the game Language.
     */
    public int m_nGameLanguage;

    /**
     * Stores the game audio setting.
     */
    public int m_nAudioSetting;

    /**
     * Keeps the level no at which high score was achieved by the player.
     */
    public byte m_bytHighScoreLevel;

    /**
     * Indicates whether a game in saved status is present. This is used to add or remove
     * menu item 'Resume' in START_GAME_SCREEN mode. A zero value indicates no game in memory,
     * else saved game is present to resume.
     */
    public boolean m_bIsSavedGamePresent;

    /**
     * Indicates whether the current game is a resumed one, or a new one.
     */
    private boolean m_bIsResumedGame = false;

	/**
     * Status code which indicates that the operation was successful.
     */
    public static final byte SUCCESS = 0;

    /**
     * Status code which indicates that the operation failed
     */
    public static final byte FAILURE = 1;

	/**
     * Status code which indicates that the existing highscores have been uploaded.
     */
    public static final byte UPLOADED = 0;

    /**
     * Status code which indicates that the existing highscores has one or more
     * new scores after the last upload operation, if any.
     */
    public static final byte NOT_UPLOADED = 1;

    /**
     * Status code which indicates that the operation failed due to
     * some other reason
     */
    public static final byte NOT_FOUND = 2;

    /**
     * New Game Easy Selection
     */
    public static final int NEW_GAME_EASY = 0;

    /**
     * New Game Medium Selection
     */
    public static final int NEW_GAME_MEDIUM = 1;

    /**
     * New Game Hard Selection
     */
    public static final int NEW_GAME_HARD = 2;

    /**
     * New Game Resume Selection
     */
    public static final int RESUME_GAME_STR = 3;

    /**
     * Stores the time in milliseconds at the start of the application
     */
    public long m_lStartTime;

    /**
     * Keeps the index at which the current high score is inserted in the high score list.
     */
    public int m_nBlinkIndex;

    /**
     * This is used for delay for which the spash screen is to be shown at the
     * the time of application loading. The value multiplied
     * by the duration of one iteration is the exact time
     * for which the splash screen is to be shown.
     */
    public int nGameSplashScreenWait;

    /**
     * The number of midlet thread iterations to wait for user input,
     * before switching to the attract mode.
     * This value multiplied by the duration of one iteration
     * is the exact time for which the application waits for
     * user input, before switching to the attract mode.
     */
    public final int ATTRACT_MODE_SCREEN_WAIT = 200;

    /**
     * Time for which the animation is to be shown on achieving a high score.
     */
    public final int ANIM_SCREEN_WAIT = 5;

   /**
    * Number of cycles for which the Splash screen is to be displayed.
    */
    public int nWaitCount;

   /**
    * A flag indicating whether the Erix MIDlet can and should
    * end the splash screen mode,
    * and switch to the language selection or the main menu mode.
    */
    public boolean m_bEndSplashMode;

   /**
    * Used to display the animation of the highscore
    */
    public boolean m_bAnimScreen;

    /**
    * Used to display splash screen
    */
    public boolean m_bAttractMode;

    /**
    * Used to determine whether or not the "Send" menu option is shown
    * on the High Scores View screen.
    */
    public boolean m_bSendMenu;

    /**
    * Used to determine whether or not the "Clear" menu option is shown
    * on the High Scores View screen.
    */
    public boolean m_bClearMenu;

    /**
    * Used to keep track of seconds elapsed since last key pressed
    */
    public int m_nKeyPressWait;

    /**
    * Used to indicate processing in any of the game screens
    */
    //public boolean m_bProcessing = true;
    public boolean m_bProcessing;

    /**
    * Used to indicate that current displayable is a list or form
    */
    public boolean m_bMenuOn;

    /**
     * Keeps the unique serial number assigned by the Highscores server
     * to this instance of the game.
     */
    public String m_strSerialNumber;

    /**
     * Menu Screen Start Selection
     */
    private final int MENU_SCREEN_START = 0;

    /**
     * Menu Screen Resume Selection
     */
    private final int MENU_SCREEN_RESUME = 0;
    /**
     * Menu Screen High Scores Selection
     */
    private final int MENU_SCREEN_HIGH_SCORES = 3;

    /**
     * Menu Screen Settings Selection
     */
    private final int MENU_SCREEN_SETTINGS = 1;

    /**
     * Menu Screen Help Selection
     */
    private final int MENU_SCREEN_HELP = 2;

    /**
     * Menu Screen Quit Selection
     */
    private final int MENU_SCREEN_QUIT = 4;

    /**
     * Keeps reference of the array containing all the values for the current game status.
     */
    public byte m_arrGameData[];

    /**
     * Settings Screen Language Selection
     */
    private final int SETTINGS_LANGUAGE = 0;

    /**
     * Settings Screen Audio Selection
     */
    private final int SETTINGS_AUDIO = 1;

    /**
     * Game Language English Selection
     */
    public final byte GAME_LANGUAGE_ENGLISH = 0;

    /**
     * Game Language French Selection
     */
    public final byte GAME_LANGUAGE_FRENCH = 1;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -